How can I replace images inside a folder with another image from different folder?
5 views (last 30 days)
Show older comments
Hi. I have a large number of captured images, however few of them are corrupted. So I use pixel threshold to identify those images and able to delete them. But I want to replace them with another image located in different folder. I am beginner to MATLAB and not aware of many functions which may solve this issue. Please let me know if you have any suggestion for this task.
I used "DELETE" function to delete images after storing the file name as a string scalar. Tried "replace" function for replaceing the images but it did not work.
0 Comments
Accepted Answer
Jon
on 14 Dec 2020
Edited: Jon
on 14 Dec 2020
If I understand what you are trying to do I think the copyfile function should do what you want
Type doc copyfile on the command line to view the documentation.
1 Comment
Image Analyst
on 14 Dec 2020
What is ready and ready2, and ee and all those other variables. My two mandatory tips for people who write code for me are to
- Use descriptive variable names, not cryptic ones.
- Put in LOTS of comments.
We can't even run your code because the code where you define imagenames, ready, etc. is not included. Please include that code, while following my tips, so we can fix your code and help you. But basically you can call
delete(destinationFileName)
copyfile(sourceFileName, destinationFileName);
You just have to set up those variables and make sure those files exist.
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!