I ran into a problem where I was trying to recognize gold on the ground so I wouldnt miss any and I couldnt figure out a solution that didnt get false positives.
Well I figured out a solution and am posting it incase someone else was having the same problem. It probably needs to be modified for different screen setups but the method will still work.
I took a screen shot of the gold label and noted points on the image that would not change due to the background or anything else.
I got the color for each point and made a function that checked each point relative to an x,y (and just loop for all the pixels on the screen) and if it matches then its a gold label.
I havent gotten any false positives from it and it's pretty quick. Please excuse the not so sexy C, but whatevs.
Code:
int IsGold(int x,int y){
if (GetPixel(ndc,x+4,y)!=16777215) return 0;
if (GetPixel(ndc,x+5,y)!=16777215) return 0;
if (GetPixel(ndc,x+18,y)!=16777215) return 0;
if (GetPixel(ndc,x+1,y+3)!=16777215) return 0;
if (GetPixel(ndc,x+13,y+3)!=16777215) return 0;
if (GetPixel(ndc,x+18,y+3)!=16777215) return 0;
if (GetPixel(ndc,x+23,y+3)!=16777215) return 0;
return 1;
}
This solution could be used for recognizing other shits with labels as well.