how to give test image path correctly?
34 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2015-11-8
@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
2021-11-17
imagePath = fullfile('testImages','patna.png');
originalImage = imread(imagePath);
getting error
回答(1 个)
Star Strider
2015-11-8
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!