You are here: Start » Technical Issues » Libraries comparison

Libraries comparison

Introduction

The below table summarizes mutually corresponding functions between OpenCV, Halcon and Adaptive Vision Library (AVL). Feel free to use this table when porting your program from one library to another. Please note, however, that in most cases the corresponding functions may not give the same results as their implementations are different in details. Quite often also the range of parameters exposed to the user will be different.

Most important general differences are:

  • OpenCV does not have any data type for regions, so binary images must be used instead. Halcon has regions with unspecified implementation and which do not have specific outer dimensions. At the same time Adaptive Vision Studio provides Region data type which is always RLE-encoded and has specific dimensions (width and height) in the same way as images have. Thus you can consider regions to be more efficiently encoded binary images.
  • The representation of multi-channel images is very similar in OpenCV and in Adaptive Vision Studio. It is so called interleaved representation, while Halcon focuses on planar images (each channel is represented in a separate memory fragment).
  • The three libraries perform spatial image filters differently in areas close to the image borders. In OpenCV one can choose between different methods of extrapolating boundary pixels. Halcon always the boundary pixel is considered repeated beyond the image range. In Adaptive Vision Studio, spatial filters are performed by considering only the pixels that are in the image range.

Image Acquisition

AVL provides dedicated support for GenICam and GigE Vision industrial standards, as well as for specific camera brands - using SDK from their manufacturers. See also CameraSupport.

OpenCV Halcon AVL Module Comment
VideoCapture::open grab_image_start GenTL_StartAcquisition
GigEVision_StartAcquisition
Genicam
Genicam
VideoCapture::release close_framegrabber GenTL_StopAcquisition
GigEVision_StopAcquisition
Genicam
Genicam
VideoCapture::grab grab_image GenTL_ReceiveImage
GigEVision_ReceiveImage
Genicam
Genicam
grab_image_async GenTL_TryReceiveImage
GigEVision_TryReceiveImage
Genicam
Genicam

Image Processing (Part I)

Here is a list of fundamental image transformations available in almost any library.

OpenCV Halcon AVL Module Comment
imread read_image LoadImage
FoundationLite
imwrite write_image SaveImage
FoundationLite
gen_image3 MakeImage
FoundationLite
addWeighted add_image AddImages
FoundationLite
subtract sub_image SubtractImages
FoundationLite
bitwise_and paint_gray ComposeImages
FoundationLite
absdiff abs_diff_image DifferenceImage
FoundationLite
divide div_image DivideImages
FoundationLite
multiply mult_image MultiplyImages
FoundationLite
add scale_image AddToImage
FoundationLite
convertScaleAbs scale_image RescalePixels
FoundationLite
cvSubRS invert_image NegateImage
FoundationLite
convertScaleAbs scale_image MultiplyImage
FoundationLite
max max_image MaximumImage
FoundationLite
min min_image MinimumImage
FoundationLite
resize zoom_image_size ResizeImage
FoundationLite
resize zoom_image_factor ResizeImage_Relative
FoundationLite
warpAffine rotate_image RotateImage
FoundationLite
flip, transpose mirror_image MirrorImage
TransposeImage
FoundationLite
FoundationLite
compose3 MergeChannels
FoundationLite
rgb1_to_gray AverageChannels_Weighted
FoundationLite
rgb3_to_gray AverageChannels_Weighted
FoundationLite
decompose3 SplitChannels
FoundationLite
cvtColor trans_from_rgb RgbToHsv
HsvToRgb
FoundationLite
FoundationLite
See also many other functions in Image Color Spaces
add_noise_white AddNoiseToImage
FoundationLite
calcHist gray_histo ImageHistogram
FoundationBasic

Image Processing (Part II)

More advanced image processing tools, including spatial filtering and transformations.

