How to compare two images in C #?

I want to try to develop a trail application in which the first image containing some text (suppose it can be "hello World") and this is the image I want to compare with another image (and suppose it is "hello") The above image comparison, I want the output to not contain the text "World".

How do i do this?

+4
source share
4 answers

It is not as easy as you think. If the second image is an exact copy of the first, but cropped, you can create two bitaries and see if they overlap. If this is not the case, I suggest you look at this article about OCR. In any case, it is very difficult to do with the code, and if there is any other way, I suggest you accept it.

+8
source

The above suggestions are good if your images always contain text (must be OCRed). A more general application would be to use a library such as OpenCV - it gives you several ways to extract objects (edges, shapes, colors, etc.) from images and compare them.

An even simpler method is to use the OpenCV pattern matching method, which β€œcompares” one image (template) with another.

Since you are in C #, you should look at the Emgu.NET shell for OpenCV .

+4
source

It looks like you would like to use optical character recognition . Use the OCR package to create text, then run text diff.

+1
source

Source: https://habr.com/ru/post/1316023/


All Articles