Rose-Hulman Robotics Team

Changeset 699

Show
Ignore:
Timestamp:
02/22/10 00:53:34 (2 years ago)
Author:
taborts
Message:

removed references to missing images, left only 3 good examples and one bad

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/2010-image-rec/hist_test.m

    r698 r699  
    11function hist_test(fn) 
    22 
    3 show_images = 0; 
     3show_images = 1; 
    44 
    55if show_images 
    66    close all; 
    7     %fn = 'images/course-walk/cimg4943.jpg'; 
    8     %fn = 'images/course-walk/cimg4921.jpg'; 
    9     fn = 'images/elphel/cam-000078.jpeg'; 
    10     %fn = 'images/elphel/cam-000086.jpeg'; % Hard image 
    11     %fn = 'images/course-walk/cimg4989.jpg'; 
    12     %fn = 'images/elphel-09/test29.jpg'; 
     7     
     8     
     9    %fn = 'images/elphel/cam-000086.jpeg'; % Hard image, example of failure 
     10     
     11    %fn = 'images/elphel/cam-000087.jpeg'; 
    1312    %fn = 'images/elphel/cam-000094.jpeg'; 
    1413    %fn = 'images/elphel/cam-000081.jpeg'; 
     
    6160% Area at the bottom of the image assumed to be grass, clear of obstacles 
    6261clear_area = im(round(clear_area_top * rows):end, ... 
    63                 round(clear_area_left * cols): ... 
    64                     round((1 - clear_area_left) * cols), :); 
     62    round(clear_area_left * cols): ... 
     63    round((1 - clear_area_left) * cols), :); 
    6564 
    6665% Histograms of each channel 
     
    155154right_x = round((1 - clear_area_left) * cols); 
    156155line([left_x right_x right_x left_x left_x], ... 
    157      [top_y top_y bottom_y bottom_y top_y],'LineWidth',4,'Color','red'); 
     156    [top_y top_y bottom_y bottom_y top_y],'LineWidth',4,'Color','red'); 
    158157scatter(bottomlist(:,1), bottomlist(:,2), '.'); 
    159158 
     
    171170axis on, axis normal, hold on; 
    172171P  = houghpeaks(H,2,'NHoodSize',[161,161],'Threshold',ceil(0.5*max(H(:)))); 
    173 x = T(P(:,2));  
     172x = T(P(:,2)); 
    174173y = R(P(:,1)); 
    175174plot(x,y,'s','color','white'); 
     
    181180figure('Name','Hough lines'), imshow(im_rgb), hold on 
    182181for k = 1:length(lns) 
    183         xy = [lns(k).point1; lns(k).point2]; 
    184         plot(xy(:,1),xy(:,2),'LineWidth',8,'Color','blue'); 
    185  
    186         % plot beginnings and ends of lines 
    187         plot(xy(1,1),xy(1,2),'x','LineWidth',8,'Color','yellow'); 
    188         plot(xy(2,1),xy(2,2),'x','LineWidth',8,'Color','red'); 
     182    xy = [lns(k).point1; lns(k).point2]; 
     183    plot(xy(:,1),xy(:,2),'LineWidth',8,'Color','blue'); 
     184     
     185    % plot beginnings and ends of lines 
     186    plot(xy(1,1),xy(1,2),'x','LineWidth',8,'Color','yellow'); 
     187    plot(xy(2,1),xy(2,2),'x','LineWidth',8,'Color','red'); 
    189188end 
    190189 
     
    198197 
    199198function rgb = bw2rgb(bw) 
    200         rgb = zeros(size(bw, 1), size(bw, 2), 3); 
    201         rgb(:,:,1) = bw; 
    202         rgb(:,:,2) = bw; 
    203         rgb(:,:,3) = bw; 
     199rgb = zeros(size(bw, 1), size(bw, 2), 3); 
     200rgb(:,:,1) = bw; 
     201rgb(:,:,2) = bw; 
     202rgb(:,:,3) = bw; 
    204203end 
    205204 
    206205function bottomlist = bottomFind(bw) 
    207     list = zeros(size(bw,2),2); 
    208     for i = 1:size(bw,2) 
    209         bw(1,:) = 1; 
    210         list(i,2) = find(bw(:,i) == 1, 1, 'last'); 
    211         list(i,1) = i; 
    212     end 
    213      
    214     bottomlist = list(list(:,2) ~= 1, :); 
    215      
    216 end 
     206list = zeros(size(bw,2),2); 
     207for i = 1:size(bw,2) 
     208    bw(1,:) = 1; 
     209    list(i,2) = find(bw(:,i) == 1, 1, 'last'); 
     210    list(i,1) = i; 
     211end 
     212 
     213bottomlist = list(list(:,2) ~= 1, :); 
     214 
     215end