%{ Code by: Arjit Soni B.Tech Student Department of Civil Engineering and Department of Engineering Science Indian Institute of Technology Hyderabad es13b1005@iith.ac.in Under Guidance of: Dr. B. Umashankar Associate Professor Department of Civil Engineering Indian Institute of Technology Hyderabad buma@iith.ac.in %} %% Read me %This code should be in same folder where images are. %select only 10-12 pixels in both kerosene and water region. %% Clear workspace clear all %to clear workspace close all %to close all windows clc %to clear command window %% Image input dynamically image should be in same folder as code in = input('Type input image name:','s'); a=sscanf(in,'%s'); %scan name of the image I = imread(a); %to read image img = im2double(I); %to convert uint8 to double whos img %to show image type %% to make rgb layer red = img(:,:,1); %to extract red layer from image green = img(:,:,2); %to extract green layer from image blue = img(:,:,3); %to extract blue layer from image %% to select pixel colour figure('Name','To select pixels (double click to finish)','NumberTitle','off'); %to name a figure imshow(img); pix = impixel(img); %to select pixel colour disp(' Red Green Blue'); disp(pix); mi = min(pix); %minimum value of pixels ma = max(pix); %maximum value of pixels disp('minimum values'); disp(mi); disp('maximum values'); disp(ma); %% taking minimum and maximum of pixel values outr = red>mi(1) & redmi(2) & greenmi(3) & blue