?
Solved

Convert 16 bit image to 12 bit image

Posted on 2011-03-22
8
Medium Priority
?
944 Views
Last Modified: 2012-08-14
Hi Experts,

I new to C# and image processing. I have a 16 bit image stored in a byte array.
Anybody could help me to convert this to 12 bit image.
0
Comment
Question by:Veerabhadraiahhv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 35189710
Just throw away 4 bits!

Actually, not all "image"s are built alike - you'll want to know what the bits are used for.

Odds are your existing image uses either 5 bits for each color with a spare bit used either for intensity or transparency, or 4 bits for each color and 4 bits for intensity, and your target image wants 4 bit for color.  You have to know, though.
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 35193452
jensfiederer is right, you need to know what those bits are used for. How is your image encoded (or not...) ? BMP, JPG, PNG ... ?
0
 
LVL 4

Author Comment

by:Veerabhadraiahhv
ID: 35196810
I have a DICOM image, it may be signed image or unsigned image.
I need to convert these images to 12 bit DICOM image.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 35197692
Fortunately, the DICOM standard is publicly available:

ftp://medical.nema.org/medical/dicom/2009/
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 35202007
there seems to exist free/open source libraries to work with DICOM. Have you had the chance to look at those:
http://opendicom.sourceforge.net/
http://sourceforge.net/projects/dicom-cs/
0
 
LVL 4

Author Comment

by:Veerabhadraiahhv
ID: 35277525
I got the answer and thanks for your  comments.
I'm using the following code to convert 16 bit images to 12 bit image.

             if (pixelVal > 4095)
                {
                    pixelVal = 4095;
                }
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 2000 total points
ID: 35279161
So you are just throwing away the high order 4 bits.

The other approach would be to discard the low order bits

pixelVal = pixelVal >> 4;

One way discards subtle differences, the other could result in some images where all the bits are 4095.
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 35285278
jensfiederer's approach seems more appropriate. Try with a large sample of images (especially those above 4095) and see which turns out best.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question