Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Converting Images to Shapes

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Converting Images to Shapes

    Hello,

    If I had a monochrome bitmap of the u.k. (including islands etc.) is there a way I can import it into Java and convert it to an object that implements 'shape' or something similar?

    So for example, I could tell if the cursor was over any part of the land but not the water. Currently I can only find ways to work with regular shapes.

    Thanks for the help - it is appreciated.

    Ian


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,354
    Thanks
    182
    Thanked 832 Times in 775 Posts
    Blog Entries
    5

    Default Re: Converting Images to Shapes

    I'm not sure there is a way to do this through the java API, so you may need to manually do it. The first possibility that pops into my head is to create several 'masks' of the image (binary type images) from which you can analyze and create a shape from (making the masks could be relatively easy if you have something like photoshop). To create the shapes you can use a variety of algorithms such as marching squares (for speed you may wish to do this once to save the shapes using Serializable from which you can load during runtime).

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Converting Images to Shapes

    Thanks for your help!

Similar Threads

  1. Loading in images
    By eXcellion in forum Java Theory & Questions
    Replies: 3
    Last Post: January 17th, 2010, 12:13 PM
  2. Embedding images in a matrix.
    By Aims_ in forum Java Theory & Questions
    Replies: 1
    Last Post: September 11th, 2009, 03:37 PM
  3. Images not going in email
    By anjali09s in forum Java SE APIs
    Replies: 3
    Last Post: August 2nd, 2009, 07:06 PM
  4. [SOLVED] Need to display multiple images from database on a webpage
    By raghuprasad in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: May 13th, 2009, 04:15 AM
  5. What are the best way of placing images in GUI?
    By Ciwan in forum AWT / Java Swing
    Replies: 5
    Last Post: February 26th, 2009, 05:19 PM

Tags for this Thread