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!