Home    MontiVision DirectShow SDK Documentation Prev Next
MontiVision Development Kit
Product Release Notes
What's new?
Installation
Overview
Components
The MontiVision Workbench
How to use the Workbench
How to insert an Filter
How to make a connction between two filter
How to change filter properties
How to get mediatypes of a pin or connection
How to delete a connection
How to delete a filter
How to find a filter
How to select a filter, pin or connection
How to make a video visible
How to preview a video stream
Workbench Menus and Commands
File menu commands
Edit menu commands
View menu commands
Graph menu commands
Extras menu commands
Help menu commands
Context menu commands
Status Bar
Toolbar
Sorting Filters
MontiVision DirectShow Filter
Common filter functions
MV Absolute Difference
MV Advanced Optical Flow
MV Affine Transformation
MV Alignment
MV Audio Test Source
MV Batch Image File Source
MV Background Subtraction
MV Bayer To Gray
MV Bayer To RGB
MV Bitmap Overlay
MV Blob Counter
MV Blob Finder
MV BlockRecording
MV Buffer Access
MV Camera Calibration
MV Camera Syncronisation
MV Camera Undistortion
MV Color Filter
MV Color Channel Mixer
MV Color Space Converter
MV Color To Gray
MV Color Twist
MV Constant Framerate
MV Convolution
MV Cooccurrence
MV Crop
MV Deinterlace
MV DeInterlace Temporal
MV Delay
MV Demo Source
MV Demultiplexer
MV DPS Renderer
MV DPS Source
MV Dyadic Arithmetic
MV Dyadic Logic
MV Fast Color Filter
MV Frame Access
MV Gauge
MV GDI Overlay
MV Gray To Color
MV Image File Source
MV Image Grabber
MV Image File Renderer
MV Integral
MV Inverse
MV I/O Bool Source
MV I/O Comparator
MV I/O Logic
MV I/O Not
MV I/O Renderer
MV I/O RS232
MV I/O RS232 Trigger Source
MV I/O Switch Source
MV I/O Textfile Renderer
MV I/O Textfile Source
MV I/O To String
MV IP Camera Source
MV Look Up Table
MV Mean
MV Mean Profile
MV Merge Frames
MV Mirror
MV MJPEG Compressor
MV MJPEG Decompressor
MV Mondic Arithmetic
MV Mondic Logic
MV Morphology
MV Motion Detection
MV Motion Direction
MV Multi File Writer
MV Network Renderer
MV Network Source
MV Nonlinear Filter
MV Object Tracker
MV Optical Flow
MV Playlist Source
MV Polar
MV Presence Detection
MV Profile
MV Recording
MV ReInterlace
MV Resize
MV Resized Rotation
MV Rotate90
MV Rotation
MV Segmentation
MV Select Mediatype
MV Separate Fields
MV Smooth Sequence
MV Splitter
MV Text Overlay
MV Ticker Overlay
MV Topography
MV Trigger Source
MV Video File Overlay
MV Video Overlay
MV Video Scaler
MV Watchdog
MV Zoom
Filter Event Mechanism
MontiVision DirectShow Filter SDK
Create a new Filter SDK DLL
Implement your custom Algorithm
Register the Filter SDK DLL
Use the new DirectShow Filter
Debugging a DirectShow Filter
Configure a Filter SDK DirectShow Filter
MontiVision Smart ActiveX Control
MV Smart Control Functions
MV Smart Control Interfaces
IMVSmartControl
IMVSCFilterGraph
IMVSCFilterGraph2
IMVSCVideoWindow
IMVSCVideoWindow2
IMVSCFullScreen
IMVSCSetFile
IMVSCSetSourceFilter
IMVSCSelectInput
IMVSCSetupVideoStream
IMVSCSetupVideoStream2
IMVSCClock
IMVSCFilterProperties
IMVSCLog
IMVSCCameraControl
IMVSCFilterEvents
IMVSCMediaSeeking
IMVSCMediaSeeking2
IMVSCQualityProperties
IMVSCFilterData
IMVSCCommonProperties
IMVSCExtDeviceControl
IMVSCVideoControl
IMVSCAnalogVideoFormat
IMVSCTVTuner
IMVSCTVAudio
Application Development with the MV Smart Control
Visual Basic 6.0
Visual Basic .NET
Visual C++ 6.0
Visual C++ .NET
Borland Delphi
MV Smart Control Samples
AviPlay Sample
CropVideo Sample
DirFinder Sample
FindObject Sample
FullScreen Sample
ImageStream Sample
IP Camera Sample
LiveDraw Sample
LoadFromString Sample
LumeneraCameraProperties Sample
MotionDetection Sample
PutBitmap Sample
SendReceiveRS232 Sample
MV Smart Control How To's
How to handle Input Events (Mouse, Keyboard) of the Video Window
How to Select and Configure a Video Input Device
How to handle Multiple Video Outputs
How to use Fullscreen Functionality
How to access the Results of a MontiVsion DirectShow Filter
MontiVision Utility ActiveX Controls
Video Source Combo Box
Video Format Combo Box
Video Size Combo Box
Input Selection Combo Box
Frame Rate Combo Box
Seeking Slider
Filter Property Page Display
Trigger Button
MontiVision I/O Controls
MVIODisplay
MVIOMonitor
MVIOLed
MVIOOutput
VMR Wrapper ActiveX Control
MV VMR Wrapper Interfaces
IMVVMRWrapper
IMVVMRFilterConfig
IMVVMRMixerControl
IMVVMRMixerBitmap
MV VMR Wrapper Sample Applications
VMR Control Sample
VMR Bitmap Overlay Sample
Extended Video Source ActiveX Control
MV Extended Video Source Control Interfaces
IMVExtendedVideoSource Interface
IMVLumeneraCustomConfig Interface
_IMVExtendedVideoSourceEvents Interface
MontiVision Tools
Getting Started
Create a MontiVision Project
Create a MontiVision Project using the MontiVision Workbench
Create new DirectShow Filters using the MontiVision Filter SDK
Use the new DirectShow Filter in your MontiVision Project
Integrate the MontiVision Project into your Application
Distribute your Application
Distributing your Applications
Application Development Examples
Apply standard Image Processing Operators to a Video Stream
Process a Sequence of Still Images, Do Batch Processing
Make your Existing Algorithms DirectShow compatible
Creating your own Image/Video Processing DirectShow Filters
Access the Image Data of a Video Stream directly from within a Windows Application
Capture Still Images from a running Video Stream
Convert a Video Stream to a Sequence of Still Images or vice versa
Sample Applications using the Smart Control
Camera Calibration
Additional HowTo's
How to Set Up Visual C++ for the MontiVision Development Kit
How to Set Up Borland Delphi for the MontiVision Development Kit
How to Set Up Borland Delphi 2005 for the MontiVision Development Kit
Interface Reference
_IMVFilterPropertyControlEvents
_IMVSeekingSliderEvents
_IMVSmartControlEvents
_ISelectInputComboBoxEvents
_IVideoFormatComboBoxEvents
_IVideoSizeComboBoxEvents
_IVideoSourceComboBoxEvents
IMVAbout
IMVAdvancedOpticalFlow
IMVAdvancedOpticalFlow2
IMVAffineTransformation
IMVAlignment
IMVAudioTestSource
IMVAutoCalcSetup
IMVBackgroundSubtraction
IMVBatchFileSource2
IMVBatchFileSource3
IMVBatchFileSource
IMVBinary
IMVBitmapOverlay
IMVBitmapOverlay2
IMVBlobCounter
IMVBlobCounter2
IMVBlobCounter3
IMVBlobCounter4
IMVBlobFinder
IMVBlobFinder2
IMVBlobFinder3
IMVBlobPostProcessing
IMVBlobPreProcessing
IMVBlockRecording
IMVBufferAccess
IMVBufferAccessCallbackC
IMVBufferAccessCallbackVB
IMVCameraCalibration
IMVCameraSync
IMVCameraUndistortion
IMVColor
IMVColorChannelMixer
IMVColorTwist
IMVConstantFramerate
IMVConvolution
IMVCooccurrence
IMVCrop
IMVCrypt
IMVDeinterlace
IMVDeInterlaceTemporal
IMVDelay
IMVDemoSource
IMVDemoSource2
IMVDPSRenderer
IMVDPSSource
IMVDyArith
IMVDyLogic
IMVEnumAudioEncoder
IMVEnumVideoEncoder
IMVFastColor
IMVFilterData
IMVFilterEvents
IMVFilterInfo
IMVFilterPropertyControl
IMVFilterSDK
IMVFrameAccess
IMVFrameAccessCallbackC
IMVFrameAccessCallbackVB
IMVGauge
IMVGaugeCalculations
IMVGDIOverlay
IMVGray
IMVGrayToColor
IMVGrid
IMVHistogram
IMVHistogram2
IMVHistogram3
IMVImageCapture
IMVImageCapture2
IMVImageCapture3
IMVImageFileSource
IMVImageFileSource2
IMVImageFileSource3
IMVImageInfo
IMVIntegral
IMVIOBoolSource
IMVIOBoolSource2
IMVIOComparator
IMVIOIntRenderer
IMVIOIntSource
IMVIOIntSource2
IMVIOLogic
IMVIONot
IMVIORenderer
IMVIORS232
IMVIORS232DataASCII
IMVIORS232DataHex.htm
IMVIORS232RxTxConnection
IMVIORS232TriggerSource
IMVIOSwitchSource
IMVIOTextfileRenderer
IMVIOTextfileSource
IMVIOToString
IMVIPCameraSource
IMVIPCameraSource2
IMVLinFilter
IMVLookUpTable
IMVMask
IMVMean
IMVMeanProfile
IMVMerger
IMVMirror
IMVMonArith
IMVMonLogic
IMVMorphology
IMVMotionDetection
IMVMotionDetection2
IMVMotionDirection
IMVMultiFileWriter
IMVNetworkReceiveInfo
IMVNetworkRenderer
IMVNetworkRenderer2
IMVNetworkRenderer3
IMVNetworkSendInfo
IMVNetworkSource
IMVNetworkSource2
IMVNonLinFilter
IMVObjectTracker
IMVOpticalFlow
IMVOpticalFlow2
IMVPlaylist
IMVPlaylistSource
IMVPolar
IMVPresenceDetection
IMVProfile
IMVRecording
IMVRegionOfInterest
IMVReinterlace
IMVResize
IMVResizedRotation
IMVRotate90
IMVRotation
IMVSCAnalogVideoFormat
IMVSCCameraControl
IMVSCCommonProperties
IMVSCClock
IMVSCExtDeviceControl
IMVSCFilterData
IMVSCFilterEvents
IMVSCFilterGraph
IMVSCFilterGraph2
IMVSCFilterProperties
IMVSCFullScreen
IMVSCLog
IMVSCMediaSeeking
IMVSCMediaSeeking2
IMVSCQualityProperties
IMVSCSelectInput
IMVSCSetFile
IMVSCSetSourceFilter
IMVSCTVTuner
IMVSCTVAudio
IMVSCVideoControl
IMVSCSetupVideoStream
IMVSCSetupVideoStream2
IMVSCVideoWindow
IMVSCVideoWindow2
IMVSeekingSlider
IMVSetImageFormat
IMVSmartControl
IMVSeparateFields
IMVSmoothSequence
IMVTextOverlay
IMVTextOverlay2
IMVTextOverlay3
IMVTickerOverlay
IMVTickerOverlay2
IMVTopography
IMVTrigger
IMVTriggerFilter
IMVVideoFileOverlay
IMVVideoScaler
IMVVMRFilterConfig
IMVVMRMixerBitmap
IMVVMRMixerControl
IMVVMRWrapper
IMVWatchdog
IMVZoom
IMVZoomConfig
ISelectInputComboBox
IVideoFormatComboBox
IVideoSizeComboBox
IVideoSourceComboBox

