What is buffer returned by cv2.imencode represent?
Here is example for 1x1 pix image.
import cv2
impor numpy as np
img= np.zeros((1,1,3),np.uint8)
en= cv2.imencode('.jpg',img)
print type(en)
<type 'tuple'>
print en[1].shape
(631, 1)
For some reason size of buffer not changed when the size of image changed:
img= np.zeros((10,10,3),np.uint8)
en= cv2.imencode('.jpg',img)
en[1].shape
(631, 1)
Update: it's have different size for bigger image.
img= np.zeros((1000,1000,3),np.uint8)
en= cv2.imencode('.jpg',img)
en[1].shape
(16503, 1)
With random data:
img= (np.random.rand(1,1,3)*255).astype(np.uint8)
en= cv2.imencode('.jpg',img)
en[1].shape
(634, 1)
img= (np.random.rand(10,10,3)*255).astype(np.uint8)
en= cv2.imencode('.jpg',img)
en[1].shape
(899, 1)
img= (np.random.rand(1000,1000,3)*255).astype(np.uint8)
en= cv2.imencode('.jpg',img)
en[1].shape
(1175962, 1)