How to convert gray scale mat file to Jpg

10 次查看(过去 30 天)
I want to convert a gray scale mat file let’s say the name is new.mat to jpg file and i don't know how to do it

采纳的回答

Image Analyst
Image Analyst 2018-8-28
Try this:
% Load the image variable from the MAT file into a structure s.
s = load(yourFileName);
% Extract the image from the structure
rgbImage = s.ImageName; % Or whatever the image variable is named.
% Write to disk in a jpg format, which you should never use for image analysis.
imwrite(rgbImage, 'my image.jpg');
  2 个评论
Jiho Ryoo
Jiho Ryoo 2020-12-10
Why should I never use the image for image analysis?
Rik
Rik 2020-12-10
Because jpeg is a lossy file format (technically it is possible to have lossless settings for jpeg, but nobody uses it). That means you will lose data when storing as jpeg, meaning your analyses will be less reliable.

请先登录,再进行评论。

更多回答(0 个)

类别

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