Automatic drive with OpenCV

Hello Guys,
i am inspired by this Video
https://zhengludwig.wordpress.com/projects/self-driving-rc-car/

I know, he made it whit and arduino and the Pi only for camera streaming...

I woult look live on the modified images with

cv2.imshow("Frame", image)

After this Section.

def ProcessImage(self, image):
        # Get the red section of the image
        image = cv2.medianBlur(image, 5)
        image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV) # Swaps the red and blue channels!
        red = cv2.inRange(image, numpy.array((115, 127, 64)), numpy.array((125, 255, 255)))
        # Find the contours
        contours,hierarchy = cv2.findContours(red, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

        <-here->

But die Pi just ignoring this.
I am new with open CV, can you help me

Thank you

PS.:
Does anybody know a good tutorial for OpenCV? For beginners?

piborg's picture

You are close, but imshow will not bring up the frames on its own.

What you need to do is create a window with the same name before the imshow call like this:

cv2.namedWindow("Frame", cv2.WINDOW_NORMAL)

This only has to be done once per window you need.
Each image is then shown on the window with the same name.

After each imshow call you will also need to give the system some time where it can do the drawing.
This can be done with:

cv2.waitKey(1)

As for tutorials the offical one might not be a bad place to start:
http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_tutorials.html

Cool, thank you it worked!

I have a look on these site, thanks :)

Subscribe to Comments for &quot;Automatic drive with OpenCV&quot;