import org.opencv.imgproc.Imgproc;
import org.opencv.videoio.VideoCapture;
-import edu.wpi.first.wpilibj.networktables.NetworkTable;
-
/**
*
*/
*/
static {
System
- .setProperty(
- "java.library.path",
- System.getProperty("java.library.path")
- + ":/home/cindy/Robotics/Workspace/opencv-3.1.0/cmake/lib" //path to opencv_java310
- + ":/home/cindy/wpilib/cpp/current/lib");
- System.out.println(System.getProperty("java.library.path"));
+ .setProperty(
+ "java.library.path",
+ System.getProperty("java.library.path")
+ + ":/home/cindy/Robotics/Workspace/opencv-3.1.0/cmake/lib"); // path
+ // to
+ // opencv_java310
+ // System.out.println(System.getProperty("java.library.path"));
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
- NetworkTable.setClientMode();
- NetworkTable.setIPAddress("roborio-3502.local");
}
// constants for the color rbg values
public static final Scalar
- RED = new Scalar(0, 0, 255),
- BLUE = new Scalar(255, 0, 0),
- GREEN = new Scalar(0, 255, 0),
- BLACK = new Scalar(0, 0, 0),
- YELLOW = new Scalar(0, 255, 255),
- // these are the threshold values in order
- // LOWER_BOUNDS = new Scalar(58, 0, 109),
- // UPPER_BOUNDS = new Scalar(93, 255, 240);
- LOWER_BOUNDS = new Scalar(6, 15, 13),
- UPPER_BOUNDS = new Scalar(31, 115, 45);
+ RED = new Scalar(0, 0, 255),
+ BLUE = new Scalar(255, 0, 0),
+ GREEN = new Scalar(0, 255, 0),
+ BLACK = new Scalar(0, 0, 0),
+ YELLOW = new Scalar(0, 255, 255),
+ // these are the threshold values in order
+ LOWER_BOUNDS = new Scalar(58, 0, 109),
+ UPPER_BOUNDS = new Scalar(93, 255, 240);
// the size for resing the image
public static final Size resize = new Size(320, 240);
* command line arguments
* just the main loop for the program and the entry points
*/
- public static void main(String[] args) {
+ public TowerTracker() {
// TODO Auto-generated method stub
matOriginal = new Mat();
matHSV = new Mat();
matThresh = new Mat();
clusters = new Mat();
matHeirarchy = new Mat();
- NetworkTable table = NetworkTable.getTable("SmartDashboard");
- // main loop of the program
- while (shouldRun) {
- try {
- // opens up the camera stream and tries to load it
- videoCapture = new VideoCapture();
- // replaces the ##.## with your team number
- videoCapture.open("http://10.##.##.11/mjpg/video.mjpg");
- // Example
- // cap.open("http://10.30.19.11/mjpg/video.mjpg");
- // wait until it is opened
- while (!videoCapture.isOpened()) {
- }
- // time to actually process the acquired images
- processImage();
- } catch (Exception e) {
- e.printStackTrace();
- break;
- }
- }
- // make sure the java process quits when the loop finishes
+ processImage();
videoCapture.release();
- System.exit(0);
}
/**