OpenCV Halcon AVL Module Comment
cvSmooth mean_image SmoothImage_Mean
FoundationLite
cvSmooth gauss_image SmoothImage_Gauss
FoundationLite
gen_gauss_filter SmoothImage_Gauss_Mask
FoundationLite
smooth_image SmoothImage_Deriche
SmoothImage_Gauss
SmoothImage_Gauss_Mask
FoundationLite
FoundationLite
FoundationLite
cvSmooth median_image SmoothImage_Median
SmoothImage_Median_Mask
FoundationLite
FoundationLite
midrange_image SmoothImage_Middle
FoundationLite
rank_image SmoothImage_Quantile
FoundationLite
bilateral_filter SmoothImage_Bilateral
FoundationPro
dilate gray_dilation DilateImage
FoundationLite
erode gray_erosion ErodeImage
FoundationLite
close gray_closing_shape CloseImage
FoundationLite
open gray_opening_shape OpenImage
FoundationLite
filter2D convol_image ConvolveImage
FoundationLite
derivate_gauss GradientImage
FoundationLite
sobel sobel_amp GradientImage_Mask
FoundationLite
sobel sobel_dir GradientImage_Mask
FoundationLite
prewitt_amp GradientImage_Mask
FoundationLite
prewitt_dir GradientImage_Mask
FoundationLite
diff_of_gauss DifferenceOfGaussians
FoundationBasic
emphasize SharpenImage
FoundationLite
illuminate NormalizeLocalContrast
FoundationBasic
inpaint inpainting_texture InpaintImage
FoundationPro
threshold ThresholdImage
FoundationLite
threshold ThresholdToRegion
FoundationBasic
hysteresis_threshold ThresholdImage_Hysteresis
FoundationBasic
dyn_threshold ThresholdImage_Dynamic
FoundationLite
histo_to_thresh SelectThresholdValue
FoundationBasic
watershed watersheds_threshold SegmentImage_Watersheds
FoundationBasic
normalize equ_histo_image EqualizeImageHistogram
FoundationLite
LineIterator ImageAlongPath
FoundationPro
measure_projection ImageProfileAlongPath
FoundationPro
tile_images CutImageIntoTiles
FoundationBasic
minMaxLoc ImageMaximum
FoundationLite
local_max ImageLocalMaxima
FoundationBasic
warpAffine affine_trans_image CreateAffineTransformMatrix
TransformImage
FoundationBasic
FoundationLite
affine_trans_image_size CreateAffineTransformMatrix
TransformImage
FoundationBasic
FoundationLite
vector_angle_to_rigid CreateCoordinateSystemFromVector
CreateCoordinateSystemFromSegment
FoundationLite
FoundationLite
hom_mat2d_identity CreateIdentityMatrix
FoundationLite
linearPolar polar_trans_image_ext ImagePolarTransform
FoundationBasic
linearPolar polar_trans_image_inv ImageInversePolarTransform
FoundationBasic
projective_trans_image TransformImage
FoundationLite
LUT lut_trans LUTTransformImage
FoundationLite
fill_interlace LerpImages
FoundationLite
meanStdDev deviation_image ImageStandardDeviation
FoundationBasic
dft fft_image FourierTransform
FoundationPro
gen_highpass FrequencyDomain_FilterFrequencies
FoundationPro
gen_lowpass FrequencyDomain_FilterFrequencies
FoundationPro

Region Analysis

In the OpenCV context, regions may be represented as binary image masks, but there are no true RLE-encoded regions. See also Region.

OpenCV Halcon AVL Module Comment
gen_circle CreateCircleRegion
FoundationLite
gen_ellipse CreateEllipseRegion
FoundationLite
gen_grid_region CreateGridRegion
FoundationLite
gen_rectangle2 CreateBoxRegion
FoundationLite
gen_region_line CreateLineRegion
FoundationLite
gen_region_polygon_filled CreatePolygonRegion
FoundationLite
difference RegionDifference
FoundationLite
intersection RegionIntersection
FoundationLite
union2 RegionUnion
FoundationLite
mirror_region MirrorRegion
FoundationBasic
transpose_region TransposeRegion
FoundationBasic
dilation_rectangle1 DilateRegion
FoundationBasic
dilation_circle DilateRegion
FoundationBasic
dilate dilation1 DilateRegion_AnyKernel
FoundationBasic
dilate dilation2 DilateRegion_AnyKernel
FoundationBasic
erosion_rectangle1 ErodeRegion
FoundationBasic
erosion_circle ErodeRegion
FoundationBasic
erode erosion1 ErodeRegion_AnyKernel
FoundationBasic
erode erosion2 ErodeRegion_AnyKernel
FoundationBasic
closing CloseRegion_AnyKernel
FoundationBasic
closing_circle CloseRegion
FoundationBasic
closing_rectangle1 CloseRegion
FoundationBasic
opening OpenRegion_AnyKernel
FoundationBasic
opening_rectangle1 OpenRegion
FoundationBasic
opening_circle OpenRegion
FoundationBasic
findContours morph_skeleton SkeletonizeRegion
FoundationBasic
thickening ThickenRegion
FoundationBasic
thinning ThinRegion
FoundationBasic
pruning PruneRegion
FoundationBasic
get_region_contour RegionContours
FoundationBasic
fill_up FillRegionHoles
FoundationBasic
expand_region ExpandRegions
FoundationBasic
move_region TranslateRegion
FoundationLite
affine_trans_region ShearRegion
FoundationBasic
test_equal_region TestRegionEqualTo
FoundationBasic
test_region_point TestPointInRegion
FoundationLite
test_subset_region TestRegionInRegion
FoundationBasic
clip_region TrimRegionToRectangle
FoundationPro
contourArea area_center RegionArea
RegionMassCenter
FoundationLite
FoundationLite
Utility function: area.
area_holes RegionHoles
FoundationBasic
circularity RegionCircularity
FoundationBasic
convexity RegionConvexity
FoundationBasic
diameter_region RegionDiameter
RegionCaliperDiameter
FoundationBasic
FoundationBasic
elliptic_axis RegionEllipticAxes
FoundationBasic
inner_circle RegionInscribedCircle
FoundationBasic
orientation_region RegionOrientation
FoundationBasic
moments region_features RegionMoment
FoundationBasic
rectangularity RegionRectangularity
FoundationBasic
connection SplitRegionIntoBlobs
FoundationBasic
hit_or_miss RegionHitAndMissTransform
FoundationBasic
DemarcateRegions
FoundationBasic
convexity RegionConvexHull
FoundationBasic
smallest_rectangle1 RegionBoundingRectangle
FoundationBasic
select_shape SelectRegions
FoundationBasic
sort_region SortRegions
FoundationBasic
read_region LoadRegion
FoundationLite
write_region SaveRegion
FoundationLite

