How to make an image (12 bit depth) from a double matrix?

Questo/a domanda è stato/a segnalato/a da DGM
  • Segnalato come Duplicato da DGM il 21 Ago 2021.

    https://www.mathworks.com/matlabcentral/answers/771138-matrix-to-12-bit-image-without-pixel-information-loss?s_tid=answers_rc1-1_p1_Topic

I am running a pipeline which initially imports tif images (12-bit; 0 to 4095 pixel intensity value), converts values to doubles (it still stores original pixel values i.e. 0-4095) and finally do some processing. Afterwards I need to save them again as tif files for further processing on ImageJ, but it seems transferrring matrix data into image changes the original pixel values. I used imshow to generate an image and save it using Save As in the dropdown menu on matlab figure.
Is there a way to generate/store images from matrix without changing the original pixel values of a 12 bit image?

1 Commento

img_new = img - min(img(:)); %where img = name of your image
img_new = double(img_new)/max(img_new(:))*4095;

Risposte (0)

Questa domanda è chiusa.

Richiesto:

il 12 Mar 2021

Chiuso:

Rik
il 21 Ago 2021

Community Treasure Hunt

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

Start Hunting!

Translated by