Cross-Correlation in JAI - What Am I Doing Wrong?
I am trying to get cross-correlation between two images (source and template) to work in Java. As far as I understand, all I need to do is
1) dft both source and template;
2) conjugate the template;
3) multiply the dft of the source with the conjugate from (2);
I am trying to do this, but the result is certainly wrong.
You can see my code at
- source.jpg is the "big" image.
- head.jpg is the template.
- target.png is the (strange) result.
- GraphicsUtilities.java contains some wrappers for JAI calls.
- Matcher.java is the main program file.
To run: java Matcher source.jpg head.jpg target.png
(This will overwrite target.png.)
I would be very much obliged to you for any help.