I have a gray scale image. I want to plot the median of the columns of that image on to the image axis. For doing this I need to have two things:
Can anyone help me or give a hint or an idea or any function for estimating the median position?
This code marks all gray-scale level values in a given column equal to median value for that column:
load clown
M = median(X, 1);
figure();
imshow(uint8(X));
hold on;
for columnIdx = 1:numel(M)
medianValue = M(columnIdx);
% find locations of gray-scale lavel values equal to the median
idx = find(X(:, columnIdx) == medianValue);
if numel(idx) > 0
% mark all the gray-scale level values on the image
plot(ones(1,numel(idx)) * columnIdx, idx, '.g');
end
end
Hope it helps