What would be the outcome of this line?

조회 수: 1 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2019년 2월 25일
댓글: Rik 2019년 2월 25일
Hi
If I use this line code
for col = col1 : col2
row2 = find(mask(:, col), 1, 'last'); % Get bottom row of mask
heights(col) = row2 - topRow;
end
The heights will be a number of pixel intensity (e.g. pixel intensity value of X - pixel intensity value of Y) OR will be a number of pixels (e.g. 320 - 310 pixels = 10 pixels)??
Can you please clarify?
Thank you
  댓글 수: 2
Stelios Fanourakis
Stelios Fanourakis 2019년 2월 25일
Ok, now I know that the above line gives an arithmetic value, like 320-310 = 10 pixels.
But why when I use the line
heights(col) = rgbImage(320,col) - rgbImage(340,col);
I get the difference of pixel intensity values of those two pixels on the image? What's the difference between those two lines?
For instance if the pixel at position X: 320 Y: 454 has value of RGB: 88
And the pixel at position X: 340 Y: 454 has value RGB: 90
I will get result 2.
Why should I get result of 2 and NOT 20 which is the number of pixels between the two points?
Can someone explain clearly the difference?
Rik
Rik 2019년 2월 25일
You are subtracting positions to get a distance, you are subtracting values to get an intensity difference.
Since in this line
heights(col) = rgbImage(320,col) - rgbImage(340,col);
you're doing the second, it stands to reason you get an intensity difference, not a distance.

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

답변 (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