Ask Your Question

Converting openCV image to simpleCV image

asked 2013-04-26 06:55:59 -0500

KOB gravatar image

Hi. I am using an Odroid-u2 to do some image processing. I have a problem with capturing frames from my webcamera in simpleCV, so instead i use cv2 module to capture the frames. I still want to use simpleCV to process the image, but when I create a simpleCV Image from an openCV image the width becomes the height and height become the width in the new Image.

The code looks like this.

cam = cv2.VideoCapture(0)
var, img =
simpleCVimg = Image(img).rotate(270).flipHorizontal()

When i print the size of both images i get 640X360(openCV) and 360X640(simpleCV) Does anyone have a clue how to fix this?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2014-01-08 11:23:55 -0500

Alan Johnstone gravatar image

updated 2014-01-08 11:26:25 -0500

I am afraid that the answer given by jayrambia does not work. It should, but if you look at the code of the Image Class it stupidly does the transform TWICE effectively doing nothing. so you have to do the following

transImg=img.transpose(1,0,2) # transpose the rows and columns

transColImg=transImg[:,:,::-1] # change from BGR to RGB


note all the above van be done on one line as


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-04-26 06:55:59 -0500

Seen: 2,056 times

Last updated: Jan 08 '14