728x90
반응형

 

문제의 코드 

cv::resize(_output, _output, cv::Size(dst_w, dst_h), cv::INTER_CUBIC);

위와 같이 double fx, double fy 의 인자를 넣지 않고 interpolation 옵션을 주면 안먹는다... (픽셀 값 확인함)

 

왜지? ....

 

보통 값 생략 하면 디폴트 값으로 들어가는 것이 아닌가 

cv::INTER_CUBIC 의 값이 2로 들어가서 fx 값으로 대치된건가?

...

 

 

문제가 해결된 코드 

cv::resize(_output, _output, cv::Size(dst_w, dst_h), 0, 0, cv::INTER_CUBIC);

 

 

resize

Resizes an image.

 

C++: 

void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR )

 

Python: 

cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst

 

 

 

Parameters:

  • src – input image.
  • dst – output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.
  • dsize 

    output image size; if it equals zero, it is computed as:

     

    Either dsize or both fx and fy must be non-zero.

  • fx 

    scale factor along the horizontal axis; when it equals 0, it is computed as

     

  • fy 

    scale factor along the vertical axis; when it equals 0, it is computed as

     

  • interpolation 

    interpolation method:

    • INTER_NEAREST - a nearest-neighbor interpolation
    • INTER_LINEAR - a bilinear interpolation (used by default)
    • INTER_AREA - resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEARESTmethod.
    • INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood
    • INTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhood
728x90
반응형