virag = imread('sarga_virag.jpg');
imshow(virag);
figure; subplot(1,3,1); imshow(virag(:,:,1));
subplot(1,3,2); imshow(virag(:,:,2));
subplot(1,3,3); imshow(virag(:,:,3));
virag_gray = rgb2gray(virag);
imshow(virag_gray);
figure; imshow(virag_gray);
virag_segment = virag_gray;
virag_segment(virag(:,:,1)>virag(:,:,2)) = 1;
imshow(virag_segment);

virag_segment(virag(:,:,1)<virag(:,:,2) & virag(:,:,3)<virag(:,:,2)) = 2;
imshow(virag_segment);
figure;imshow(virag_segment);
virag_segment(virag_segment>2) = 3;
figure; imshow(virag_segment, [0,3]);

virag_seg_rgb = label2rgb(virag_segment, 'jet');
figure; imshow(virag_seg_rgb);