KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to convert image from PIL to OpenCV format. I'm using OpenCV 2.4.3 . here is what I've attempted till now. >>> from PIL import Image >>> import cv2 as cv >>> pimg = Image.open('D:\\traffic.jpg') #PIL Image >>> cimg = cv.cv.CreateImageHeader(pimg.size,cv.IPL_DEPTH_8U,3) #CV Image >>> cv.cv.SetData(cimg,pimg.tostring()) >>> cv.cv.NamedWindow('cimg') >>> cv.cv.ShowImage('cimg',cimg) >>> cv.cv.WaitKey() But I think the image is not getting converted to CV format. The Window shows me a large brown image. Where am I going wrong in Converting image from PIL to CV format? Also, why do I need to type cv.cv to access functions?
Tags (comma-separated)
Save Edits
Cancel