Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function varargout = gui_replica(varargin)
- % gui_replica MATLAB code for gui_replica.fig
- % gui_replica, by itself, creates a new gui_replica or raises the existing
- % singleton*.
- %
- % H = gui_replica returns the handle to a new gui_replica or the handle to
- % the existing singleton*.
- %
- % gui_replica('CALLBACK',hObject,eventData,handles,...) calls the local
- % function named CALLBACK in gui_replica.M with the given input arguments.
- %
- % gui_replica('Property','Value',...) creates a new gui_replica or raises the
- % existing singleton*. Starting from the left, property value pairs are
- % applied to the GUI before gui_replica_OpeningFcn gets called. An
- % unrecognized property name or invalid value makes property application
- % stop. All inputs are passed to gui_replica_OpeningFcn via varargin.
- %
- % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
- % instance to run (singleton)".
- %
- % See also: GUIDE, GUIDATA, GUIHANDLES
- % Edit the above text to modify the response to help gui_replica
- % Last Modified by GUIDE v2.5 27-Dec-2017 16:45:15
- % Begin initialization code - DO NOT EDIT
- gui_Singleton = 1;
- gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @gui_replica_OpeningFcn, ...
- 'gui_OutputFcn', @gui_replica_OutputFcn, ...
- 'gui_LayoutFcn', [] , ...
- 'gui_Callback', []);
- if nargin && ischar(varargin{1})
- gui_State.gui_Callback = str2func(varargin{1});
- end
- if nargout
- [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
- else
- gui_mainfcn(gui_State, varargin{:});
- end
- % End initialization code - DO NOT EDIT
- % --- Executes just before gui_replica is made visible.
- function gui_replica_OpeningFcn(hObject, eventdata, handles, varargin)
- % This function has no output args, see OutputFcn.
- % hObject handle to figure
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % varargin command line arguments to gui_replica (see VARARGIN)
- % img = imread('logo-tbl.png');
- % axes(handles.axes4)
- % imshow(img)
- % axis off
- % axis image
- % Choose default command line output for gui_replica
- handles.output = hObject;
- % Update handles structure
- guidata(hObject, handles);
- % UIWAIT makes gui_replica wait for user response (see UIRESUME)
- % uiwait(handles.figure1);
- % --- Outputs from this function are returned to the command line.
- function varargout = gui_replica_OutputFcn(hObject, eventdata, handles)
- % varargout cell array for returning output args (see VARARGOUT);
- % hObject handle to figure
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Get default command line output from handles structure
- varargout{1} = handles.output;
- % --- Executes on button press in pushbutton1.
- function pushbutton1_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton1 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % [file_name,path_name] = uigetfile('*.jpg','Select image file');
- % full_path = [path_name,'\',file_name];
- % handles.filename=full_path;
- % guidata(hObject,handles)
- % img = imread(full_path);
- % axes(handles.axes1)
- % imshow(img)
- % axis off
- % axis image
- % --- Executes on button press in pushbutton2.
- function pushbutton2_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton2 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- filePath = uigetdir;
- imgFilePath = dir([filePath '/*.jpg']);
- imgFilesNo = size(imgFilePath,1);
- imgName = imgFilePath(1).name;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.filePath = filePath;
- handles.imgFolderInfo = imgFilePath;
- handles.imgName = imgName;
- handles.imgOrder = 1;
- handles.imgTotal = imgFilesNo;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.lcrop = 0;
- handles.rcrop = 0;
- handles.tcrop = 0;
- handles.bcrop = 0;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.g1Val = 2;
- handles.g2Val = 4;
- handles.medVal = 20;
- handles.diff = 2;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- guidata(hObject,handles);
- set(handles.imgOrderLabel, 'String', handles.imgOrder);
- set(handles.imgTotalLabel, 'String', imgFilesNo);
- img = imread([filePath,'\',imgName]);
- axes(handles.axes1)
- %imshow(img)
- axis off
- axis image
- imshow(img);
- % imgName = imgFilePath(1).name;
- [H,W] = size(img);
- img3d = zeros(H,W,imgFilesNo);
- handles.imgHeight = H;
- handles.imgWidth = W;
- guidata(hObject,handles);
- for step = 1:imgFilesNo
- file_name = imgFilePath(step).name;
- % [H,W] = size(img);
- img = imread([filePath,'\',file_name]);
- img3d(:,:,step) = img;
- fprintf('%d\n', step);
- end
- avg = mean(img3d,1);
- avg = squeeze(avg);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.axes3)
- axis image
- imshow(avg,[]);
- hold on
- x = [1 W];
- y = [handles.imgOrder handles.imgOrder];
- handles.lineRef = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
- guidata(hObject,handles);
- hold off
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % [H,W,I] = size(img3d);
- % avg = zeros(W,imgFilesNo);
- % for i = 1:W
- % for j = 1:imgFilesNo
- % avg(i,j) = sum(double(img3d(:,i,j)))/imgFilesNo;
- % end
- % end
- % fprintf('%d\n', step);
- % OpenfilePath = 'C:\Users\TBL\Documents\MATLAB\Yujin_Data\20170404_Amore_Replica\Eye-rim\5-Y';
- % max_step = 994;
- % avg_rough = zeros(1,max_step);
- % rms_rough = zeros(1,max_step);
- % max_rough = zeros(1,max_step);
- % total_rough = zeros(1,max_step);
- %
- % % full_path = handles.filename;
- % diff = 2;
- % l_crop = 156;
- % r_crop = 10;
- % t_crop = 45;
- % b_crop = 5;
- % for step = 1:max_step
- % offset = 6;
- % num = sprintf('%d',step+offset);
- % file_name = strcat('bb _',num,'.jpg');
- % img0 = imread([OpenfilePath,'\',file_name]);
- % img = rgb2gray(img0);
- % [H,W] = size(img);
- % img = flip(img, 1);
- % [img_crop,H_crop,W_crop] = crop(img,H,W,l_crop,r_crop,t_crop,b_crop);
- % img_filt = imgaussfilt(img_crop,6);
- % img_diff = filt_diff(img_filt,H_crop,W_crop,diff);
- %
- % %ref_line to ref+line_surf
- % [img_line_surf,ind_line_surf,avg_index,ref_line_surf] = line_surf2(img_diff,H_crop,W_crop,diff);
- % img3d(:,:,step) = img_line_surf;
- %
- % [peak_height_front,valley_depth_front] = peak_valley(ind_line_surf,avg_index,W_crop);
- % [avg_rough_front(step),rms_rough_front(step),max_rough_front(step),total_rough_front(step)] = roughness(peak_height_front,valley_depth_front);
- %
- % fprintf('%d\n', step);
- %
- % end
- % avg_roughness = zeros(1,W_crop);
- % rms_roughness = zeros(1,W_crop);
- % max_roughness = zeros(1,W_crop);
- % total_roughness = zeros(1,W_crop);
- % for ii = 1:W_crop
- % s = img3d(:,ii,:);
- % s = squeeze(s);
- % [Hs,Ws] = size(s);
- % [row,col] = find(s);
- %
- % avg_index_side = round(mean(row));
- % ref_line = zeros(Hs,Ws);
- % ref_line(avg_index_side,:) = 255;
- %
- % abs_roughness = zeros(1,Ws);
- %
- % [peak_height_side,valley_depth_side] = peak_valley(row,avg_index_side,W_crop);
- % [avg_rough_side(ii),rms_rough_side(ii),max_rough_side(ii),total_rough_side(ii)] = roughness(peak_height_side,valley_depth_side);
- %
- % fprintf('%d\n', ii);
- %
- % end
- %mean_avg_rough_front = mean(avg_rough_front)
- % mean_rms_rough_front = mean(rms_rough_front)
- % mean_max_rough_front = mean(max_rough_front)
- % mean_total_rough_front = mean(total_rough_front)
- % disp('Front view roughness');
- %
- % text_avg_rough_front = sprintf('%.2f', mean(avg_rough_front));
- % text_rms_rough_front = sprintf('%.2f', mean(rms_rough_front));
- % text_max_rough_front = sprintf('%.2f', mean(max_rough_front));
- % text_total_rough_front = sprintf('%.2f', mean(total_rough_front));
- %
- % set(handles.text13, 'String', text_avg_rough_front);
- % set(handles.text14, 'String', text_rms_rough_front);
- % set(handles.text15, 'String', text_max_rough_front);
- % set(handles.text16, 'String', text_total_rough_front);
- %
- %
- % disp('Side view roughness');
- % text_avg_rough = sprintf('%.2f', mean(avg_rough_side));
- % text_rms_rough = sprintf('%.2f', mean(rms_rough_side));
- % text_max_rough = sprintf('%.2f', mean(max_rough_side));
- % text_total_rough = sprintf('%.2f', mean(total_rough_side));
- %
- % set(handles.text25, 'String', text_avg_rough);
- % set(handles.text26, 'String', text_rms_rough);
- % set(handles.text29, 'String', text_max_rough);
- % set(handles.text30, 'String', text_total_rough);
- %
- %
- %
- %
- % axes(handles.axes1)
- % %imshow(img)
- % axis off
- % axis image
- % imshow(img0);
- %
- %
- % r1 = img_crop;
- % g1 = r1;
- % b1 = r1;
- % r1(img_line_surf > 0) = 255;
- % g1(img_line_surf > 0) = 0; %%
- % b1(ref_line_surf > 0) = 255; %
- %
- % axes(handles.axes3)
- % %imshow(img)
- % axis off
- % axis image
- % imshow(cat(3,r1,g1,b1),[]);
- % figure('Name','Wrinkle')
- % imshow();
- % imshow(img_crop,[], 'parent',handle.axes1)
- % imshow(cat(3,r1,g1,b1),[], 'parent',handle.axes3)
- % %% Roughness Values
- % text_avg_rough = sprintf('%.2f', avg_rough);
- % text_rms_rough = sprintf('%.2f', rms_rough);
- % text_max_rough = sprintf('%.2f', max_rough);
- % text_total_rough = sprintf('%.2f', total_rough);
- %
- % set(handles.text13, 'String', text_avg_rough);
- % set(handles.text14, 'String', text_rms_rough);
- % set(handles.text15, 'String', text_max_rough);
- % set(handles.text16, 'String', text_total_rough);
- % img = imread(full_path);
- % [H,W] = size(img);
- % %% Parameters setup
- % l_crop = 18;
- % r_crop = 18;
- % t_crop = 12;
- % b_crop = 10;
- % diff = 2;
- % med = 80;
- % wind_size = 40;
- % threshold = 30;
- % %% Preprocessing
- % [img_crop,H_crop,W_crop] = crop(img,H,W,l_crop,r_crop,t_crop,b_crop);
- % img_filt = imgaussfilt(img_crop,7);
- % %% Wrinkle surface
- % img_diff = filt_diff(img_filt,H_crop,W_crop,diff);
- % [img_line_wrinkle,ind_line_wrinkle,avg_index,ref_line] = line_surf1(img_diff,H_crop,W_crop,diff);
- %
- % [peak_height,valley_depth] = peak_valley(ind_line_wrinkle,avg_index,W_crop);
- % [avg_rough,rms_rough,max_rough,total_rough] = roughness(peak_height,valley_depth);
- %
- % %% Roughness Values
- % text_avg_rough = sprintf('%.2f', avg_rough);
- % text_rms_rough = sprintf('%.2f', rms_rough);
- % text_max_rough = sprintf('%.2f', max_rough);
- % text_total_rough = sprintf('%.2f', total_rough);
- %
- % set(handles.text13, 'String', text_avg_rough);
- % set(handles.text14, 'String', text_rms_rough);
- % set(handles.text15, 'String', text_max_rough);
- % set(handles.text16, 'String', text_total_rough);
- % --- Executes on button press in pushbutton3.
- function pushbutton3_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton3 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton4.
- function pushbutton4_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton4 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton5.
- function pushbutton5_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton5 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton6.
- function pushbutton6_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton6 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton7.
- function pushbutton7_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton7 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes during object creation, after setting all properties.
- function text21_CreateFcn(hObject, eventdata, handles)
- % hObject handle to text21 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % --- Executes on button press in btnNext.
- function btnNext_Callback(hObject, eventdata, handles)
- % hObject handle to btnNext (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if handles.imgOrder < handles.imgTotal
- handles.imgOrder = handles.imgOrder + 1;
- guidata(hObject,handles);
- set(handles.imgOrderLabel, 'String', handles.imgOrder);
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- axes(handles.axes1)
- axis off
- axis image
- imshow(img);
- delete(handles.lineRef);
- axes(handles.axes3)
- % axis image
- % imshow(avg,[]);
- % hold on
- x = [1 handles.imgWidth];
- y = [handles.imgOrder handles.imgOrder];
- %handles.lineRef = c1;
- handles.lineRef = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.lcrop = 0;
- handles.rcrop = 0;
- handles.tcrop = 0;
- handles.bcrop = 0;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.g1Val = 2;
- handles.g2Val = 4;
- handles.medVal = 20;
- handles.diff = 2;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- guidata(hObject,handles);
- % hold off
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- end
- % save the changes to the structure
- % handles.imgOrder = 1;
- % handles.imgTotal = folderImgNo;
- % guidata(hObject,handles);
- % set(handles.imgTotalLabel, 'String', folderImgNo);
- % --- Executes on button press in btnPrev.
- function btnPrev_Callback(hObject, eventdata, handles)
- % hObject handle to btnPrev (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- if handles.imgOrder > 1
- handles.imgOrder = handles.imgOrder - 1;
- guidata(hObject,handles);
- set(handles.imgOrderLabel, 'String', handles.imgOrder);
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- axes(handles.axes1)
- axis off
- axis image
- imshow(img);
- delete(handles.lineRef);
- axes(handles.axes3)
- x = [1 handles.imgWidth];
- y = [handles.imgOrder handles.imgOrder];
- handles.lineRef = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
- handles.lcrop = 0;
- handles.rcrop = 0;
- handles.tcrop = 0;
- handles.bcrop = 0;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- handles.g1Val = 2;
- handles.g2Val = 4;
- handles.medVal = 20;
- handles.diff = 2;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- guidata(hObject,handles);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- end
- % --- Executes on slider movement.
- function rcropSlider_Callback(hObject, eventdata, handles)
- % hObject handle to rcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- r_crop_normalized = get(handles.rcropSlider,'Value');
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- [H,W] = size(img);
- % l_crop = 0;
- r_crop = r_crop_normalized*W;
- % t_crop = 0;
- % b_crop = 0;
- handles.rcrop = r_crop;
- guidata(hObject,handles);
- [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
- axes(handles.axes1)
- axis off
- axis image
- imshow(img_crp);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function rcropSlider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to rcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function lcropSlider_Callback(hObject, eventdata, handles)
- % hObject handle to lcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- l_crop_normalized = get(handles.lcropSlider,'Value')
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- [H,W] = size(img);
- l_crop = l_crop_normalized*W;
- % r_crop = 0;
- % t_crop = 0;
- % b_crop = 0;
- handles.lcrop = l_crop;
- guidata(hObject,handles);
- [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
- axes(handles.axes1)
- axis off
- axis image
- imshow(img_crp);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function lcropSlider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to lcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function tcropSlider_Callback(hObject, eventdata, handles)
- % hObject handle to tcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- t_crop_normalized = get(handles.tcropSlider,'Value');
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- [H,W] = size(img);
- t_crop = t_crop_normalized*W;
- handles.tcrop = t_crop;
- guidata(hObject,handles);
- [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
- axes(handles.axes1)
- axis off
- axis image
- imshow(img_crp);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function tcropSlider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to tcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function bcropSlider_Callback(hObject, eventdata, handles)
- % hObject handle to bcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- b_crop_normalized = get(handles.bcropSlider,'Value');
- filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([filePath,'\',imgName]);
- [H,W] = size(img);
- % l_crop = 0;
- % r_crop = 0;
- % t_crop = 0;
- b_crop = b_crop_normalized*W;
- handles.bcrop = b_crop;
- guidata(hObject,handles);
- [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
- axes(handles.axes1)
- axis off
- axis image
- imshow(img_crp);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function bcropSlider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to bcropSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function slider8_Callback(hObject, eventdata, handles)
- % hObject handle to slider8 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- % --- Executes during object creation, after setting all properties.
- function slider8_CreateFcn(hObject, eventdata, handles)
- % hObject handle to slider8 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function g1Slider_Callback(hObject, eventdata, handles)
- % hObject handle to g1Slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- handles.g1Val = get(handles.g1Slider,'Value');
- set(handles.g1ValLabel, 'String', handles.g1Val);
- guidata(hObject,handles);
- % filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([handles.filePath,'\',imgName]);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function g1Slider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to g1Slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function g2Slider_Callback(hObject, eventdata, handles)
- % hObject handle to g2Slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- handles.g2Val = get(handles.g2Slider,'Value');
- set(handles.g2ValLabel, 'String', handles.g2Val);
- guidata(hObject,handles);
- % filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([handles.filePath,'\',imgName]);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function g2Slider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to g2Slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- % --- Executes on slider movement.
- function medSlider_Callback(hObject, eventdata, handles)
- % hObject handle to medSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Hints: get(hObject,'Value') returns position of slider
- % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
- handles.medVal = get(handles.medSlider,'Value');
- set(handles.medValLabel, 'String', handles.medVal);
- guidata(hObject,handles);
- % filePath = handles.filePath;
- imgFilePath = handles.imgFolderInfo;
- imgName = imgFilePath(handles.imgOrder).name;
- img = imread([handles.filePath,'\',imgName]);
- [H,W] = size(img);
- [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
- img_gau = imgaussfilt(img_crp,handles.g1Val);
- img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
- [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
- img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
- img_med = filt_diff(img_med,H,W,handles.diff);
- [img_idl,ind_idl,~] = find_srf(img_med,H,W);
- mrg = 60;
- [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
- img_gau = imgaussfilt(img_flt,handles.g2Val);
- img_diff = filt_diff(img_gau,H,W,handles.diff);
- [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- axes(handles.imgOutputAxes)
- axis image
- imshow(img_rl,[]);
- % --- Executes during object creation, after setting all properties.
- function medSlider_CreateFcn(hObject, eventdata, handles)
- % hObject handle to medSlider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
Advertisement
Add Comment
Please, Sign In to add comment