# Extrusion

How can I extrude a single geometry from a specific color say black, yellow etc?

Kind of like Height mapping i guess

Can someone give me an example.

I'm trying to basically get the parameters from a image say length and width for rectangles and i would color it black and say red for sphere and get the radius, not sure how to get the param from drawings

I'm not entirely clear on what you're asking, but java.awt.image.BufferedImage has methods for getting the image width and height.

It sounds like you're also trying to discern shapes from 2d images as well?  You might also look into Processing, which offers a good deal of image manipulation functionality http://processing.org/reference/alpha.html

(you can use the processing library without their flimsy IDE ;))

sbook said:

It sounds like you're also trying to discern shapes from 2d images as well?  You might also look into Processing, which offers a good deal of image manipulation functionality http://processing.org/reference/alpha.html

well...yeah, my apologies if I was unclear, but basically I want tomake say extrusions from a white picture image with different shapes. I figured to make things easier I would use certain colors on the backgrounds to indicate which shape to use. From those shapes the parameters for the height and length or the diameter can be found and I can extrude them all from the white background

I just need to find the different heights and widths of the different shapes so that I can add them to a parameter and extrude them from the picture.

Definitely look at Processing then

http://processing.org/learning/3d/extrusion.html

http://processing.org/learning/topics/edgedetection.html

The edge detection topic is really more to your area of interest…  You should be able to loop through the pixels and find the contiguous areas of black without too much difficulty.

squares and rectangles shouldn't be hard to find, as they involve straight lines, meaning that 25 pixels of black will have 25 pixels of black below it… the shape ends when that's no longer true…  For a circle, you'd need to constantly reset your search requirements for what is still part of the shape. A problem could arise if you have a circle wth a radius of 50 pixels, and near the bottom, where a line is only, say, 5 pixels, that a whole 'nother shape could be located within that 50x50 square around the circle.