matlab小工具

曲线reverse

I = imread('NaAnt.jpg');x = 400:1:700;
I_gray =  rgb2gray(I);
I_b = I_gray < 150;
imshow(I_b);

[m,n] = size(I_gray);
result = [];
for j = 1:n
    column = I_b(:,j);
    X = find(column);
    result = [result,m-X(1)];
end
%重新划分到波长
result1 = [];
for  wavelength = x
    index = round((wavelength-x(1))/(x(end)-x(1))*n);
    if (wavelength == x(1))
        index = index + 1;
    end
    result1 = [result1;[wavelength,result(index)]];
end
plot(result1(:,1),result1(:,2));
============================找指导老师布置任务吧==============================