What to upload for RPI Vision

rpi
vision

#1

Hey guys. I’ve created a vision pipeline using GRIP and I’m also writing a client side application for it to read the values. Now I’m on this screen here:

Capture

And I don’t know what to upload to this. Do I upload my vision pipeline? Or do I upload my client program? Also, how do I export either of them as a JAR file? Thanks

E: Grammar/clarification


#2

Build the program using gradle. That compiles it into a single .jar file. You’ll find it in the directory/build/libs/-all.jar

then, upload that file


#3

What program do I build? The pipeline or the client side program?


#4

They should be built together. We may be envisioning separate things, but for us the pipeline is inside of the raspberry program itself.

If your pipeline has a main method, then you should build that.


#5

Just download their example program, implement your pipeline inside of it, and use gradle to build their example.

For example, our Github account has a vision project that can be built and run on the raspberry pi. It only draws a circle on the dead center of the image, and outputs that to a secondary camera stream so you can see the modified image.

Feel free to use it. With regard to your GRIP pipeline, you just need to include the logic in your process() method (and include any supporting functions your pipeline calls).


#6

Thanks. I’m trying to access your GitHub repo but I think you have it set to private.


#7

Sorry about that, try again. Public now.


#8

@Uberlyuber Just added this so you’d be notified it’s public now.


#9

We tried to build your code with our pipeline but it doesn’t work when I run gradlew build

gradlew build

