SmartDashboard's and OpenCV's formats are not compatible with each others but there is a trick. There could be better methods but here's what worked for me, at least for debugging purposes. Save your cv::Mat, the one you want to see, probably after all the OpenCV processing with marks and numbers on it, using imwrite() somewhere in RoboRIO's filesystem. I used /var/volatile/tmp/ directory as I guess it's some kind of a RAM-disk on RoboRIO, so all the IO should happen in-memory. Then create an IMAQ image object, something like "Image image = frcCreateImage(IMAQ_IMAGE_RGB);", and read your file into it and set it as the current frame with the CameraServer:
Code:
void CameraFeedCommand::CameraFeedCommand()
{
image = frcCreateImage(IMAQ_IMAGE_RGB);
}
void CameraFeedCommand::Execute()
{
frcReadImage(image,"/var/volatile/tmp/opencv-frame.png");
CameraServer::GetInstance()->SetImage(image);
}
PS: Do not run the automatic capture with the CameraServer, feed it the images yourself repeatedly.
PPS: Set the camera mode on the Dashboard to "USB camera HW"