Ask Your Question
1

simpleCV to openCV

asked 2012-10-17 03:24:58 -0500

harsha_fractal gravatar image

Hi, I ve got a simplecv Image on which I drew a colour rectangle on the source image only.(not on any layer) Now I want to take this colour image and turn it into a cvMat (8UC3) so that I can use it with some openCV functions. How do i do that?

edit retag flag offensive close merge delete

Comments

Can you post your code here? That would be really helpful.

jayrambhia gravatar imagejayrambhia ( 2012-10-17 04:54:40 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-10-17 09:51:25 -0500

xamox gravatar image

We don't have anything built-in, but we can return an IPLImage and then use OpenCV to convert it for us:

from SimpleCV import *

img = Image('simplecv.png')
iplimg = img.getBitmap()
cvmat = cv.GetMat(iplimg)
edit flag offensive delete link more
0

answered 2012-10-17 09:31:14 -0500

kscottz gravatar image

Try the getMatrix() method.

SimpleCV:3> img = Image("lenna")
SimpleCV:4> img.drawRectangle(10,10,100,100,color=Color.RED)
SimpleCV:5> img = img.applyLayers()
SimpleCV:6> mat = img.getMatrix() #OpenCV matrix
SimpleCV:7> img2 = Image(mat)
SimpleCV:8> img2.show()

See the documentation here

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

2 followers

Stats

Asked: 2012-10-17 03:24:58 -0500

Seen: 1,356 times

Last updated: Oct 17 '12