We want to access the camera output in order to draw lines on the video.
Is there any way to do this so that the drawings appear on the driver station as the video is shown in realtime?
Notes:
-Using Java.
-The shapes do not cover the whole picture, only a small portion. The rest of the video should still be playing in realtime.
Your best bet is to just edit your dashboard and just add a line to the display. Are you using the Smart Dashboard (gray in color) or the Labview Dashboard (Blackish in color)?
If you are using Java I’ll assume you are suing the SmartDashboard, then you can make a extension which extends the WPICameraExtension, and then you can overide the process image method- using rawImage.drawPolygon(I think there a more methods you can use tlike drawLine or drawRectangle) and then return the new rawImage.
This way you will have whatever shape you pick on the camera Image and the video running behind it
And then import everything under
C:\Program Files\SmartDashboard
and
C:\Program Files\SmartDashboard\extensions
and
C:\Program Files\SmartDashboard\extensions\lib
into your Java Class Library (a type of project you can start in Netbeans)
You will want to have your extension class extend WPICameraExtension.
You will also want to override the method processImage, as sretter has said.
Thank you for clearing things up, I have imported the .jar files in these folders but when I try to use the classes in these files I get compile time errors such as: “cannot find symbol symbol: class WPILaptopCameraExtension”, although when editing the class the IDE (NetBeans 7.2) doesn’t give these errors. I have checked “java sources classpath” multiple times but still the same.
Did you tell NetBeans to include the SmartDashboard jars as libraries?
Right-click your project, click Properties, click Libraries, and hit “Add JAR/Folder” and the choose SmartDashboard.jar, and then repeat for WPICameraExtension.jar, WPIJavaCV.jar, javacpp.jar, javac-windows-x(VERSION).jar, and javac.jar.
Oops, the mistake is on my part. I told you to extend the widget for accessing the computer’s camera instead of the Axis Camera.
You should be extending WPICameraExtension, not WPILaptopCameraExtension, my apologies.
that is not the actual problem here, the compiler somehow cannot read the libraries that I imported, for example after I changed it to “WPICameraExtenion”, I still get the same error: package edu.wpi.first.smartdashboard.camera does not exist
import edu.wpi.first.smartdashboard.camera.*;
this error occurs only during compile time, mean while, when I am editing the code, I don’t get the this error. God, I have been spoiled with Visual Studio and C#.