How To:Calibrate/Undistort a Camera

Introduction

To correct the geometrical distortion of an optical system (Camera and Lens) using the MontiVision Camera Calibration Toolbox, follow these steps:

1. Create a calibration pattern (Even x Odd).

2. Create a MontiVision calibration parameter file (*.mvc) for you camera/lens combination using the MV CamCalib Application or the MV Camera Calibration filter directly.

3. Insert the MV Camera Undistortion filter to your applications filter configuration.

4. Load the correct calibration parameter file (*.mvc) into the MV Camera Undistortion filter.  

 

1. Create a calibration pattern

The MV Camera Calibration filter uses images of a chessboard pattern to calculate the parameters of the optical system. Make sure to use a pattern with Even x Odd or Odd x Even number of rectangles.

10 x 7 Chessboard

The MV CamCalib application provides a print function for chessboards. The chessboard size should at least 6 x 5 squares.

 

2. Create a camera parameter file

This is the most important part when calibrating a camera. You may either use the MV Camera Calibration DirectShow filter or the MV CamCalib application to create a calibration parameter file. We highly recommend to utilize the MV CamCalib application.

Preparation

First of all the hardware to be calibrated has to be selected.

The next step is to provide some information about the optical system. This includes camera type and label, chip dimension, lens label and focal length. This data is used to calculate a default parameter set and helps you later to choose the correct calibration parameters in the MV Camera Undistortion DirectShow filter.

 

