Part size measurement. Hardware questions.

General discussion about topics related to OpenMV.
neuron
Posts: 5
Joined: Tue Nov 26, 2019 10:54 pm

Part size measurement. Hardware questions.

Postby neuron » Mon Jan 06, 2020 7:19 am

I am very sorry for the beginner's questions. But I'm a beginner.
I want to make a part measurement using OpenMV. I'm currently experimenting with the program but it seems I need good backlighting.
Does anyone have experience in this field?
I have two questions:
Should I have a diffused white light source or do I need a light pulse source?
The second question is is it enough to have a standard sensor or is it better to buy a Global Shutter sensor?
User avatar
kwagyeman
Posts: 4446
Joined: Sun May 24, 2015 2:10 pm

Re: Part size measurement. Hardware questions.

Postby kwagyeman » Mon Jan 06, 2020 3:40 pm

Hi, can you show me a picture of what the issue is?

I can't tell what you are struggling with.
Nyamekye,
neuron
Posts: 5
Joined: Tue Nov 26, 2019 10:54 pm

Re: Part size measurement. Hardware questions.

Postby neuron » Tue Jan 07, 2020 1:45 am

There is picture from real machine where is mounted original camera:
example.jpg
Camera is marked with number 1
Point 2 is where part comes out in mid air and point 3 is where white background can be placed.
This is wire processing machine for springs forming.
My original camera is broken and old as me :D and I want to try make a new one based on OpenMV.
User avatar
kwagyeman
Posts: 4446
Joined: Sun May 24, 2015 2:10 pm

Re: Part size measurement. Hardware questions.

Postby kwagyeman » Tue Jan 07, 2020 2:23 am

Thanks, but, I was asking more about how you'd use the OpenMV Cam in this situation? What is the camera looking at and what does the picture look like?
Nyamekye,
neuron
Posts: 5
Joined: Tue Nov 26, 2019 10:54 pm

Re: Part size measurement. Hardware questions.

Postby neuron » Thu Jan 09, 2020 4:22 am

I hope to write a program to make a screenshot and find a rectangle in it. The screen shot is created when Pin1 has a low logic level.
Then I get the length of this rectangle, which also gives information about the length of the part. I will then send this resulting number to the PLC which manages the part sorting.
If there is enough time for the program, I will entrust the management of the sorter to OpenMV using the digital output.
The original camera will be replaced by OpenMV and the component will be surrounded by a diffused light source. Now I make the camera case so it can be fixed.
I can only show the video: https://mega.nz/#!Jy50gCSY!9l4MqMAHVO-U ... Fceq0fjaHc of the camera body making stage. I can draw a sketch of the idea.
User avatar
kwagyeman
Posts: 4446
Joined: Sun May 24, 2015 2:10 pm

Re: Part size measurement. Hardware questions.

Postby kwagyeman » Fri Jan 10, 2020 1:29 am

Please start with the find_line_segments() algorithm. It will give you line segments for the edge of the box which you can use to measure the length. There's also the find_rect() method.
Nyamekye,
neuron
Posts: 5
Joined: Tue Nov 26, 2019 10:54 pm

Re: Part size measurement. Hardware questions.

Postby neuron » Fri Jan 10, 2020 3:43 am

What do You mean with edge of 'box'?
My object for measurements are spring
IMG_20200110_103732.jpg
Somehow I should get a rightmost edge of that spring. That kind of springs comes out of machine and I trying to measure each of them.
Box in attached video are enclosure for camera.
User avatar
kwagyeman
Posts: 4446
Joined: Sun May 24, 2015 2:10 pm

Re: Part size measurement. Hardware questions.

Postby kwagyeman » Sat Jan 11, 2020 4:26 pm

You were talking about finding rectangles. So, I thought you were looking at a box.

Just use find_line_segments(). Then it will return a list of line segments. See the example under feature detection examples to get started.

1. To make the algorithm run faster constrain the ROI of the code to just to the area in the image where you expect the spring to be. You can find the ROI in the image by selecting the area in the IDE frame buffer. Pass that ROI to the method like "roi=(x,y,w,h)" as one of the arguments to the method.

2. Given the list of the line segments, find the min left and max right line segment:

Code: Select all

min_x = min(line_segments, key=lambda x: min(x.x1(), x.x2()))
max_x = max(line_segments, key=lambda x: max(x.x1(), x.x2()))
The lambda method finds the min/max of each line itself and then the min/max of the list of lines.

The max_x-min_x is the length of the spring.
Nyamekye,
neuron
Posts: 5
Joined: Tue Nov 26, 2019 10:54 pm

Re: Part size measurement. Hardware questions.

Postby neuron » Tue Jan 14, 2020 5:30 am

Thank You, Nyamekye for giving idea.
User avatar
kwagyeman
Posts: 4446
Joined: Sun May 24, 2015 2:10 pm

Re: Part size measurement. Hardware questions.

Postby kwagyeman » Tue Jan 14, 2020 3:23 pm

Note, in the upcoming firmware we increased the speed of find_line_segments to 20 fps or so.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest