NiVision inverting image

Does anyone know how to flip the live feed on the smart dashboard by 180 degrees basically inverting it in java?

You can flip the image with the imaqFlip method in the NIVision class. This does require you to be setting the image using the setImage method in CameraServer and manually opening the camera and acquiring the image with NIVision.

This requires the following init code:


cam = NIVision.IMAQdxOpenCamera(frontCameraName, NIVision.IMAQdxCameraControlMode.CameraControlModeController);
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
NIVision.IMAQdxConfigureGrab(newID);
NIVision.IMAQdxStartAcquisition(newID);

Then add this to teleop:


NIVision.IMAQdxGrab(activeCam, frame, 1);
NIVision.imaqFlip(frame, frame, NIVision.FlipAxis.HORIZONTAL_AXIS);
CameraServer.getInstance().setImage(frame);

What kind of camera are you using? Many IP cameras have an option to invert the image that they provide. That’s there in case you have to mount a camera upside down for some reason. USB cameras typically require such inversion to be provided by the driver or user software the way Aaron describes, but maybe yours is atypical.

Look for configuration terms like mirror or rotation. Invert means something different.

I don’t remember a camera that doesn’t have this config option.

Greg McKaskle