Latest recipes tagged "opencv" Code RecipesTest various OpenCV feature detectors in Python (Python) 2012-09-13T16:07:21-07:00J W J <p style="color: grey"> Python recipe 578261 by <a href="/recipes/users/4181154/">J W J</a> (<a href="/recipes/tags/feature_detection/">feature_detection</a>, <a href="/recipes/tags/opencv/">opencv</a>). </p> <p>Iterates through all feature detectors (that didn't crash my computer) and plots the point results.</p> OpenKinect Mouse Control Using Python (Python) 2012-04-15T18:49:00-07:00Alexander James Wallar <p style="color: grey"> Python recipe 578104 by <a href="/recipes/users/4179768/">Alexander James Wallar</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/computer/">computer</a>, <a href="/recipes/tags/computer_vision/">computer_vision</a>, <a href="/recipes/tags/depth/">depth</a>, <a href="/recipes/tags/hand_tracking/">hand_tracking</a>, <a href="/recipes/tags/kinect/">kinect</a>, <a href="/recipes/tags/mouse/">mouse</a>, <a href="/recipes/tags/opencv/">opencv</a>, <a href="/recipes/tags/openkinect/">openkinect</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/tracking/">tracking</a>, <a href="/recipes/tags/vision/">vision</a>). Revision 2. </p> <p>This is a simple code that lets a user control the mouse and left-click using the Microsoft Kinect, Python, and OpenKinect. </p> <pre class="prettyprint"><code>Computer Prerequisites: -OpenKinect -Python Wrapper for OpenKinect -A Linux machine using Ubuntu -OpenCV 2.1 -OpenCV 2.3 -Python 2.7.2 -A Microsoft Kinect -A Microsoft Kinect USB Adapter -PyGame -Xlib for Python </code></pre> <p>To run this code you either need to start it in the terminal or you need to write a short bash script that runs the code. This is necessary because it requires super-user privileges.</p> <p>The Bash script is (Assuming the code is saved by the name 'Hand' in /home/$USER directory:</p> <pre class="prettyprint"><code>#!bin/bash cd 'home/$USER' gksudo python 'Hand' </code></pre> <p>The code is heavily commented and most of what you will need to know is there. </p> Python+OpenCV: Camera frame grab and sobel display (Python) 2012-03-22T07:21:35-07:00J W J <p style="color: grey"> Python recipe 578085 by <a href="/recipes/users/4181154/">J W J</a> (<a href="/recipes/tags/opencv/">opencv</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>A couple snippets grabbed from other sources and put together here. Demonstrates: Conversion to greyscale: cv.CvtColor, Sobel operator: cv.Sobel, Smoothing: cv.Smooth</p> Libreenect (OpenKinect) Minimum Value Joystick With Display - Kinect Demo Using OpenKinect SDK (Python) 2012-03-18T18:52:42-07:00Alexander James Wallar <p style="color: grey"> Python recipe 578080 by <a href="/recipes/users/4179768/">Alexander James Wallar</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/computer_vision/">computer_vision</a>, <a href="/recipes/tags/depth/">depth</a>, <a href="/recipes/tags/joystick/">joystick</a>, <a href="/recipes/tags/kinect/">kinect</a>, <a href="/recipes/tags/libfreenect/">libfreenect</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/opencv/">opencv</a>, <a href="/recipes/tags/programming/">programming</a>, <a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/virtual_joystick/">virtual_joystick</a>). Revision 3. </p> <p>This demo requires you to be using a Linux machine and to have libfreenect installed with the python wrapper. This demo also requires you to have opencv, numpy, and pygame. They can all be installed using sudo apt-get install {PROGRAM NAME HERE}. Here are instructions on installing libfreenect: <a href="" rel="nofollow"></a>. Okay, so what this demo does is finds the minimum point on the depth image and uses the index of this minimum point to create a four button joystick that codes for 'A', 'B', 'X', 'Y'. It also uses the minimum point and the RGB image to put a circle on the minimum point on the screen. So basically a dot will follow your hand on the RGB image. If the minimum value is larger than 600 (arbitrary units), the color of the dot will change from red to purple and the dot will remain stationary. Also, if the Kinect is not properly opened the first time, unplug it and plug it back in and run in the terminal sudo freenect-glview. After try running the program again. One more thing, this code requires super user privileges so run it through the terminal. Here is how to do this for linux n00bs.</p> <ol> <li>Change your directory the the directory the code is in (use cd {PATH})</li> <li>Run the code using sudo python {FILENAME}</li> <li>Don't forget to add the the .py at the end</li> </ol>