在numpy类型转换后更改帧大小

时间:2017-10-10 09:13:21

标签: python-2.7 opencv numpy

将dtpye更改为np.unit8后,帧显示被拉伸

Y = array.array('f')
yy = np.array(Y)    
bb=yy + (1.7790 * (uu - 128));
bb=np.reshape(bb, (672,1280))
bb.dtype=np.uint8 *without this frame size is fine*
cv2.imshow('Image', bb)

1 个答案:

答案 0 :(得分:0)

更改行:

bb.dtype=np.uint8

为:

bb_new = np.array(bb,dtype=np.uint8)