The information is not absolutely necessary to calculate the default parameters, but if you have to deal with more than a single camera/lens combination it is reasonable to use the description to be able to assigne the calibration parameters to the appropriate optical system.

Automatic Calibration

The MontiVision CamCalib application provides all the functionality required to calculate the camera parameters from a couple of calibration pattern images.

Set the column and row count in the Target Dimension group to the corresponding number of rectangles in your chessboard pattern. The Image Count parameter defines the number of images used to calculate the camera parameters. At least four images are required in order to get valid camera parameters, but fifteen or more images are recommended. The Image Delay parameter is the minimum time in seconds between the capturing of successive calibration images. This gives you time to modify the camera or pattern position.

To start the auto calibration process, press the Start button. From now on the application tries to record calibration pattern images. The camera parameters will be calculated after the number of required images is captured. If you prefer to choose the images manually, disable the Automode checkbox and press the Get Image everytime you'd like to capture an image. Capture the chessboard from as many different camera perspectives as possible, but do not rotate the chessboard or the camera. Rotation may result in invalid camera parameters.

The following set is just an example to give you a rough idea how a set of valid calibration images could look like.

The application shows the the calibration results in the Calibration Status group after calculating the camera parameters.

Enable the Undistortion checkbox in order to visually verify the camera parameters. Use the Save button to save the camera parameters into a MontiVision calibration parameter file (*.mvc).

