Image Processing is one of the emerging areas in the field of Information Technology and people yet exploring the limits of it. It is heavily used in major areas of IT such as Computer Vision, Artificial Intelligence, Computer Security etc. Recently I got an opportunity to work with Image Processing Technologies as a part of one of my projects and my task was to find matching images from an image store when a new image is given. I started my project with googling "How to compare images using java" and I got some good articles on finding the similarity of two images. Allmost all of them were based on four basic steps, they are:
- Locating the Region of Interest (Where the Objects appear in the given image),
- Re-sizing the ROIs in to a common size,
- Substracting ROIs,
- and Calculating the Black and White Ratio of the resultant image after subtraction.
- Pre-process the image, if needed (e.g. to enhance contrast, filter noise, etc.).
- Do an Image Segmentation, process in which the image is converted to regions which contains pixels that are similar to pixels in the same region and different from pixels to other regions. This can be done using region-growing, mathematical morphology, clustering or classification algorithms. There are many algorithms to do that, just google for "image segmentation" and other keywords to get more information.
- With the regions, create descriptors for them. Descriptors are calculated from the region and can include shape, area, perimeter, number of holes, general color of the region, texture, orientation, position, etc.
- If needed, do a Re-Segmentation of the image, process in which regions are merged if they can be considered as belonging to the same object. Note that this step may require some high-level knowledge of the objects and the task in general, seldom being fully automatic and often being task-dependent.
- If needed, filter the regions that seem relevant to the task in hand, eliminating small regions or regions which are deemed unrelated to the task (again this may require some knowledge about the task).
- Store the image's regions' descriptor for further processing. Repeat those steps for other images.
- Use the descriptors for comparison of the contents of the images, using some of many algorithms for pattern matching, classification, clustering, artificial intelligence and data mining in general.