mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
bugfix for camera mat 0
This commit is contained in:
@@ -23,14 +23,16 @@ public class CameraProcess implements Runnable{
|
||||
|
||||
//calling all classes
|
||||
CameraServer cs = CameraServer.getInstance();
|
||||
// NetworkTableInstance networkTableInstance = NetworkTableInstance.getDefault();
|
||||
NetworkTableInstance networkTableInstance = NetworkTableInstance.getDefault();
|
||||
SettingsManager manager = SettingsManager.getInstance();
|
||||
manager.CamerasCurrentPipeline.put(CameraName,manager.Cameras.get(CameraName).pipelines.keySet().toArray()[0].toString());
|
||||
//Setting up camera and network table
|
||||
// var Table = networkTableInstance.getTable("/Chameleon-Vision/" + CameraName);
|
||||
// var PipeLineEntry = Table.getEntry("Pipeline");
|
||||
// var DriverModeEntry = Table.getEntry("Driver_Mode");
|
||||
var Table = networkTableInstance.getTable("/Chameleon-Vision/" + CameraName);
|
||||
var PipeLineEntry = Table.getEntry("Pipeline");
|
||||
var DriverModeEntry = Table.getEntry("Driver_Mode");
|
||||
var cv_sink = cs.getVideo(manager.UsbCameras.get(CameraName));
|
||||
|
||||
|
||||
int Width = manager.Cameras.get(CameraName).camVideoMode.width;
|
||||
int Height = manager.Cameras.get(CameraName).camVideoMode.heigh;
|
||||
var cv_publish = cs.putVideo(CameraName,Width,Height);
|
||||
@@ -53,10 +55,13 @@ public class CameraProcess implements Runnable{
|
||||
while (!Thread.interrupted()){
|
||||
Pipeline pipeline = manager.Cameras.get(CameraName).pipelines.get(manager.CamerasCurrentPipeline.get(CameraName));
|
||||
time = cv_sink.grabFrame(mat);
|
||||
// Mat HSVImage = visionProcess.HSVThreshold(pipeline.hue,pipeline.saturation,pipeline.value,mat,pipeline.erode,pipeline.dilate);
|
||||
// List<MatOfPoint> Contours = visionProcess.FindContours(HSVImage);
|
||||
// List<MatOfPoint> FilterdContours = visionProcess.FilterContours(Contours,pipeline.area,pipeline.ratio,pipeline.extent,pipeline.sort_mode,pipeline.target_intersection,pipeline.target_group);
|
||||
cv_publish.putFrame(mat);
|
||||
if (mat.cols() !=0 && mat.rows() != 0) {
|
||||
Mat HSVImage = visionProcess.HSVThreshold(pipeline.hue, pipeline.saturation, pipeline.value, mat, pipeline.erode, pipeline.dilate);
|
||||
// List<MatOfPoint> Contours = visionProcess.FindContours(HSVImage);
|
||||
// List<MatOfPoint> FilterdContours = visionProcess.FilterContours(Contours, pipeline.area, pipeline.ratio, pipeline.extent, pipeline.sort_mode, pipeline.target_intersection, pipeline.target_group);
|
||||
cv_publish.putFrame(mat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class VisionProcess {
|
||||
Imgproc.cvtColor(image,hsv,Imgproc.COLOR_BGR2HSV,3);
|
||||
new Scalar(hue.get(0),saturation.get(0),value.get(0));
|
||||
Mat threshold = new Mat();
|
||||
Core.inRange(threshold,new Scalar(hue.get(0),saturation.get(0),value.get(0)),new Scalar(hue.get(1),saturation.get(1),value.get(1)),threshold);
|
||||
Core.inRange(hsv,new Scalar(hue.get(0),saturation.get(0),value.get(0)),new Scalar(hue.get(1),saturation.get(1),value.get(1)),threshold);
|
||||
if (IsErode){
|
||||
Imgproc.erode(threshold,threshold, Kernel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user