View Single Post
  #9   Spotlight this post!  
Unread 08-02-2017, 09:08
justaparent justaparent is offline
Registered User
no team
 
Join Date: Jan 2017
Location: Fairfield, CA
Posts: 3
justaparent is an unknown quantity at this point
Re: Using the Raspberry Pi for Vision Processing

Quote:
Originally Posted by thecoopster20 View Post
Thank you very much! I got the build to go through, now to just get it on the pi and then make the vision jar run on startup.
Make sure you write a little test program and verify that you can run it. There were runtime native lib. dependency issues i ran into, specifically I had to use this:

http://first.wpi.edu/FRC/roborio/mav...m-raspbian.jar

cscore.

This is my test program:

Code:
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.networktables.NetworkTable;
import org.opencv.core.Rect;
import org.opencv.imgproc.Imgproc;
//import com.ctre.CANTalon;
import edu.wpi.cscore.UsbCamera;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.vision.VisionRunner;
import edu.wpi.first.wpilibj.vision.VisionThread;
public class Test {
        public static void main(String[] args){


                VisionThread visionThread;
             
                Object imgLock = new Object();
                System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
                NetworkTable table = NetworkTable.getTable("foo");
                Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
                System.out.println("mat = " + mat.dump());
                UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
               camera.setResolution(640, 480);
    }
}
That's enough to verify that the needed native libraries can be loaded.
Reply With Quote