简体   繁体   中英

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.

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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