02-17-2016 07:39 AM
hello hatef,
As per your suggestion i did the particle analysis to my project and extracted the feauters the project flow is as follows:
step 1: acquiring an image with camera (in my case i took red bull)
step 2: converting rgb from camera to hsi.
step 3: extracting hue and saturation planes.
step 4: caluclating the range for hue an dsaturation planes with the selected ROI of step 1 image.( note my ROI is white backgraound)
step 5: give the calculated ranges to the threshoding and do the thresholding using IMAQ color thresholding.
step 6: do inverse thresholding to get the threshoding of objects( as we did the thresholding of background)
step 7: remove noises using erosion of IMAQ Remove particles and IMAQ Particle filter of selecting the area of range 0 to 20,000
step 8: do the dialaltion to get better image
step 9: fill hole to fill the holes.
step 10 : do the particle analysisi to extract the features of the object ( i took center of mass and First pixel Y and Elogation factor) to get the size of the object.
number of particle is = 1
and i have to do color classification and particle classification for the respective object (i.e. redbull) please have a look at it and please suggestion the further steps to complete my project . i am attaching the VI and screenshot of front panel.
02-17-2016 06:47 PM
Please attach pictures of the different objects that you need to classify. That will help the community suggest a solution.
The color classifier that you are using can only be used to identify the color of a new part. Not the shape.
You can use it as is to find out the color, then use particle analysis to get additional information on the shape of the particle.
Once you have segmented your particle using the code you posted, the particle analysis VIs can returns lots of different parameters that can be used to describe the shape of the particle.
A possible solution is to combine a color classifier with a particle classifier.
Again, seeing images of what exactly you are trying to classifier would help.
Best regards,
Christophe
02-17-2016 08:39 PM
ok
what ChristopheC told is true please do that
also what you done in your vi for escape form making classify files is good and now you can classify your abject with that
for example you can use % area / image and use compression to classify object to 3 class under10% under 30% under 60% and call them
small medium and big abject (just use case structure ans compression ) any time you want you can change classify by change present controls and rename them also you can all class or remove just by some easy codes
OK now what is the next step for color classify
is to do one of these two thing
1 make RIO with information that you find with particle analyze this ROI should be exactly edge of your particle
there is some method to do that just search around labview vi information
2 if easy way but not exact one just turn you binary image of your particle to grayscale with to value 1 for particle and 0 for back ground
and then try to split your main image plate of RGB (there is a vi for that) then multiply with that image and then create 32bit RGB image with the three plate in this case you have image with real color but black background ( this method problem is just black classifying )
if you could do this step you could classify object by color in next step and your project is done
02-22-2016 07:33 AM
hello ChristopherC,
I succesfully designed the color classification training in the program i created two color classes
one class is black and another class is yellow.
the VI runs in a while loop and a switch is a decisiion taker in case when switch is on it goes to black and switch is off it goes to the class yellow where i can stop the program once i got enough samples.
and i am able to classify them below i am attacjing the color classification training and classification testing
02-22-2016 08:36 AM
but my program what i did only works for two classes but now i wanted to design it for 6 classes but using the switch so many times is not logical i want to make it more user friendly so please help me how to design for more number of classes.
for example there are 5 objects with 5 different colors so i want to create 5 different color classes where i can classify them.
and one empty class where another than these 5 colors are detected it has to given unknown color.
Therefore i would like make more user friendly.
02-22-2016 09:20 AM
this is the example color images which i need to classify using above VI
02-24-2016 08:03 AM
hello,
For further solution i tried to build an user interface
my project sir project flow will be in the following way:
case 1 image acquisition. which directs to the case2:
case 2 will be having two booleans button "Test " and "Train" if the user presses "test" it should go to case 3 where the image acqised is tested based on the color classification.
if the user presses button "Train" it should direct to the case 4 wher there will be couple of buttons like RED Green Blue Yellow when particular button is pressed it should direct to particular case whereit trains the system by adding color samples to the prescribed class file.
red----------case 5(for red color)
blue--------case 6(for blue color)
green------case 7(for green color)
yellow------case8(for yellow color)
i gave two buttons to any array and converted boolean array to number sir now my probelem is i not getting an idea how to give directions to my case 2 that it should go to case 3 and case 4 when user selects test and train button in case 2.
02-24-2016 10:05 AM
@ramisetti wrote:i gave two buttons to any array and converted boolean array to number sir now my probelem is i not getting an idea how to give directions to my case 2 that it should go to case 3 and case 4 when user selects test and train button in case 2.
"Boolean array to number" Is useful if all switch combinations are possible and need a different response (in your case FF, TF, FT, TT), the resulting number will give you the pattern. If only one boolean can be true (which would make sense since you can only do one processing step at a time), you can use "search array" to find the first TRUE. If no swith is TRUE, the result will be -1.
02-24-2016 11:55 AM
Sir,
now i can add succesfully 4 classes with four boolean buttons.
now the work flow be in the following:
Case0: Image Acquisition with ROI.
Case 1: select function Test or Train.
if Test is selected go to case 3 and classify color and give the result.
if Train is selected go to case 4 where you need to select one of the four booleans which is again directed to some set of cases which are explained below
4 buttons
red - blue-green- orange which are given to an array and converted to number and is given as an input to case structure.
when no button is selected case 0 is executed where it returns to take an acquistion.
when red button is selected case 1 is executed write value to a file and returns again to image acquisition.
when blue button is selected case 2 is executed write value to a file and returns again to image acquisition.
when green button is selected case 3 is executed write value to a file and returns again to image acquisition.
when orange button is selected case 4 is executed write value to a file and returns again to image acquisition.
now the problem is:
if i select test in case 2 and give input color as other than these 4 colors to test or to classify (example: pink or black or brown etc...) it should give me result that as unknown color because i trained only these 4 colors. other than these 4 colors my doesnt know because it is not trained.
please help me with your valuable suggestions to overcome this problem.
below i am attaching my improved code. please go through it once and suggest me with your solotion idea.
02-24-2016 09:58 PM
I don't understand why you are using a different classifier file per color. You can add different samples to the same classifier file.
Also, since you are classifying color only, I would recommend using the Color Classification training interface to train the classifier.
Take a look at the color classification example located here:
C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\Vision\Classification\Color Classification.vi