LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ_IGNORE_BLACK_AND_WHITE

Solved!
Go to solution

Hi all,

 

I'm writing in LabWindows/CVI function for searching color pattern over grabed image. Unfortunately I can't get very good results, because most uninterested part of template for evaluation is black or white. I want to eliminate to score those 2 colors by imaqLearnColorPattern function from NI Vision.

There is variable ColorIgnoreMode   ignoreMode;  IMAQ_IGNORE_BLACK_AND_WHITE but its a part of LearnColorPatternOptions_struct and there is ColorInformation_struct where I don't understand :

double* info; //An array of color information that represents the color spectrum analysis of a region of an image in a compact form.

 

What is color spectrum analysis of region in compact form ???

Can somebody help me what I have to pass to info ?

 

Thank you !!!!

 

Radovan Demko

 

structs used:

 

typedef struct ColorInformation_struct {
int infoCount;
int saturation;
double* info; //An array of color information that represents the color spectrum analysis of a region of an image in a compact form.
} ColorInformation;

 

typedef struct LearnColorPatternOptions_struct {
LearningMode learnMode;
ImageFeatureMode featureMode;
int threshold;

hue values.
ColorIgnoreMode ignoreMode;
ColorInformation* colorsToIgnore; //An array of ColorInformation structures providing a set of colors to exclude from the color features of the template image.
int numColorsToIgnore;
} LearnColorPatternOptions;

0 Kudos
Message 1 of 4
(3,363 Views)
Solution
Accepted by topic author throll

Hi Radovan,

 

This is Austin Hill in Applications Engineering! Thanks for asking about this Vision function in CVI. The answer is a little involved, so let me know if any of my points need clarification.

 

 You can use the imaqLearnColor( ) function to acquire the colorInformation Array, which you can pass into LearnColorPatternOptions_struct . You could use the LearnColor function to detect the Black and White hues you want to avoid in your color match pattern and put that into the Options_struct. You don't technically need to pass anything to 'info *' in the ColorInformation struct, because you attain that from Learn Color.

 

Basically what you'll need to do to eliminate those 2 colors is:

1. Call imaqLearnColor to determine the color you want to ignore

2. Pass ColorInformation* into the LearnColorPatternOptions as colorsToIgnore

3. Call imaqLearnColorPattern as options to tell the image what to look for / ignore

 

I'd also recommend you take a look at / try running the example that calls this function located at C:\Users\Public\Documents\National Instruments\CVI\samples\Vision\2. Functions\Color Pattern Matching . If you open teh Workspace called Color Pattern Matching, you can see how this is implemented in a specific way.

 

If you have any questions feel free to let me know and reply here.

 

Best!

Austin H.

Applications Engineering

NI

Austin H.
Chief Product Manager
Test Software
Message 2 of 4
(3,327 Views)

Hi Austin,

 

Thank you for answer. Basically at the end I did the same you suggested to me with imaqLearnColor... And thank you much about telling me that there are CVI examples for Vision, c'oz in my main CVI2015 folder are no Vision examples. By accident they are somewhat below CVI folder ... 

 

Have a nice day ..

 

Radovan Demko

0 Kudos
Message 3 of 4
(3,321 Views)

Hi Radovan,

 

I'm glad imaqLearnColor worked out for you! And yes, knowing where those examples are is always very helpful, especially because they're not in an obvous location. 

 

Let me know if you have any other questions or concerns!

 

Austin H.
Chief Product Manager
Test Software
0 Kudos
Message 4 of 4
(3,315 Views)