Task :compileJava FAILED
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:15: error: package com.google.gson does not exist
import com.google.gson.Gson;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:16: error: package com.google.gson does not exist
import com.google.gson.GsonBuilder;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:17: error: package com.google.gson does not exist
import com.google.gson.JsonArray;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:18: error: package com.google.gson does not exist
import com.google.gson.JsonElement;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:19: error: package com.google.gson does not exist
import com.google.gson.JsonObject;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:20: error: package com.google.gson does not exist
import com.google.gson.JsonParser;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:22: error: package edu.wpi.cscore does not exist
import edu.wpi.cscore.CvSource;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:23: error: package edu.wpi.cscore does not exist
import edu.wpi.cscore.MjpegServer;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:24: error: package edu.wpi.cscore does not exist
import edu.wpi.cscore.UsbCamera;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:25: error: package edu.wpi.cscore does not exist
import edu.wpi.cscore.VideoSource;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:26: error: package edu.wpi.first.cameraserver does not exist
import edu.wpi.first.cameraserver.CameraServer;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:27: error: package edu.wpi.first.networktables does not exist
import edu.wpi.first.networktables.NetworkTable;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:28: error: package edu.wpi.first.networktables does not exist
import edu.wpi.first.networktables.NetworkTableEntry;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:29: error: package edu.wpi.first.networktables does not exist
import edu.wpi.first.networktables.NetworkTableInstance;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:30: error: package edu.wpi.first.vision does not exist
import edu.wpi.first.vision.VisionPipeline;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:31: error: package edu.wpi.first.vision does not exist
import edu.wpi.first.vision.VisionThread;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:33: error: package org.opencv.core does not exist
import org.opencv.core.*;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:34: error: package org.opencv.imgproc does not exist
import org.opencv.imgproc.Imgproc;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:35: error: package org.opencv.imgproc does not exist
import org.opencv.imgproc.LineSegmentDetector;
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:100: error: cannot find symbol
public static boolean readCameraConfig(JsonObject config) {
^
symbol: class JsonObject
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:188: error: cannot find symbol
public static VideoSource startCamera(CameraConfig config) {
^
symbol: class VideoSource
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:79: error: cannot find symbol
public JsonObject config;
^
symbol: class JsonObject
location: class CameraConfig
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:80: error: cannot find symbol
public JsonElement streamConfig;
^
symbol: class JsonElement
location: class CameraConfig
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:209: error: cannot find symbol
public static class MyPipeline implements VisionPipeline {
^
symbol: class VisionPipeline
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:210: error: cannot find symbol
private Mat hsvThresholdOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:211: error: cannot find symbol
private Mat cvBitwiseNotOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:212: error: cannot find symbol
private Mat cvErodeOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:213: error: cannot find symbol
private Mat maskOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:223: error: cannot find symbol
@Override public void process(Mat source0) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:259: error: cannot find symbol
public Mat hsvThresholdOutput() {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:267: error: cannot find symbol
public Mat cvBitwiseNotOutput() {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:275: error: cannot find symbol
public Mat cvErodeOutput() {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:283: error: cannot find symbol
public Mat maskOutput() {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:304: error: cannot find symbol
private void hsvThreshold(Mat input, double[] hue, double[] sat, double[] val,
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:305: error: cannot find symbol
Mat out) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:316: error: cannot find symbol
private void cvBitwiseNot(Mat src, Mat dst) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:316: error: cannot find symbol
private void cvBitwiseNot(Mat src, Mat dst) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:330: error: cannot find symbol
private void cvErode(Mat src, Mat kernel, Point anchor, double iterations,
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:330: error: cannot find symbol
private void cvErode(Mat src, Mat kernel, Point anchor, double iterations,
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:330: error: cannot find symbol
private void cvErode(Mat src, Mat kernel, Point anchor, double iterations,
^
symbol: class Point
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:331: error: cannot find symbol
int borderType, Scalar borderValue, Mat dst) {
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:331: error: cannot find symbol
int borderType, Scalar borderValue, Mat dst) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:350: error: cannot find symbol
private void mask(Mat input, Mat mask, Mat output) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:350: error: cannot find symbol
private void mask(Mat input, Mat mask, Mat output) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:350: error: cannot find symbol
private void mask(Mat input, Mat mask, Mat output) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:379: error: cannot find symbol
private void findLines(Mat input, ArrayList lineList) {
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:104: error: cannot find symbol
JsonElement nameElement = config.get(“name”);
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:112: error: cannot find symbol
JsonElement pathElement = config.get(“path”);
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:134: error: cannot find symbol
JsonElement top;
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:136: error: cannot find symbol
top = new JsonParser().parse(Files.newBufferedReader(Paths.get(configFile)));
^
symbol: class JsonParser
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:147: error: cannot find symbol
JsonObject obj = top.getAsJsonObject();
^
symbol: class JsonObject
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:150: error: cannot find symbol
JsonElement teamElement = obj.get(“team”);
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:170: error: cannot find symbol
JsonElement camerasElement = obj.get(“cameras”);
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:175: error: cannot find symbol
JsonArray cameras = camerasElement.getAsJsonArray();
^
symbol: class JsonArray
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:176: error: cannot find symbol
for (JsonElement camera : cameras) {
^
symbol: class JsonElement
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:190: error: cannot find symbol
CameraServer inst = CameraServer.getInstance();
^
symbol: class CameraServer
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:190: error: cannot find symbol
CameraServer inst = CameraServer.getInstance();
^
symbol: variable CameraServer
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:191: error: cannot find symbol
UsbCamera camera = new UsbCamera(config.name, config.path);
^
symbol: class UsbCamera
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:191: error: cannot find symbol
UsbCamera camera = new UsbCamera(config.name, config.path);
^
symbol: class UsbCamera
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:192: error: cannot find symbol
MjpegServer server = inst.startAutomaticCapture(camera);
^
symbol: class MjpegServer
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:194: error: cannot find symbol
Gson gson = new GsonBuilder().create();
^
symbol: class Gson
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:194: error: cannot find symbol
Gson gson = new GsonBuilder().create();
^
symbol: class GsonBuilder
location: class Main
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:197: error: package VideoSource does not exist
camera.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:210: error: cannot find symbol
private Mat hsvThresholdOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:211: error: cannot find symbol
private Mat cvBitwiseNotOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:212: error: cannot find symbol
private Mat cvErodeOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:213: error: cannot find symbol
private Mat maskOutput = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:217: error: cannot find symbol
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
^
symbol: variable Core
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:223: error: method does not override or implement a method from a supertype
@Override public void process(Mat source0) {
^
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:225: error: cannot find symbol
Mat hsvThresholdInput = source0;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:232: error: cannot find symbol
Mat cvBitwiseNotSrc1 = hsvThresholdOutput;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:236: error: cannot find symbol
Mat cvErodeSrc = cvBitwiseNotOutput;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:237: error: cannot find symbol
Mat cvErodeKernel = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:237: error: cannot find symbol
Mat cvErodeKernel = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:238: error: cannot find symbol
Point cvErodeAnchor = new Point(-1, -1);
^
symbol: class Point
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:238: error: cannot find symbol
Point cvErodeAnchor = new Point(-1, -1);
^
symbol: class Point
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:240: error: cannot find symbol
int cvErodeBordertype = Core.BORDER_CONSTANT;
^
symbol: variable Core
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:241: error: cannot find symbol
Scalar cvErodeBordervalue = new Scalar(-1);
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:241: error: cannot find symbol
Scalar cvErodeBordervalue = new Scalar(-1);
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:245: error: cannot find symbol
Mat maskInput = source0;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:246: error: cannot find symbol
Mat maskMask = cvErodeOutput;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:250: error: cannot find symbol
Mat findLinesInput = maskOutput;
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:306: error: cannot find symbol
Imgproc.cvtColor(input, out, Imgproc.COLOR_BGR2HSV);
^
symbol: variable Imgproc
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:306: error: cannot find symbol
Imgproc.cvtColor(input, out, Imgproc.COLOR_BGR2HSV);
^
symbol: variable Imgproc
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:307: error: cannot find symbol
Core.inRange(out, new Scalar(hue[0], sat[0], val[0]),
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:308: error: cannot find symbol
new Scalar(hue[1], sat[1], val[1]), out);
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:307: error: cannot find symbol
Core.inRange(out, new Scalar(hue[0], sat[0], val[0]),
^
symbol: variable Core
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:317: error: cannot find symbol
Core.bitwise_not(src, dst);
^
symbol: variable Core
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:333: error: cannot find symbol
kernel = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:336: error: cannot find symbol
anchor = new Point(-1,-1);
^
symbol: class Point
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:339: error: cannot find symbol
borderValue = new Scalar(-1);
^
symbol: class Scalar
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:341: error: cannot find symbol
Imgproc.erode(src, dst, kernel, anchor, (int)iterations, borderType, borderValue);
^
symbol: variable Imgproc
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:351: error: cannot find symbol
mask.convertTo(mask, CvType.CV_8UC1);
^
symbol: variable CvType
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:352: error: cannot find symbol
Core.bitwise_xor(output, output, output);
^
symbol: variable Core
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:380: error: cannot find symbol
final LineSegmentDetector lsd = Imgproc.createLineSegmentDetector();
^
symbol: class LineSegmentDetector
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:380: error: cannot find symbol
final LineSegmentDetector lsd = Imgproc.createLineSegmentDetector();
^
symbol: variable Imgproc
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:381: error: cannot find symbol
final Mat lines = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:381: error: cannot find symbol
final Mat lines = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:386: error: cannot find symbol
final Mat tmp = new Mat();
^
symbol: class Mat
location: class MyPipeline
C:\Users\Student\Documents\rpivision\src\main\java\Main.java:386: error: cannot find symbol
final Mat tmp = new Mat();
^
symbol: class Mat
location: class MyPipeline
100 errors
FAILURE: Build failed with an exception.

Sorry for the wall of text but I’m very confused as to why this is all failing. We’ve been trying without any results to make headway but we can’t. Any advice?


#10

Are you connected to the Internet? It should pull in the dependencies on it’s own…


#12

I updated the build file a bit and it fixed most of the issues except for this:

import edu.wpi.cscore.MjpegServer;
^
bad class file: C:\Users\Student\Documents\rpivision\libs\cscore.jar(edu/wpi/cscore/MjpegServer.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.


#13

Odd, I can build it just fine.

All I literally did was change the process method in the example build, so you could try to download the current java example from your PI, and just try to insert our process method to see if you get different results.

Maybe we have differing versions of the libraries somehow.


#14

Seems like you might be using the wrong JDK. WPILIB is built for OpenJDK 11, however, from the looks of it you’re using JDK 1.8.

Make sure your JAVA_HOME, or Environment SDK is set to C:\Users\Public\frc2019\jdk


#16

@NewtonCrosby @Kinzerfest Thank you SO MUCH for your help! We’d be dead in the water without y’all :slight_smile: