활성 x64로 바꾸고

모든구성 c/c++ 추가포함 C:\opencv-4.1.0\build\include

링커 추가라이브러리 디렉터리 C:\opencv-4.1.0\build\x64\vc15\lib

디버깅 환경 PATH=C:\opencv-4.1.0\build\x64\vc15\bin;%PATH%

debug구성 opencv_world410d.lib;

release 구성 opencv_world410.lib;

http://tanbakuchi.com/posts/comparison-of-openv-interpolation-algorithms/



interpolation 알고리즘 목록은 다음과 같다


  • 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_NEAREST method.
  • INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood
  • INTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhood



결과 이미지는 원문링크에 가면 있고, 정리만 여기에 기입하도록 하겠음


업샘플링

50x50 이미지를 400x400으로 업샘플링

area, nearest 알고리즘은 계단현상이 발생하였고 linear는 부드러운 엣지 그리고 cubic과 Lanczos 는 샤프한 엣지를 만들었다고함


다운샘플링

400x400 이미지를 50x50으로 다운샘플링

area 알고리즘이 앨리어싱 현상이 없다 

#encode to jpeg format
#encode param image quality 0 to 100. default:95
#if you want to shrink data size, choose low image quality.
encode_param=[int(cv2.IMWRITE_JPEG_QUALITY),90]
result,encimg=cv2.imencode('.jpg',img,encode_param)
if False==result:
print 'could not encode image!'
quit()
#decode from jpeg format
decimg=cv2.imdecode(encimg,1)





result 에 true false로 압축 결과 저장

encimg에 인코딩된 이미지 저장


https://github.com/kyatou/python-opencv_tutorial


틈틈히 공부해야겠다

+ Recent posts