Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindMMDots(BMP: TMufasaBitmap): TPointArray;
- function FindDots(blacks: TPointArray; Color, T: Int32): TPointArray;
- var
- i: Int32;
- p: TPoint;
- begin
- for i:=0 to High(blacks)-1 do
- if (BMP.GetPixel(blacks[i].x+3,blacks[i].y+0) = 65536) or
- (BMP.GetPixel(blacks[i].x+2,blacks[i].y+1) = 65536) then
- begin
- p := blacks[i];
- p.y -= 3;
- if Ord(SimilarColors(Color, BMP.GetPixel(p.x+1,p.y+0), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+2,p.y+0), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+0,p.y+1), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+1,p.y+1), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+2,p.y+1), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+3,p.y+1), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+0,p.y+2), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+1,p.y+2), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+2,p.y+2), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+3,p.y+2), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+1,p.y+3), t)) +
- Ord(SimilarColors(Color, BMP.GetPixel(p.x+2,p.y+3), t)) >= 8 then
- begin
- Result += p;
- end;
- end;
- end;
- var
- blacks: TPointArray;
- begin
- BMP.FindColors(blacks, 65536);
- blacks := blacks.FilterBox(Box(1,4,BMP.GetWidth-4, BMP.GetHeight-1));
- SetColorToleranceSpeed(2);
- SetToleranceSpeed2Modifiers(0.001,0.001);
- Result := FindDots(blacks, $FFFFFF, 30); //white
- SetColorToleranceSpeed(2);
- SetToleranceSpeed2Modifiers(0.05,1);
- Result += FindDots(blacks, $00FFFF, 30); //yellow
- Result += FindDots(blacks, $0000FF, 30); //red
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement