简体   繁体   English

如何实现Java Image处理做模板匹配?

[英]how to implement Java Image processing to do template matching?

I've been doing a lot of searching and i could not find any solution. 我一直在进行大量搜索,但找不到任何解决方案。

I've an image ( assume it's 400*400) and i have a small piece of it (133*133) i want to locate where is the starting point (x,y) of the small image piece in the large image. 我有一个图像(假设它是400 * 400),我有一小幅图像(133 * 133),我想找到大图像中小图像片段的起点(x,y)。

in another word i want to be able to know where the small image is located inside the big image. 换句话说,我希望能够知道小图像在大图像内的位置。

any suggestions how to implement it using java without using external libraries? 任何建议如何使用Java而不使用外部库来实现它?

The simplest way is to iterate through all possible starting points and calculate the (sum of squared) differences between the template and the image. 最简单的方法是遍历所有可能的起点,并计算模板和图像之间的(平方和)差

This is horribly inefficient, though. 但是,这效率极低。 You should look into filtering in the frequency domain and implement your own Fast Fourier Transform (even with a home made FFT algorithm processing should be far faster than calculating differences at each point). 您应该研究频域中的滤波并实现自己的快速傅立叶变换 (即使使用自制的FFT算法,处理也要比计算每个点的差要快得多)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM