Clear Filters
Clear Filters

how to give test image path correctly?

34 views (last 30 days)
Meena s
Meena s on 8 Nov 2015
Commented: Pavankumar Dani on 17 Nov 2021
When i give the path like this I am getting this error*
File "~\Desktop\ME project\images\bungee.png" does not exist.
origImg = imread([testImageSource,'.png']);
PROGRAM*
clear
%%parameters
testImageName = 'bungee'; % cow or bungee or man
psz = 9; % patch size ( to be inpainted in inpainting)
testImagePath = '~/Documents/MATLAB/AutoShared/testimages/Petter_Strandmark/';
testImageSource = fullfile(testImagePath,testImageName);
origImg = imread([testImageSource,'bungee.png']);
mask = imread([testImageSource,'bungee-mask.jpg']);
mask(mask==255) = 1;
tic
%output is fix!
[inpaintedImg,c,d,fillingMovie] = inpainting(origImg,mask,psz);
toc
maskedImg = repmat(uint8(~mask),[1,1,3]).*origImg;
figure(1),imshow(uint8(origImg)),title('Original Image')
figure(2),imshow(uint8(maskedImg)),title('Masked Image')
figure(3),imshow(uint8(inpaintedImg)),title('Inpainted Image')
folderName = ['myresults/',datestr(now,'yymmdd-HHMMSS'),'_',testImageName];
mkdir(folderName)
imwrite(uint8(origImg),fullfile(folderName,'origImg.bmp'),'BMP');
imwrite(uint8(maskedImg),fullfile(folderName,'maskedImg.bmp'),'BMP');
imwrite(uint8(inpaintedImg),fullfile(folderName,'inpaintedImg.bmp'),'BMP');
  2 Comments
Stephen23
Stephen23 on 8 Nov 2015
@Meena s: please do not post duplicate questions on the exactly the same problem. Instead of spamming us with your new questions please simply edit or comment your existing question.
Because this question has the most information I closed the other questions.
Pavankumar Dani
Pavankumar Dani on 17 Nov 2021
imagePath = fullfile('testImages','patna.png');
originalImage = imread(imagePath);
getting error

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 8 Nov 2015
Use the full path name. It is probably
C:\Users\<UserName>\Desktop\ME project\images\bungee.png
Where you would fill in your UserName in the appropriate location.

Community Treasure Hunt

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

Start Hunting!