tuttelikz

gui_replica.m [v2latest]

Dec 27th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 34.05 KB | None | 0 0
  1. function varargout = gui_replica(varargin)
  2. % gui_replica MATLAB code for gui_replica.fig
  3. %      gui_replica, by itself, creates a new gui_replica or raises the existing
  4. %      singleton*.
  5. %
  6. %      H = gui_replica returns the handle to a new gui_replica or the handle to
  7. %      the existing singleton*.
  8. %
  9. %      gui_replica('CALLBACK',hObject,eventData,handles,...) calls the local
  10. %      function named CALLBACK in gui_replica.M with the given input arguments.
  11. %
  12. %      gui_replica('Property','Value',...) creates a new gui_replica or raises the
  13. %      existing singleton*.  Starting from the left, property value pairs are
  14. %      applied to the GUI before gui_replica_OpeningFcn gets called.  An
  15. %      unrecognized property name or invalid value makes property application
  16. %      stop.  All inputs are passed to gui_replica_OpeningFcn via varargin.
  17. %
  18. %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
  19. %      instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22.  
  23. % Edit the above text to modify the response to help gui_replica
  24.  
  25. % Last Modified by GUIDE v2.5 27-Dec-2017 16:45:15
  26.  
  27. % Begin initialization code - DO NOT EDIT
  28. gui_Singleton = 1;
  29. gui_State = struct('gui_Name',       mfilename, ...
  30.                    'gui_Singleton',  gui_Singleton, ...
  31.                    'gui_OpeningFcn', @gui_replica_OpeningFcn, ...
  32.                    'gui_OutputFcn',  @gui_replica_OutputFcn, ...
  33.                    'gui_LayoutFcn',  [] , ...
  34.                    'gui_Callback',   []);
  35. if nargin && ischar(varargin{1})
  36.     gui_State.gui_Callback = str2func(varargin{1});
  37. end
  38.  
  39. if nargout
  40.     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  41. else
  42.     gui_mainfcn(gui_State, varargin{:});
  43. end
  44. % End initialization code - DO NOT EDIT
  45.  
  46.  
  47. % --- Executes just before gui_replica is made visible.
  48. function gui_replica_OpeningFcn(hObject, eventdata, handles, varargin)
  49. % This function has no output args, see OutputFcn.
  50. % hObject    handle to figure
  51. % eventdata  reserved - to be defined in a future version of MATLAB
  52. % handles    structure with handles and user data (see GUIDATA)
  53. % varargin   command line arguments to gui_replica (see VARARGIN)
  54.  
  55.  
  56.  
  57.  
  58. % img = imread('logo-tbl.png');
  59. % axes(handles.axes4)
  60. % imshow(img)
  61. % axis off
  62. % axis image
  63.  
  64. % Choose default command line output for gui_replica
  65. handles.output = hObject;
  66.  
  67. % Update handles structure
  68. guidata(hObject, handles);
  69.  
  70. % UIWAIT makes gui_replica wait for user response (see UIRESUME)
  71. % uiwait(handles.figure1);
  72.  
  73.  
  74. % --- Outputs from this function are returned to the command line.
  75. function varargout = gui_replica_OutputFcn(hObject, eventdata, handles)
  76. % varargout  cell array for returning output args (see VARARGOUT);
  77. % hObject    handle to figure
  78. % eventdata  reserved - to be defined in a future version of MATLAB
  79. % handles    structure with handles and user data (see GUIDATA)
  80.  
  81. % Get default command line output from handles structure
  82. varargout{1} = handles.output;
  83.  
  84.  
  85. % --- Executes on button press in pushbutton1.
  86. function pushbutton1_Callback(hObject, eventdata, handles)
  87. % hObject    handle to pushbutton1 (see GCBO)
  88. % eventdata  reserved - to be defined in a future version of MATLAB
  89. % handles    structure with handles and user data (see GUIDATA)
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. % --- Executes on button press in pushbutton2.
  100. function pushbutton2_Callback(hObject, eventdata, handles)
  101. % hObject    handle to pushbutton2 (see GCBO)
  102. % eventdata  reserved - to be defined in a future version of MATLAB
  103. % handles    structure with handles and user data (see GUIDATA)
  104. filePath = uigetdir;
  105. imgFilePath = dir([filePath '/*.jpg']);
  106. imgFilesNo = size(imgFilePath,1);
  107. imgName = imgFilePath(1).name;
  108.  
  109. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  110. handles.filePath = filePath;
  111. handles.imgFolderInfo = imgFilePath;
  112. handles.imgName = imgName;
  113. handles.imgOrder = 1;
  114. handles.imgTotal = imgFilesNo;
  115. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  116. handles.lcrop = 0;
  117. handles.rcrop = 0;
  118. handles.tcrop = 0;
  119. handles.bcrop = 0;
  120. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  121. handles.g1Val = 2;
  122. handles.g2Val = 4;
  123. handles.medVal = 20;
  124. handles.diff = 2;
  125. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  126. guidata(hObject,handles);
  127.  
  128. set(handles.imgOrderLabel, 'String', handles.imgOrder);
  129. set(handles.imgTotalLabel, 'String', imgFilesNo);
  130.  
  131. img = imread([filePath,'\',imgName]);
  132. axes(handles.axes1)
  133. %imshow(img)
  134. axis off
  135. axis image
  136. imshow(img);
  137.  
  138. % imgName = imgFilePath(1).name;
  139. [H,W] = size(img);
  140. img3d = zeros(H,W,imgFilesNo);
  141. handles.imgHeight = H;
  142. handles.imgWidth = W;
  143. guidata(hObject,handles);
  144.  
  145. for step = 1:imgFilesNo
  146.     file_name = imgFilePath(step).name;
  147. %     [H,W] = size(img);
  148.     img = imread([filePath,'\',file_name]);
  149.     img3d(:,:,step) = img;
  150.     fprintf('%d\n', step);
  151. end
  152.  
  153. avg = mean(img3d,1);
  154. avg = squeeze(avg);
  155. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  156. axes(handles.axes3)
  157. axis image
  158. imshow(avg,[]);
  159. hold on
  160.  
  161. x = [1 W];
  162. y = [handles.imgOrder handles.imgOrder];
  163. handles.lineRef  = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
  164.  
  165. guidata(hObject,handles);
  166.  
  167. hold off
  168.  
  169. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  170. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  171.    
  172. img_gau = imgaussfilt(img_crp,handles.g1Val);
  173. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  174. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  175.  
  176. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  177. img_med = filt_diff(img_med,H,W,handles.diff);
  178.  
  179. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  180. mrg = 60;
  181. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  182.  
  183. img_gau = imgaussfilt(img_flt,handles.g2Val);
  184. img_diff = filt_diff(img_gau,H,W,handles.diff);
  185.  
  186. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  187. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  188. axes(handles.imgOutputAxes)
  189. axis image
  190. imshow(img_rl,[]);
  191. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  192.  
  193.  
  194. % [H,W,I] = size(img3d);
  195.  
  196. % avg = zeros(W,imgFilesNo);
  197. % for i = 1:W
  198. %     for j = 1:imgFilesNo
  199. %         avg(i,j) = sum(double(img3d(:,i,j)))/imgFilesNo;
  200. %     end
  201. % end
  202.  
  203.  
  204.  
  205. %     fprintf('%d\n', step);
  206.  
  207. % OpenfilePath = 'C:\Users\TBL\Documents\MATLAB\Yujin_Data\20170404_Amore_Replica\Eye-rim\5-Y';
  208.  
  209. % max_step = 994;
  210. % avg_rough = zeros(1,max_step);
  211. % rms_rough = zeros(1,max_step);
  212. % max_rough = zeros(1,max_step);
  213. % total_rough = zeros(1,max_step);
  214. %
  215. % % full_path = handles.filename;
  216. % diff = 2;
  217. % l_crop = 156;
  218. % r_crop = 10;
  219. % t_crop = 45;
  220. % b_crop = 5;
  221.  
  222. % for step = 1:max_step
  223. %     offset = 6;
  224. %     num = sprintf('%d',step+offset);
  225. %     file_name = strcat('bb _',num,'.jpg');
  226. %     img0 = imread([OpenfilePath,'\',file_name]);
  227. %     img = rgb2gray(img0);
  228. %     [H,W] = size(img);
  229. %     img = flip(img, 1);
  230. %     [img_crop,H_crop,W_crop] = crop(img,H,W,l_crop,r_crop,t_crop,b_crop);
  231. %     img_filt = imgaussfilt(img_crop,6);
  232. %     img_diff = filt_diff(img_filt,H_crop,W_crop,diff);
  233. %    
  234. %     %ref_line to ref+line_surf
  235. %     [img_line_surf,ind_line_surf,avg_index,ref_line_surf] = line_surf2(img_diff,H_crop,W_crop,diff);
  236. %     img3d(:,:,step) = img_line_surf;
  237. %
  238. %     [peak_height_front,valley_depth_front] = peak_valley(ind_line_surf,avg_index,W_crop);
  239. %     [avg_rough_front(step),rms_rough_front(step),max_rough_front(step),total_rough_front(step)] = roughness(peak_height_front,valley_depth_front);
  240. %
  241. %     fprintf('%d\n', step);
  242. %
  243. % end
  244.  
  245. % avg_roughness = zeros(1,W_crop);
  246. % rms_roughness = zeros(1,W_crop);
  247. % max_roughness = zeros(1,W_crop);
  248. % total_roughness = zeros(1,W_crop);
  249.  
  250. % for ii = 1:W_crop
  251. %     s = img3d(:,ii,:);
  252. %     s = squeeze(s);
  253. %     [Hs,Ws] = size(s);
  254. %     [row,col] = find(s);
  255. %
  256. %     avg_index_side = round(mean(row));
  257. %     ref_line = zeros(Hs,Ws);
  258. %     ref_line(avg_index_side,:) = 255;
  259. %
  260. %     abs_roughness = zeros(1,Ws);
  261. %    
  262. %     [peak_height_side,valley_depth_side] = peak_valley(row,avg_index_side,W_crop);
  263. %     [avg_rough_side(ii),rms_rough_side(ii),max_rough_side(ii),total_rough_side(ii)] = roughness(peak_height_side,valley_depth_side);
  264. %    
  265. %     fprintf('%d\n', ii);
  266. %  
  267. % end
  268.  
  269.  
  270.  
  271. %mean_avg_rough_front = mean(avg_rough_front)
  272. % mean_rms_rough_front = mean(rms_rough_front)
  273. % mean_max_rough_front = mean(max_rough_front)
  274. % mean_total_rough_front = mean(total_rough_front)
  275. % disp('Front view roughness');
  276. %
  277. % text_avg_rough_front = sprintf('%.2f', mean(avg_rough_front));
  278. % text_rms_rough_front = sprintf('%.2f', mean(rms_rough_front));
  279. % text_max_rough_front = sprintf('%.2f', mean(max_rough_front));
  280. % text_total_rough_front = sprintf('%.2f', mean(total_rough_front));
  281. %
  282. % set(handles.text13, 'String', text_avg_rough_front);
  283. % set(handles.text14, 'String', text_rms_rough_front);
  284. % set(handles.text15, 'String', text_max_rough_front);
  285. % set(handles.text16, 'String', text_total_rough_front);
  286. %
  287. %
  288. % disp('Side view roughness');
  289.  
  290. % text_avg_rough = sprintf('%.2f', mean(avg_rough_side));
  291. % text_rms_rough = sprintf('%.2f', mean(rms_rough_side));
  292. % text_max_rough = sprintf('%.2f', mean(max_rough_side));
  293. % text_total_rough = sprintf('%.2f', mean(total_rough_side));
  294. %
  295. % set(handles.text25, 'String', text_avg_rough);
  296. % set(handles.text26, 'String', text_rms_rough);
  297. % set(handles.text29, 'String', text_max_rough);
  298. % set(handles.text30, 'String', text_total_rough);
  299. %
  300. %
  301. %
  302. %
  303. % axes(handles.axes1)
  304. % %imshow(img)
  305. % axis off
  306. % axis image
  307. % imshow(img0);
  308. %
  309. %
  310. % r1 = img_crop;
  311. % g1 = r1;
  312. % b1 = r1;
  313. % r1(img_line_surf > 0) = 255;
  314. % g1(img_line_surf > 0) = 0; %%
  315. % b1(ref_line_surf > 0) = 255; %
  316. %
  317. % axes(handles.axes3)
  318. % %imshow(img)
  319. % axis off
  320. % axis image
  321. % imshow(cat(3,r1,g1,b1),[]);
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328. % figure('Name','Wrinkle')
  329. % imshow();
  330.  
  331. % imshow(img_crop,[], 'parent',handle.axes1)
  332. % imshow(cat(3,r1,g1,b1),[], 'parent',handle.axes3)
  333.  
  334. % %% Roughness Values
  335. % text_avg_rough = sprintf('%.2f', avg_rough);
  336. % text_rms_rough = sprintf('%.2f', rms_rough);
  337. % text_max_rough = sprintf('%.2f', max_rough);
  338. % text_total_rough = sprintf('%.2f', total_rough);
  339. %
  340. % set(handles.text13, 'String', text_avg_rough);
  341. % set(handles.text14, 'String', text_rms_rough);
  342. % set(handles.text15, 'String', text_max_rough);
  343. % set(handles.text16, 'String', text_total_rough);
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350. % img = imread(full_path);
  351. % [H,W] = size(img);
  352. % %% Parameters setup
  353. % l_crop = 18;
  354. % r_crop = 18;
  355. % t_crop = 12;
  356. % b_crop = 10;
  357. % diff = 2;
  358. % med = 80;
  359. % wind_size = 40;
  360. % threshold = 30;
  361. % %% Preprocessing
  362. % [img_crop,H_crop,W_crop] = crop(img,H,W,l_crop,r_crop,t_crop,b_crop);
  363. % img_filt = imgaussfilt(img_crop,7);
  364. % %% Wrinkle surface
  365. % img_diff = filt_diff(img_filt,H_crop,W_crop,diff);
  366. % [img_line_wrinkle,ind_line_wrinkle,avg_index,ref_line] = line_surf1(img_diff,H_crop,W_crop,diff);
  367. %
  368. % [peak_height,valley_depth] = peak_valley(ind_line_wrinkle,avg_index,W_crop);
  369. % [avg_rough,rms_rough,max_rough,total_rough] = roughness(peak_height,valley_depth);
  370. %
  371. % %% Roughness Values
  372. % text_avg_rough = sprintf('%.2f', avg_rough);
  373. % text_rms_rough = sprintf('%.2f', rms_rough);
  374. % text_max_rough = sprintf('%.2f', max_rough);
  375. % text_total_rough = sprintf('%.2f', total_rough);
  376. %
  377. % set(handles.text13, 'String', text_avg_rough);
  378. % set(handles.text14, 'String', text_rms_rough);
  379. % set(handles.text15, 'String', text_max_rough);
  380. % set(handles.text16, 'String', text_total_rough);
  381.  
  382.  
  383.  
  384. % --- Executes on button press in pushbutton3.
  385. function pushbutton3_Callback(hObject, eventdata, handles)
  386. % hObject    handle to pushbutton3 (see GCBO)
  387. % eventdata  reserved - to be defined in a future version of MATLAB
  388. % handles    structure with handles and user data (see GUIDATA)
  389.  
  390.  
  391. % --- Executes on button press in pushbutton4.
  392. function pushbutton4_Callback(hObject, eventdata, handles)
  393. % hObject    handle to pushbutton4 (see GCBO)
  394. % eventdata  reserved - to be defined in a future version of MATLAB
  395. % handles    structure with handles and user data (see GUIDATA)
  396.  
  397.  
  398.  
  399. % --- Executes on button press in pushbutton5.
  400. function pushbutton5_Callback(hObject, eventdata, handles)
  401. % hObject    handle to pushbutton5 (see GCBO)
  402. % eventdata  reserved - to be defined in a future version of MATLAB
  403. % handles    structure with handles and user data (see GUIDATA)
  404.  
  405.  
  406. % --- Executes on button press in pushbutton6.
  407. function pushbutton6_Callback(hObject, eventdata, handles)
  408. % hObject    handle to pushbutton6 (see GCBO)
  409. % eventdata  reserved - to be defined in a future version of MATLAB
  410. % handles    structure with handles and user data (see GUIDATA)
  411.  
  412.  
  413. % --- Executes on button press in pushbutton7.
  414. function pushbutton7_Callback(hObject, eventdata, handles)
  415. % hObject    handle to pushbutton7 (see GCBO)
  416. % eventdata  reserved - to be defined in a future version of MATLAB
  417. % handles    structure with handles and user data (see GUIDATA)
  418.  
  419.  
  420. % --- Executes during object creation, after setting all properties.
  421. function text21_CreateFcn(hObject, eventdata, handles)
  422. % hObject    handle to text21 (see GCBO)
  423. % eventdata  reserved - to be defined in a future version of MATLAB
  424. % handles    empty - handles not created until after all CreateFcns called
  425.  
  426.  
  427. % --- Executes on button press in btnNext.
  428. function btnNext_Callback(hObject, eventdata, handles)
  429. % hObject    handle to btnNext (see GCBO)
  430. % eventdata  reserved - to be defined in a future version of MATLAB
  431. % handles    structure with handles and user data (see GUIDATA)
  432. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  433.  
  434. if handles.imgOrder < handles.imgTotal
  435.     handles.imgOrder = handles.imgOrder + 1;
  436.     guidata(hObject,handles);
  437.     set(handles.imgOrderLabel, 'String', handles.imgOrder);
  438.    
  439.    
  440.     filePath = handles.filePath;
  441.     imgFilePath = handles.imgFolderInfo;
  442.     imgName = imgFilePath(handles.imgOrder).name;
  443.    
  444.     img = imread([filePath,'\',imgName]);
  445.     axes(handles.axes1)
  446.     axis off
  447.     axis image
  448.     imshow(img);
  449.    
  450.    
  451.    
  452.    
  453.    
  454.     delete(handles.lineRef);
  455.    
  456.     axes(handles.axes3)
  457. %     axis image
  458. %     imshow(avg,[]);
  459. %     hold on
  460.  
  461.     x = [1 handles.imgWidth];
  462.     y = [handles.imgOrder handles.imgOrder];
  463.    
  464.    
  465.     %handles.lineRef = c1;
  466.    
  467.    
  468.     handles.lineRef = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
  469.    
  470.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  471.     handles.lcrop = 0;
  472.     handles.rcrop = 0;
  473.     handles.tcrop = 0;
  474.     handles.bcrop = 0;
  475.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  476.     handles.g1Val = 2;
  477.     handles.g2Val = 4;
  478.     handles.medVal = 20;
  479.     handles.diff = 2;
  480.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  481.  
  482.     guidata(hObject,handles);
  483.    
  484. %     hold off
  485.  
  486.     [H,W] = size(img);
  487.  
  488.     [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  489.    
  490.     img_gau = imgaussfilt(img_crp,handles.g1Val);
  491.     img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  492.     [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  493.  
  494.     img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  495.     img_med = filt_diff(img_med,H,W,handles.diff);
  496.  
  497.     [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  498.     mrg = 60;
  499.     [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  500.  
  501.     img_gau = imgaussfilt(img_flt,handles.g2Val);
  502.     img_diff = filt_diff(img_gau,H,W,handles.diff);
  503.  
  504.     [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  505.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  506.     axes(handles.imgOutputAxes)
  507.     axis image
  508.     imshow(img_rl,[]);
  509.    
  510.    
  511. end
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. % save the changes to the structure
  532.  
  533.  
  534.  
  535. % handles.imgOrder = 1;
  536. % handles.imgTotal = folderImgNo;
  537. % guidata(hObject,handles);
  538.  
  539.  
  540. % set(handles.imgTotalLabel, 'String', folderImgNo);
  541.  
  542.  
  543.  
  544.  
  545. % --- Executes on button press in btnPrev.
  546. function btnPrev_Callback(hObject, eventdata, handles)
  547. % hObject    handle to btnPrev (see GCBO)
  548. % eventdata  reserved - to be defined in a future version of MATLAB
  549. % handles    structure with handles and user data (see GUIDATA)
  550. if handles.imgOrder > 1
  551.     handles.imgOrder = handles.imgOrder - 1;
  552.     guidata(hObject,handles);
  553.     set(handles.imgOrderLabel, 'String', handles.imgOrder);
  554.    
  555.    
  556.     filePath = handles.filePath;
  557.     imgFilePath = handles.imgFolderInfo;
  558.     imgName = imgFilePath(handles.imgOrder).name;
  559.    
  560.     img = imread([filePath,'\',imgName]);
  561.     axes(handles.axes1)
  562.     axis off
  563.     axis image
  564.     imshow(img);
  565.    
  566.    
  567.    
  568.     delete(handles.lineRef);
  569.     axes(handles.axes3)
  570.  
  571.     x = [1 handles.imgWidth];
  572.     y = [handles.imgOrder handles.imgOrder];
  573.    
  574.     handles.lineRef = line(x,y,'Color','red','LineStyle','--','LineWidth',2);
  575.    
  576.     handles.lcrop = 0;
  577.     handles.rcrop = 0;
  578.     handles.tcrop = 0;
  579.     handles.bcrop = 0;
  580.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  581.     handles.g1Val = 2;
  582.     handles.g2Val = 4;
  583.     handles.medVal = 20;
  584.     handles.diff = 2;
  585.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  586.  
  587.     guidata(hObject,handles);
  588.    
  589.    
  590.    
  591.     [H,W] = size(img);
  592.  
  593.     [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  594.    
  595.     img_gau = imgaussfilt(img_crp,handles.g1Val);
  596.     img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  597.     [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  598.  
  599.     img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  600.     img_med = filt_diff(img_med,H,W,handles.diff);
  601.  
  602.     [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  603.     mrg = 60;
  604.     [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  605.  
  606.     img_gau = imgaussfilt(img_flt,handles.g2Val);
  607.     img_diff = filt_diff(img_gau,H,W,handles.diff);
  608.  
  609.     [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  610.     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  611.     axes(handles.imgOutputAxes)
  612.     axis image
  613.     imshow(img_rl,[]);
  614.    
  615. end
  616.  
  617.  
  618. % --- Executes on slider movement.
  619. function rcropSlider_Callback(hObject, eventdata, handles)
  620. % hObject    handle to rcropSlider (see GCBO)
  621. % eventdata  reserved - to be defined in a future version of MATLAB
  622. % handles    structure with handles and user data (see GUIDATA)
  623.  
  624. % Hints: get(hObject,'Value') returns position of slider
  625. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  626. r_crop_normalized = get(handles.rcropSlider,'Value');
  627.  
  628. filePath = handles.filePath;
  629. imgFilePath = handles.imgFolderInfo;
  630. imgName = imgFilePath(handles.imgOrder).name;
  631.  
  632. img = imread([filePath,'\',imgName]);
  633. [H,W] = size(img);
  634.  
  635. % l_crop = 0;
  636. r_crop = r_crop_normalized*W;
  637. % t_crop = 0;
  638. % b_crop = 0;
  639.  
  640. handles.rcrop = r_crop;
  641. guidata(hObject,handles);
  642.  
  643. [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
  644.  
  645. axes(handles.axes1)
  646. axis off
  647. axis image
  648. imshow(img_crp);
  649.  
  650.  
  651.  
  652. [H,W] = size(img);
  653.  
  654. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  655.  
  656. img_gau = imgaussfilt(img_crp,handles.g1Val);
  657. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  658. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  659.  
  660. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  661. img_med = filt_diff(img_med,H,W,handles.diff);
  662.  
  663. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  664. mrg = 60;
  665. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  666.  
  667. img_gau = imgaussfilt(img_flt,handles.g2Val);
  668. img_diff = filt_diff(img_gau,H,W,handles.diff);
  669.  
  670. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  671. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  672. axes(handles.imgOutputAxes)
  673. axis image
  674. imshow(img_rl,[]);
  675.  
  676.  
  677. % --- Executes during object creation, after setting all properties.
  678. function rcropSlider_CreateFcn(hObject, eventdata, handles)
  679. % hObject    handle to rcropSlider (see GCBO)
  680. % eventdata  reserved - to be defined in a future version of MATLAB
  681. % handles    empty - handles not created until after all CreateFcns called
  682.  
  683. % Hint: slider controls usually have a light gray background.
  684. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  685.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  686. end
  687.  
  688.  
  689. % --- Executes on slider movement.
  690. function lcropSlider_Callback(hObject, eventdata, handles)
  691. % hObject    handle to lcropSlider (see GCBO)
  692. % eventdata  reserved - to be defined in a future version of MATLAB
  693. % handles    structure with handles and user data (see GUIDATA)
  694.  
  695. % Hints: get(hObject,'Value') returns position of slider
  696. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  697. l_crop_normalized = get(handles.lcropSlider,'Value')
  698.  
  699. filePath = handles.filePath;
  700. imgFilePath = handles.imgFolderInfo;
  701. imgName = imgFilePath(handles.imgOrder).name;
  702.  
  703. img = imread([filePath,'\',imgName]);
  704. [H,W] = size(img);
  705.  
  706. l_crop = l_crop_normalized*W;
  707. % r_crop = 0;
  708. % t_crop = 0;
  709. % b_crop = 0;
  710.  
  711. handles.lcrop = l_crop;
  712. guidata(hObject,handles);
  713.  
  714. [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
  715.  
  716. axes(handles.axes1)
  717. axis off
  718. axis image
  719. imshow(img_crp);
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726. [H,W] = size(img);
  727.  
  728. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  729.  
  730. img_gau = imgaussfilt(img_crp,handles.g1Val);
  731. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  732. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  733.  
  734. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  735. img_med = filt_diff(img_med,H,W,handles.diff);
  736.  
  737. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  738. mrg = 60;
  739. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  740.  
  741. img_gau = imgaussfilt(img_flt,handles.g2Val);
  742. img_diff = filt_diff(img_gau,H,W,handles.diff);
  743.  
  744. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  745. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  746. axes(handles.imgOutputAxes)
  747. axis image
  748. imshow(img_rl,[]);
  749.  
  750.  
  751.  
  752. % --- Executes during object creation, after setting all properties.
  753. function lcropSlider_CreateFcn(hObject, eventdata, handles)
  754. % hObject    handle to lcropSlider (see GCBO)
  755. % eventdata  reserved - to be defined in a future version of MATLAB
  756. % handles    empty - handles not created until after all CreateFcns called
  757.  
  758. % Hint: slider controls usually have a light gray background.
  759. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  760.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  761. end
  762.  
  763.  
  764. % --- Executes on slider movement.
  765. function tcropSlider_Callback(hObject, eventdata, handles)
  766. % hObject    handle to tcropSlider (see GCBO)
  767. % eventdata  reserved - to be defined in a future version of MATLAB
  768. % handles    structure with handles and user data (see GUIDATA)
  769.  
  770. % Hints: get(hObject,'Value') returns position of slider
  771. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  772. t_crop_normalized = get(handles.tcropSlider,'Value');
  773.  
  774. filePath = handles.filePath;
  775. imgFilePath = handles.imgFolderInfo;
  776. imgName = imgFilePath(handles.imgOrder).name;
  777.  
  778. img = imread([filePath,'\',imgName]);
  779. [H,W] = size(img);
  780.  
  781.  
  782. t_crop = t_crop_normalized*W;
  783.  
  784. handles.tcrop = t_crop;
  785. guidata(hObject,handles);
  786.  
  787. [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
  788.  
  789. axes(handles.axes1)
  790. axis off
  791. axis image
  792. imshow(img_crp);
  793.  
  794.  
  795.  
  796.  
  797. [H,W] = size(img);
  798.  
  799. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  800.  
  801. img_gau = imgaussfilt(img_crp,handles.g1Val);
  802. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  803. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  804.  
  805. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  806. img_med = filt_diff(img_med,H,W,handles.diff);
  807.  
  808. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  809. mrg = 60;
  810. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  811.  
  812. img_gau = imgaussfilt(img_flt,handles.g2Val);
  813. img_diff = filt_diff(img_gau,H,W,handles.diff);
  814.  
  815. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  816. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  817. axes(handles.imgOutputAxes)
  818. axis image
  819. imshow(img_rl,[]);
  820.  
  821.  
  822. % --- Executes during object creation, after setting all properties.
  823. function tcropSlider_CreateFcn(hObject, eventdata, handles)
  824. % hObject    handle to tcropSlider (see GCBO)
  825. % eventdata  reserved - to be defined in a future version of MATLAB
  826. % handles    empty - handles not created until after all CreateFcns called
  827.  
  828. % Hint: slider controls usually have a light gray background.
  829. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  830.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  831. end
  832.  
  833.  
  834. % --- Executes on slider movement.
  835. function bcropSlider_Callback(hObject, eventdata, handles)
  836. % hObject    handle to bcropSlider (see GCBO)
  837. % eventdata  reserved - to be defined in a future version of MATLAB
  838. % handles    structure with handles and user data (see GUIDATA)
  839.  
  840. % Hints: get(hObject,'Value') returns position of slider
  841. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  842. b_crop_normalized = get(handles.bcropSlider,'Value');
  843.  
  844. filePath = handles.filePath;
  845. imgFilePath = handles.imgFolderInfo;
  846. imgName = imgFilePath(handles.imgOrder).name;
  847.  
  848. img = imread([filePath,'\',imgName]);
  849. [H,W] = size(img);
  850.  
  851. % l_crop = 0;
  852. % r_crop = 0;
  853. % t_crop = 0;
  854. b_crop = b_crop_normalized*W;
  855.  
  856. handles.bcrop = b_crop;
  857. guidata(hObject,handles);
  858.  
  859. [img_crp,H,W] = crop(img,H,W,int16(handles.lcrop),int16(handles.rcrop),int16(handles.tcrop),int16(handles.bcrop));
  860.  
  861. axes(handles.axes1)
  862. axis off
  863. axis image
  864. imshow(img_crp);
  865.  
  866.  
  867.  
  868. [H,W] = size(img);
  869.  
  870. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  871.  
  872. img_gau = imgaussfilt(img_crp,handles.g1Val);
  873. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  874. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  875.  
  876. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  877. img_med = filt_diff(img_med,H,W,handles.diff);
  878.  
  879. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  880. mrg = 60;
  881. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  882.  
  883. img_gau = imgaussfilt(img_flt,handles.g2Val);
  884. img_diff = filt_diff(img_gau,H,W,handles.diff);
  885.  
  886. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  887. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  888. axes(handles.imgOutputAxes)
  889. axis image
  890. imshow(img_rl,[]);
  891.  
  892.  
  893.  
  894. % --- Executes during object creation, after setting all properties.
  895. function bcropSlider_CreateFcn(hObject, eventdata, handles)
  896. % hObject    handle to bcropSlider (see GCBO)
  897. % eventdata  reserved - to be defined in a future version of MATLAB
  898. % handles    empty - handles not created until after all CreateFcns called
  899.  
  900. % Hint: slider controls usually have a light gray background.
  901. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  902.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  903. end
  904.  
  905.  
  906. % --- Executes on slider movement.
  907. function slider8_Callback(hObject, eventdata, handles)
  908. % hObject    handle to slider8 (see GCBO)
  909. % eventdata  reserved - to be defined in a future version of MATLAB
  910. % handles    structure with handles and user data (see GUIDATA)
  911.  
  912. % Hints: get(hObject,'Value') returns position of slider
  913. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  914.  
  915.  
  916. % --- Executes during object creation, after setting all properties.
  917. function slider8_CreateFcn(hObject, eventdata, handles)
  918. % hObject    handle to slider8 (see GCBO)
  919. % eventdata  reserved - to be defined in a future version of MATLAB
  920. % handles    empty - handles not created until after all CreateFcns called
  921.  
  922. % Hint: slider controls usually have a light gray background.
  923. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  924.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  925. end
  926.  
  927.  
  928. % --- Executes on slider movement.
  929. function g1Slider_Callback(hObject, eventdata, handles)
  930. % hObject    handle to g1Slider (see GCBO)
  931. % eventdata  reserved - to be defined in a future version of MATLAB
  932. % handles    structure with handles and user data (see GUIDATA)
  933.  
  934. % Hints: get(hObject,'Value') returns position of slider
  935. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  936. handles.g1Val = get(handles.g1Slider,'Value');
  937. set(handles.g1ValLabel, 'String', handles.g1Val);
  938. guidata(hObject,handles);
  939.  
  940. % filePath = handles.filePath;
  941. imgFilePath = handles.imgFolderInfo;
  942. imgName = imgFilePath(handles.imgOrder).name;
  943.  
  944. img = imread([handles.filePath,'\',imgName]);
  945.    
  946.  
  947. [H,W] = size(img);
  948.  
  949. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  950.  
  951. img_gau = imgaussfilt(img_crp,handles.g1Val);
  952. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  953. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  954.  
  955. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  956. img_med = filt_diff(img_med,H,W,handles.diff);
  957.  
  958. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  959. mrg = 60;
  960. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  961.  
  962. img_gau = imgaussfilt(img_flt,handles.g2Val);
  963. img_diff = filt_diff(img_gau,H,W,handles.diff);
  964.  
  965. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  966. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  967. axes(handles.imgOutputAxes)
  968. axis image
  969. imshow(img_rl,[]);
  970.    
  971.  
  972.  
  973. % --- Executes during object creation, after setting all properties.
  974. function g1Slider_CreateFcn(hObject, eventdata, handles)
  975. % hObject    handle to g1Slider (see GCBO)
  976. % eventdata  reserved - to be defined in a future version of MATLAB
  977. % handles    empty - handles not created until after all CreateFcns called
  978.  
  979. % Hint: slider controls usually have a light gray background.
  980. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  981.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  982. end
  983.  
  984.  
  985. % --- Executes on slider movement.
  986. function g2Slider_Callback(hObject, eventdata, handles)
  987. % hObject    handle to g2Slider (see GCBO)
  988. % eventdata  reserved - to be defined in a future version of MATLAB
  989. % handles    structure with handles and user data (see GUIDATA)
  990.  
  991. % Hints: get(hObject,'Value') returns position of slider
  992. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  993. handles.g2Val = get(handles.g2Slider,'Value');
  994. set(handles.g2ValLabel, 'String', handles.g2Val);
  995. guidata(hObject,handles);
  996.  
  997. % filePath = handles.filePath;
  998. imgFilePath = handles.imgFolderInfo;
  999. imgName = imgFilePath(handles.imgOrder).name;
  1000.  
  1001. img = imread([handles.filePath,'\',imgName]);
  1002.    
  1003.  
  1004. [H,W] = size(img);
  1005.  
  1006. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  1007.  
  1008. img_gau = imgaussfilt(img_crp,handles.g1Val);
  1009. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  1010. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  1011.  
  1012. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  1013. img_med = filt_diff(img_med,H,W,handles.diff);
  1014.  
  1015. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  1016. mrg = 60;
  1017. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  1018.  
  1019. img_gau = imgaussfilt(img_flt,handles.g2Val);
  1020. img_diff = filt_diff(img_gau,H,W,handles.diff);
  1021.  
  1022. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  1023. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1024. axes(handles.imgOutputAxes)
  1025. axis image
  1026. imshow(img_rl,[]);
  1027.  
  1028. % --- Executes during object creation, after setting all properties.
  1029. function g2Slider_CreateFcn(hObject, eventdata, handles)
  1030. % hObject    handle to g2Slider (see GCBO)
  1031. % eventdata  reserved - to be defined in a future version of MATLAB
  1032. % handles    empty - handles not created until after all CreateFcns called
  1033.  
  1034. % Hint: slider controls usually have a light gray background.
  1035. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1036.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  1037. end
  1038.  
  1039.  
  1040. % --- Executes on slider movement.
  1041. function medSlider_Callback(hObject, eventdata, handles)
  1042. % hObject    handle to medSlider (see GCBO)
  1043. % eventdata  reserved - to be defined in a future version of MATLAB
  1044. % handles    structure with handles and user data (see GUIDATA)
  1045.  
  1046. % Hints: get(hObject,'Value') returns position of slider
  1047. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  1048. handles.medVal = get(handles.medSlider,'Value');
  1049. set(handles.medValLabel, 'String', handles.medVal);
  1050. guidata(hObject,handles);
  1051.  
  1052. % filePath = handles.filePath;
  1053. imgFilePath = handles.imgFolderInfo;
  1054. imgName = imgFilePath(handles.imgOrder).name;
  1055.  
  1056. img = imread([handles.filePath,'\',imgName]);
  1057.    
  1058.  
  1059. [H,W] = size(img);
  1060.  
  1061. [img_crp,H,W] = crop(img,H,W,handles.lcrop,handles.rcrop,handles.tcrop,handles.bcrop);
  1062.  
  1063. img_gau = imgaussfilt(img_crp,handles.g1Val);
  1064. img_diff_bef = filt_diff(img_gau,H,W,handles.diff);
  1065. [img_rl_bef,ind_rl_bef,avg_rl_bef] = find_srf(img_diff_bef,H,W); %img_rl
  1066.  
  1067. img_med = medfilt2(img_gau,[handles.medVal*2 handles.medVal*2],'symmetric');
  1068. img_med = filt_diff(img_med,H,W,handles.diff);
  1069.  
  1070. [img_idl,ind_idl,~] = find_srf(img_med,H,W);
  1071. mrg = 60;
  1072. [img_flt,H,W] = flatten(img_crp,H,W,ind_idl,mrg);
  1073.  
  1074. img_gau = imgaussfilt(img_flt,handles.g2Val);
  1075. img_diff = filt_diff(img_gau,H,W,handles.diff);
  1076.  
  1077. [img_rl,ind_rl,avg_rl] = find_srf(img_diff,H,W); %img_rl
  1078. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1079. axes(handles.imgOutputAxes)
  1080. axis image
  1081. imshow(img_rl,[]);
  1082.  
  1083. % --- Executes during object creation, after setting all properties.
  1084. function medSlider_CreateFcn(hObject, eventdata, handles)
  1085. % hObject    handle to medSlider (see GCBO)
  1086. % eventdata  reserved - to be defined in a future version of MATLAB
  1087. % handles    empty - handles not created until after all CreateFcns called
  1088.  
  1089. % Hint: slider controls usually have a light gray background.
  1090. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1091.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  1092. end
Advertisement
Add Comment
Please, Sign In to add comment