MATLAB Answers

How can I replace images inside a folder with another image from different folder?

조회 수: 34(최근 30일)
Rupayan Saha
Rupayan Saha 14 Dec 2020
댓글: Image Analyst 14 Dec 2020
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.

채택된 답변

Jon
Jon 14 Dec 2020
편집: Jon 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
Image Analyst
Image Analyst 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
  1. Use descriptive variable names, not cryptic ones.
  2. 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.

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

추가 답변(0개)

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by