필터 지우기
필터 지우기

subtraction of two images

조회 수: 6 (최근 30일)
vidya
vidya 2013년 10월 18일
댓글: snehal dahiphale 2017년 2월 8일
I have two images with different dimension. I need to perform subtraction on it. I am not able to do it and don't know how to fix the error. Can somebody tell me the right code in matlab? i am unable to post images here. each time i do it i get error saying matrix dimension must agree. how shall i solve it
R=imread('If.jpg');
S=imread('j.jpg');
f8=R-S;
below is the description of my image u= imread('If.jpg');
whos Name Size Bytes Class Attributes
u 363x484x3 527076 uint8
v= imread ('j.jpg');
whos Name Size Bytes Class Attributes
v 900x1200x3 3240000 uint8
i am unable to subtract it because of the error minus Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> file1>filter_Callback at 695 f8=If-J;
  댓글 수: 1
snehal dahiphale
snehal dahiphale 2017년 2월 8일
use imresize and then perform subtraction

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

채택된 답변

David Sanchez
David Sanchez 2013년 10월 18일
You can not subtract images with different sizes the same way you can not subtract arrays with different lengths:
a=[1 2 3 4];
b=[1 2];
c=a-b; % -> !!!!! this will yield an error, dimensions must agree. Same for your images
Perform a crop of the biggest image with the dimensions of the smallest, use imcrop:
doc imcrop
and then subtract the smallest image and the crop from the biggest.
  댓글 수: 1
vidya
vidya 2013년 10월 19일
thank you for replyin sir...but when i perform crop of the big image i am getting error msg ssayin > minus Number of array dimensions must match for binary array op.
Error in ==> file1>filter_Callback at 703 f8=J-If; how shall i correct it

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by