Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Resistor sorter

Hello, 

I'm working on a school project which is a resistor sorter. I'm tried to use the color segmentation from the Vision assistant but I couldn't get a match because the clasifier I used was based on a resistor and can't be used if I changed the resistor. I've also tried this VI but I can't determine the color code via the RGB profil .

1/ How can I make a clasifier file to include all possible colors? 

2/ How can I modifie my VI to get the RGB values of only the bars? 

0 Kudos
Message 1 of 11
(3,371 Views)

Hi Nezarovsky,

Since Brad already gave you general suggestions on your Idea Exchange post, I'll simply try to answer your specific questions here. 

1. Color classifiers should be trained on a data set of as many sample images as you can provide. It's meant to use the "knowledge" of the training set you use to identify the colors, so if you are only training with a specific instance then your application will be biased by that training. Instead, you should be using as many sample images as you can, and include every possible color you wish to identify so that they are properly included in the classifier. Using a single resistor as your sample pool simply isn't going to be enough.

2. To determine the RGB value of the bar, you first need to actually find each bar in your image. There are a large number of ways to do this, using various detection and thresholding methods. Pattern Matching, Edge Detection, Color Thresholding, and many other methods might work for this but you will need to test all of your options to decide what works best. Once you know the location of the bar, you can then use a region of interest in the bar with your color classifier to determine the pre-trained color. You could also pull the pixel value from the image to get the actual RGB values, but that may not be as accurate as the classifier. 

What you are describing is absolutely a non-trivial application. There are a number of other things you should consider, such as the orientation of the resistors and ensuring you have consistent lighting conditions. 

Charlie J.
National Instruments
0 Kudos
Message 2 of 11
(3,331 Views)

Hi Charlie, 

Since I have a biginner's level on LbVIEW I couldn't find out how to actually find the resistor's rings nor to classify every color shade so I can't decide which way to go with and I'm running out of time. Can I have a hint? 

0 Kudos
Message 3 of 11
(3,309 Views)

Do you have sample images that we could take a look at and show all of the different ways the resistor may be oriented or displayed for which we would still need to determine the resistance value?

 

When it comes to vision software algorithms there are usually many different ways to arrive at the same information and determining which one is the best and most reliable for your specific application really comes down to what assumptions we can make about the incoming image which is why having a broad range of sample images is so helpful.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 11
(3,296 Views)

I don't have a specific simple because resistors would be passing by on a convoyer and I have to analyze it. However, if needed, the convoyer can stop during the aqcuisition. I attached a photo of what the resistor would look like (which can be rotated). 

0 Kudos
Message 5 of 11
(3,293 Views)

So what do you have so far and what parts are you stuck on?

Matt J | National Instruments | CLA
0 Kudos
Message 6 of 11
(3,289 Views)

So far I can manually select a ROI line and extract the RGB value. I can see that there are variations due to the resistor's band but I can't find how to determine only the RGB of the bands in order to determine the resistor's value.

There are many parts I'm stuck on: 

1- how to extract the RGB values for only the bands? 

2- when that's done, I would like to automatically rotate the resistor's image and draw the ROI line in order to select the RGB profil.

Download All
0 Kudos
Message 7 of 11
(3,286 Views)

Taking this one step at a time, you first need to find where the bands are. You can either take the information you have from the line profiles and interpret those results or look for straight edges to find the bands and then figure out what colors the bands are.

Matt J | National Instruments | CLA
0 Kudos
Message 8 of 11
(3,270 Views)

I suggest that you try to improve the lighting of the resistors. If you can produce a more diffuse illumination you will get rid of specular reflections and reduce shadowing which will give you a better chance of processing the images correctly. I would agree with a previous post - this is not a trivial task. 

0 Kudos
Message 9 of 11
(3,237 Views)
that is not easy cake this project involve with several problem that many of them relate to color and lighting problem
0 Kudos
Message 10 of 11
(3,152 Views)