Difference between revisions of "LaneDetection"

From BITPlan Wiki
Jump to navigation Jump to search
Line 4: Line 4:
 
https://github.com/naokishibuya/car-finding-lane-lines
 
https://github.com/naokishibuya/car-finding-lane-lines
  
 +
= Color Filter =
 
[[File:show7141511869219163446.jpg|800px]]
 
[[File:show7141511869219163446.jpg|800px]]
 
[[File:show6147902249785399207.jpg|800px]]
 
[[File:show6147902249785399207.jpg|800px]]
 +
 +
<source lang='java'>
 +
@Test
 +
  public void testColorFilter() throws Exception {
 +
    ColorFilter cf=new ColorFilter();
 +
    cf.setMinColorRGB( 65,  85,  85);
 +
    cf.setMaxColorRGB(140, 140, 140);
 +
    Mat frame = getTestImage();
 +
    Mat gray=new Mat();
 +
    Imgproc.cvtColor(frame, gray, Imgproc.COLOR_BGR2GRAY);
 +
    assertEquals(2458261,Core.countNonZero(gray));
 +
    Mat colorFiltered = cf.filter(frame);
 +
    assertEquals(colorFiltered.width(), frame.width());
 +
    Mat cfGray=new Mat();
 +
    Imgproc.cvtColor(colorFiltered, cfGray, Imgproc.COLOR_BGR2GRAY);
 +
    assertEquals(173768,Core.countNonZero(cfGray));
 +
    if (show) {
 +
      ImageUtils.show(getTestImage());
 +
      ImageUtils.show(gray);
 +
      ImageUtils.show(colorFiltered);
 +
    }
 +
  }
 +
</source>

Revision as of 08:11, 14 March 2020

Click here to comment see Self Driving RC Car

see https://github.com/naokishibuya/car-finding-lane-lines

Color Filter

Show7141511869219163446.jpg Show6147902249785399207.jpg

 @Test
  public void testColorFilter() throws Exception {
    ColorFilter cf=new ColorFilter();
    cf.setMinColorRGB( 65,  85,  85);
    cf.setMaxColorRGB(140, 140, 140);
    Mat frame = getTestImage();
    Mat gray=new Mat();
    Imgproc.cvtColor(frame, gray, Imgproc.COLOR_BGR2GRAY);
    assertEquals(2458261,Core.countNonZero(gray));
    Mat colorFiltered = cf.filter(frame);
    assertEquals(colorFiltered.width(), frame.width());
    Mat cfGray=new Mat();
    Imgproc.cvtColor(colorFiltered, cfGray, Imgproc.COLOR_BGR2GRAY);
    assertEquals(173768,Core.countNonZero(cfGray));
    if (show) {
      ImageUtils.show(getTestImage());
      ImageUtils.show(gray);
      ImageUtils.show(colorFiltered); 
    }
  }