Manual Calibration

The second and harder method to retrieve the camera parameters is to do the camera calibration manually. To do so, you need to press the Reset button to calculate default parameter for the camera. Create a chessboard (or similiar) pattern and align the camera perpendiculary in front of the pattern. The pattern helps you to see the distortion of your optical system. Additinally you can activate the applications grid functionality. Press the Grid button in order to open the grid dialog.

Enable the grid and adjust it to the lower left corner of your pattern.

To finally find the right camera parameters, open the Adjustment dialog.

 

The Reset button sets the camera parameters to their default values. Make sure that the Undistortion function is enabled, otherwise you won't see the calibrated output. Now adjust barrel distortion, perspective, focal length and principal point using the sliders. The spin controls are used to change the paramter scale in case this is required. Once you finished the adjustment, you can save the camera parameters into a MontiVision calibration parameter file (*.mvc) using the Save button.

 

3. Insert the MV Camera Undistortion filter

To apply the camera calibration parameters to your camera within your applications, you have to utilize the MV Camera Undistortion DirectShow filter inside your filter configuration. The filter has to be placed directly behind your video source filter (Or behind a decoder/color space converter in case this is required).

Example:

4. Load a camera parameter file into the MV Camera Undistotion filter

The MV Camera Undistortion  filter doesn't save the camera calibration parameter or the path to the camera calibration parameter file (*-mvc) to filter graph configuration files (*.mvp). Therefore an application has to load a valid calibration parameter file for the actually selected camera using the IMVCameraUndistortion::LoadCameraParameter method. The CamUndist sample demonstrates how to use the MV Camera Undistortion filter within an application.