フィルターのクリア

Covert to PNG or help me in reading a .gif image

14 ビュー (過去 30 日間)
Sanjib
Sanjib 2022 年 3 月 6 日
コメント済み: Sanjib 2022 年 3 月 6 日
I am working with Harvard Medical School MRI images , and these images are gray and in .gif format. When I use imread() and then imshow() functions, the images are not appearing as it is seen in the website or in desktop.
I asked the question they asked me to change the format to png. How can I change format to png in matlab as a gray image without losing information . I tried imread() and imwrite( gif), it can not solve the problem. I attached some images herewith.

採用された回答

Image Analyst
Image Analyst 2022 年 3 月 6 日
Use ind2rgb.
fileName = '1.gif';
[img, colorMap] = imread('1.gif');
rgbImage = ind2rgb(img, colorMap);
grayImage = rgb2gray(rgbImage);
imshow(grayImage, []);
% Save as png
fileName = strrep(fileName, '.gif', '.png');
imwrite(grayImage, fileName);
% Recall to test that it saved it correctly
figure
img = imread(fileName);
imshow(img, []);
  1 件のコメント
Sanjib
Sanjib 2022 年 3 月 6 日
Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRed についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by