且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在matlab中连接像素

更新时间:2023-02-26 15:10:56

I would crop out and fill in a template for each of the available letters. Presumably, that would be the letters [A-Z] and the digits [0-9] like this.

0.png

3.png

Now I would do a sub-image search for each of them in your original image. I am doing this at the command-line with ImageMagick but you could use Matlab, OpenCV, or CImg or the Python, Perl, PHP, C, C++ bindings of ImageMagick.

So, I look for the 3 first:

compare -metric rmse -dissimilarity-threshold 1 -subimage-search plate.png 3.png result.png
25607.9 (0.390752) @ 498,46

So, the 3 is found at coordinates 498,46. There will be 2 output files, output-0.png which looks like this:

and output-1.png in which you can see the brightest areas showing where the match is best:

Likewise with the 0:

compare -metric rmse -dissimilarity-threshold 1 -subimage-search plate.png 0.png result.png
31452.6 (0.479936) @ 664,44