Log in

View Full Version : NiVision inverting image


Bernstern
25-03-2016, 10:59
Does anyone know how to flip the live feed on the smart dashboard by 180 degrees basically inverting it in java?

soundfx
25-03-2016, 13:02
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.CameraControlMode Controller);
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);

Alan Anderson
25-03-2016, 14:13
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.

Greg McKaskle
27-03-2016, 13:21
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