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

Commit 2665fcd

Browse files
committed
Merge branch 'release/0.7'
2 parents e8b796b + b4b4e1f commit 2665fcd

File tree

66 files changed

+1444
-1053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1444
-1053
lines changed

README.md

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ Download the jar file from the releases page (https://github.com/kylecorry31/Rob
1717

1818
Then add both files to your Eclipse buildpath.
1919

20-
### Example
21-
```Java
22-
CameraSource camera = new CameraSource(new UsbCamera("cam", 0));
23-
camera.setExposure(0);
24-
camera.setBrightness(0);
25-
camera.setResolution(640, 480);
26-
27-
TargetDetector targetDetector = new TargetDetector(new ExampleSpecs(), (targets) -> {
28-
// do something
29-
});
30-
camera.setDetector(targetDetector);
31-
32-
camera.start();
33-
```
3420

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

43-
TargetGroupDetector pegDetector = new TargetGroupDetector(new PegSingleRetroreflectiveSpecs(), new PegGroupSpecs(), (targets) -> {
44-
// Draw the most probable target on the output stream
45-
if (!targets.isEmpty()) {
46-
Mat image = camera.getPicture();
47-
Rect boundary = new Rect((int) Math.round(targets.get(0).getPosition().x),
48-
(int) Math.round(targets.get(0).getPosition().y),
49-
(int) Math.round(targets.get(0).getWidth()),
50-
(int) Math.round(targets.get(0).getHeight()));
51-
Imgproc.rectangle(image, boundary.tl(), boundary.br(), new Scalar(0, 255, 0));
52-
outputStream.putFrame(image);
53-
}
54-
});
55-
56-
camera.setDetector(pegDetector);
57-
5829
camera.start();
30+
31+
final int MIN_PIXEL_AREA = 200;
32+
33+
PegDetector pegDetector = new PegDetector(new IndividualPegDetector(new BrightnessFilter(200, 255), MIN_PIXEL_AREA));
34+
35+
Mat image = camera.getPicture();
36+
37+
List<Targets> targets = pegDetector.detect(image);
38+
39+
for(Target target: targets){
40+
Rect boundary = new Rect((int) Math.round(target.getPosition().x),
41+
(int) Math.round(target.getPosition().y),
42+
(int) Math.round(target.getWidth()),
43+
(int) Math.round(target.getHeight()));
44+
Imgproc.rectangle(image, boundary.tl(), boundary.br(), new Scalar(0, 255, 0));
45+
outputStream.putFrame(image);
46+
}
5947
```

build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ plugins {
66
}
77

88
group 'com.kylecorry.frc.vision'
9-
version '0.6'
9+
version '0.7'
1010

1111

1212
sourceCompatibility = 1.8
1313

1414
repositories {
1515
mavenCentral()
1616
maven {
17-
name = "GradleRio"
18-
url = "http://dev.imjac.in/maven"
17+
name = 'GradleRio'
18+
url = 'http://dev.imjac.in/maven'
1919
}
2020

21-
maven { url "https://plugins.gradle.org/m2/" }
21+
maven { url 'https://plugins.gradle.org/m2/' }
2222
}
2323

2424
dependencies {
@@ -28,10 +28,10 @@ dependencies {
2828
}
2929

3030
wpi {
31-
wpilibVersion = "+" // The WPILib version to use. For this version of GradleRIO, must be a 2017 version
32-
ntcoreVersion = "+" // The NetworkTables Core version to use.
33-
opencvVersion = "+" // The OpenCV version to use
34-
cscoreVersion = "+" // The CSCore version to use
31+
wpilibVersion = '+' // The WPILib version to use. For this version of GradleRIO, must be a 2017 version
32+
ntcoreVersion = '+' // The NetworkTables Core version to use.
33+
opencvVersion = '+' // The OpenCV version to use
34+
cscoreVersion = '+' // The CSCore version to use
3535
}
3636

3737
jar {

libs/Geometry-0.5.jar

-5 KB
Binary file not shown.

libs/Geometry-0.6.1.jar

14.4 KB
Binary file not shown.

libs/libopencv_java340.so

69 MB
Binary file not shown.

libs/opencv_java340_32.dll

27.4 MB
Binary file not shown.

libs/opencv_java340_64.dll

43.8 MB
Binary file not shown.

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rootProject.name = 'Robot Vision API'
1+
rootProject.name = 'RobotVisionAPI'
22

src/main/java/com/kylecorry/frc/vision/CameraSource.java

Lines changed: 0 additions & 223 deletions
This file was deleted.

src/main/java/com/kylecorry/frc/vision/Detector.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)