Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Jan 5, 2018
2 parents e8b796b + b4b4e1f commit 2665fcd
Show file tree
Hide file tree
Showing 66 changed files with 1,444 additions and 1,053 deletions.
46 changes: 17 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ Download the jar file from the releases page (https://github.com/kylecorry31/Rob

Then add both files to your Eclipse buildpath.

### Example
```Java
CameraSource camera = new CameraSource(new UsbCamera("cam", 0));
camera.setExposure(0);
camera.setBrightness(0);
camera.setResolution(640, 480);

TargetDetector targetDetector = new TargetDetector(new ExampleSpecs(), (targets) -> {
// do something
});
camera.setDetector(targetDetector);

camera.start();
```

### Displaying the most probable target example
```Java
Expand All @@ -40,20 +26,22 @@ camera.setExposure(0);
camera.setBrightness(0);
camera.setResolution(640, 480);

TargetGroupDetector pegDetector = new TargetGroupDetector(new PegSingleRetroreflectiveSpecs(), new PegGroupSpecs(), (targets) -> {
// Draw the most probable target on the output stream
if (!targets.isEmpty()) {
Mat image = camera.getPicture();
Rect boundary = new Rect((int) Math.round(targets.get(0).getPosition().x),
(int) Math.round(targets.get(0).getPosition().y),
(int) Math.round(targets.get(0).getWidth()),
(int) Math.round(targets.get(0).getHeight()));
Imgproc.rectangle(image, boundary.tl(), boundary.br(), new Scalar(0, 255, 0));
outputStream.putFrame(image);
}
});

camera.setDetector(pegDetector);

camera.start();

final int MIN_PIXEL_AREA = 200;

PegDetector pegDetector = new PegDetector(new IndividualPegDetector(new BrightnessFilter(200, 255), MIN_PIXEL_AREA));

Mat image = camera.getPicture();

List<Targets> targets = pegDetector.detect(image);

for(Target target: targets){
Rect boundary = new Rect((int) Math.round(target.getPosition().x),
(int) Math.round(target.getPosition().y),
(int) Math.round(target.getWidth()),
(int) Math.round(target.getHeight()));
Imgproc.rectangle(image, boundary.tl(), boundary.br(), new Scalar(0, 255, 0));
outputStream.putFrame(image);
}
```
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ plugins {
}

group 'com.kylecorry.frc.vision'
version '0.6'
version '0.7'


sourceCompatibility = 1.8

repositories {
mavenCentral()
maven {
name = "GradleRio"
url = "http://dev.imjac.in/maven"
name = 'GradleRio'
url = 'http://dev.imjac.in/maven'
}

maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://plugins.gradle.org/m2/' }
}

dependencies {
Expand All @@ -28,10 +28,10 @@ dependencies {
}

wpi {
wpilibVersion = "+" // The WPILib version to use. For this version of GradleRIO, must be a 2017 version
ntcoreVersion = "+" // The NetworkTables Core version to use.
opencvVersion = "+" // The OpenCV version to use
cscoreVersion = "+" // The CSCore version to use
wpilibVersion = '+' // The WPILib version to use. For this version of GradleRIO, must be a 2017 version
ntcoreVersion = '+' // The NetworkTables Core version to use.
opencvVersion = '+' // The OpenCV version to use
cscoreVersion = '+' // The CSCore version to use
}

jar {
Expand Down
Binary file removed libs/Geometry-0.5.jar
Binary file not shown.
Binary file added libs/Geometry-0.6.1.jar
Binary file not shown.
Binary file added libs/libopencv_java340.so
Binary file not shown.
Binary file added libs/opencv_java340_32.dll
Binary file not shown.
Binary file added libs/opencv_java340_64.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'Robot Vision API'
rootProject.name = 'RobotVisionAPI'

223 changes: 0 additions & 223 deletions src/main/java/com/kylecorry/frc/vision/CameraSource.java

This file was deleted.

54 changes: 0 additions & 54 deletions src/main/java/com/kylecorry/frc/vision/Detector.java

This file was deleted.

Loading

0 comments on commit 2665fcd

Please sign in to comment.