Ask Your Question

Optimizing image processing code

asked 2016-02-16 11:10:35 -0500

Dr Dre gravatar image

Hi guys

I am working on image processing project which involves line following and also traffic sign detection.

If traffic sign displays stop, line follower robot should stop . other wise it follows the line

i want to perform the above two operations of line follower and traffic signal detection concurrently.

What should be my approach in doing so

i am using raspberry pi b+ and python.. how can i optimize image processing operation

edit retag flag offensive close merge delete



The first go-to optimization in image processing algorithms is downscaling your working image. You should test your algorithm for various image sizes and choose one that has a nice balance between functionality and performance.

Pedro Batista gravatar imagePedro Batista ( 2016-02-16 12:09:23 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-02-17 03:11:34 -0500

kbarni gravatar image

First, I strongly suggest to use the Raspberry Pi 2 instead of the B+. It costs the same, has the same layout, uses less power and it's more than 5x faster. It's much better in multitasking, too.

The Raspberry Pi B+ has a very limited processing power, and I definitely wouldn't use it for real-time image processing applications.

Then, you should find the right balance between robustness and processing time. An algorithm detecting red patches in the image is fast and easy to implement, but then your robot might stop at any red thing.

As Pedro said, first reduce the image size. Then try to process only a small part of the image. For example, to detect the line on the ground, use only the bottom part of the image.

There are some simple and fast algorithms you can try: HSV color space (to detect a specific color), thresholding (to binarize the image), morphological operators (to clean up the binary image), image moments (to detect the area and center of a zone), Sobel edge detector (to detect contours).

Then look, where you need more robustness, and use more complex algorithms on that part of your detection process.

edit flag offensive delete link more


Thank U....

Dr Dre gravatar imageDr Dre ( 2016-02-26 08:33:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-02-16 11:10:35 -0500

Seen: 321 times

Last updated: Feb 17 '16