473,411 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

image generation in C++

Dear all,

I would like to generate images like the ones in the right column at
this link
http://www.micthemodel.org/pages/examples.html (Sorry but I can not
post
attachment).

These images are in fact 2D slices of a 3D image of a cube containing
a set
of layered spheres. A layered sphere is a set of concentric spheres of
different
colors (called grains). So, in my program, I have the coordinates of
the center of the grains, its radii and the colors of each layers.

As the easiest way, I have used the Povray (www.povray.org/) program
by writing my grains data to text file of format required by Povray.
With this way, I can generate image of up to about 3000 grains. More
than that, the tracing progress of Povray is so slow.

I have therefore been looking for other more effective approaches. The
first one is to use a free C++ image library that can write images
containing spheres. The second way is to write my data to pixels.

My question is how to realize these two ways in real C++ code. Please
help me.

Many thanks in advance.

Phu
Jun 27 '08 #1
2 2730
nv******@gmail.com wrote:
I would like to generate images like the ones in the right column at
[..]
My question is how to realize these two ways in real C++ code. Please
help me.
Using any third-party library in C++ is basically the same. If you can
use one library, you can use them all. There is nothing in the
*language* itself specific to images. Please post to 'comp.graphics'
hierarchy for more help on image processing.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
In article <d1ad669a-040f-4182-94fb-191ea939cd89
@a1g2000hsb.googlegroups.com>, nv******@gmail.com says...

[ ... ]
These images are in fact 2D slices of a 3D image of a cube containing
a set of layered spheres. A layered sphere is a set of concentric
spheres of different colors (called grains). So, in my program, I
have the coordinates of the center of the grains, its radii and the
colors of each layers.

As the easiest way, I have used the Povray (www.povray.org/) program
by writing my grains data to text file of format required by Povray.
With this way, I can generate image of up to about 3000 grains. More
than that, the tracing progress of Povray is so slow.

I have therefore been looking for other more effective approaches. The
first one is to use a free C++ image library that can write images
containing spheres. The second way is to write my data to pixels.

My question is how to realize these two ways in real C++ code. Please
help me.
A great deal depends on what you really want. If you want to produce a
display (especially an interactive display), the answer is quite a bit
different than if you want to produce a bitmap file of some sort.

If you want produce an (interactive) display, you probably want to use
something like OpenGL. This will allow you to send your data to the
display as a set of items with 3D coordinates. You can then pick an
angle of view and coordinates of the slice you want to view, and it'll
produce a display of that part of the data visible from that point.

If you want to produce an output file, you can create a 3D volume as
(for example) a three dimensional array (or some sort of matrix) of
numbers signifying the color at any given spot in the volume. Be aware
that this step can take a great deal of memory. Picking a slice from
that consists of reading the colors from the matrix where it intersects
a plane of your choosing. You'll typically pick that plane in terms of
polar coordinates (i.e. its angles with respect to some origin) and then
convert to individual pixel coordinates using sine and cosine. If you're
concerned with speed, you can also do a version of something like
Bresenham's algorithm, but for a plane instead of a line.

Of course, from that point you'll need to convert the individual pixel
values into a readable file format, but that's mostly a matter of
finding documentation on your format of choice, and writing the
appropriate "stuff" into the header and such, then writing out the
values of the individual pixels. Of course some formats (e.g. JPEG) do
lossy compression on the pixels, but they're probably not very suitable
for your purposes -- from the looks of things, something like RLE or LZ*
compression should work quite well.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mr_burns | last post by:
Hi there, How would I check if image generation is supported on my server? I used phpinfo() but didnt know what to look for. Also, I just want to resize image when they are uploaded using PHP....
6
by: bissatch | last post by:
Hi, I am using the following code to generate images online: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta...
3
by: Geoff Soper | last post by:
I'm trying to get some text to lie to the right of an image. If the text is deeper than the image I want the text to continue with its left margin following the line projected down from the right...
53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
0
by: Vadivel Kumar | last post by:
I'm writing a data input page, which will be used by the users to input their information. I recently heard that lot of automated programs which use this page to send junk information into the...
7
by: Victor Irzak | last post by:
Hi, Is there an Image Generation Service in framework 2.0??? I couldn't find anything related to it. Thanks in advance, Victor
2
by: guoqi zheng | last post by:
dear sir, I am using itextShap for pdf generation. I know I can insert image into it, I can add header to it as well. However, I can not add an image as a header. Does any one has experience...
3
by: computer_guy | last post by:
Hi Everyone, I run into a problem. I am trying to write an aspx that can dynamically generate an image based on some input parameters. Things are very simple if the size of the parameters is...
7
by: dino d. | last post by:
Hi- I want to create a dynamic image with areas so that when the user clicks different areas, the user jumps to those pages. The problem is, I can't seem to figure out how to do this efficiently....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.