I set up the camera using the LabView vision application and determined the hue, saturation and luminance with fixed color correction and exposure for the red piece of material supplied with the kit of parts. Using those values, I created the min/max structures for each property of the color I wanted to track as follows:
(the color values are not what I was using. this is just an example of what was in the code)
Range hue, sat, lum;
hue.minValue = 140; // Hue
hue.maxValue = 155;
sat.minValue = 100; // Saturation
sat.maxValue = 255;
lum.minValue = 40; // Luminance
lum.maxValue = 255;
ParticleAnalysisReport par;
if (StartCameraTask() == -1)
{
printf( "Failed to spawn camera task; Error code %s", GetErrorText( GetLastError()) );
}
// this code is in the operator control loop...
if (FindColor(IMAQ_HSL, &hue, &sat, &lum, &par)
{
printf(“color found at x = %i, y = %i", par.center_mass_x_normalized, par.center_mass_y_normalized);
printf(“color as percent of image: %d", par.particleToImagePercent); }
}
Runs without errors but FindColor returns a value of 128. I find this odd.
I also tried setting min/max values for all to 1 and 250 and it still couln't find anything. I think this should have found everything in the room no?
Quote:
Originally Posted by JamesByrne
did you set the color in the code to red, if i remember right the default color that it is searching for is red.
Also did you build the camera pan tilt mount? so that you can use it with that.
|