C# 클래스 AForge.Video.Ximea.XimeaCamera

The class provides access to XIMEA cameras.

The class allows to perform image acquisition from XIMEA cameras. It wraps XIMEA'a xiAPI, which means that users of this class will also require m3api.dll and a correct TM file for the camera model connected to the system (both are provided with XIMEA API software package).

Sample usage:

XimeaCamera camera = new XimeaCamera( ); // open camera and start data acquisition camera.Open( 0 ); camera.StartAcquisition( ); // set exposure time to 10 milliseconds camera.SetParam( CameraParameter.Exposure, 10 * 1000 ); // get image from the camera Bitmap bitmap = camera.GetImage( ); // process the image // ... // dispose the image when it is no longer needed bitmap.Dispose( ); // stop data acquisition and close the camera camera.StopAcquisition( ); camera.Close( );
파일 보기 프로젝트 열기: holisticware-admin/MonoVersal.AForgeNET

공개 메소드들

메소드 설명
Close ( ) : void

Close opened camera (if any) and release allocated resources.

The method also calls StopAcquisition method if it was not done by user.

GetImage ( ) : Bitmap

Get image from the opened XIMEA camera.

The method calls GetImage(int) method specifying 5000 as the timeout value.

GetImage ( int timeout ) : Bitmap

Get image from the opened XIMEA camera.

The method calls GetImage(int,bool) method specifying the makeCopy parameter.

GetImage ( int timeout, bool makeCopy ) : Bitmap

Get image from the opened XIMEA camera.

If the makeCopy is set to , then the method creates a managed copy of the camera's image, so the managed image stays valid even when the camera is closed. However, setting this parameter to creates a managed image which is just a wrapper around camera's unmanaged image. So if camera is closed and its resources are freed, the managed image becomes no longer valid and accessing it will generate an exception.

GetParamFloat ( string parameterName ) : float

Get camera's parameter as float value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

GetParamInt ( string parameterName ) : int

Get camera's parameter as integer value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

GetParamString ( string parameterName ) : string

Get camera's parameter as string value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

Open ( int deviceID ) : void

Open XIMEA camera.

Opens the specified XIMEA camera preparing it for starting video acquisition which is done using StartAcquisition method. The IsDeviceOpen property can be used at any time to find if a camera was opened or not.

SetParam ( string parameterName, float value ) : void

Set camera's parameter.

The method allows to control different camera's parameters, like exposure time, gain value, etc. See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

SetParam ( string parameterName, int value ) : void

Set camera's parameter.

The method allows to control different camera's parameters, like exposure time, gain value, etc. See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

StartAcquisition ( ) : void

Begin camera's work cycle and start data acquisition from it.

The IsAcquisitionStarted property can be used at any time to find if the acquisition was started or not.

StopAcquisition ( ) : void

End camera's work cycle and stops data acquisition.

비공개 메소드들

메소드 설명
CheckConnection ( ) : void
HandleError ( int errorCode ) : void

메소드 상세

Close() 공개 메소드

Close opened camera (if any) and release allocated resources.

The method also calls StopAcquisition method if it was not done by user.

An error occurred while communicating with a camera. See error /// message for additional information.
public Close ( ) : void
리턴 void

GetImage() 공개 메소드

Get image from the opened XIMEA camera.

The method calls GetImage(int) method specifying 5000 as the timeout value.

public GetImage ( ) : Bitmap
리턴 System.Drawing.Bitmap

GetImage() 공개 메소드

Get image from the opened XIMEA camera.

The method calls GetImage(int,bool) method specifying the makeCopy parameter.

public GetImage ( int timeout ) : Bitmap
timeout int Maximum time to wait in milliseconds till image becomes available.
리턴 System.Drawing.Bitmap

GetImage() 공개 메소드

Get image from the opened XIMEA camera.

If the makeCopy is set to , then the method creates a managed copy of the camera's image, so the managed image stays valid even when the camera is closed. However, setting this parameter to creates a managed image which is just a wrapper around camera's unmanaged image. So if camera is closed and its resources are freed, the managed image becomes no longer valid and accessing it will generate an exception.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods. Time out value reached - no image is available within specified time value.
public GetImage ( int timeout, bool makeCopy ) : Bitmap
timeout int Maximum time to wait in milliseconds till image becomes available.
makeCopy bool Make a copy of the camera's image or not.
리턴 System.Drawing.Bitmap

GetParamFloat() 공개 메소드

Get camera's parameter as float value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public GetParamFloat ( string parameterName ) : float
parameterName string Parameter name to get from camera.
리턴 float

GetParamInt() 공개 메소드

Get camera's parameter as integer value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public GetParamInt ( string parameterName ) : int
parameterName string Parameter name to get from camera.
리턴 int

GetParamString() 공개 메소드

Get camera's parameter as string value.

See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public GetParamString ( string parameterName ) : string
parameterName string Parameter name to get from camera.
리턴 string

Open() 공개 메소드

Open XIMEA camera.

Opens the specified XIMEA camera preparing it for starting video acquisition which is done using StartAcquisition method. The IsDeviceOpen property can be used at any time to find if a camera was opened or not.

An error occurred while communicating with a camera. See error /// message for additional information.
public Open ( int deviceID ) : void
deviceID int Camera ID to open.
리턴 void

SetParam() 공개 메소드

Set camera's parameter.

The method allows to control different camera's parameters, like exposure time, gain value, etc. See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public SetParam ( string parameterName, float value ) : void
parameterName string Parameter name.
value float Float parameter value.
리턴 void

SetParam() 공개 메소드

Set camera's parameter.

The method allows to control different camera's parameters, like exposure time, gain value, etc. See CameraParameter class for the list of some possible configuration parameters. See XIMEA documentation for the complete list of supported parameters.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public SetParam ( string parameterName, int value ) : void
parameterName string Parameter name.
value int Integer parameter value.
리턴 void

StartAcquisition() 공개 메소드

Begin camera's work cycle and start data acquisition from it.

The IsAcquisitionStarted property can be used at any time to find if the acquisition was started or not.

An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public StartAcquisition ( ) : void
리턴 void

StopAcquisition() 공개 메소드

End camera's work cycle and stops data acquisition.
An error occurred while communicating with a camera. See error /// message for additional information. No camera was opened, so can not access its methods.
public StopAcquisition ( ) : void
리턴 void