We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Confused about FillThreshold and TrimWhitePixels

In the attached image file, I do not understand the results I am seeing.

The orange block (sensitive box - my terminology) is the area that the amr file identifies a vote box. Note that the “sensitive box” is 1.5 times the size of the “vote box”.

Please explain what % FillThreshold would be necessary to see the black slash as a mark with

TrimWhitePixels set to true


TrimWhitePixels set to false.

Secondly, when TrimWHitlePixels is set to true, which whit pixels are removed?

Only ones outside the black box border?

Thank you for your attention, this is driving me bonkers!

Hi Chuck,

Thank you for your inquiry.

I like to apprise you that:

Threshold: is actually the percentage of the black pixels in the OMR mark area to consider it as filled. Setting the mark threshold level allows Aspose.OCR to determine which area is actually filled. This value directs how leniently or strictly the API will interpret the OMR marks. The default FillThreshold value is set to 0.45 whereas the maximum value is 1.0.

With threshold value as low as 0.1 (10%) all marks are recognized as filled. Marks are considered to be filled because even the empty mark circle takes about 26% to 30% of the area depending on area size, whereas actually filled mark takes about 60% to 70% of the area. Therefore, if threshold value is set less than 30%, all marks are recognized as filled. Sample images are attached showing the percentage for better understanding.

TrimWhitePixels: OMR algorithm considers any element’s cell as filled if ratio of black pixels to white pixels is above a certain threshold level. If a cell is bigger than a bubble/OMR element, then white space around the bubble/OMR element makes it impossible for amount of black pixels to get above the threshold. OmrConfigTrimWhitePixels property allows you to solve this problem by discarding white space around black pixels.

Hope the above information helps. Feel free to contact us in case of any query or comments.