Python Examples
The Python examples are located in a folder in the installation directory:
Windows: /RVCSDK/examples/Python
Linux: /opt/RVC/examples/Python
The examples are categorized and their functions are briefly described below. Click a example name to view the corresponding example code.
Basic
Demonstrate the basic process of image acquisition and how to capture and save different types of data.
-
QuickCaptureX1: Basic flow of monocular mode image capture.
-
QuickCaptureX2: Basic flow of binocular mode image capture.
-
CaptureGigE: Basic flow of GigE scanner image capture.
-
CaptureUSB: Basic flow of USB scannner image capture.
-
CaptureInContinueMode: Capture 10 times continuously in monocular mode, saving point cloud and 2D image.
-
X1Capture2D: Set 2D exposure in monocular mode, capture and save 2D image.
-
X2Capture2D: Set 2D exposure in binocular mode, capture and save the 2D image acquired by the left camera.
-
GetDepthImage: Capture in monocular mode, save point cloud, 2D image and depth image.
-
GetNormalMap: Capture, save 2D image and point cloud with normal vector.
-
SaveColorPointMap: Capture and save point cloud with color data.
-
GetValidPointMap: Get the valid points in the point cloud after capturing and save the valid point cloud.
Parameter Settings
RVC SDK provides four ways to set parameters. In practical applications, it is recommended to complete the parameter adjustment in RVCManager software to write the parameters to the scanner, and then directly call the parameters stored in the scanner in the SDK (i.e., Method 3), or load the parameters from the configuration file (i.e., Method 4).
Methods | Brief |
---|---|
Method 1 | Use the system default parameters and modify them. |
Method 2 | Load the parameters stored in the scanner and modify them. |
Method 3 | Use the parameters stored in the scanner directly. |
Method 4 | Load parameters from configuration file. |
The descriptions and code snippets of the different methods are detailed in the example files.
-
CaptureOptionsX1: Print capture parameters in monocular mode, the four ways of passing parameters are described, and the in-scanner parameters are called for capturing.
-
CaptureOptionsX2: Print capture parameters in binocular mode, the four ways to passing parameters are described, and the in-scanner parameters are called for capturing.
-
SaveLoadCaptureOptions: Read and modify the capture parameters in the scanner, store the modified parameters in the scanner and print them.
-
SaveLoadCameraSetting: Export and import capture parameters in .json format.
-
AdjustCaptureParameter: Explanation of capture parameters in monocular mode, modify capture parameters, capture, save point cloud and 2D image.
-
CaptureByX2: Modify capture parameters in binocular mode, capture, save point cloud and 2D image.
Functions
Demonstrate the setting methods and functions of smoothing, denoising, ROI, HDR and other parameters.
-
AdjustCaptureMode: Set capture mode (Normal/Fast).
-
GetDownsamplePointMap: Set downsampling distance of point cloud.
-
GetSmoothPointMap: Smooth the point cloud with Gaussian filter.
-
GetConfidenceMap: Set the confidence denoising threshold, capture and save the point cloud and 2D image, select a point in the image and print the confidence value of this point.
-
GetNoiseRemovalPointMap: Set clustering denoising and reflection denoising parameters for point clouds.
-
GetBilateralFiteredPointMapX1: Set bilateral filtering parameters (Bilateral Filtering Kernal Size, Bilateral Filtering Depth Sigma, Bilateral Filtering Space Sigma) in monocular mode.
-
GetBilateralFiteredPointMapX2: Set bilateral filtering parameters (Bilateral Filtering Kernal Size, Bilateral Filtering Depth Sigma, Bilateral Filtering Space Sigma) in binocular mode.
-
GetZFilteredPointMap: Set Z-Truncate parameters (Z-Truncate Upper Limit, Z-Truncate Lower Limit).
-
SetROI: Set ROI (Region of Interest), capture, save point cloud and 2D image in this region.
-
X1HDR: Set HDR parameters in monocular mode.
-
X2HDR: Set HDR parameters in binocular mode.
Auto Adjustment
For some parameters, RVC SDK provides auto parameter setting function, which can automatically set the capture parameters according to the image information in a given area to optimize the capturing effect.
-
GetAutoNoiseRemovalSetting: Automatically adjust clustering denoising parameters (Cluster Denoising Distance Threshold, Cluster Denoising Effective Points).
-
X1AutoSetParam: In monocular mode, set an ROI area, automatically adjust some parameters (Exposure2D, Exposure3D, Brightness, Light Contrast) according to the given ROI area, print the adjusted parameters, capture, save the point cloud and 2D image.
-
X2AutoSetParam: In binocular mode, set an ROI area, automatically adjust some parameters (Exposure2D, Exposure3D, Brightness, Light Contrast) according to the given ROI area, print the adjusted parameters, capture, save the point cloud and the 2D image acquired by the left camera.
-
X1AutoHdrSetParam: In monocular mode, set an ROI area, automatically adjust the HDR parameters (HDR Extra Times and 3D exposure time for each exposure) according to the given ROI area, print the adjusted parameters, capture, save the point cloud and 2D image.
-
X2AutoHdrSetParam: In binocular mode, set an ROI area, automatically adjust the HDR parameters (HDR Extra Times and 3D exposure time for each exposure) according to the given ROI area, print the adjusted parameters, capture, save the point cloud and 2D image acquired by the left camera.
Calibration Board/Marker Recognition
-
GetCailBoardPoseX1: Acquire calibration board pose in monocular mode.
-
GetCailBoardPoseX2: Acquire calibration board pose in binocular mode.
-
MarkerDetectionExample: Detect the coded circles in the captured area.
Coordinate System Transformation
-
X1SetTransformation: In monocular mode, set the customer coordinate system through the transformation matrix, transform the point cloud from the original coordinate system to the customer coordinate system.
-
X2SetTransformation: In binocular mode, set the customer coordinate system through the transformation matrix, transform the point cloud from the original coordinate system to the customer coordinate system.
Camera Parameters
- GetCameraParameter: Print camera external, internal and distortion parameters.
Scanner Accuracy Test
-
X1TestAccuracy: Test scanner accuracy in monocular mode.
-
X2TestAccuracy: Test scanner accuracy in binocular mode.
Data Type Conversion and Processing
-
ConvertDepthMapToPointMap: Convert depth map to point cloud (with distortion parameters).
-
GetImageCorresponcePoint: Read the point in the 2D image, get and print the corresponding 3D coordinates of the point in the point cloud.
-
TruncatePointCloud: Set the range of the area, truncate the point cloud according to the given range.
-
CaptureAndConvertToOpen3DType: Capture the point cloud and convert it to Open3D format.
Controls and Functions for RVC-M Series
-
ControlProtectiveCover: Control the Protective Cover status (Opening or Closing) of the RVC-M series.
-
X2SwingLineScanMode: RVC-M Series Swing Line Scan Mode parameter settings and capture.
-
GetCorrespondMap: Corresponds the point cloud position to the 2D image pixels in Swing Line Scan Mode.
Scanner Functions
-
PointCloudCompensating: Compensate for the point cloud drift caused by changes of camera or ambient temperature.
-
GetExternalColorCameraPointMap: Acquire the point cloud of an external camera. (You need to calibrate the external camera first and modify the corresponding values in the code.)