why the answer is coming as matrix and not a single number?
이전 댓글 표시
I'm trying to find an answer of an mathematics operation to find a difference in two different black and white images, and the answer is coming as an matrix and i only need a single value.... what can i do? and how i can take two values for different conditions (equal pr not equal) if the answer is coming as matrix with different number of ones at each time?
댓글 수: 7
José-Luis
2016년 7월 1일
Well, without knowing how you calculate that difference, helping you is akin to try shooting pigeons with a blindfold on.
haya yousuf
2016년 7월 1일
José-Luis
2016년 7월 1일
An equally unspecific answer: there are very many different ways of getting a scalar when comparing two arrays. A straight on comparison, ==, will give a logical array.
KSSV
2016년 7월 1일
you may also consider trying isequal
Thorsten
2016년 7월 1일
What is the supposed meaning of the "single value" that you need?
haya yousuf
2016년 7월 1일
haya yousuf
2016년 7월 1일
답변 (1개)
dpb
2016년 7월 1일
" and how i can take two values for different conditions (equal pr not equal) if the answer is coming as matrix ...?"
Well, the short answer is
truefalse=all(yourDifferenceArray); % only a single pixel is noted as a difference
truefalse=any(yourDifferenceArray); % takes every pixel to be different for TRUE
Or, of course, you could have some threshold of how many must be different to count by
truefalse=sum(yourDifferenceArray)<ThresholdNumber;
This assumes the difference is the plain subtraction so '==' returns 1 (TRUE) for locations that are the same.
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!