%sample program to grab image and process %Lab 13 - 380A %plots horizontal profile summed over a number of rows. %112909 TDM clear all clc [filename, pathname] = uigetfile('*.jpg', 'Pick an image'); if isequal(filename,0) disp('User selected Cancel') else disp(['User selected: ', fullfile(pathname, filename)]) end [X,map] = imread(fullfile(pathname, filename),'jpeg'); %convert to grayscale X = uint8(round(sum(double(X),3)/3)); X = double(X); figure(100);imagesc(X);colormap(gray) %find max of image [r_max c_max] = find(max(max(X))==X); disp(['max row number = ' num2str(r_max(1))] ) %plot profile summed over +/- range of rows row = input('enter row number : '); range = input('enter range of rows to sum : '); [nr nc] = size(X); rowvec = (row-range):(row+range); yvec = sum(double(X(rowvec,:))); yvec = yvec/max(yvec); power_test = 0.25; yvec2 = power_test*repmat(1,1,length(yvec)); figure(101);plot(1:nc,[yvec;yvec2]') legend('Normalized Scan','Reference Power') title('Horizontal Profile') xlabel('Column Number') ylabel('Summed Profile') grid