C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[49301] Re:Re:Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련
[] 1373 읽음    2007-05-18 11:31
int ImageWidth  = Image1->Width;
    int ImageHeight = Image1->Height;

    BYTE* SourcePtr = new BYTE[ImageWidth*ImageHeight];
    BYTE* ResultPtr = new BYTE[ImageWidth*ImageHeight];

    RGBTRIPLE * rtColor;
    for (int y=0; y<ImageHeight; y++)
    {
        rtColor = (RGBTRIPLE *) Image1->Picture->Bitmap->ScanLine[y];
        for (int x=0; x<ImageWidth; x++)
        {
            SourcePtr[y*ImageWidth +x]=(rtColor[x].rgbtRed  +
                                        rtColor[x].rgbtBlue +
                                        rtColor[x].rgbtGreen)/3;
        }
    }

    for(int x=1; x<ImageWidth-1; x++)
    {
        for(int y=1; y<ImageHeight-1; y++)
        {
            if(SourcePtr[y*ImageWidth +x]==255)
            {
                if(SourcePtr[(y-1)*ImageWidth +x-1]==0||
                   SourcePtr[(y-1)*ImageWidth +x  ]==0||
                   SourcePtr[(y-1)*ImageWidth +x+1]==0||
                   SourcePtr[(y  )*ImageWidth +x-1]==0||
                   SourcePtr[(y  )*ImageWidth +x  ]==0||
                   SourcePtr[(y  )*ImageWidth +x+1]==0||
                   SourcePtr[(y+1)*ImageWidth +x-1]==0||
                   SourcePtr[(y+1)*ImageWidth +x  ]==0||
                   SourcePtr[(y+1)*ImageWidth +x+1]==0  )
                   ResultPtr[y*ImageWidth +x] = 255;
                else ResultPtr[y*ImageWidth +x] = 0;
            }
            else ResultPtr[y*ImageWidth +x] = 0;
        }
    }

    for (int y=1; y<ImageHeight-1; y++)
    {
        rtColor = (RGBTRIPLE *) Image1->Picture->Bitmap->ScanLine[y];
        for (int x=1; x<ImageWidth-1; x++)
        {
            if(ResultPtr[y*ImageWidth+x]==255)
            {
              rtColor[x].rgbtRed   = 255;
              rtColor[x].rgbtBlue  =   0;
              rtColor[x].rgbtGreen =   0;
            }
        }
    }
    Image1->Invalidate();
    delete SourcePtr;
    delete ResultPtr;




정구일 님이 쓰신 글 :
: 이렇게 관심 가져 주셔서 정말 감사합니다 ^^;
:
: 우선 어려운 소스는 제가 #include <vcl.h> 해더 파일을 처음 보는거라서요.
:
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: __fastcall TForm1::TForm1(TComponent* Owner)
:     : TForm(Owner)
: 제가 C를 하면서 이건 본적이 없거든요^^;
: 그래서 어렵게 느껴졌습니다.
:
: 그리고 어떻게 컴파일을 시켜야 하는지...
: 어떤 걸로 해도 #include <vcl.h> 해더 파일이 존재 하지 않다고 나와서요^^;
: 완전 초보라서요^^:
: 제가 아는건 C 와 API 뿐이거든요^^:
: 아무리 봐도  C와 API 가 아닌 다른것 같아서 어렵네요^^:
:
: 이렇게 신경써주셔서 정말 감사합니다^^*

+ -

관련 글 리스트
49245 비트맵 파일 외각선 추출 관련 정구일 1866 2007/05/14
49271     Re:비트맵 파일 외각선 추출 관련 2456 2007/05/16
49278         Re:Re:비트맵 파일 외각선 추출 관련 정구일 1593 2007/05/16
49283             Re:Re:Re:비트맵 파일 외각선 추출 관련 1455 2007/05/17
49290                 Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 정구일 1422 2007/05/17
49293                     Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 1292 2007/05/17
49299                         Re:Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 정구일 1295 2007/05/17
49301                             Re:Re:Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 1373 2007/05/18
49302                                 Re:Re:Re:Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 정구일 1405 2007/05/18
49300                             Re:Re:Re:Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 1311 2007/05/18
49284                 Re:Re:Re:Re:비트맵 파일 외각선 추출 관련 - scanline으로 하면 빨라요 장성호 1684 2007/05/17
49261     Re:비트맵 파일 외각선 추출 관련 장성호 2256 2007/05/14
49270         Re:Re:비트맵 파일 외각선 추출 관련 정구일 1453 2007/05/15
49257     Re:비트맵 파일 외각선 추출 관련 머슴.한석복 2109 2007/05/14
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.