Geometry 2D

Geometrical algorithms are essential in processing results in most computer vision applications. For the full list see Geometry2D – AVL provides a comprehensive geometry library with many more functions than presented below. AVL also provides simple utility functions described in comments.

OpenCV Halcon AVL Module Comment
angle_ll AngleBetweenLines
AngleBetweenSegments
FoundationLite
FoundationLite
Utility functions: angleTurn, angleDiff.
distance_cc_min PathToPathDistance
FoundationPro
Utility function: distance.
distance_cc PathToPathDistance
PathToPathMaximumDistance
FoundationPro
FoundationPro
Utility function: distance.
distance_lc PathToLineDistance
PathToLineDistanceProfile
FoundationBasic
FoundationBasic
distance_pc PathToPointDistance
PathToPointDistanceProfile
FoundationBasic
FoundationBasic
Utility function: distance.
distance_pl PointToLineDistance
PointToLineDistance_Oriented
FoundationLite
FoundationLite
distance_contours_xld PathToPathDistanceProfile
FoundationPro
distance_pp PointToPointDistance
FoundationLite
Utility function: distance.
distance_ps PointToSegmentDistance
FoundationLite
distance_ss SegmentToSegmentDistance
FoundationLite
distance_rr_min RegionToRegionDistance
FoundationBasic
intersection_circles CircleCircleIntersection
FoundationLite
intersection_line_circle LineCircleIntersection
FoundationLite
intersection_lines LineLineIntersection
FoundationLite
Utility function: intersection.
intersection_segment_line LineSegmentIntersection
FoundationLite
Utility function: intersection.
intersection_ll LineLineIntersection
SegmentSegmentIntersection
FoundationLite
FoundationLite
Utility function: intersection.
intersection_segments SegmentSegmentIntersection
FoundationLite
Utility function: intersection.
projection_pl ProjectPointOnLine
FoundationLite
Utility function: project.
line_orientation LineOrientation
SegmentOrientation
FoundationLite
FoundationLite
Utility property: Line2D.Orientation.
line_position SegmentOrientation
FoundationLite
Utility property: Line2D.Orientation.
convexHull shape_trans PointsConvexHull
FoundationLite
contourArea area_center_xld PolygonArea
FoundationBasic

Computer Vision

This section contains higher-level vision tools.

