필터 지우기
필터 지우기

How to read Harvard Medical MRI images which are in .gif format?

조회 수: 2 (최근 30일)
Sanjib
Sanjib 2022년 3월 6일
댓글: Image Analyst 2022년 4월 19일
I can not read Harvard Mediacl School MRI images which are in .gif format.Whenever I tried to read by using imread() and show it using imshow() funcions, the images are not appearing as it is seen in the webside or in desktop.Two images are included here with the attachment.

채택된 답변

yanqi liu
yanqi liu 2022년 3월 7일
yes,sir,may be check the map,use
k = 1;
[im,map] = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/916049/1.gif');
if ~isempty(map)
im = ind2gray(im,map);
end
imwrite(im, sprintf('%d.jpg', k));
figure; imshow(im, []);
if use loop to prcess 310 images, may be use
% total 310 images.
for k = 1 : 310
[im,map] = imread('your image file path');
if ~isempty(map)
im = ind2gray(im,map);
end
imwrite(im, sprintf('%d.jpg', k));
end
  댓글 수: 2
DGM
DGM 2022년 3월 8일
In your prior comment, you asked about avoiding quality loss. If that's still your concern, do not use JPG to save the image.

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

추가 답변 (1개)

Simon Chan
Simon Chan 2022년 3월 6일
Save it as png file and open it
data = imread('1.png');
imshow(data)
  댓글 수: 3
Sanjib
Sanjib 2022년 3월 6일
I have total 310 images.
Image Analyst
Image Analyst 2022년 4월 19일
See the FAQ
Inside the loop call imread() to read it into a variable, then change the file extension to PNG and call imwrite().

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

카테고리

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