Why negative image is used in preprocessing?

I've observed that for many preprocessing operations (I mean mainly preprocessing for OCR) usually negative image is used?

For example: http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/ http://felix.abecassis.me/2011/09/opencv-detect-skew-angle/

I've found it also when objects are found using kNN algorithm.

Why inverted images are used? Is that only to show it is just preprocessing step? Are there any advantages during using inverted images?


The answer is more or less given the second example you linked:

In image processing, objects are white and the background is black, we have the opposite, we need to invert the colors of our image

By convention most image processing detection algorithms assume what's supposed to be detected is white and the background is black. However most text in the real world is black text on white background, like for example a page of a book, so many real world images will need to be inverted to match the assumptions of the image detection algorithm.


No, there are strictly no advantages in working with inverted images. Linear filtering and edge detection are strictly insensitive to contrast reversal. Morphological filters are always defined in dual pairs (both polarities). Binarization and blob analysis are also contrast independent. (Assuming of course that you make the right association of background/foreground and black/white.) There is a complete symmetry.

The reason why some text is shown white on black is often purely practical: you can see the limits of the region of interest ! (Other reason can be that the library on hand is just lacking the option of a white background.)


处理时黑白图像比彩色图像更方便。

链接地址: http://www.djcxy.com/p/79648.html

上一篇: 图像检测中的文本

下一篇: 为什么在预处理中使用负像?