Groups | Blog | Home
all groups > dotnet drawing api > april 2004 >

dotnet drawing api : Handling 16bit grayscale images


charon NO[at]SPAM schiefermueller.com
4/5/2004 12:41:38 PM
Hi!!

i just asked this question, under another circumstances:
I get 16bit greyscale from an scanner, and i want to generate
thumbnails out of it. i thought it would be quite easy to use an
picturebox under c#, but i have problems to open the files, couse i
get "an generic error occured in gdi+"

i dont have any clue what to do?!?

is there any other way, i cant see??

please help!

charon NO[at]SPAM schiefermueller.com
4/6/2004 12:47:51 AM
thanks bob,

i get those images from an CCD-cam stripe per stripe. these are
greyscale images. i handle these images with marox-active-mil 7.5 in
c# (this is painful, too...). but i need to generate thumbnails out of
it, so i can use them in an thumbnail-image navigator.

is there any other possibility to face my needs? is there any way to
generate thumbnails? how can i read just the imageinformation out of
the picture - or - is it possible to convert it in an other format -
like 24bpp or something else?

bob, please help me!!

thanks so far!
andi


[quoted text, click to view]
Bob Powell [MVP]
4/6/2004 1:39:26 AM
How do you get the image?

If it's in a stream or byte array we may be able to read it byte for byte
and decode it while creating a GDI+ style bitmap


--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

andi s.
4/6/2004 10:22:09 AM


hey bob,
thanks so far!! you're a great help!

i got a step further: now i have got the imageinformation in an array
[number of bands, size_x, size_y]- straight from the active-mil. how can
i put these information together to get an bitmap in c#?

perhaps with an memorystream?

do you have any toughts/ideas?

best regards,
andi

*** Sent via Developersdex http://www.developersdex.com ***
Bob Powell [MVP]
4/6/2004 3:18:10 PM
If you're getting the information stripe by stripe you can use a bitmap with
locked bits to accumulate the image.

You can use a 24 bit per pixel image and just scale and duplicate the gray
values that you're getting to suit an 8 bit value (rotate right by 1 bit).
All you need to know is the positions of the positions of the pixels in the
stripe.

Can you post the bit of code that you use to get the data from the camera
and I'll see if I can apply that to a quick demo for you.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Bob Powell [MVP]
4/6/2004 8:49:02 PM
This would be much easier if you simply post the code you have to extract
images from the CCD camera.

I'm expecting to see the dimensions of the frame which you say you already
have and a byte array or memory stream containing the actual scan lines from
the camera. What needs to happen is you create a Bitmap off the correct
size and then use the LockBits method to gain access to the pixels in the
bitmap. You can then stepped through the byte array or memory stream
sequentially filling the bitmap bits as you go. For information on the
LockBits method you can search the GDI+ FAQ. There is an article on there
which tells you how to understand the BitmapData class.


--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

AddThis Social Bookmark Button