SparkFun will be closed May 25, 2015 for Memorial Day. Orders placed after 2pm on Friday the 22nd will ship out on Tuesday. Thanks!
Frequently Asked Questions
Mon-Fri, 9am to 5pm
U.S. Mountain Time:
Chat With Us
March 25, 2013
Tutorial - Face Tracking with a Pan/Tilt Servo Bracket
about 2 years ago
HA! The zero value I was getting was not midFaceX but was midScreenX so it would always occur being that the height and width variables were not returning values. I simply changed the variable midScreen + midWindow to the pixel value of my center being 640x320 +/-10 to being 330 and 190 or 310 and 170! It works now thought its a bit choppy. I will change the update increment to be the angular displacement of the center then it should be able to center in 1 iteration! =) Thanks so much for your help Cowattack! You rock!
It seems that my lines:
midFaceY = faces.y + (faces.height/2);
midFaceX = faces.x + (faces.width/2);
only return a value of zero. So the value of faces.x and the width/height expression is zero as well.. which I dont understand because I am seeing the rectangle around my face which then simply causes my servos to increment to the maximum while a face is present..
http://pastebin.com/B2U33H43 is what I have so far. Ill try your example and let you know.
Okay so your code worked with the memory leak you described. But hey that was a real encouragement to know my computer is actually capable of such things! =)
It seems to be okay with ‘faces’ now but I get a NullPointerException. Is there anyway I could share my code with you as I don’t think I have the knowledge I need to be a good troubleshootie? I haven’t worked with java before so I’m stumbling through as I go.
Also I was getting the black image screen before I modified the original code. I have seen a few people referring to workarounds but I will try a simpler camera, currently using a Microsoft HD720.
I included the import java.awt.*; and it doesnt complain about the specific Rectangle function but in calling it later to define the screen position as in ‘if(faces.lenght > 0)’. Ill let you know about the memory issue IF I can get it functional.
After giving up on my desktop I got past this problem by using my old laptop. Desktop was a custom build. Laptop is running on W7 and using the x32.
My new problem is after adding the modified code for controlling the position in the processing sketch, it doesn’t like ‘faces’. “Cannot find faces”. I would declare it as an array at the beginning of the program but I don’t know how to do that.
I am getting an error after changing ‘import java.awt.*;’
!!! required library not found : C:…\My Documents\Processing\libraries\OpenCV\library\OpenCV.dll: Can’t load IA 32-bit .dll on a AMD 64-bit platform
Verify that the java.library.path property is correctly set and the ‘\path\to\OpenCV\bin’ exists in your system PATH
Does this mean I cannot complete this project on a Windown7 64bit platform? =(
It seems like you are getting this to work? I am new to sparkfun and this is my first project with openCV. I can get past the cannot find hypermedia.video but then I don’t seem to have the library for Rectangle and cannot find it anywhere online. Any ideas?
No public wish lists :(
Forgot your password?
No account? Register one!