![]() |
getting output from opencv onto smartdashboard
Hello. We are testing some vision code we wrote on the roboRIO and are using opencv on the RIO. I would like to be able to get the output steam of jpegs from opencv to the c++ smartdashboard.
I have seen you can use CameraServer's setImage, but how does that work in correlation with the smartdashboard? Thanks, Drew |
Re: getting output from opencv onto smartdashboard
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()PPS: Set the camera mode on the Dashboard to "USB camera HW" |
Re: getting output from opencv onto smartdashboard
3 Attachment(s)
I wrote a MJPG streaming server in Java for our vision system and I have a more limited C++ version of it that I ported for a personal project, but it requires Boost, which might be a little difficult to get working on the roboRIO.
I attached them both to this post, in case they might be helpful. |
| All times are GMT -5. The time now is 10:17 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi