the program works but my difference image is just black...did i do something wrong? or is there a way to make it visible?
%% 3. Interpolation
ori=imread('body.jpg'); %a)Read‘body.jpg’;store into‘ori’
sma=imresize(ori,[32 32]); %b)Resize‘ori’ to 32x32;store into‘sma’
nea=imresize(ori,1,'nearest'); %c)Resize‘sma’ to original using nearest interpolation;store into‘nea’
bil=imresize(ori,1,'bilinear'); %d)Resize‘sma’ to original using bilinear interpolation;store result into‘bil’
bic=imresize(ori,1,'bicubic'); %e)Resize‘sma’to original using bicubic interpolation;store result into‘bic’
figure %f)Display‘ori’,‘nea’,‘bil’,'bic' same figure
subplot(4,1,1);
imshow(ori)
title('ori');
subplot(4,1,2);
imshow(nea)
title('nea');
subplot(4,1,3);
imshow(bil)
title('bil');
subplot(4,1,4);
imshow(bic)
title('bic');
df=imabsdiff(bil,bic);
figure %g)Display the difference image between bil and bic
imshow(df,[])
title('difference image');

댓글 수: 4

Marcel Kreuzberg
Marcel Kreuzberg 2021년 10월 6일
nea, bil and bic are all the same, because you are doing no resizing at all. in the comment you want to resize sma and not ori. try
nea=imresize(sma,[256 256],'nearest'); %c)Resize‘sma’ to original using nearest interpolation;store into‘nea’
bil=imresize(sma,[256 256],'bilinear'); %d)Resize‘sma’ to original using bilinear interpolation;store result into‘bil’
bic=imresize(sma,[256 256],'bicubic'); %e)Resize‘sma’to original using bicubic interpolation;store result into‘bic’
regards
Marcel
Matt J
Matt J 2021년 10월 6일
편집: John Kelly 2021년 12월 9일
I suggest that you attach df in a .mat file so that we can examine it.
why is my difference image black?...
the program works but my difference image is just black...did i do something wrong? or is there a way to make it visible?
%% 3. Interpolation
ori=imread('body.jpg'); %a)Read‘body.jpg’;store into‘ori’
sma=imresize(ori,[32 32]); %b)Resize‘ori’ to 32x32;store into‘sma’
nea=imresize(ori,1,'nearest'); %c)Resize‘sma’ to original using nearest interpolation;store into‘nea’
bil=imresize(ori,1,'bilinear'); %d)Resize‘sma’ to original using bilinear interpolation;store result into‘bil’
bic=imresize(ori,1,'bicubic'); %e)Resize‘sma’to original using bicubic interpolation;store result into‘bic’
figure %f)Display‘ori’,‘nea’,‘bil’,'bic' same figure
subplot(4,1,1);
imshow(ori)
title('ori');
subplot(4,1,2);
imshow(nea)
title('nea');
subplot(4,1,3);
imshow(bil)
title('bil');
subplot(4,1,4);
imshow(bic)
title('bic');
df=imabsdiff(bil,bic);
figure %g)Display the difference image between bil and bic
imshow(df,[])
title('difference image');
Rena Berman
Rena Berman 2021년 12월 13일
(Answers Dev) Restored edit

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

 채택된 답변

Matthew Worker
Matthew Worker 2021년 10월 6일

0 개 추천

https://www.mathworks.com/matlabcentral/answers/1467816-why-is-my-difference-image-black#comment_1770511

추가 답변 (1개)

Rik
Rik 2021년 12월 1일
편집: Rena Berman 2021년 12월 13일

0 개 추천

Posted after a now-deleted comment:
@Matt J @Marcel Kreuzberg Thank you so much i didnt notice that error. It works well now

카테고리

제품

릴리스

R2021a

질문:

2021년 10월 6일

편집:

2021년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by