Plotting maximum intensity value

조회 수: 4 (최근 30일)
Harsha Vardhan Rao  Avunoori
Harsha Vardhan Rao Avunoori 2011년 5월 24일
I wrote the following code to plot the maximum intensity value in an Infrared image.It had shaded of white and black so I have thresholded it.But I don't find the output to be accurate.Can anyone help me out in correcting the code.
function [row col] = maximum( X )
[r c] = size(X);
for i=1:r
for j=1:c
if X(i,j)>140 && X(i,j)<160
temp(i,j) = X(i,j);
else
temp(i,j) = 1;
end
if temp(i,j) == max(max(temp))
row = i;
col = j;
end
end
end
end
x0 = rgb2gray(imread('img_1.jpg'));
x1 = rgb2gray(imread('img_2.jpg'));
[row0 col0] = maximum(x0);
[row1 col1] = maximum(x1);
figure(1)
plot(row0,col0,'+',row1,col1,'d')
Any help will be appreciated.

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 5월 24일
[the_mx, idx] = max(X(:))
[row_mx, col_mx] = ind2sub(size(X),idx);
  댓글 수: 1
Harsha Vardhan Rao  Avunoori
Harsha Vardhan Rao Avunoori 2011년 5월 26일
Thanks Sean it worked!!! I can plot the max value now :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by