# Thread: I want to check if generated images are a mirror or rotation of previous images

1. Member
Join Date
Dec 2016
Posts
1
Rep Power
0

## I want to check if generated images are a mirror or rotation of previous images

At regular intervals on a canvas I'll generate a random number that determines if it leaves that space blank or draws a line down, to the right or both.

After I finish doing this I want to be able to export it as an xml file and in other to reduce the size of that file I want to first check if I have any duplicates, mirrors or rotations of existing images in the file.

What would be a good way to do this?

I was thinking about setting up hashCode() in a way that it would return the same value if the image is a mirror or rotation, but I can't figure out how.

2. ## Re: I want to check if generated images are a mirror or rotation of previous images

What?

3. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
14

## Re: I want to check if generated images are a mirror or rotation of previous images

For a basic image I would simply take a some small number N samples from some (x,y) pixel coordinates of the image. Then you can adjust those coordinates to reflect the different configurations and compute a SHA-2 hash on a series of pixel values and add them together to get the final hash. I don't think it should matter which image configuration you start with since addition is commutative. But I haven't really thought too much about this. There may be some better mathemagic that does this for you.

Note that for any given image, the algorithm must always determine the exact same set of (x,y) pairs. And depending on the image, this could result
in duplicate hashcodes since the pixels could all be the same. If the image isn't very "busy" with different colors, it may not work at all.

Regards,
Jim
Last edited by jim829; 12-11-2016 at 12:32 AM.

4. ## Re: I want to check if generated images are a mirror or rotation of previous images

Originally Posted by jim829
...

Regards,
Jim
Wait what? How did you make sense of the question? Do you have a job doing image processing in Java and this is exactly the thing you face every day?

5. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
14

## Re: I want to check if generated images are a mirror or rotation of previous images

No, I figured the OP wanted to be able to compute a checksum that would be the same regardless of its rotation or orientation. I have no experience in image processing. I was just thinking of the image as data.

Regards,
Jim

6. Member
Join Date
Dec 2016
Posts
1
Rep Power
0

up top

7. ## Re: I want to check if generated images are a mirror or rotation of previous images

Originally Posted by global93
up top
What? What posesses someone to go through all the trouble to register an account, and have this as first post. I am getting too old for this shit.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•