Rose-Hulman Robotics Team

Changeset 663

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

fixed problem with all figures not appearing

Location:
branches/2010-image-rec
Files:
2 modified

Legend:

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

    r662 r663  
    106106mask = imclose(mask, se); 
    107107 
    108 textureactual=texture; 
    109 for threshold = .3:.02:.5 
    110     texture(textureactual > threshold & mask == 0) = 1; 
    111     texture(texture ~= 1) = 0; 
    112     imtool(texture); 
     108line_mask = texture; 
     109for threshold = .42 
     110    line_mask(texture > threshold & mask == 0) = 1; 
     111    line_mask(texture <= threshold | mask ~= 0) = 0; 
     112    imtool(line_mask); 
    113113end 
    114114 
     
    124124line([left_x right_x right_x left_x left_x], ... 
    125125     [top_y top_y bottom_y bottom_y top_y]); 
     126  
     127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 
     128  
     129 figure(3); 
     130  
     131 [H,T,R] = hough(line_mask); 
     132       imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); 
     133       xlabel('\theta'), ylabel('\rho'); 
     134       axis on, axis normal, hold on; 
     135       P  = houghpeaks(H,5,'NHoodSize',[161,161])%ceil(0.3*max(H(:)))); 
     136       x = T(P(:,2));  
     137       y = R(P(:,1)); 
     138       plot(x,y,'s','color','white'); 
     139  
     140  lines = houghlines(line_mask,T,R,P,'FillGap',5,'MinLength',7); 
     141       figure, imshow(im_rgb), hold on 
     142       max_len = 0; 
     143       for k = 1:length(lines) 
     144         xy = [lines(k).point1; lines(k).point2]; 
     145         plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','blue'); 
     146  
     147         % plot beginnings and ends of lines 
     148         plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); 
     149         plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); 
     150  
     151         % determine the endpoints of the longest line segment  
     152         len = norm(lines(k).point1 - lines(k).point2); 
     153         if ( len > max_len) 
     154           max_len = len; 
     155           xy_long = xy; 
     156         end 
     157       end 
     158  
     159       % highlight the longest line segment 
     160       plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan'); 
     161  
     162  
     163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    126164 
    127165fprintf('Done\n'); 
  • branches/2010-image-rec/hist_test.m

    r661 r663  
    127127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 
    128128  
     129 figure(3); 
     130  
    129131 [H,T,R] = hough(line_mask); 
    130132       imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); 
     
    141143       for k = 1:length(lines) 
    142144         xy = [lines(k).point1; lines(k).point2]; 
    143          plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green'); 
     145         plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','blue'); 
    144146  
    145147         % plot beginnings and ends of lines