Home | Community | Message Board


Crestline Sales - MycoPath
Please support our sponsors.

General Interest >> Science and Technology

Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Jump to first unread post. Pages: 1
Offlinejong21
Mycologist/CSMajor

Registered: 05/28/03
Posts: 576
Loc: Berkeley, CA
Last seen: 12 years, 5 months
Have a beer! Now that I gave you beer, help me!
    #2128963 - 11/22/03 12:12 PM (13 years, 8 months ago)

Ok beers all around everyone drink up. I have an OTD question but alas it is gone so I'm coming here to ask it while still maintaining the "Pub" atmosphere. Ok another round...

OK now that you are a little drunk, help me with my omputer graphics project!

I'm using openGL, writing a 2D morphing algorithm, need to somehow take bmp files (uncompressed, 24 bit) and create a 2D array of RGB values in C++. Then, I'll be able to access this 24 bit value by pixel location (i.e. image[x][y], where "image" is the name of the array). To demo my algorithm I'm going to be using only 200x200 images, to make coding simple. I've got the bitmaps, sized to 200x200, just need to get them into openGL. How do I take the bmp and efficiently extract all these values into an array without going into photoshop and moving my mouse over each individual pixel and writing down the values and then typing in 40,000 values manually into an array definition.

Hopefully someone here has programming experience, but if not, thanks for reading and one more round of beer....

OK crap I'm gonna have to work on my project later I'm too drunk (and at only 9:15 AM).... OK you got me I'm bored at work.


--------------------
I either talk about my friends in the first or third person, but I never, ever talk about myself on this website. Except that last sentence.


Post Extras: Print Post  Remind Me! Notify Moderator
Anonymous

Re: Have a beer! Now that I gave you beer, help me! [Re: jong21]
    #2129042 - 11/22/03 01:34 PM (13 years, 8 months ago)

yeah i don't even know what any of that means.


Post Extras: Print Post  Remind Me! Notify Moderator
OfflineAnnomM
※※※※※※
 User Gallery

Folding@home Statistics
Registered: 12/22/02
Posts: 6,364
Loc: Europe
Last seen: 1 month, 3 days
Re: Have a beer! Now that I gave you beer, help me! [Re: ]
    #2129045 - 11/22/03 01:36 PM (13 years, 8 months ago)

I can't help you.

Thanks for the beer!  :thumbup: :smile:


Post Extras: Print Post  Remind Me! Notify Moderator
Offlineaje
Why not?
Male User Gallery

Folding@home Statistics
Registered: 10/11/03
Posts: 16,392
Loc: in some small dive
Last seen: 4 months, 18 days
Re: Have a beer! Now that I gave you beer, help me! [Re: Annom]
    #2129076 - 11/22/03 01:59 PM (13 years, 8 months ago)

that was all gibberish


--------------------



Post Extras: Print Post  Remind Me! Notify Moderator
InvisibleShroomismM
Space Travellin
Male User Gallery
Folding@home Statistics
Registered: 02/13/00
Posts: 65,048
Loc: 9th Dimension Flag
Re: Have a beer! Now that I gave you beer, help me! [Re: jong21]
    #2129081 - 11/22/03 02:02 PM (13 years, 8 months ago)

hehe... maybe science and technology people could help you better?


--------------------


Post Extras: Print Post  Remind Me! Notify Moderator
Anonymous

Re: Have a beer! Now that I gave you beer, help me! [Re: jong21]
    #2129087 - 11/22/03 02:06 PM (13 years, 8 months ago)

- Post History Deleted Upon User's Request -


Post Extras: Print Post  Remind Me! Notify Moderator
OfflineSeussA
Error: divide byzero

Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 6 months, 18 days
Re: Have a beer! Now that I gave you beer, help me! [Re: ]
    #2129246 - 11/22/03 04:27 PM (13 years, 8 months ago)

