Python Forum

Full Version: how to compare two different size images in python and find corresponding pixel value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[I'm currently doing this project in which I have two similar images, however they are in slightly different angles. Think of it as shifting left, right, up, down, but not in the z-axis, only x and y-axis are changed. Is it possible to compare these images, and let's say I have a value in the first image (340,150), what methods can I use to find that pixel in the second image, and since the second image was shifted won't the pixel value shift as well? How do I solve this problem thanks! Huh Big Grin
I'm not quite sure the problem. Are the images different sizes?

Is your example of (340, 150) the width and height of the image or x and y of where it is displayed? "Pixel Value" isn't a term I'm familiar with, however...

Have you used pygame? It has the image.get_rect() feature that will measure and image for you. You can then compare the width and height of the two images that way. You can also use the center of the image to locate it on the screen so that the two images will be in the same location regardless of size.