OpenCV/튜토리얼
메모리상에서 jpeg으로 압축,디코딩하기; python opencv jpeg compression and decoding in memory
Jae Ryun, Buster, Chung
2018. 6. 14. 22:27
#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에 인코딩된 이미지 저장