Is there a way to match images and determine which two match? The images are not exactly the same but are similar!

Dani AI

Generated

Yes — you can match images by content, but approach depends on how "similar" the images are. Simple exact/near-duplicate cases are handled with perceptual hashes or color histograms; images that differ by scale, rotation, partial occlusion or viewpoint changes need local feature matching (keypoints + descriptors) plus geometric verification; semantic similarity (same object class but different scenes) usually requires learned embeddings from a CNN or a Siamese network.

: a practical progression is to start small and increase complexity. Try a perceptual hash (fast, good for edited/copied images). If that fails, move to feature-based matching (ORB/SIFT/BRIEF descriptors) and use nearest-neighbor matching with the Lowe ratio test and RANSAC to filter false matches. ’s size/ratio idea is useful as a cheap pre-filter before doing heavier matching. was right about third-party libraries — the JDK has no built-ins for this.

For Java tooling consider BoofCV (pure Java feature detection/matching), OpenCV via Java bindings or JavaCV (widely used C++ implementations exposed to Java), and OpenIMAJ. For perceptual hashing and background on the technique see perceptual hashing. For implementation details and examples, consult the BoofCV and OpenCV documentation: BoofCV and OpenCV docs.

Troubleshooting tips: normalize sizes and lighting first; tune matching thresholds on a labeled sample set; use geometric checks to remove spurious matches; for large galleries use hashing or approximate nearest-neighbor indexing to scale.

Recommended Answers

All 4 Replies

I think there is a way.

Match in size (the same width and height) or Match in the ratio of width over height, or by other criteria?

I want to match the content in the images. to see if they r similar. can that be done? if so how?

Maybe. That is a difficult app. There are probably third party packages that do that. It is not part of the JDK. You'll have to write your own code or find someone else that will give you their code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.