Changeset 655
- Timestamp:
- 02/06/10 13:42:26 (2 years ago)
- Files:
-
- 1 modified
-
branches/2010-image-rec/hist_test.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2010-image-rec/hist_test.m
r654 r655 4 4 fn = 'images/course-walk/cimg4943.jpg'; 5 5 fn = 'images/course-walk/cimg4921.jpg'; 6 fn = 'images/elphel/cam-000078.jpeg'; 7 fn = 'images/elphel/cam-000086.jpeg'; % Hard image 6 8 fn = 'images/course-walk/cimg4989.jpg'; 7 9 fn = 'images/elphel/cam-000094.jpeg'; 8 fn = 'images/elphel/cam-000086.jpeg'; % Hard image9 10 fn = 'images/elphel/cam-000081.jpeg'; 10 fn = 'images/elphel/cam-000078.jpeg';11 11 12 12 fprintf('Running on %s... ', fn); … … 23 23 s_mean_factor = 0.2; % Seems to most effect obstacle detection 24 24 v_mean_factor = 0.1; % Obstacles and lines 25 t_mean_factor = 0. 0;26 resize_factor = 4;25 t_mean_factor = 0.; 26 texture_band = 2; 27 27 28 28 im_rgb = imread(fn); 29 % im_rgb = imresize(im_rgb, 0.1); 30 im_hsv = rgb2hsv(imresize( 31 rows = size(im_rgb, 1); 32 cols = size(im_rgb, 2); 29 30 rows = size(im_rgb, 1)/4; 31 cols = size(im_rgb, 2)/4; 33 32 34 33 im = zeros(rows, cols, 4); 35 im(:,:,1:3) = rgb2hsv(im_rgb); 34 imbig = rgb2hsv(im_rgb); 35 im_rgb = imresize(im_rgb, 0.25); 36 37 36 38 fsobel = fspecial('sobel'); 37 hedges = (filter2(fsobel , im(:,:,2)) + filter2(fsobel, im(:,:,3))) / 2;38 vedges = (filter2(fsobel', im(:,:,2)) + filter2(fsobel, im(:,:,3))) / 2;39 hedges = filter2(fsobel , imbig(:,:,texture_band)); 40 vedges = filter2(fsobel', imbig(:,:,texture_band)); 39 41 edges = sqrt(hedges .^ 2 + vedges .^ 2); 40 42 texture = filter2(fspecial('average', 10), edges); … … 42 44 texture = filter2(fspecial('average', 10), texture); 43 45 texture = filter2(fspecial('average', 10), texture); 44 %texture = filter2(fspecial('average', 10), texture);45 %texture = filter2(fspecial('average', 10), texture);46 %texture = filter2(fspecial('average', 10), texture);47 %texture = filter2(fspecial('average', 10), texture);46 texture = filter2(fspecial('average', 10), texture); 47 texture = filter2(fspecial('average', 10), texture); 48 texture = filter2(fspecial('average', 10), texture); 49 texture = filter2(fspecial('average', 10), texture); 48 50 texture(texture > 1) = 1; 49 51 … … 51 53 imshow([edges; texture]); 52 54 55 texture=imresize(texture,.25); 56 57 im(:,:,1:3) = rgb2hsv(im_rgb); 53 58 im(:,:,4) = texture; 54 59 … … 84 89 for r = 1:rows 85 90 for c = 1:cols 86 if grass_h_mask(h(r,c)) && ...grass_s_mask(s(r,c)) && ...91 if grass_h_mask(h(r,c)) && grass_s_mask(s(r,c)) && ... 87 92 grass_v_mask(v(r,c)) && grass_t_mask(t(r,c)) 88 93 mask(r,c) = 1;

