1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<SPAN id=tx_marker_caret></SPAN>int row,col,i,i1,j,j1;
    int Size=3; //마스크 크기 조절
    unsigned char Max,Min;
    unsigned char *Result;
 
    Result=(unsigned char*)calloc(Width*Height,sizeof(char));
 
    for(row=0;row<Height;row++)
    {
        for(col=0;col<Width;col++)
        {
            Min=255;
            Max=0;
            for(i=0;i<Size;i++)
            {
                i1=row+i-(int)((Size-1)/2);
                if(i1<0)i1=0;
                if(i1>Height-1) i1=Height-1;
                for(j=0;j<Size;j++)
                {
                    j1=col+j-(int)((Size-1)/2);
                    if(j1<0) j1=0;
                    if(j1>Width-1) j1=Width-1;
                    if(Min>Orig[i1*Width+j1]) Min=Orig[i1*Width+j1];
                    if(Max<Orig[i1*Width+j1]) Max=Orig[i1*Width+j1];
                }
            }
            Result[row*Width+col]=Min;
            Result[row*Width+col]=Max;
        }
    }
    return Result;

 

 


원본 Bahoon -> 가우시안15의 흡집 -> max min filter를 사용한 경우

마스크를 3 5 7 세가지로 조절했을때도 결과 값은 다르다 (소스참고)

 




 

Posted by 코딩하는 야구쟁이
,