Ask Your Question
0

How can I change the 8bit rgb images into 12bit rgb image

asked 2020-01-06 05:51:23 -0600

I have mapped and sampled each channel to 12 bit.

Example: 8 bit image- R[0-255], G[0-255], B[0-255] mapped to 12 bit image - R[0-4095], G[0-4095], B[0-4095]

----> formula used: (8 bit image intensity * 4095) / 255

12 bit image = (8 bit image intensity * 4095) / 255

is this the right way to convert into 12 bit? if no please suggest the possible way to do it

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-01-06 07:39:22 -0600

mvuori gravatar image

Sounds correct.

edit flag offensive delete link more

Comments

Thanks for the reply. We have tried above-mentioned formula on 8-bit image but we are getting a black image as output. but we use OpenCV method ( convertTo) by setting alpha as 255 then getting readable image

swapnilbalpande gravatar imageswapnilbalpande ( 2020-01-06 08:06:07 -0600 )edit

don't forget, that you need a larger type to hold 12 bits, such as CV_16U, so:

img8.convertTo( img16, CV_16U, 4095.0/255 );

(just multiplying by 255 will make it 16bit range)

berak gravatar imageberak ( 2020-01-06 08:11:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-01-06 05:45:50 -0600

Seen: 2,622 times

Last updated: Jan 06 '20