OpenCV Halcon AVL Module Comment
measure_pos ScanSingleEdge
ScanMultipleEdges
ScanExactlyNEdges
MetrologyBasic
MetrologyBasic
MetrologyBasic
See also ScanSingleRidge
measure_pairs ScanSingleStripe
ScanMultipleStripes
ScanExactlyNStripes
MetrologyBasic
MetrologyBasic
MetrologyBasic
measure_thresh ScanSingleEdge
ScanMultipleEdges
ScanExactlyNEdges
MetrologyBasic
MetrologyBasic
MetrologyBasic
See also ScanSingleRidge
edges_sub_pix DetectEdges
DetectEdges_AsPaths
FoundationLite
FoundationBasic
edges_color_sub_pix DetectEdges
DetectEdges_AsPaths
FoundationLite
FoundationBasic
find_data_code_2d ReadSingleDataMatrixCode
ReadSingleQRCode
Datacodes
Datacodes
See also Datacodes
find_bar_code ReadSingleBarcode
Barcodes
See also: Barcodes
detect_edge_segments FitSegmentToEdges
MetrologyPro
fit_line_contour_xld FitSegmentToPoints
FoundationBasic
fit_circle_contour_xld FitCircleToPoints
FoundationBasic
FitPathToRidges
MetrologyPro
FitPathToStripe
MetrologyPro
FitPathToEdges
MetrologyPro
fit_circle_contour_xld FitCircleToRidges
MetrologyPro
fit_circle_contour_xld FitCircleToEdges
MetrologyPro
FitCircleToStripe
MetrologyPro
matchTemplate find_ncc_model LocateSingleObject_NCC
LocateMultipleObjects_NCC
MatchingBasic
MatchingBasic
find_shape_model LocateSingleObject_Edges
LocateMultipleObjects_Edges
MatchingPro
MatchingPro
segment_image_mser FindMaxStableExtremalRegions
FoundationPro
auto_threshold SegmentImage_Color
FoundationPro
detect_edge_segments SegmentImage_Edges
FoundationPro
local_threshold SegmentImage_Gray
FoundationPro
Methods are very different.
corner_response DetectCorners_CornerResponse
FoundationBasic
preCornerDetect points_foerstner DetectCorners_Foerstner
FoundationBasic
photometric_stereo PhotometricStereo_Perform
PhotometricStereo_ComputeHeightMap
PhotometricStereo_SurfaceCurvature
Photometric
Photometric
Photometric
HoughLines2 hough_lines DetectLines
FoundationBasic
HoughCircles hough_circles DetectSingleCircle
DetectMultipleCircles
FoundationBasic
FoundationBasic
DetectPaths
FoundationBasic
texture_laws LawsFilter
FoundationBasic
LinearBinaryPattern
FoundationBasic

Camera Calibration

The three products have quite different approach to calibration functions. OpenCV provides basic distortion correction based on (x, y) transformation maps. Commercial libraries provide highly optimized remapping based on precomputed data, but also focus on coordinate space transformations and image stitching functionalities. For details see Camera Calibration and World Coordinates.

OpenCV Halcon AVL Module Comment
calibrateCamera camera_calibration CalibrateCamera_Pinhole
CalibrateCamera_Telecentric
Calibration
Calibration
All function could use different methods.
find_caltab DetectCalibrationGrid_Circles
Calibration
find_marks_and_pose GenerateCalibrationPoints
Calibration
set_origin_pose ShiftWorldPlane
Calibration
gen_image_to_world_plane_map CreateRectificationMap_Advanced
Calibration
remap map_image RectifyImage
Calibration
OpenCV needs operation to extract final transformation matrix.

Machine Learning

Fundamental machine learning algorithms include K Nearest Neighbors, Support Vector Machines, Multi-Layer Perceptron and Principal Component Analysis. In the below table we provide just basic algorithms as a starting point for finding what you need.

OpenCV Halcon AVL Module Comment
CvKNearest::find_nearest classify_image_class_knn KNN_Classify
FoundationPro
CvSVM::predict classify_image_class_svm SVM_ClassifySingle
SVM_ClassifyMultiple
FoundationPro
FoundationPro
CvANN_MLP::predict classify_image_class_mlp MLP_Respond
FoundationPro
gen_principal_comp_trans ApplyPCATransform
FoundationPro

Communication

The below table contains only basic functions. Please refer to detailed documentation for more details.

OpenCV Halcon AVL Module Comment
open_serial SerialPort_Config
FoundationLite
read_serial SerialPort_ReadBuffer
FoundationLite
write_serial SerialPort_WriteBuffer
FoundationLite
open_socket_accept TcpIp_Accept
FoundationLite
open_socket_connect TcpIp_Connect
FoundationLite
close_socket TcpIp_Close
FoundationLite
receive_data TcpIp_ReadBuffer
FoundationLite
send_data TcpIp_WriteBuffer
FoundationLite
Ftp_ReceiveFile
FoundationBasic
Ftp_ReceiveImage
FoundationBasic
Ftp_SendFile
FoundationBasic
Ftp_SendImage
FoundationBasic
Http_SendRequest_GET
FoundationBasic
Http_SendRequest_POST
FoundationBasic
Http_DecodeURL
FoundationBasic
Http_EncodeURL
FoundationBasic
Previous: Optimizing Image Analysis for Speed Next: Deep Learning Training API