Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2016
    Posts
    1
    Rep Power
    0

    Question 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. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

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

    What?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default 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 01:32 AM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

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

    Quote Originally Posted by jim829 View Post
    ...

    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?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default 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
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  6. #6
    global93 is offline Member
    Join Date
    Dec 2016
    Posts
    1
    Rep Power
    0

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

    up top

  7. #7
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

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

    Quote Originally Posted by global93 View Post
    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.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 0
    Last Post: 11-14-2012, 12:15 PM
  2. Replies: 0
    Last Post: 12-16-2010, 06:14 PM
  3. Replies: 4
    Last Post: 12-16-2010, 05:32 PM
  4. Need help with mirror images for dr.java
    By outlawstar7788 in forum New To Java
    Replies: 1
    Last Post: 04-07-2010, 11:44 PM
  5. Check java version with previous versions
    By Basit56 in forum New To Java
    Replies: 4
    Last Post: 09-15-2009, 09:12 PM

Tags for this Thread

Posting Permissions

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