The picture OMR grayscale is divided into 16 levels, ready to process the picture, rewrite the underlying OMR identification algorithm
Procedure ConvertTogramyGraphic (var Bmp: Tbitmap); VAR P: PbyteArray; Gray, X, Y: Inteder; Begin for Y: = 0 to bmp.height-1 do begin p: = bmp.scanline [y]; for x: = 0 to bmp.width-1 do begin gray: = round (p [x * 3 2] * 0.3 p [x * 3 1] * 0.59 p [x * 3] * 0.11); p [x * 3]: = gray; p [x * 3 1]: = Gray; p [x * 3 2]: = Gray; end; end; end; this is the grayscale of the whole pair image. As for any point, haha ... mycolor: = image.picture.bitmap.canvas.pixels [x, y]; r: = getrValue (mycolor); g: = getGValue (MyColor); b: = getBValue (MyColor); Grayscale: = 0.3 * R 0.59 * g 0.11 * b;