How can I add new images into the MATLAB build-in images?

조회 수: 39 (최근 30일)
Ermanas
Ermanas 2017년 3월 21일
댓글: Ermanas 2019년 5월 30일
Basicly, I want to add new images from the internet to the MATLAB built-in images and I want to use like
imshow('cameraman.tif')
wherever and whenever I want. I found the folder that includes images and it's -> 'C:\Program Files\MATLAB\R2016a\toolbox\images\imdata' I copied to there a new image and i tried call the new image on command window with
imshow('new_image.tif')
But it didn't work. Is there any way to do it?
  댓글 수: 3
David Wilson
David Wilson 2019년 5월 28일
Notwithstanding Steven's warning, did you do a rehash after you dumped your new image in the directory?
Ermanas
Ermanas 2019년 5월 29일
Ohh, It worked! I put the external file on the built-in images folder and ran the rehash. Thank you for this solution, could be not right to work with the root folders but it'll give me a practical way of working with my own referance images. I can do this also with Steven's answer but it's good to know that we can do it like this as well.

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

채택된 답변

Steven Lord
Steven Lord 2019년 5월 28일
You shouldn't add, delete, or modify files in a directory under the MATLAB root directory. Put your data files in a different directory and add it to the MATLAB search path.
You can use the pathtool function to add a directory to the search path. Searching the documentation for the phrase "search path" should show more information about the path.
  댓글 수: 3
Steven Lord
Steven Lord 2019년 5월 29일
One added benefit of this approach I forgot to mention: when you install a new version of MATLAB, in order to allow that new version to access your images all you need to do is add the directory containing them to the path.
If you put them under the root directory of your older version you'll need to remember to copy or move them to the new version of MATLAB before you uninstall the older version. Murphy's Law predicts you'll remember about 3 seconds after you press the Uninstall button in the uninstaller. :(
Ermanas
Ermanas 2019년 5월 30일
Yeah, actually you're definitely right to remembering what I did. So now I have a extra folder on my MATLAB's search path. I appreciate your help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by