Do a search on the web for the BMP file format. Write a function to open the file, and read the contents into your array. (I am not familiar with BMP, so I cant help here much.) To store three values, RGB, into a single unsigned integer, just use shifts and ors.


unsigned int color;
color=red << 16 | green << 8 | blue;


Of couse, you will replace 'color' with your indexed array. I am also assuming that red, green, and blue are 8 bit values.


--------------------
Just another spore in the wind.


Post Extras: Print Post  Remind Me! Notify Moderator
Offlinejong21
Mycologist/CSMajor

Registered: 05/28/03
Posts: 576
Loc: Berkeley, CA
Last seen: 12 years, 5 months
Re: Have a beer! Now that I gave you beer, help me! [Re: Seuss]
    #2129290 - 11/22/03 05:10 PM (13 years, 8 months ago)

I tried opening the bmp file in notepad and it is all gibberish. Someone told me to try converting to ppm format but I'm not on my computer and don't have anything to convert, so I'll try that later.

If anyone knows anything about file formats etc it would be helpful, thanks.


--------------------
I either talk about my friends in the first or third person, but I never, ever talk about myself on this website. Except that last sentence.


Post Extras: Print Post  Remind Me! Notify Moderator
OfflineSeussA
Error: divide byzero

Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 6 months, 18 days
Re: Have a beer! Now that I gave you beer, help me! [Re: jong21]
    #2129304 - 11/22/03 05:17 PM (13 years, 8 months ago)

> I tried opening the bmp file in notepad and it is all gibberish

It is a binary file.  You will have to open it with a function you write in c/c++ and read it as binary data.

The ppm solution is what I typically use.  Convert the bmp to text pnm file.  The pnm (ppm) format is very easy.  First line has two numbers, number of x pixels and number of y pixels.  The rest of the file is full of text numbers, in groups of three, for red green and blue.  Imagemajick can be used to convert between graphics file formats.

There is probably source code on the net to read in a bmp file.  Do a google search and save yourself some time.  :smile:


--------------------
Just another spore in the wind.


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemuhurgle
Turtles all theway down

Registered: 10/29/03
Posts: 299
Re: Have a beer! Now that I gave you beer, help me! [Re: jong21]
    #2130649 - 11/23/03 05:11 PM (13 years, 8 months ago)

A quick Google search will give you this:

http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

which seems to be all you need to know to read (uncompressed) bmp.


--------------------
"To make this mundane world sublime
Take half a gram of phanerothyme."

Aldous Huxley


Post Extras: Print Post  Remind Me! Notify Moderator
Jump to top. Pages: 1

General Interest >> Science and Technology

Similar ThreadsPosterViewsRepliesLast post
* Pixel Shading v1.1 Fliquid 1,230 8 04/12/05 11:15 AM
by Fliquid
* that little plastic thing in beer can? the man 2,323 5 09/21/03 02:23 AM
by daussaulit
* for u plp that gave me hell Cubie 1,219 12 01/20/08 02:15 AM
by mentalIMAGE
* Laptop Screen Display funkymonk 880 10 09/08/04 11:23 PM
by debianlinux
* Evolution problem
( 1 2 3 all )
Buckeye Oysters 3,980 51 02/10/09 04:53 PM
by zouden
* How come when you wtach a DVD on your computer JunkFood 1,374 11 08/01/07 06:59 AM
by JunkFood
* Screen Resolutions bort 850 10 01/18/08 06:04 PM
by ThirdEyeOpening
* Nvidia releases 6800 and 6800 Ultra *pictures* daba 1,459 15 05/30/04 01:54 AM
by Redo

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: Lana, trendal, automan
927 topic views. 0 members, 3 guests and 1 web crawlers are browsing this forum.
[ Toggle Favorite | Print Topic | Stats ]
Search this thread:
The Spore Depot
Please support our sponsors.

Copyright 1997-2017 Mind Media. Some rights reserved.

Generated in 0.018 seconds spending 0.002 seconds on 19 queries.