Cartwheel1984
Posts: 5
Joined: Thu Aug 22, 2019 6:01 am

set a camera up to recognize shapes ?

Tue Sep 10, 2019 6:26 am

Hi all,

How easy would it be for me to set a camera up to recognize shapes then take my idea onto more complex shapes?

For example I work in a machine shop producing components, could I set it up to recognise if a feature such as a hole was missing?

Total beginner looking for a interesting project.

Thanks for any advice

User avatar
Gavinmc42
Posts: 4041
Joined: Wed Aug 28, 2013 3:31 am

Re: Pi project idea help

Tue Sep 10, 2019 7:26 am

Not that easy, so start with OpenCV as that probably has the best support.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Heater
Posts: 13885
Joined: Tue Jul 17, 2012 3:02 pm

Re: Pi project idea help

Tue Sep 10, 2019 7:56 am

I have no idea about shape recoginition or object detection or any of the methods used to do that like neural nets etc. But I'm working on a project now with some guys who have been doing this for a while. They use YOLO: Real-Time Object Detection: https://pjreddie.com/darknet/yolo/

Reading the page there it seems to be relatively simple, and require no programming to get recognize things. The tricky part that will take some effort is training the thing to recognize what you want. You have to gather lots of example images containing what you want to recognize, and what you don't. They expplain how to use some ready made training data sets on their page.

If you want to train it with your own images of your particular objects here is a guy describing how hed did it:
https://towardsdatascience.com/yolov2-t ... f98d5ce5bf

Now the problem could be performance. It can take tens of seconds for a Pi to detect things with Yolo. So you can use an neural net accelerator. The Intel Movidius USB dongle for example: http://raspberrypi4u.blogspot.com/2018/ ... bject.html

There are tons of links to such projects around the net and interesting vids on YouTube.
Memory in C++ is a leaky abstraction .

Cartwheel1984
Posts: 5
Joined: Thu Aug 22, 2019 6:01 am

Re: Pi project idea help

Tue Sep 10, 2019 7:57 am

Thanks gavin

Just wanted an idea how easy it would be, I'll look into it but if its 2 hard then might have to get a bit more experienced first, would it still be hard just for basic shapes you think?

Cartwheel1984
Posts: 5
Joined: Thu Aug 22, 2019 6:01 am

Re: set a camera up to recognize shapes ?

Tue Sep 10, 2019 2:56 pm

Thanks heater for taking your time to write, that yolov2 looks amazing definitely going to check it out!

Thanks!

User avatar
Gavinmc42
Posts: 4041
Joined: Wed Aug 28, 2013 3:31 am

Re: set a camera up to recognize shapes ?

Wed Sep 11, 2019 2:33 am

One thing I noticed is the image sizes for face recog seem to be about 300x300 pixels.
Some go down to 64x64 for car, dog, tree type recog.
Too much data is hard too analyse and takes way longer.

But if you want to detect missing/misplaced holes, a known good pattern is just differenced with the object being tested.
This is much easier to do, even at higher resolution and high speed.
The trick is to have them in a reference position, ie stick them in a fixed jig with fixed light levels.

Someone has sorted cucumbers at speed with Pi's ;)

Start here with some simple Python coding
https://picamera.readthedocs.io/en/rele ... index.html

I think even Mathematica can do image stuff.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “General discussion”