0

I just successfully installed SimpleCV on my Windows 7 Dell XPS. I have a HP Deluxe Webcam KQ246AA plugged into it. I have navigated to the SimpleCV Shell. I am trying to run the tutorial to take and show a picture from the webcam. From the SimpleCV shell I execute the following lines:

cam = Camera()
img = cam.getImage()
img.show()

After the first command, the light on my webcam turns on. After the second command nothing happens. After the third command I get some text output: <SimpleCV.Display.Display instance at 0x038D2A58> and a window pops up that is all black, and then that new window does the classic windows "Not Responding" and asks me if I want to force close. When I close the Shell, the light on the webcam turns off.

I have also tried:

img.save('C:/path/to/file/name.jpg');

Which saved the picture to the right location, but the picture was just all black. I guess that the picture is not being captured correctly, but I don't know why that causes the img.show() command to crash.

I tried referencing the SimpleCV docs (http://doc.simplecv.org/), but the link appears to be non-existent. I think I would really benefit from SimpleCV. Does anyone have any suggestions how I would debug this problem? Or, where is the documentation? I would at least to verify that I can capture pictures correctly from the webcam. Then get started with some of the other functionality.

** EDIT **

I installed the SimpleCV package from the .deb downloaded from their website onto my Thinkpad X61s running Ubuntu 10.10. 5 minutes for installationn. I plugged in a very generic webcam (not even sure what brand it is) and repeated the 3 lines of code above. I DID see the picture take from my webcam come up. So everything worked on the linux, and was very simple.

jeffery_the_wind
  • 17,048
  • 34
  • 98
  • 160

2 Answers2

3

Consider the following code:

img = cam.getImage()

if for some reason the device could not retrieve an image, img would be NULL and calling img.show()will certainly crash the application. You need to add proper checks to prevent this sort of problem:

import sys

cam = Camera()
if (not cam)
    print 'Camera() Failed!'
    sys.exit(-1)

img = cam.getImage()
if (not img)
    print 'getImage() Failed!'    
    sys.exit(-1)

# Everything succeeded, display image!
img.show()
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Thanks for the help. Do you know the commands for displaying those errors? – jeffery_the_wind Feb 22 '12 at 18:43
  • i have checked, and the `cam` is defined as a `SimpleCV.Camera.Camera` object and the `img` is defined as a `SimpleCV.ImageClass.Image` object. – jeffery_the_wind Feb 22 '12 at 18:46
  • Are you a software developer or an enthusiast? Updated my answer. – karlphillip Feb 22 '12 at 18:48
  • I am a developer, but I have no experience with computer vision. Like I said I cannot find the docs for this package online. – jeffery_the_wind Feb 22 '12 at 18:52
  • Have you tried my updated code? Does it print anything on your console? – karlphillip Feb 22 '12 at 19:05
  • Yes I just tried it, it completes with no errors. Like I wrote above, I just executed `cam` or `img` and it displays the type of the object, so it leads me to believe (also by your code) `cam` and `img` are being defined properly... As far as I understand, Simple CV is a modified OpenCV, i checked the OpenCV docs, and I found a list of supported webcams here-> http://opencv.willowgarage.com/wiki/Welcome/OS. My Webcam is not on the list... – jeffery_the_wind Feb 22 '12 at 20:06
  • img.show() just displays the blank picture and then crashes. I tested this by importing a saved image using `my_image = Image('name_of_image.jpg');` and then `my_image.show()`. This shows the image properly but the new pop-up window with the image still hangs and crashes... – jeffery_the_wind Feb 22 '12 at 20:09
  • Ah, sorry about that. If the webcam is not supported there's nothing we can do. Good luck! – karlphillip Feb 22 '12 at 20:09
1

I'm one of the SimpleCV developers. Sorry I didn't notice our doc.simplecv.org is not working. I will try to get it working right away, that is just a shortcut to http://www.simplecv.org/doc/.

The camera may just not work on windows, or you may have to manually install the drivers. Linux is much nicer in dealing with it. You can also test your camera on linux by installing a program called cheese from the app store or:

sudo apt-get install cheese

I'm normally a windows guy. I haven't found a good windows webcam viewer that is free and open source to verify that your camera is working. We are working on 1.3 and trying to get system test to notify you if any problems occur. See if you can verify your camera is working on windows before trying it with SimpleCV.

xamox
  • 2,599
  • 4
  • 27
  • 30
  • ~ Thanks for the info and the work on this great CV package! Python on linux is my development environment of choice, so I am not really upset about the windows driver compatibility issues. I just have a Windows 7 box at work, so I tried this first. The webcam works with skype and google video chat, so I am not sure why simpleCV wasn't picking it up. Thanks for the link to the docs, that is what I need. Now if I can get ZXING working for reading barcodes, then I will be all set. – jeffery_the_wind Feb 27 '12 at 19:49
  • No problem. Let me know how the ZXING stuff goes, I just updated the wrapper so it installs as a module correctly now, although I haven't tested on windows. Also I tend to check our personal help forum (http://help.simplecv.org) more frequently if you are looking for quicker responses. – xamox Feb 27 '12 at 20:52
  • this line in the README for zxing `ant -f javase2/build.xml`. There is no folder named javase2, only one named javase. – jeffery_the_wind Feb 29 '12 at 02:50
  • It was also pointing to the wrong download location. Should be fixed, thanks for the heads up. – xamox Mar 02 '12 at 04:33