Lecture 3 How to read, write and display multiple images
ฝัง
- เผยแพร่เมื่อ 5 ก.พ. 2025
- The video describes how to read, write and display multiple images using MATLAB. Please watch the whole video tutorial series to learn about Image processing using MATLAB. For further information, please visit the my blog below.
mytutsonimage....
Hi, thanks for the tutorial, very helpful. But I am getting an error message about not being able to open the file due to not having write permission. How do I fix this error?
If the Img file name is not sequenced integer, can it work?
Does it work in octave...?
Thank you sir...I want to apply some operations on images jointly. How can I do that? I have operations for single image, Want to apply on batch of images
Thanks, It's helpful.Could you share a tutorial about how some classification features work like KNN,NN ?if you have time
Great video, thanks ! I would like to know how I can change the extension of three images using you code.
Thanks for the simple and clear explanation Sir! Could you please let me know how to read 2 or more different format images from a folder.
I tried using extension *.* but got an error
srcFile=dir('F:\01 Harsimran\CoMoFoD_Less\*.*');
Error using imread (line 347)
Cannot open file "F:\01 Harsimran\CoMoFoD_Less\." for reading. You might not have read permission.
I used 2 different for loops(as in the code below) which worked fine. Is there any other option as its quite lenghty?
srcFile=dir('F:\01 Harsimran\CoMoFoD_Less\*.jpg');
for i=1 : length(srcFile)
filename=strcat('F:\01 Harsimran\CoMoFoD_Less\',srcFile(i).name);
I=imread(filename);
figure;
imshow(I);
end
srcFile=dir('F:\01 Harsimran\CoMoFoD_Less\*.png');
for i=1 : length(srcFile)
filename=strcat('F:\01 Harsimran\CoMoFoD_Less\',srcFile(i).name);
I=imread(filename);
figure;
imshow(I);
end
How to save all these image matrix array in workspace with different name. Because only last image of loop is saved there.
how can i display image one by one, after one another
Sir, I 've multiple images in two folders one jpg and other png. I've to multiply both images and save the output in another folder. I've loaded both folders and I've created a function to multiple images in both folders. I've created a for loop for multiplication. I want to get all images multiplied to be in a folder. What changes should I do to get the output?
Undefined function or variable 'srcfiles'. what to do with this ???
how i increase the images in " save folder"
mean if there is 3 images in " image Processing folder " and i crop these 3 images now after cropping the number of images is 6 , then only 3 images is save in " save folder " other 3 image is lost
how i save these 6 images
i want to compress one image and apply same technique on many images one by one, how can i do this?
Thank you sir for sharing this video.
Welcome, Glad to hear from you!
Very helpful sir!
Thank you brother, also could you please subscribe to my channel please for my useful insights!
how can i create a mat file from these multiple images?
Hi, thanks for watching my tutorials. Please try the below code
srcFile=dir('C:\Users\Muhammad Waqas\Desktop\New folder\*.jpg');
for i=1:length(srcFile)
filename=strcat('C:\Users\Muhammad Waqas\Desktop\New folder\',srcFile(i).name);
I=imread(filename);
figure,imshow(I);
image{i}=I;
save('save_multiple_images.mat','image')
end
% load('save_multiple_images.mat')
Hope this will help. Thanks
Additionally, if you want to display the saved images in mat file. You can do so by including the following lines of code. In these lines of code, I retrieved the first image and display it accordingly.
load('save_multiple_images.mat')
image=image{1};
imshow(image)
very informative. thanx .. can u plz help me that how to classify images?
Glad to hear from you. For image classification, you need to use classification algorithm such as KNN, SVM, NN, C mean etc. Thanks
can u give me ur email?? i want to discuss my project
Hey thanks for this information, i have problem too with classify images using SVM. Can you give me a solution??
How to save a multiple output images generated from a for loop in a single folder??
Just use imwrite() function in the loop.
how we can write these .jpg images into other formats( like .png)
Hi Jasman Rattol,
Thank you so much for watching my tutorial its very easy. Just try below example
srcFile=dir('C:\Users\Muhammad Waqas\Desktop\Image Processing\*.jpg');
for i=1:length(srcFile)
filename=strcat('C:\Users\Muhammad Waqas\Desktop\Image Processing\',srcFile(i).name);
I=imread(filename);
figure, imshow(I);
path=strcat('C:\Users\Muhammad Waqas\Desktop\Image Processing\save\',srcFile(i).name);
fname=srcFile(i).name;
fname = [fname(1:end-4),'.jpg'];
imwrite(I,['C:\Users\Muhammad Waqas\Desktop\Image Processing\save\',fname],'png');
end
Thanks a lot sir. It works but in 8th line it should be png. Thankyou so much
Glad to hear that its working with you. Please subscribe to my channel to watch more videos related to image processing and computer vision. Thanks
Welcome
Hi Muhammad Waqas,
Thanks for your code, but i don't understand for the code (fname=srcFile(i).name;
fname = [fname(1:end-4),'.jpg'];), why these code is needed?
Thanks.
what is the use of strcat()?
strcat() function is used to concatenate the name and type of the image like (1.jpg or something.jpg).
Thank you very much
Glad to hear from you!
Hi I get this error ---> Undefined variable "scrFile" or class "scrFile".
Please share your code here in comment.
@@Xjapan360d same thing with me
??/
very helpful
Thank you brother, also could you please subscribe to my channel please for my useful insights!
excellent
Thank you brother, also could you please subscribe to my channel please for my useful insights!
how to read 2 folder in one new script