Hi Viesturs, I have done all that except the orientation angle. It has been almost two years since I last played with it, so I'm having a bit of difficulty finding all the pieces.
The camera I used is this: http://www.ebay.com/itm/110764982958 (although any UVC compatible camera should work fine) I installed OpenCV with Python bindings with these instructions: http://opencv.willowgarage.com/wiki/InstallGuide%20:%20Debian I found examples of OpenCV in Python at: https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/python/ I used camera.py and fitellipse.py to start with. I wrote a user-space python script hal component that returned the center coordinate of a specific sized circle when it appeared in the frame. So in my configuration hal file, I had a line: loadusr ./homecart I have copied my "homecart" script to http://engr.wallawalla.edu/engr480/examples/linuxcnc . I don't seem to have an example of actually using the homecart component, but I do remember actually getting it to work and getting numbers out of it which I could use to move my axis to a "home" position. If you need some help getting it to work, I could play with my code a bit on Monday and see if I can recreate an example. I think you just need to use the hal pins 'offset' and 'located' in your hal file logic. 'located' tells you the proper circle was spotted, and 'offset' tells you where it is located in the frame. I was only homing one axis, so I ignore the x value. You likely would want to use it. I also convert my offset from pixel count to inches using the known diameter of the target circle. Hope this helps. -- Ralph ________________________________________ From: Viesturs Lācis [[email protected]] Sent: Saturday, October 26, 2013 5:20 AM To: Enhanced Machine Controller (EMC) Subject: [Emc-users] Technical vision Hello! I have a guy from university that is doing internship in my company. I gave him a task to use opencv and write a script that would recognize a part in webcam capture and provide a coordinate of particular feature of part (center of a hole in part or whatever) and angle of part's orientation. That script is running in terminal and it shows the coordinates and the angle. I think there are few guys on this mailing list that have played with computer vision, so I would appreciate if you could share some hints, how are the coordinates of the captured part communicated to LinuxCNC and how LinuxCNC requests capturing next part. I would appreciate some links that explain, how others have done that, my attempts at searching the web did not provide any meaningful results. -- Viesturs ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
