필터 지우기
필터 지우기

imwrite with window/level setting

조회 수: 1 (최근 30일)
Alan Li
Alan Li 2021년 1월 11일
편집: Srija Kethiri 2022년 8월 24일
Is there anyway to imwrite an image with a specific window/level setting?
'
I've tried to imwrite(getframe(gcf).cdata, 'myfilename.png') but it doesn't preserve the window/level setting I had with caxis

답변 (1개)

Srija Kethiri
Srija Kethiri 2022년 8월 24일
편집: Srija Kethiri 2022년 8월 24일
Hi Alan,
To get the color limits same as caxis, create a map of matrix with 3 columns and desired number of rows by using randi() function.
If the input data is double then normalize the map matrix. This map matrix can be given to the imwrite function to get the image in the required color limits
map = randi([min(caxis),max(caxis)],<desired no. of rows>, 3);
map = map - min(map(:));
map = map/max(map(:));
imwrite(getframe(gcf).cdata, map,'myfilename.png');
You can refer the following documentations for better understanding of
Hope this helps!

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by