#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