필터 지우기
필터 지우기

reg Image Subtraction

조회 수: 1 (최근 30일)
Nagarajan sivathanu
Nagarajan sivathanu 2012년 1월 18일
I want to subtract two images. I used 'imread' function which get images in uint8. when I subtract two images a and b, abs(a-b) and abs(b-a) are not equal. How to compare two images or subtract two images for detecting changes?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 1월 18일
Consider uint8(3)-uint8(5) . What value do you expect that to result in? uint8(-2) ... but -2 is clearly not an unsigned integer such as is representable in the datatype of Unsigned 8 Bit Integers (uint8)
In order to be able to get negative values, you have to convert the data to a signed datatype that can hold the maximum values of the subtraction, 256 minus 0 and 0 minus 256.
If you just want to check if two images are exactly equal, you can use equal().

카테고리

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