Grab frame from diddyborg stream and view it using imshow
Forums:
I'm currently playing around with diddyborg follow red ball code. the code runs perfectly on my Pi without those PicoBorg code (removed them for now). I haven't attached my ZeroBorg to the Pi so im currently testing just the video streaming and detection part.
But how do grab the frame and display them on the screen? i wanna see what the camera sees. because i'm planning to use this code as my template for line following robot (follow black line over white background)
can i use something like this? --> cv2.imshow('frame',frame_array)
but i don't know where to implement that method in the code.
it's because the code seems quite complex for my level to understand deeply although i have a pretty basic
understandings of threading that are mostly used in the code.
i hope piborg could help me with this. thanks =)
piborg
Fri, 04/28/2017 - 14:55
Permalink
Showing images in diddyFollowBall.py
You are on the right lines,
cv2.imshow
is the function you want. You will also need a call likecv2.waitkey
to get the window to display correctly.What I would suggest is adding these calls to the start of the
ProcessImage
function. For example:YAZID
Sat, 04/29/2017 - 12:22
Permalink
Thank you so much. that
Thank you so much. that method works well. actually the only line that i've been missing was that
cv2.waitKey(1)
. i didn't realize that thecv2.waitKey(1)
was such an important part of displaying images in OpenCV. now i've learned something useful.I hope that i could use this code for line following purposes since the tracking algorithm for the red ball is quite reliable. do you have any suggestions for me to start with?
piborg
Sat, 04/29/2017 - 12:39
Permalink
Good place to start
This article is probably a good place to start: http://nzee-wifi.blogspot.co.uk/2013/01/line-following-robot-using-camer...
The logic is fairly easy to follow and should point you in the right direction :)
YAZID
Sat, 04/29/2017 - 04:40
Permalink
thanks for the fast response.
thanks for the fast response. will try that later =)