Comparing hundreds of JPEG images taken from multiple angles - python

I am comparing X-ray images to find a specific difference between these images. All images are in jpeg format. Sometimes there are six, or eight different camera angles from which these images are taken. From each angle there are ~ 100 images. I am trying to compare a couple of hundred images to identify a specific difference between these images.
I am using Python and I am relatively new to it. Can Sci-kit image segmentation be used for the following problems?
Compensate for the image exposure variations in all images
Compensate for image size variations in all images

I don't know Sci-kit, but I'm sure OpenCV can do the job!
https://en.wikipedia.org/wiki/OpenCV
http://docs.opencv.org/2.4/modules/stitching/doc/exposure_compensation.html
http://docs.opencv.org/2.4/modules/objdetect/doc/cascade_classification.html

Related

Find similar image if resolution was changed [duplicate]

This question already has answers here:
Compare Images in Python
(4 answers)
Closed 1 year ago.
Im using python to check in hundred of websites if a web banner in GIF format exist.
I have a folder with gif files as examples and Im compairing the gif files from each web sites with my own examples files.
I use filecmp but I found that many webs compress the gif files so even the files are visually identical the filecmp wont detect as same.
Is there any python library to detect if two gif files or vídeos are similar even if the resolución has changed?
Comparing two images for similarity is a general image processing problem so the solution you develop can be as simple or complex as you want it to be. In your specific case, you'll need a method for making two images the same size and a method for comparing the images.
First, you'll probably want to convert the images to RGB or grayscale arrays for comparison.
I would suggest reducing the size of the larger image to the size of the smaller image. That is less likely to introduce artifacts than increasing the size of the smaller image. Resizing can be accomplished with the Python Pillow library.
Image.resize(size, resample=None, box=None, reducing_gap=None)
https://pillow.readthedocs.io/en/stable/reference/Image.html
The resampling method may have some small effect on the similarity measure. However, you'll probably be fine just using resample = NEAREST.
After making sure the images are the same size, they must be compared. One could compare them using mean squared error (MSE) or structural similarity (SSIM). Luckily, SSIM is already implemented in scikit-image.
from skimage.metrics import structural_similarity as ssim
s = ssim(imageA, imageB)
https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/?_ga=2.129476107.608689084.1632687977-376301729.1627364626
In your case, MSE might work just as well. However, if the average brightness of the image had been changed by some kind of process, you'd want to first subtract that from each image.
If resizing is the only issue, that should be it. If, however, the images may have been flipped, rotated, or cropped, additional steps might be necessary.

Applying identical Canny to two different images

I have two images - the images are identical but of different sizes.
Currently I complete a Canny analysis of the smaller image using track bars in an interactive environment.
I want to have this output created on the second (larger) image - when I apply the same parameters the output is different
I've tried to use cv.resize however the output is blurred significantly
Any help is appreciated
Thanks in advance
To archieve comparable results you should resize the bigger image to the size of the smaller one. Image upscaling is "creating" information which isn't contained in your image, that's why you see the blur. Using interpolation=cv2.INTER_AREA should deliver good results, if you used a camera for images acquisition.

Find Coordinates of cropped image (JPG) from it's original

I have a database of original images and for each original images there are various cropped versions.
This is an example of how the image look like:
Original
Horizontal Crop
Square Crop
This is a very simple example, but most images are like this, some might taken a smaller section of the original image than others.
I was looking at OpenCV in python but I'm very new to this kind of image processing.
The idea is to be able to save the cropping information separate from the image to save space and then generate all the cropping and different aspect ratio on the fly with a cache system instead.
The method you are looking for is called "template matching". You find examples here
https://docs.opencv.org/trunk/d4/dc6/tutorial_py_template_matching.html
For your problem, given the large images, it might be a good idea to constrain the search space by resizing both images by the same factor. So that searching a position that isn't as precise, but allows then to constrain the actual full pixel sized search to a smaller region around that point.

Images registration for low resolution highway images

I am using opencv with Python and I have a collection of images of highways. They have fixed resolution 352*288. They have been taken by mounted cameras, these cameras rotated horizontally and diagonally. I want to align this highways into piles,
I have tried feature passed images registration using SIFT, SURF and ORB. They are providing good results but when the image have rotation diagonally and when there is a small zooming the aligning will be damaged.
I have tried intensity based image registration using findTransformEcc and it is a little bit acceptable, but when I tried intensity based image registration using Matlab the results are much better.
example of images:
first image
second image

Tiling of large numer of images using database

I have coordinates in a numpy array of all the images which needs to be joined. I have used OpenCV to find the coordinates using normalized cross-correlation. I am having a problem in tiling those images as it is very large 300X300 images of resolution 640X480 pixels. For now, I am using pyvips to merge all this image to form a high-resolution image, but it is talking around 20GB RAM.
Is there any method to bring it down to <4GB? Is there any database to store all the images and display the tiled images?
I will do all the preprocessing steps before using a database. I just need a high-resolution tiled image using images and coordinates without utilizing much RAM. Even I can make those images in a grid which can be joined directly without coordinates. Please suggest a way to achieve this.

Categories

Resources