필터 지우기
필터 지우기

converting 16 bit image to 12 bit

조회 수: 40 (최근 30일)
Varsha Nataraj
Varsha Nataraj 2020년 10월 28일
댓글: Walter Roberson 2020년 10월 29일
i have read a .pgm image in imread. it is in 16 bit
can i know how to recover to 12 bit .
  댓글 수: 2
Steve Eddins
Steve Eddins 2020년 10월 28일
There is no 12-bit integer type in MATLAB, so it's not obvious to me what you mean by "recover to 12 bit." Can you clarify?
Varsha Nataraj
Varsha Nataraj 2020년 10월 29일
But pgm will be 12 bit but matlab stores it in 16 bit. How to get 12 bit value of pgm from 16 bit which is stored

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2020년 10월 28일
Different programs deal with storing lower number of bits (such as 12) in higher number of bits (such as 16) in different ways.
Sometimes they just store the data as the "bottom" bits, padding with 0 for the top bits. In such a case, the "12 bit" version of the data has the same numeric value as the 16 bit version does, except in the case where the "12 bit" data is intended to be signed numbers.
Sometimes instead the data is stored as the "top" bits, padding with 0 for the bottom bits. This has the advantage of preserving relative intensity -- full intensity of 12 bit translates to (nearly) full intensity of 16 bit. In this situation, to convert the 16 bit values down to 12, just divide the 16 bit values by 2^(16-12) = 2^4 = 16.
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 10월 29일
has the authorative answer as to how MATLAB reads 12 bit PGM, and has functions to scale the value.
... They come down to dividing by 16, just like I suggested.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by