Log in

View Full Version : Display Mat Images On SmartDashboard?


JDub
15-12-2016, 16:04
I'm investigating having the team do some vision processing this year. GRIP seems like a great tool. It looks like we could use the VideoCapture class to grab an image from the camera and then run it through the image processing pipeline generated from GRIP. As a debug aid, I've found examples of how to overlay bounding rectangles and such onto the processed image, but it's not clear to me how to display the image with the overlayed info on the SmartDashboard. FRC ScreenStepsLive says to use the CameraServer class, but it uses the NIVision.Image class to represent images, not OpenCV's Mat class that is used by GRIP. Is there a way to display a Mat image on the SmartDashboard, or does anyone know of a method to convert a Mat image to a NIVision.Image image? Thanks.

euhlmann
15-12-2016, 17:23
Converting Mat to NIVision.Image is probably too much work. Instead, you should create your own version of CameraServer that calls Imgcodecs.imencode() to create a jpeg instead of imaqFlatten().

Thad House
15-12-2016, 17:37
If you can wait until kickoff, expect some changes then that will make this a whole lot easier. ;)

Otherwise, as euhlmann said you'd probably have to implement your own CameraServer if you want to be able to do this now.

virtuald
15-12-2016, 18:48
If you really don't want to wait until kickoff, github (https://github.com/wpilibsuite) is a great place to find cool new things.

JDub
15-12-2016, 20:29
I can wait for kickoff. Thanks for the feedback everyone.