Open huckw opened 4 years ago
Good catch! Thanks!
When you do A = cv2.imread("path/to/hbl.png")
A
will be a (200, 200, 3)
image.
when you do I=cv2.imread("path/to/hbl.png")[:,:,0]
I
will be a view
of shape (200, 200)
over the same underlaying memory as A
. You can see that doing A.strides
and I.strides
, I1.strides
, I2.strides
.
What I3 = I.astype(np.uint8)
is doing is creating a new (200, 200)
buffer and copying the I
data. Hence now the I3
memory is continuous and has the same strides as I2
.
The bug lies at the function from_array
doing the assumption that the array
memory is continous.
Attached is an image that is acting very strange...
I1 is all messed up but I2 works as expected. I's
dtype
is alreadynp.uint8
so I don't know what the magic is with theasytpe()
converting it to the same datatype.Any idea what I might be doing incorrectly?