I cannot read and display this image

조회 수: 7 (최근 30일)
abdullah
abdullah 2023년 8월 29일
편집: DGM 2024년 7월 5일
By using simple imread and then disp command
for example: im=imread("daemon.jpeg");
disp(im);
this pic dont open but other jpeg pictures open perfectly
please make and give me a code that will open and read these types of jpeg so i can use that code on my project
Download and try this image please
My Course teacher Gave us project with this Pic

채택된 답변

DGM
DGM 2023년 8월 30일
편집: DGM 2024년 7월 5일
That's a WEBP file, not a JPG. There are no native utilities in MATLAB that I know of that will read a WEBP. You will need to use external tools to convert the file if you want to view it in MATLAB.
On Linux, I can install the webp package and then use cwebp and dwebp to encode and decode WEBP files.
webpname = 'image.webp';
tempfilename = 'temp.png';
system(sprintf('dwebp %s -o %s',webpname,tempfilename));
inpict = imread(tempfilename);
imshow(inpict)
Maybe there are other options, but they'll all be external and may depend on your OS.
EDIT:
That workaround is still about the only thing there is. I just added a simple pair of tools to MIMT to do the job using cwebp and dwebp.
% at least it's more convenient than using system()
inpict = wpread('image.webp');
Images with transparency (IA/RGBA) will be returned with attached alpha.
MIMT wpwrite() accepts I/IA/RGB/RGBA images, and defaults to lossless encoding options (-lossless and -exact in cwebp versions which support it). Something tells me though that 99% of users' interest in WEBP is trying to figure out how to make it go away, not how to create more.

추가 답변 (1개)

Image Analyst
Image Analyst 2023년 8월 29일
Use imshow() instead of disp():
imshow(im);
  댓글 수: 2
abdullah
abdullah 2023년 8월 30일
Error using imread>get_format_info
Unable to determine the file format.
YASSINE
YASSINE 2023년 8월 30일
There is no broblem with jpeg images, you can apply the same code for the attached image "sample.jpeg" without any problems.

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

카테고리

Help CenterFile Exchange에서 Prepare Model Inputs and Outputs에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by