how to rename images from a folder?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello every one, I have a folder 'SET1' that contain 60 folders (person_1, person_2,...,person_60). Each folder contain 50 images : SentenceImage_0, SentenceImage_1, ......,SentenceImage_49).
I want to rename and save these images in a single folder 'dataset': the name of each image is as follows: 1_SentenceImage0_SET1, 1_SentenceImage1_SET1, 1_SentenceImage2_SET1, ..., 1_SentenceImage50_SET1, 2_SentenceImage0_SET1 ... etc. with 1 corresponding to folder person_1, 2 corresponds to folder person_2, up to 60 corresponding to person_60.
Please, any suggestion for a matlab code and thanks in advance.
댓글 수: 0
답변 (2개)
Guillaume
2015년 11월 30일
While it's certainly possible to do this in matlab using dir, a for loop, and some simple path manipulation, there are plenty of tools freely available dedicated to renaming files which will be simpler to use and more importantly, don't require debugging (hence no risk of losing files because your script all rename them to the same file).
Personally, I would use IrfanView because I've got it installed on my machine (I'm in no way affiliated with the product) and it's trivial to do what you want with it. Use it to open any of your image. Press B, select batch rename, select all the files, select output directory. Write $d$N in the rename field. Press 'Start Batch', and you're done.
댓글 수: 0
Image Analyst
2015년 11월 30일
You can use movefile(). Be sure to use fullfile() if you want the renamed files to live in a different folder.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!