달력

32024  이전 다음

  • 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

Smooth

OpenCV 2011. 4. 4. 06:17

출처 : http://www.newtypeunion.com/40?category=5

Smooth

OpenCV에서는 몇가지 방법으로 Smooth를 할 수 있게 하여 줍니다.

함수의 원형은 다음과 같습니다.

void cvSmooth( const CvArr* src, CvArr* dst,

               int smoothtype=CV_GAUSSIAN,

               int param1=3, int param2=0, double param3=0 );


smoothing 타입에 따라서 파라미터 인자의 역활이 바뀝니다.

요 부분만 알고 있으면 나머진 쉽습니다.

src

원본 이미지


dst

결과 이미지


smoothtype

smoothing 타입

  • CV_BLUR_NO_SCALE (simple blur with no scaling)
    • summation over a pixel param1×param2 neighborhood.
    • If the neighborhood size may vary, one may precompute integral image with cvIntegral function.
  • CV_BLUR (simple blur)
    • summation over a pixel param1×param2 neighborhood with subsequent scaling by 1/(param1param2).
  • CV_GAUSSIAN (gaussian blur)
    • convolving image with param1×param2 Gaussian kernel.
  • CV_MEDIAN (median blur)
    • finding median of param1×param1 neighborhood (i.e. the neighborhood is square).
  • CV_BILATERAL (bilateral filter)


param1

첫번째 인자

param2

두번째 인자

In case of simple scaled/non-scaled and Gaussian blur if param2 is zero, it is set to param1.

param3

         가우시안 방식일 경우 시그마를 넣어야 하지만,

이 파라미터가 0이면 커널 사이즈에서 자동으로 만들어진다.  수식은 아래와 같습니다.

              sigma = (n/2 - 1)*0.3 + 0.8,

                  where n=param1 for horizontal kernel,

                                                

                        n=param2 for vertical kernel.


  • Using standard sigma for small kernels (3×3 to 7×7) gives better speed.
  •       If param3 is not zero, while param1 and param2 are zeros, the kernel size is calculated from the sigma (to provide accurate enough operation).

보통의 시그마를 쓸 경우 그냥 좀 빨라진다. (차이는 ???)

         - 사실 차이라는게 크게 없는듯 합니다. 많이 하면 차이가 있겠지만 제 머쉰에서는 금방 결과가 나왔습니다.

         커널 사이즈를 안주고 (0으로 주고) 호출하면 역으로 시그마에서 커널 사이즈를 만듭니다

Posted by sukay
|