开发者

Trying to convert a 2D image into 3D objects in Java

开发者 https://www.devze.com 2022-12-31 22:27 出处:网络
Hey, I\'m trying to take a simple image, something开发者_如何转开发 like a black background with colored blocks representing walls. I\'m trying to figure out how to go about starting on something like

Hey, I'm trying to take a simple image, something开发者_如何转开发 like a black background with colored blocks representing walls. I'm trying to figure out how to go about starting on something like this. Do I need to parse the image and look at each pixel or is there an easier way to do it? I'm using Java3D but it doesn't seem to have any sort of built in support for that...


This might be more compex than you think. A solution would basically include the following steps:

  • Edge detection using Java 2D ConvolveOp Filter
  • Vectorizing the edges into a 2D model.
  • Extrusion to 3D


Turns out what I really wanted was a height mapper. I mapped each pixel to a certain height based on its gray-scale RGB value. If I wanted color to be independent of height, I would have two images, one with the gray-scale height map and another with a colored image of what I want the, in this case, room to look like. As for recognizing colors from an image as a specific object other than by pixel, definitely requires something more complex. A friend was suggesting something like painter's algorithm for something like that. However, at least for me, that was being the scope of my application.

0

精彩评论

暂无评论...
验证码 换一张
取 消