<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Pixel-wise - Medium]]></title>
        <description><![CDATA[Painting the big picture in Machine Learning &amp; Computer Vision, pixel-wise. - Medium]]></description>
        <link>https://medium.com/pixel-wise?source=rss----d76e02c0ccbd---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Pixel-wise - Medium</title>
            <link>https://medium.com/pixel-wise?source=rss----d76e02c0ccbd---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:45:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/pixel-wise" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Real-time Pose Estimation in webcam using OpenPose : Python 2/3 & OpenCV]]></title>
            <link>https://medium.com/pixel-wise/real-time-pose-estimation-in-webcam-using-openpose-python-2-3-opencv-91af0372c31c?source=rss----d76e02c0ccbd---4</link>
            <guid isPermaLink="false">https://medium.com/p/91af0372c31c</guid>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[pose-estimation]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[openpose]]></category>
            <dc:creator><![CDATA[Nisha Gandhi]]></dc:creator>
            <pubDate>Fri, 24 Aug 2018 23:51:01 GMT</pubDate>
            <atom:updated>2018-08-25T00:02:49.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rRuGXw7Y7XhSgbx8unvUBA.gif" /><figcaption>Human Pose Estimation Demo</figcaption></figure><p>Welcome to pixel-wise.</p><p><a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose">OpenPose</a> is a popular Human Pose Estimation (open-source) library in <strong>C++. </strong>There have been several PyTorch, Keras, Tensorflow implementations of the same. But, the thing we all have been waiting for, Python API for OpenPose (!!) is finally here, released in <strong>June 2018</strong> by OpenPose authors.</p><p>So what does that mean? Now we can import OpenPose and pass images (or frames) as NumPy matrices. Then, we get the key-points (pose-positions) for that image as a NumPy matrix.</p><p><em>NOTE: Python- OpenPose currently works for body pose, not face and hands.</em></p><p>So, lets get started (The installation instructions below are for Ubuntu, the instructions for the rest can be found <a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md">here</a>) :</p><h4>Step 1: Install OpenPose from source</h4><ol><li>Clone the repository in your local computer:</li></ol><pre>git clone <a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose">https://github.com/CMU-Perceptual-Computing-Lab/openpose</a></pre><p>2. Install CMake GUI:</p><pre>sudo apt-get install cmake-qt-gui</pre><p><em>NOTE: The steps here assume you have OpenCV, Caffe, CUDA and cuDNN installed. If not, please check the </em><a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md"><em>installation link</em></a><em> for more details.</em></p><p>3. Open CMake GUI:</p><pre>cmake-gui</pre><p>4. Put the source code location &amp; build directory location as /path/to/openpose and /path/to/openpose/build respectively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*vsBEGEmKC_9nYKSqFslQkg.png" /></figure><p>This might prompt a window asking if build directory should be created, press yes.</p><p>5. Tick the BUILD_PYTHON checkbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*AxNP61lgdLfRPAT5har-SA.gif" /></figure><p>6. Press Configure. You should now get a message saying Configuring Done . Press Generate and then close the GUI.</p><p>7. Go to the build directory and make:</p><pre>cd build<br>make -j`nproc`</pre><p>8. Installing OpenPose Python:</p><pre>cd build/python<br>sudo make install</pre><p>Add the build path to bash:</p><pre>vim ~/.bashrc</pre><pre>#(Add this line to the end of the file)<br>export PYTHONPATH=/path/to/openpose/build/python:</pre><p>9. We are done installing OpenPose! Lets check if it works. If everything went well, you should be able to import openpose in python 2 or 3:</p><pre>Python 2.7.12 (default, Dec  4 2017, 14:50:18) <br>[GCC 5.4.0 20160609] on linux<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>&gt;&gt;&gt; import openpose<br>&gt;&gt;&gt;</pre><pre>Python 3.5.2 (default, Nov 23 2017, 16:37:01) <br>[GCC 5.4.0 20160609] on linux<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>&gt;&gt;&gt; import openpose<br>&gt;&gt;&gt;</pre><h4>Step 2: Estimating Pose from web-cam using Python OpenCV</h4><p>Now, lets write a simple code in Python for live-streaming with the help of the example provided by OpenPose authors:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8fbc94ec115e4d099a2572c017126f1/href">https://medium.com/media/c8fbc94ec115e4d099a2572c017126f1/href</a></iframe><p>In the program above, we first set some parameters pose model, number of GPU’s etc. And then we set up our OpenCV webcam stream. Click <a href="https://github.com/nishagandhi/OpenPose_PythonOpenCV">here</a> for the full code on Github.</p><p>So that is it! Running this code should now give you a similar output as the one above. Pose Estimation has many exciting and fun applications such as Gesture Recognition, Gaming applications, Pose Matching and many more.</p><blockquote>LinkedIn Profile : <a href="https://www.linkedin.com/in/nisha-gandhi/">Know more about me!</a></blockquote><blockquote>GitHub Profile : <a href="https://github.com/nishagandhi">Check out my other projects!</a></blockquote><p>Stay tuned for further posts. Thank you :)</p><p><strong>References</strong></p><p>[1] <a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md">https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md</a></p><p>[2] <a href="https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/examples/tutorial_python/1_extract_pose.py">https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/examples/tutorial_python/1_extract_pose.py</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91af0372c31c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixel-wise/real-time-pose-estimation-in-webcam-using-openpose-python-2-3-opencv-91af0372c31c">Real-time Pose Estimation in webcam using OpenPose : Python 2/3 &amp; OpenCV</a> was originally published in <a href="https://medium.com/pixel-wise">Pixel-wise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harris Corner Detection and Shi-Tomasi Corner Detection]]></title>
            <link>https://medium.com/pixel-wise/detect-those-corners-aba0f034078b?source=rss----d76e02c0ccbd---4</link>
            <guid isPermaLink="false">https://medium.com/p/aba0f034078b</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[corner-detection]]></category>
            <category><![CDATA[harris-corner-detection]]></category>
            <category><![CDATA[opencv-python]]></category>
            <category><![CDATA[shi-tomasi-corner]]></category>
            <dc:creator><![CDATA[Nisha Gandhi]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 22:33:42 GMT</pubDate>
            <atom:updated>2018-08-16T16:31:03.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qemvI-VGHXqQyHYZUdYGug.gif" /></figure><p>Hi! Welcome to pixel-wise. This post provides a good starting point for anyone wanting to begin with Computer Vision. We will understand Harris &amp; Shi-Tomasi Corner Detection algorithms &amp; see how to implement them in Python 3 and OpenCV. But, before that, we need to know what are image features:</p><p>Features in images are the points of interest which provide rich image content information. They are basically comprised of two things:</p><ol><li><strong>Interest points</strong> : Points in the image which are invariant to rotation, translation, intensity and scale changes. (Basically, robust and reliable). There are different interest points such as corners, edges, blobs etc.</li><li><strong>Feature Descriptors</strong> : These describe the image patch around the interest points in vectors. They can be as simple as raw pixel values or complicated like Histogram of Gradients (HoG) etc.</li></ol><p>So corner detection is basically detecting (one type of) interest points in an image.</p><p>Corner Detection : Corners are locations in images where a slight shift in the location will lead to a large change in intensity in both horizontal (X) and vertical (Y) axes.</p><h3><strong>Harris Corner Detector</strong></h3><p>The Harris Corner Detector algorithm in simple words is as follows:</p><blockquote><strong>STEP 1</strong>. It determines which windows (small image patches) produce very large variations in intensity when moved in both X and Y directions (i.e. gradients).</blockquote><blockquote><strong>STEP 2</strong>. With each such window found, a score R is computed.</blockquote><blockquote><strong>STEP 3</strong>. After applying a threshold to this score, important corners are selected &amp; marked.</blockquote><p>For those of you not interested in the mathematical overview, feel free to skip directly to the code section :)</p><h4>Mathematical overview</h4><p><strong>STEP 1</strong> :How do we determine windows which produce large variations?</p><p>Let a window (the center) be located at position <em>(x,y)</em>. Let the intensity of the pixel at this location be <em>I(x,y)</em>. If this window slightly shifts to a new location with displacement <em>(u,v)</em>, the intensity of the pixel at this location will be <em>I(x+u,y+v)</em>. Hence <em>[I(x+u,y+v)-I(x,y)] </em>will be the difference in intensities of the window shift. For a corner, this difference will be very high. Hence, we maximize this term by differentiating it with respect to the X and Y axes. Let <em>w(x,y)</em> be the weights of pixels over a window (Rectangular or a Gaussian) Then, <em>E(u,v)</em> is defined as :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/0*v4pgxvEFE8JvroJv.png" /><figcaption>Weighted sum multiplied by the intensity difference for all pixels in a window [1]</figcaption></figure><p>Now, computing <em>E(u</em>,v) by the above formula will be really, really slow. Hence, we use Taylor series expansion (only the 1rst order).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*2f_Yy0iYm62xfJItAte-CQ.png" /></figure><p><strong>STEP 2</strong>: Now that we know how to find windows with large variations, how do we select the ones with suitable corners? It was estimated that the <a href="https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors">eigenvalues</a> of the matrix can be used to do this. Thus, we calculate a score associated with each such window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/0*oahBtth2YSWxNa-Z.png" /><figcaption>Score for classifying into flat region/edge/corner. [1]</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*tKBvNLJ22UBzWm9JWcB3Tg.png" /></figure><p><strong>STEP 3</strong>: Depending on the value of <em>R</em>, the window is classified as consisting of flat, edge, or a corner.(Finally 😛) A large value of <em>R </em>indicates a corner, a negative value indicates an edge. Also, to pick up the optimal corners, we can use non-maximum suppression.</p><p>(Note: Harris Detector is not scale-invariant). Now, lets dive into the code. ⬇️</p><h4>Code Overview</h4><p>Harris Corner detection is implemented in OpenCV. Let’s see the code below :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a71ff02197199f4eb39913c9a5fc20d5/href">https://medium.com/media/a71ff02197199f4eb39913c9a5fc20d5/href</a></iframe><h3>Shi-Tomasi Corner Detector</h3><p>Shi-Tomasi is almost similar to Harris Corner detector, apart from the way the score (R) is calculated. This gives a better result. Moreover, in this method, we can find the top <em>N</em> corners, which might be useful in case we don’t want to detect each and every corner. (Trust me, the mathematics overview is very small here! 😃)</p><h4>Mathematical Overview</h4><p>In Shi-Tomasi, R is calculated in the following way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/125/0*VfWV-mD3WxTQpR7M.png" /><figcaption>Shi-Tomasi R score [4]</figcaption></figure><p>If R is greater than a threshold, its classified as a corner.</p><p>Heading over to the code. ⬇️</p><h4><strong>Code Overview</strong></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb0d05854963c2a693bac1d00c317ac4/href">https://medium.com/media/eb0d05854963c2a693bac1d00c317ac4/href</a></iframe><p>You can check the full code <a href="https://github.com/nishagandhi/detect_those_corners">here</a>. The code can be used to detect corners using Harris and Shi-Tomasi detection methods in an image, a folder of images, or from a live webcam. You can also play with some other parameters to get different outputs.</p><p>Now to the fun part 💃! Let’s see some of this code in action. As we can see, Shi-Tomasi detects corners better than Harris Detector :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*wvTlz05svCeCPu3MvJgeBQ.gif" /><figcaption>Top Left: Harris, Top Right: Shi-Tomasi, Bottom left : Original</figcaption></figure><h3>Conclusion</h3><p>To conclude, Harris &amp; Shi-Tomasi corner detection methods are some really cool and easy algorithms to detect-those-corners using the simple concepts of intensity gradients. Shi-Tomasi is a slightly better version after just changing the score formula. We detect corners for several applications : image alignment, image stitching (remember the panorama feature on your phone camera?), object recognition, 3D reconstruction, motion tracking and so on.</p><p>That’s it for this post! I have tried to include all the necessary details without making it into a long boring essay 😛. All questions/suggestions are most welcome, please drop a comment below or get in touch with me.</p><blockquote>LinkedIn Profile : <a href="https://www.linkedin.com/in/nisha-gandhi/">Know more about me!</a></blockquote><blockquote>GitHub Profile : <a href="https://github.com/nishagandhi">Check out my other projects!</a></blockquote><p>Stay tuned for further posts. Thank you :)</p><h4>References</h4><p>[1] <a href="https://docs.opencv.org/3.0-alpha/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html">https://docs.opencv.org/3.0-alpha/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html</a></p><p>[2]<a href="http://www.aishack.in/tutorials/harris-corner-detector/">http://www.aishack.in/tutorials/harris-corner-detector/</a></p><p>[3] <a href="https://en.wikipedia.org/wiki/Harris_Corner_Detector">https://en.wikipedia.org/wiki/Harris_Corner_Detector</a></p><p>[4] <a href="https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_shi_tomasi/py_shi_tomasi.html">https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_shi_tomasi/py_shi_tomasi.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aba0f034078b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixel-wise/detect-those-corners-aba0f034078b">Harris Corner Detection and Shi-Tomasi Corner Detection</a> was originally published in <a href="https://medium.com/pixel-wise">Pixel-wise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>