ScratchPad

clear all;

clc;

close all;

WATERSHED=-1;

MASK=-2;

LABEL_START=-3;

I=imread('1_chest2.jpg');

I=rgb2gray(I);

I=[5 2 6 8 3; 1 7 9 3 7; 3 7 3 8 9 ; 8 0 7 3 1; 6 4 8 5 1];

global_min=min(min(I));

current_label=LABEL_START;

for k=global_min:global_min+1

    %Check for new local Minimas

    m=1;

    for i=1:size(I,1)

        for j=1:size(I,2)

            if I(i,j)<=k;

                L_im(i,j)=current_label;

                min_loc(1,m)=i;

                min_loc(2,m)=j;

                m=m+1;

            end

        end

    end

    current_label=current_label-1;

    for i=1:size(I,1)

        for j=1:size(I,2)

           

        end

    end

    %increase size of regions along 4 neighbours & assign labels & check for watersheds

end