Azzera filtri
Azzera filtri

how to give test image path correctly?

34 visualizzazioni (ultimi 30 giorni)
Meena s
Meena s il 8 Nov 2015
Commentato: Pavankumar Dani il 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 Commenti
Stephen23
Stephen23 il 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 il 17 Nov 2021
imagePath = fullfile('testImages','patna.png');
originalImage = imread(imagePath);
getting error

Accedi per commentare.

Risposte (1)

Star Strider
Star Strider il 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!

Translated by