• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing a pixel mapping program

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to write a pixel mapping program which performs like this (the image below is just so you know what the grid should look like):


(image from ladyada's SpokePOV project: www.ladyada.net/make/spokepov)

1. The home screen is a blank grid of segments. The segments are made by dividing a circle into sections
2. The user loads a monochrome (black and white) image, and the grid is overlaid onto the image
3. The program generates a boolean data array which says which grid segments contain part of the image

There are a number of aspects which I don't know how to address:
-How to draw a segmented circular grid with a 32-segment radius and 256 angular segments (in total there are 32 x 256 = 8192 segments)
-How to make an individual segment detect whether it contains part of the image or not
-How to efficiently generate a data table from the segments. For example, is individually checking the boolean values of the ~8200 pixels a good approach?

Thanks for any suggestions.
 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I can start simpler.

Lets say I want a square grid. The image below demonstrates what I mean.


The black shapes are a user-loaded image. The the grid is overlaid onto the image. Each segment of the grid should return a boolean value:
true, if it contains part of the image
false, if it is blank.

Thanks for any suggestions.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a BufferedImage you can query its data using getRGB:
Here x and Y are the coordinates of the grid part to check, and block is the size of each grid. You'll have to check out what values of getRGB indicate data and which do not.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic