The Rotate Flip filter allows image data to be flipped and rotated in steps of 90 degrees.
The Rotate Flip filter is loaded by an application using the following code:
[C#]
FrameFilter RotateFlipFilter; RotateFlipFilter = ICImagingControl1.FrameFilterCreate("Rotate Flip", ""); if( RotateFlipFilter == null ) MessageBox.Show("Failed to create RotateFlipFilter"); else ICImagingControl1.DeviceFrameFilters.Add(RotateFlipFilter);
The part of the image that is copied to the destination frame is determined by four filter parameters:
The rotation angle and flipping modes can be specified in the filter's property dialog:
If the parameters should be set by an application, following source code can be used:
[C#]
// Retrieve the current parameter settings. int angle = RotateFlipFilter.GetIntParameter("Rotation Angle"); bool flipVertical = RotateFlipFilter.GetBoolParameter("Flip V"); bool flipHorizontal = RotateFlipFilter.GetBoolParameter("Flip H"); // Change the parameters. int newAngle = 90; // Only the values 0, 90, 180 270 are allowed. // If the rotation value is 90 or 270, then the resulting video format // is changed. Thus, the new value can only be set while the live video is // stopped. Otherwise, an error is returned. if( Math.Abs(angle - newAngle) == 90 || Math.Abs(angle - newAngle) == 270 ) { if( !ICImagingControl1.LiveVideoRunning ) { RotateFlipFilter.SetIntParameter("Rotation Angle", newAngle); } } else { RotateFlipFilter.SetIntParameter("Rotation Angle", newAngle); } // The flip parameters do not cause a video format change, so they can be // set regardless of whether the live video is running. flipVertical = true; flipHorizontal = true; RotateFlipFilter.SetBoolParameter("Flip V", flipVertical); RotateFlipFilter.SetBoolParameter("Flip H", flipHorizontal);