<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Raspberry Pi - Image processing for UAV navigation</title><link>/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><description>Hey all, I am quite new to the Raspberry Pi world but very interested. I have done a few basic things on the Raspberry Pi so far, the main one was learning to code in python (as I already know C) and learning to use a linux based system (first t...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Sun, 15 Nov 2015 13:46:44 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Need help in image processing by pi 2.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;&lt;p&gt;Hassan mughal&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Mon, 18 Feb 2013 21:27:09 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Changed to a discussion&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-message-small" href="https://www.element14.com/community/message/69975/l/re-raspberry-pi-webcam-python-opencv-weird-problems-no-solutions#69975"&gt;http://www.element14.com/community/message/69975#69975/l/re-raspberry-pi-webcam-python-opencv-weird-problems-no-solutions&lt;/a&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Mon, 18 Feb 2013 01:16:11 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Now, That TakePic function works really well thankyou, so this is my code below. I run the program and can see the webcam feed, I then press a key capturing an image as img1, then again but as img2, and again img3. Now when the final image displays (img2+img3) it just shows img3 added to itself, i.e. as though I coded Add(img3,img3,img1). I have also tried AddWeighted and AND functions.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have tried and tried and cannot find the problem, is it the Add function that is not reading img2, or could img2 not be saved properly? or what is going on!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any help would be great,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Dan.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;# Daniel Myers&lt;br /&gt;# cvTest.py&lt;br /&gt;# 18 Feb 13&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;from cv import *&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;SIZE=(HEIGHT,WIDTH)=(640,480) # Image capture size&lt;br /&gt;CAMERA_INDEX=-1 # -1 means any camera attached&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;def TakePic(cam):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NamedWindow(&amp;#39;cvTest&amp;#39;,CV_WINDOW_AUTOSIZE)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while True:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; img=QueryFrame(cam)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ShowImage(&amp;#39;cvTest&amp;#39;,img)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k=WaitKey(2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if k&amp;gt;=0: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return img&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;cam=CaptureFromCAM(CAMERA_INDEX) # Initializes capturing a video from a camera&lt;br /&gt;SetCaptureProperty(cam,CV_CAP_PROP_FRAME_WIDTH,WIDTH) # Set the capture image width&lt;br /&gt;SetCaptureProperty(cam,CV_CAP_PROP_FRAME_HEIGHT,HEIGHT) # Set the capture image height&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;img1=TakePic(cam)&lt;br /&gt;ShowImage(&amp;#39;img1&amp;#39;,img1)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;img2=TakePic(cam)&lt;br /&gt;ShowImage(&amp;#39;img2&amp;#39;,img2)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;img3=TakePic(cam)&lt;br /&gt;ShowImage(&amp;#39;img3&amp;#39;,img3)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;AddWeighted(img2,0.4,img3,0.6,20,img1)&lt;br /&gt;ShowImage(&amp;#39;img2+img3&amp;#39;,img1)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;k=WaitKey(100000)&lt;br /&gt;DestroyAllWindows()&lt;br /&gt;del(cam)&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Sun, 17 Feb 2013 09:27:29 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks Eduardo,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have been away for the weekend but will be trying out your code tomorrow, it looks like that may fix my problem, or maybe I really want it to.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;James, think that link is broken now, did you mean Texas in QLD or USA?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Anyway, I&amp;#39;ll be on tomorrow to reveal if the problem is fixed and if so I&amp;#39;ll post the max frames per second I can get my program running at.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;Dan&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Sat, 16 Feb 2013 06:18:10 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt; I hope you don&amp;#39;t live in Texas. Although, it is a great Q.&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="http://www.popsci.com/technology/article/2013-02/privacy-and-drones" rel="nofollow ugc noopener" target="_blank" title="http://www.popsci.com/technology/article/2013-02/privacy-and-drones"&gt;http://www.popsci.com/technology/article/2013-02/privacy-and-drones&lt;/a&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Wed, 13 Feb 2013 21:32:24 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi all,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have got openCV working for python and C, just using python for now. But I have ran into problems and need help since I&amp;#39;ve tried everywhere and everything I can think of.&lt;/p&gt;&lt;blockquote class="jive-quote" dir="ltr"&gt;&lt;p&gt;-Using python with openCV but can use C instead&lt;/p&gt;&lt;p&gt;-Running Raspberry Pi, 512Mb model B&lt;/p&gt;&lt;p&gt;-Using a logitech QuickCam Communicate MP/S5500 Webcam&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Now, my ultimate goal is to capture an image, wait some time, capture another image, merge (add) the images together, save the output.&lt;/p&gt;&lt;p&gt;The issue is the second image captured is just like the first, dispite the program correctly waiting, the camera does not wait to capture the next image. I have tried in both python and C and had the same issue so I believe I must be missing some key element. &lt;/p&gt;&lt;p&gt;Here is the Code:&lt;/p&gt;&lt;blockquote class="jive-quote" dir="ltr"&gt;&lt;p&gt;&lt;span&gt;# PudFish&lt;br /&gt;# cvTest.py&lt;br /&gt;# 11 Feb 13&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;from cv import *&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;SIZE=(HEIGHT,WIDTH)=(640,480) &lt;span&gt;# Image capture size&lt;/span&gt;&lt;br /&gt;CAMERA_INDEX=-1 &lt;span&gt;# -1 means any camera attached&lt;/span&gt;&lt;br /&gt;WAIT_TIME=10 &lt;span&gt;# In seconds&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;cam=CaptureFromCAM(CAMERA_INDEX) &lt;span&gt;# Initializes capturing a video from a camera&lt;/span&gt;&lt;br /&gt;SetCaptureProperty(cam,CV_CAP_PROP_FRAME_WIDTH,WIDTH) &lt;span&gt;# Set the capture image width&lt;/span&gt;&lt;br /&gt;SetCaptureProperty(cam,CV_CAP_PROP_FRAME_HEIGHT,HEIGHT) &lt;span&gt;# Set the capture image height&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;img1=QueryFrame(cam) &lt;span&gt;# Capture an image and store as img&lt;br /&gt;&lt;/span&gt;print &amp;quot;img1 captured&amp;quot;&lt;br /&gt;SaveImage(&amp;quot;img1.png&amp;quot;,img1) &lt;span&gt;# Save the img to file&lt;/span&gt;&lt;br /&gt;print &amp;quot;img1 saved&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;# Delay, indexed for debugging&lt;/span&gt;&lt;br /&gt;for i in range(0,WAIT_TIME):&lt;br /&gt;print &amp;quot;i: %d&amp;quot; %i &lt;span&gt;# Print the current index&lt;br /&gt;&lt;/span&gt;WaitKey(1000)&lt;br /&gt;&lt;br /&gt;img2=QueryFrame(cam) &lt;span&gt;# Capture an image and store as img&lt;/span&gt;&lt;br /&gt;print &amp;quot;img2 captured&amp;quot;&lt;br /&gt;SaveImage(&amp;quot;img2.png&amp;quot;,img2) &lt;span&gt;# Save the img to file&lt;/span&gt;&lt;br /&gt;print &amp;quot;img2 saved&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;# Print the data types and ID&amp;#39;s for debugging&lt;/span&gt;&lt;br /&gt;print &amp;quot;img1 Type: %s&amp;quot; %type(img1) #&lt;span&gt; Print the data type of the img variable&lt;/span&gt;&lt;br /&gt;print &amp;quot;img1 ID: %d&amp;quot; %id(img1) &lt;span&gt;# Print the unique ID of the img1 object&lt;/span&gt;&lt;br /&gt;print &amp;quot;img2 Type: %s&amp;quot; %type(img2) &lt;span&gt;# Print the data type of the img variable&lt;br /&gt;&lt;/span&gt;print &amp;quot;img2 ID: %d&amp;quot; %id(img2) &lt;span&gt;# Print the unique ID of the img2 object&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p dir="ltr"&gt;&lt;span&gt;And the Output:&lt;/span&gt;&lt;/p&gt;&lt;blockquote class="jive-quote" dir="ltr"&gt;&lt;p dir="ltr"&gt;&lt;span&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;VIDIOC_QUERYMENU: Invaild argument&lt;br /&gt;img1 captured&lt;br /&gt;img1 saved&lt;br /&gt;i: 0&lt;br /&gt;i: 1&lt;br /&gt;i: 2&lt;br /&gt;i: 3&lt;br /&gt;i: 4&lt;br /&gt;i: 5&lt;br /&gt;i: 6&lt;br /&gt;i: 7&lt;br /&gt;i: 8&lt;br /&gt;i: 9&lt;br /&gt;img2 captured&lt;br /&gt;img2 saved&lt;br /&gt;img1 Type: &amp;lt;type &amp;#39;cv2.cv.iplimage&amp;#39;&amp;gt;&lt;br /&gt;img1 ID: 1147448688&lt;br /&gt;img2 Type: &amp;lt;type &amp;#39;cv2.cv.iplimage&amp;#39;&amp;gt;&lt;br /&gt;img2 ID: 1147448712&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p dir="ltr"&gt;&lt;span&gt;So, I had the webcam facing the monitor for debugging:&lt;/span&gt;&lt;/p&gt;&lt;blockquote class="jive-quote" dir="ltr"&gt;&lt;p dir="ltr"&gt;&lt;span&gt;-img1 shows the last line as &amp;quot;VIDIOC_QUERYMENU: Invaild argument&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;-img2 shows the last line as &amp;quot;i: 2&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;Now the odd thing which occurs, I comment out the capturing of img1, and then img2 is captured at the correct time, i.e. the last line in the picture is i: 9&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Let me know if you need any more info or to clear things up, thanks in advance for any help.&lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Dan.&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry Pi - Image processing for UAV navigation</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pi---image-processing-for-uav-navigation</link><pubDate>Wed, 13 Feb 2013 15:13:11 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de0c30f-76aa-4106-acff-b5938c4b6cae</guid><dc:creator>eduardofv</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hope this posts I wrote (a while ago) may help:&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="http://eduardofv.com/read_post/185-Installing-OpenCV-on-the-Raspberry-Pi" rel="nofollow ugc noopener" target="_blank" title="http://eduardofv.com/read_post/185-Installing-OpenCV-on-the-Raspberry-Pi"&gt;http://eduardofv.com/read_post/185-Installing-OpenCV-on-the-Raspberry-Pi&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="http://eduardofv.com/read_post/192-OpenCV-on-the-Raspberry-Pi-with-Arch-Linux-ARM" rel="nofollow ugc noopener" target="_blank" title="http://eduardofv.com/read_post/192-OpenCV-on-the-Raspberry-Pi-with-Arch-Linux-ARM"&gt;http://eduardofv.com/read_post/192-OpenCV-on-the-Raspberry-Pi-with-Arch-Linux-ARM&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="http://eduardofv.com/read_post/194-A-Laser-Range-Finder-using-RapsberryPi-Arduino-and-OpenCV" rel="nofollow ugc noopener" target="_blank" title="http://eduardofv.com/read_post/194-A-Laser-Range-Finder-using-RapsberryPi-Arduino-and-OpenCV"&gt;http://eduardofv.com/read_post/194-A-Laser-Range-Finder-using-RapsberryPi-Arduino-and-OpenCV&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Let me tell you that&amp;nbsp; a USB camera is pretty slow (usually no more than 3fps). I&amp;#39;m waiting for the CSI camera to be released.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Eduardo&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15060&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>