Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

@LBerger My understanding of numpy slicing leaves a lot to be desired what does this do? Also, I found the solution: my array had the color channel as the first element like this (1, 480, 640) so I had to swap the axes around, but I can't answer my own question yet because I'm a newb on this site.

@LBerger My understanding of numpy slicing leaves a lot to be desired what does this do? Also, I found the solution: my solution. My image array had the color channel as the first element like this (1, 480, 640) so in other words it was (color, width, height), but OpenCV didn't expect 640 color channels. So, I had to swap the axes around, but I can't answer my own question yet because I'm a newb on this site.around like so:

 img = np.swapaxes(img, 0, 2)
 img = np.swapaxes(img, 0, 1)

I found the solution. My image array had the number of color channel channels as the first element like this (1, 480, 640) in other words it was (color, width, height), but OpenCV didn't expect 640 color channels. So, I had to swap the axes around like so:

 img = np.swapaxes(img, 0, 2)
 img = np.swapaxes(img, 0, 1)