SparkFun Electronics will be closed on July 3rd, 2015 in observance of Independence Day. Any orders placed after 2:00pm MT on July 2nd will be shipped out after the weekend. Thanks!


Member Since: July 15, 2008

Country: United States

  • Woops, missed that reply. If you’re just concerned about tracking a single face, try just changing your faces[0] to faces[i].

  • Actually, just in case someone else reads this. If you scroll down to the last discussion on this page there’s some links to pastebin I made. If you follow those links, there’s two working pieces of code that you can use to test your system (I know they work on Windows 7 (64 bit), with Processing 2.0b (32 bit version)).

  • Oh no worries, I managed to get the program running through some trial and error on the same setup that you seem to have used. I’m kind of curious if it’s easier to operate through linux though. Thanks for the response at any rate!

  • Here you go, this link will show you the code that displays pixel by pixel. It also lets you move around the image in the display window by changing the x and y start values above void setup(). Try combining this with your Arduino stuff.


  • Awesome! At least that means the system is set up properly. I’ll post a link for the workaround for that leak in just a little bit.

  • See if you can follow this link. Should show you a basic, functional code. This code does memory leak for me, but it’ll make sure everything works for you.


  • Actually, I was thinking of sending you my piece of code somehow. I don’t know if there’s a way to do a private message on this site, but maybe I can find somewhere to post it. I haven’t had time to do a tutorial yet.

    In regards to your second black screen thing, I was getting that too. The problem seems to be that OpenCV’s Capture function doesn’t activate the camera. To get that to work I had to capture using processing.video.*; and then use the copy function to pass the image to OpenCV. That may be the workaround you referred to.

  • Try making faces global by writing “Rectangle[] faces;” above your void setup(). Then change the original bit to just “faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 );”.

  • Is it the Rectangle[] faces thing? You might need to declare “import java.awt.*;” That should get the java Rectangle working. Although, if you get everything running, I’d love to know if your program crashes out for running out of memory. If so, you have a memory leak with “image()”. I got past that by writing to each pixel individually.

  • Sorry, a little slow responding. I’m not familiar with that error, but I am using a Windows 7 64-bit system so that shouldn’t be the issue. That being said, I’m using the 32-bit version of Processing 2.0b, so if you’ve downloaded the 64-bit version try switching it out. Also, I found that OpenCV didn’t actually create the proper System Path when you follow the directions and click the little box during install. You’ll have to make sure by going to the system variables, finding the entry that starts with “Path=”, and adding the value “C:\OpenCV\bin\” or “C:\Program Files\OpenCV\bin\” depending on your install location. I used Rapid Environment Editor 7.2 for editing the system variables (It’s free). Hope that helps!