#include <visioncamera.h>
 | 
| static const cv::Mat_< float >  | default_matrix {cv::Mat_<float>::zeros(3, 3)} | 
|   | 
| static const cv::Mat_< float >  | default_distort {cv::Mat_<float>::zeros(1, 5)} | 
|   | 
Adds extra functionality and ease of use on top of cs::VideoCaemra (base of cs::HTTPCamera and cs::UsbCamera) 
Definition at line 15 of file visioncamera.h.
 
◆ VisionCamera() [1/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          CS_Source  | 
          source_handle | ) | 
           | 
        
      
 
Construct from a raw cscore source handle 
- Parameters
 - 
  
    | source_handle | A cscore source handle for a camera  | 
  
   
Definition at line 9 of file visioncamera.cpp.
 
 
◆ VisionCamera() [2/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          const cs::VideoSource &  | 
          source,  | 
        
        
           | 
           | 
          const wpi::json &  | 
          config = wpi::json()  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Construct from a VideoSource and optional config json 
- Parameters
 - 
  
    | source | The source object that will be copied from  | 
    | config | The config json for the camera  | 
  
   
Definition at line 14 of file visioncamera.cpp.
 
 
◆ VisionCamera() [3/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          const cs::UsbCamera &  | 
          source,  | 
        
        
           | 
           | 
          const wpi::json &  | 
          config = wpi::json()  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Construct from a UsbCamera and optional config json - SEEMINGLY NOT FUNCTIONAL 
- Parameters
 - 
  
    | source | The source object that will be copied from  | 
    | config | The config json for the camera  | 
  
   
Definition at line 20 of file visioncamera.cpp.
 
 
◆ VisionCamera() [4/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          const cs::HttpCamera &  | 
          source,  | 
        
        
           | 
           | 
          const wpi::json &  | 
          config = wpi::json()  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Construct from a HttpCamera and optional config json - SEEMINGLY NOT FUNCTIONAL 
- Parameters
 - 
  
    | source | The source object that will be copied from  | 
    | config | The config json for the camera  | 
  
   
Definition at line 26 of file visioncamera.cpp.
 
 
◆ VisionCamera() [5/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          const wpi::json &  | 
          source_config,  | 
        
        
           | 
           | 
          const wpi::json &  | 
          calibration  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Construct using json configuration and calibration blocks 
- Parameters
 - 
  
    | source_config | The camera configuration json object  | 
    | calibration | The json object containing calibration values for the camera  | 
  
   
Definition at line 32 of file visioncamera.cpp.
 
 
◆ VisionCamera() [6/8]
      
        
          | VisionCamera::VisionCamera  | 
          ( | 
          const wpi::json &  | 
          source_config | ) | 
           | 
        
      
 
Construct using json configuration without camera calibration 
- Parameters
 - 
  
    | source_config | The camera configuration json object  | 
  
   
Definition at line 51 of file visioncamera.cpp.
 
 
◆ VisionCamera() [7/8]
◆ VisionCamera() [8/8]
◆ ~VisionCamera()
      
        
          | VisionCamera::~VisionCamera  | 
          ( | 
           | ) | 
           | 
        
      
 
Deletes all networktable entries for the camera's subtable 
Definition at line 88 of file visioncamera.cpp.
 
 
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ isValidJson()
      
        
          | bool VisionCamera::isValidJson  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get if the cameras calibration json is valid 
- Returns
 - Whether or not the calibration json is valid 
 
Definition at line 123 of file visioncamera.cpp.
 
 
◆ getJson()
      
        
          | const wpi::json & VisionCamera::getJson  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the calibration json 
- Returns
 - The calibration json object 
 
Definition at line 126 of file visioncamera.cpp.
 
 
◆ isValidStreamJson()
      
        
          | bool VisionCamera::isValidStreamJson  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the config contains a stream configuration 
- Returns
 - Whether or not the config json has a stream configuration block 
 
Definition at line 129 of file visioncamera.cpp.
 
 
◆ getStreamJson()
      
        
          | wpi::json VisionCamera::getStreamJson  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the stream configuration json 
- Returns
 - A stream configuration json block - returns an empty wpi::json on error (isValidStreamJson() is false) 
 
Definition at line 132 of file visioncamera.cpp.
 
 
◆ getJsonCameraMatrix() [1/2]
      
        
          | bool VisionCamera::getJsonCameraMatrix  | 
          ( | 
          cv::Mat_< double > &  | 
          array | ) | 
           const | 
        
      
 
Get the camera's matrix array (doubles) - parsed from json 
- Parameters
 - 
  
    | array | An output array that will be set to the camera's matrix values - size is 3x3 (double)  | 
  
   
- Returns
 - Whether or not the array could be successfully filled 
 
Definition at line 139 of file visioncamera.cpp.
 
 
◆ getJsonCameraMatrix() [2/2]
      
        
          | bool VisionCamera::getJsonCameraMatrix  | 
          ( | 
          cv::Mat_< float > &  | 
          array | ) | 
           const | 
        
      
 
Get the camera's matrix array (floats) - parsed from json 
- Parameters
 - 
  
    | array | An output array that will be set to the camera's matrix values - size is 3x3 (float)  | 
  
   
- Returns
 - Whether or not the array could be successfully filled 
 
Definition at line 155 of file visioncamera.cpp.
 
 
◆ getJsonDistortionCoefs() [1/2]
      
        
          | bool VisionCamera::getJsonDistortionCoefs  | 
          ( | 
          cv::Mat_< double > &  | 
          array | ) | 
           const | 
        
      
 
Get the camera's distortion coefficients (doubles) - parsed from json 
- Parameters
 - 
  
    | array | An output array that will be set to the camera's distortion coefficients - size is 5x1 (double)  | 
  
   
- Returns
 - Whether or not the array coulb be successfully filled 
 
Definition at line 171 of file visioncamera.cpp.
 
 
◆ getJsonDistortionCoefs() [2/2]
      
        
          | bool VisionCamera::getJsonDistortionCoefs  | 
          ( | 
          cv::Mat_< float > &  | 
          array | ) | 
           const | 
        
      
 
Get the camera's distortion coefficients (floats) - parsed from json 
- Parameters
 - 
  
    | array | An output array that will be set to the camera's distortion coefficients - size is 5x1 (float)  | 
  
   
- Returns
 - Whether or not the array could be successfully filled 
 
Definition at line 185 of file visioncamera.cpp.
 
 
◆ getCameraMatrix()
  
  
      
        
          | const cv::Mat_< float > & VisionCamera::getCameraMatrix  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the internally stored camera matrix 
- Returns
 - a const reference to the internal matrix 
 
Definition at line 120 of file visioncamera.h.
 
 
◆ getDistortionCoefs()
  
  
      
        
          | const cv::Mat_< float > & VisionCamera::getDistortionCoefs  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the internally stored distortion coefficient matrix 
- Returns
 - a const reference to the internal matrix 
 
Definition at line 125 of file visioncamera.h.
 
 
◆ setCalibrationJson()
      
        
          | bool VisionCamera::setCalibrationJson  | 
          ( | 
          const wpi::json &  | 
          j | ) | 
           | 
        
      
 
 
◆ setCameraMatrix()
      
        
          | bool VisionCamera::setCameraMatrix  | 
          ( | 
          const cv::Mat_< float > &  | 
          mat | ) | 
           | 
        
      
 
 
◆ setDistortionCoefs()
      
        
          | bool VisionCamera::setDistortionCoefs  | 
          ( | 
          const cv::Mat_< float > &  | 
          mat | ) | 
           | 
        
      
 
 
◆ getFrame()
      
        
          | uint64_t VisionCamera::getFrame  | 
          ( | 
          cv::Mat &  | 
          o_frame,  | 
        
        
           | 
           | 
          double  | 
          timeout = 0.225  | 
        
        
           | 
          ) | 
           |  const | 
        
      
 
Wraps cs::CvSink::GrabFrame() for the internal sink. If the camera is not physically connected, the buffer is set to a blank frame 
- Parameters
 - 
  
    | o_frame | the output framebuffer  | 
    | timeout | maximum time that the thread with block until returning with an empty frame  | 
  
   
- Returns
 - the frametime, in 1 microsecond increments (see wpi::Now()) 
 
Definition at line 224 of file visioncamera.cpp.
 
 
◆ getFrameNoTmO()
      
        
          | uint64_t VisionCamera::getFrameNoTmO  | 
          ( | 
          cv::Mat &  | 
          o_frame | ) | 
           const | 
        
      
 
Wraps cs::CvSink::GrabFrameNoTimeout() for the internal sink. If the camera is not phystically connected, the buffer is set to a blank frame 
- Parameters
 - 
  
    | o_frame | the output framebuffer  | 
  
   
- Returns
 - the frametime, in 1 microsecond increments (see wpi::Now()) 
 
Definition at line 232 of file visioncamera.cpp.
 
 
◆ getSink()
  
  
      
        
          | const cs::CvSink & VisionCamera::getSink  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the internal CvSink for aquiring frames from the camera 
- Returns
 - a const reference to the internal sink 
 
Definition at line 148 of file visioncamera.h.
 
 
◆ getWidth()
      
        
          | int VisionCamera::getWidth  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the width of a frame output by the camera 
- Returns
 - The width in pixels 
 
Definition at line 241 of file visioncamera.cpp.
 
 
◆ getHeight()
      
        
          | int VisionCamera::getHeight  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the height of a frame output by the camera 
- Returns
 - The height in pixels 
 
Definition at line 244 of file visioncamera.cpp.
 
 
◆ getPixels()
      
        
          | int VisionCamera::getPixels  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the total number of pixels in each frame (width x height) 
- Returns
 - The total number of pixels in each frame 
 
Definition at line 247 of file visioncamera.cpp.
 
 
◆ getConfigFPS()
      
        
          | int VisionCamera::getConfigFPS  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the current fps the camera is set to capture at 
- Returns
 - The fps 
 
Definition at line 251 of file visioncamera.cpp.
 
 
◆ getResolution()
      
        
          | cv::Size VisionCamera::getResolution  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the width and height of a camera frame in cv::Size format 
- Returns
 - The resolution of a camera frame in a cv::Size object 
 
Definition at line 254 of file visioncamera.cpp.
 
 
◆ getBrightness()
      
        
          | int VisionCamera::getBrightness  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the current brightness setting for the camera 
- Returns
 - The brightness (0-100, -1 for auto) 
 
Definition at line 258 of file visioncamera.cpp.
 
 
◆ getExposure()
      
        
          | int VisionCamera::getExposure  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the current exposure setting for the camera 
- Returns
 - The exposure (0-100, -1 for auto) 
 
Definition at line 261 of file visioncamera.cpp.
 
 
◆ getWhiteBalance()
      
        
          | int VisionCamera::getWhiteBalance  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get the current whitebalance setting for the camera 
- Returns
 - The whitebalance (0-??? (>7000), -1 for auto) 
 
Definition at line 264 of file visioncamera.cpp.
 
 
◆ setBrightness()
      
        
          | void VisionCamera::setBrightness  | 
          ( | 
          int  | 
          b | ) | 
           | 
        
      
 
Set the brightness of the camera 
- Parameters
 - 
  
    | b | The brightness (0-100, -1 for auto)  | 
  
   
Definition at line 268 of file visioncamera.cpp.
 
 
◆ setWhiteBalance()
      
        
          | void VisionCamera::setWhiteBalance  | 
          ( | 
          int  | 
          wb | ) | 
           | 
        
      
 
Set the whitebalance of the camera 
- Parameters
 - 
  
    | wb | The whitebalance (0-???, -1 for auto)  | 
  
   
Definition at line 271 of file visioncamera.cpp.
 
 
◆ setExposure()
      
        
          | void VisionCamera::setExposure  | 
          ( | 
          int  | 
          e | ) | 
           | 
        
      
 
Set the exposure of the camera 
- Parameters
 - 
  
    | e | The exposure (0-100, -1 for auto)  | 
  
   
Definition at line 274 of file visioncamera.cpp.
 
 
◆ setNetworkBase()
      
        
          | void VisionCamera::setNetworkBase  | 
          ( | 
          const std::shared_ptr< nt::NetworkTable > &  | 
          table | ) | 
           | 
        
      
 
Set the root networktable in which the camera's own networktable should reside 
- Parameters
 - 
  
    | table | The root table (the camera resides in ~table~/Cameras)  | 
  
   
Definition at line 278 of file visioncamera.cpp.
 
 
◆ setNetworkAdjustable()
      
        
          | void VisionCamera::setNetworkAdjustable  | 
          ( | 
           | ) | 
           | 
        
      
 
Publish networktables-adjustable settings for exposure, brightness, and whitebalance under the camera's networktable 
Definition at line 281 of file visioncamera.cpp.
 
 
◆ _setBrightness()
  
  
      
        
          | int VisionCamera::_setBrightness  | 
          ( | 
          int  | 
          b | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ _setWhiteBalance()
  
  
      
        
          | int VisionCamera::_setWhiteBalance  | 
          ( | 
          int  | 
          wb | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ _setExposure()
  
  
      
        
          | int VisionCamera::_setExposure  | 
          ( | 
          int  | 
          e | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ default_matrix
  
  
      
        
          | const cv::Mat_<float> VisionCamera::default_matrix {cv::Mat_<float>::zeros(3, 3)} | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ default_distort
  
  
      
        
          | const cv::Mat_<float> VisionCamera::default_distort {cv::Mat_<float>::zeros(1, 5)} | 
         
       
   | 
  
static   | 
  
 
 
◆ config
  
  
      
        
          | wpi::json VisionCamera::config | 
         
       
   | 
  
private   | 
  
 
 
◆ calibration
  
  
      
        
          | wpi::json VisionCamera::calibration | 
         
       
   | 
  
private   | 
  
 
 
◆ raw
  
  
      
        
          | cs::CvSink VisionCamera::raw | 
         
       
   | 
  
private   | 
  
 
 
◆ camera_matrix
◆ distortion
◆ properties
  
  
      
        
          | cs::VideoMode VisionCamera::properties | 
         
       
   | 
  
private   | 
  
 
 
◆ ntable
  
  
      
        
          | std::shared_ptr<nt::NetworkTable> VisionCamera::ntable | 
         
       
   | 
  
private   | 
  
 
Initial value:{
        nt::NetworkTableInstance::GetDefault().GetTable("Cameras")->GetSubTable(this->GetName())}
 
Definition at line 229 of file visioncamera.h.
 
 
◆ nt_brightness
  
  
      
        
          | nt::IntegerEntry VisionCamera::nt_brightness | 
         
       
   | 
  
private   | 
  
 
 
◆ nt_exposure
  
  
      
        
          | nt::IntegerEntry VisionCamera::nt_exposure | 
         
       
   | 
  
private   | 
  
 
 
◆ nt_whitebalance
  
  
      
        
          | nt::IntegerEntry VisionCamera::nt_whitebalance | 
         
       
   | 
  
private   | 
  
 
 
◆ listener_handle
  
  
      
        
          | NT_Listener VisionCamera::listener_handle {0} | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: