mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-17 15:26:00 +08:00
Add calib3d to julia bindings
This commit is contained in:
@@ -68,6 +68,7 @@ ocv_add_module(
|
||||
opencv_dnn
|
||||
opencv_features2d
|
||||
opencv_objdetect
|
||||
opencv_calib3d
|
||||
)
|
||||
|
||||
set(HDR_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/python/src2/hdr_parser.py)
|
||||
|
@@ -88,4 +88,4 @@ All other types map directly to the corresponding types on C++. Unlike Python, `
|
||||
Current Functionality
|
||||
---
|
||||
|
||||
The bindings implement most of the functionality present in the core,imgproc,highgui,videoio,dnn and imgcodecs. The samples also implement some additional manually wrapped functionality. The complete list of automatically wrapped functionality is [here](gen/funclist.csv).
|
||||
The bindings implement most of the functionality present in the core,imgproc,highgui,videoio,dnn,calib3d and imgcodecs. The samples also implement some additional manually wrapped functionality. The complete list of automatically wrapped functionality is [here](gen/funclist.csv).
|
||||
|
@@ -41,11 +41,12 @@ ${include_code}
|
||||
//
|
||||
|
||||
#ifdef HAVE_OPENCV_FEATURES2D
|
||||
template <>
|
||||
struct SuperType<cv::Feature2D>
|
||||
{
|
||||
typedef cv::Algorithm type;
|
||||
};
|
||||
// template <>
|
||||
// struct SuperType<cv::Feature2D>
|
||||
// {
|
||||
// typedef cv::Algorithm type;
|
||||
// };
|
||||
// TODO: Needs to be fixed but doesn't matter for now
|
||||
template <>
|
||||
struct SuperType<cv::SimpleBlobDetector>
|
||||
{
|
||||
@@ -88,7 +89,6 @@ JLCXX_MODULE cv_wrap(jlcxx::Module &mod)
|
||||
|
||||
|
||||
|
||||
${cpp_code}
|
||||
|
||||
//
|
||||
// Manual Wrapping BEGIN
|
||||
@@ -128,16 +128,21 @@ JLCXX_MODULE cv_wrap(jlcxx::Module &mod)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCV_FEATURES2D
|
||||
mod.add_type<cv::Feature2D>("Feature2D", jlcxx::julia_base_type<cv::Algorithm>());
|
||||
mod.add_type<cv::Feature2D>("Feature2D");
|
||||
mod.add_type<cv::SimpleBlobDetector>("SimpleBlobDetector", jlcxx::julia_base_type<cv::Feature2D>());
|
||||
mod.add_type<cv::SimpleBlobDetector::Params>("SimpleBlobDetector_Params");
|
||||
|
||||
mod.method("jlopencv_cv_cv_Feature2D_cv_Feature2D_detect", [](cv::Ptr<cv::Feature2D> &cobj, Mat &image, Mat &mask) {vector<KeyPoint> keypoints; cobj->detect(image, keypoints, mask); return keypoints; });
|
||||
mod.method("jlopencv_cv_cv_SimpleBlobDetector_create", [](SimpleBlobDetector_Params ¶meters) { auto retval = cv::SimpleBlobDetector::create(parameters); return retval; });
|
||||
#endif
|
||||
|
||||
//
|
||||
// Manual Wrapping END
|
||||
//
|
||||
|
||||
${cpp_code}
|
||||
|
||||
#ifdef HAVE_OPENCV_FEATURES2D
|
||||
|
||||
mod.method("jlopencv_cv_cv_Feature2D_cv_Feature2D_detect", [](cv::Ptr<cv::Feature2D> &cobj, Mat &image, Mat &mask) {vector<KeyPoint> keypoints; cobj->detect(image, keypoints, mask); return keypoints; });
|
||||
mod.method("jlopencv_cv_cv_SimpleBlobDetector_create", [](SimpleBlobDetector_Params ¶meters) { auto retval = cv::SimpleBlobDetector::create(parameters); return retval; });
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@@ -75,6 +75,11 @@ typedef cv::dnn::DictValue LayerId;
|
||||
typedef cv::dnn::Backend dnn_Backend;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCV_CALIB3D
|
||||
|
||||
#include <opencv2/calib3d.hpp>
|
||||
#endif
|
||||
|
||||
template <typename C>
|
||||
struct get_template_type;
|
||||
template <typename C>
|
||||
|
@@ -65,4 +65,38 @@ Int32|0|0
|
||||
Float64|255.|255
|
||||
Scalar|Scalar(1)|cpp_to_julia(ScalarOXP())
|
||||
Int32|1|1
|
||||
Size{Int32}|Size()|cpp_to_julia(SizeOP())
|
||||
Size{Int32}|Size()|cpp_to_julia(SizeOP())
|
||||
TermCriteria|TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON)|cpp_to_julia(TermCriteriaOTermCriteriaggEPSGRGTermCriteriaggCOUNTSGYWSGFLTREPSILONP())
|
||||
Int32|RANSAC|cv_RANSAC
|
||||
Float32|8.0|8.0
|
||||
Float64|-1|-1
|
||||
Int32|21|21
|
||||
TermCriteria|TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON)|TermCriteriaOGTermCriteriaggCOUNTGRGTermCriteriaggEPSSGZWSGDBLREPSILONP
|
||||
TermCriteria|TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6)|TermCriteriaOTermCriteriaggCOUNTRTermCriteriaggEPSSGZWSGXeTcP
|
||||
Int32|CALIB_CB_SYMMETRIC_GRID|cv_CALIB_CB_SYMMETRIC_GRID
|
||||
InputArray|cv::Mat()|CxxMat()
|
||||
Int32|SOLVEPNP_ITERATIVE|cv_SOLVEPNP_ITERATIVE
|
||||
Float64|3|3
|
||||
Int32|CALIB_FIX_INTRINSIC|cv_CALIB_FIX_INTRINSIC
|
||||
Float64|5|5
|
||||
Float64|0.99|0.99
|
||||
Int32|CALIB_ZERO_DISPARITY|cv_CALIB_ZERO_DISPARITY
|
||||
size_t|2000|2000
|
||||
SolvePnPMethod|SOLVEPNP_ITERATIVE|cv_SOLVEPNP_ITERATIVE
|
||||
Float64|0.0|0.0
|
||||
Ptr{Feature2D}|SimpleBlobDetector::create()|SimpleBlobDetectorggcreateOP
|
||||
Int32|StereoSGBM::MODE_SGBM|StereoSGBMggMODERSGBM
|
||||
Int32|CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE|cv_CALIB_CB_ADAPTIVE_THRESH + cv_CALIB_CB_NORMALIZE_IMAGE
|
||||
Float64|3.|3
|
||||
size_t|10|10
|
||||
Int32|16|16
|
||||
Point{Float64}|Point2d(0, 0)|PointYdOWSGWP
|
||||
Int32|2000|2000
|
||||
Int32|FM_RANSAC|cv_FM_RANSAC
|
||||
Int32|100|100
|
||||
TermCriteria|TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON)|TermCriteriaOTermCriteriaggCOUNTGRGTermCriteriaggEPSSGXWWSGDBLREPSILONP
|
||||
HandEyeCalibrationMethod|CALIB_HAND_EYE_TSAI|cv_CALIB_HAND_EYE_TSAI
|
||||
Float32|0.8F|0.8
|
||||
Int32|fisheye::CALIB_FIX_INTRINSIC|cv_fisheye_CALIB_FIX_INTRINSIC
|
||||
Float64|0.999|0.999
|
||||
Float64|0.995|0.995
|
@@ -373,4 +373,120 @@ cv.setTrackbarMax
|
||||
cv.setTrackbarMin
|
||||
cv.addText
|
||||
cv.displayOverlay
|
||||
cv.displayStatusBar
|
||||
cv.displayStatusBar
|
||||
cv.Rodrigues
|
||||
cv.findHomography
|
||||
cv.RQDecomp3x3
|
||||
cv.decomposeProjectionMatrix
|
||||
cv.matMulDeriv
|
||||
cv.composeRT
|
||||
cv.projectPoints
|
||||
cv.solvePnP
|
||||
cv.solvePnPRansac
|
||||
cv.solveP3P
|
||||
cv.solvePnPRefineLM
|
||||
cv.solvePnPRefineVVS
|
||||
cv.solvePnPGeneric
|
||||
cv.initCameraMatrix2D
|
||||
cv.findChessboardCorners
|
||||
cv.checkChessboard
|
||||
cv.findChessboardCornersSB
|
||||
cv.findChessboardCornersSB
|
||||
cv.estimateChessboardSharpness
|
||||
cv.find4QuadCornerSubpix
|
||||
cv.drawChessboardCorners
|
||||
cv.drawFrameAxes
|
||||
cv.CirclesGridFinderParameters.CirclesGridFinderParameters
|
||||
cv.findCirclesGrid
|
||||
cv.findCirclesGrid
|
||||
cv.calibrateCamera
|
||||
cv.calibrateCamera
|
||||
cv.calibrateCameraRO
|
||||
cv.calibrateCameraRO
|
||||
cv.calibrationMatrixValues
|
||||
cv.stereoCalibrate
|
||||
cv.stereoCalibrate
|
||||
cv.stereoRectify
|
||||
cv.stereoRectifyUncalibrated
|
||||
cv.rectify3Collinear
|
||||
cv.getOptimalNewCameraMatrix
|
||||
cv.calibrateHandEye
|
||||
cv.convertPointsToHomogeneous
|
||||
cv.convertPointsFromHomogeneous
|
||||
cv.findFundamentalMat
|
||||
cv.findFundamentalMat
|
||||
cv.findEssentialMat
|
||||
cv.findEssentialMat
|
||||
cv.decomposeEssentialMat
|
||||
cv.recoverPose
|
||||
cv.recoverPose
|
||||
cv.recoverPose
|
||||
cv.computeCorrespondEpilines
|
||||
cv.triangulatePoints
|
||||
cv.correctMatches
|
||||
cv.filterSpeckles
|
||||
cv.getValidDisparityROI
|
||||
cv.validateDisparity
|
||||
cv.reprojectImageTo3D
|
||||
cv.sampsonDistance
|
||||
cv.estimateAffine3D
|
||||
cv.estimateTranslation3D
|
||||
cv.estimateAffine2D
|
||||
cv.estimateAffinePartial2D
|
||||
cv.decomposeHomographyMat
|
||||
cv.filterHomographyDecompByVisibleRefpoints
|
||||
cv.StereoMatcher.compute
|
||||
cv.StereoMatcher.getMinDisparity
|
||||
cv.StereoMatcher.setMinDisparity
|
||||
cv.StereoMatcher.getNumDisparities
|
||||
cv.StereoMatcher.setNumDisparities
|
||||
cv.StereoMatcher.getBlockSize
|
||||
cv.StereoMatcher.setBlockSize
|
||||
cv.StereoMatcher.getSpeckleWindowSize
|
||||
cv.StereoMatcher.setSpeckleWindowSize
|
||||
cv.StereoMatcher.getSpeckleRange
|
||||
cv.StereoMatcher.setSpeckleRange
|
||||
cv.StereoMatcher.getDisp12MaxDiff
|
||||
cv.StereoMatcher.setDisp12MaxDiff
|
||||
cv.StereoBM.getPreFilterType
|
||||
cv.StereoBM.setPreFilterType
|
||||
cv.StereoBM.getPreFilterSize
|
||||
cv.StereoBM.setPreFilterSize
|
||||
cv.StereoBM.getPreFilterCap
|
||||
cv.StereoBM.setPreFilterCap
|
||||
cv.StereoBM.getTextureThreshold
|
||||
cv.StereoBM.setTextureThreshold
|
||||
cv.StereoBM.getUniquenessRatio
|
||||
cv.StereoBM.setUniquenessRatio
|
||||
cv.StereoBM.getSmallerBlockSize
|
||||
cv.StereoBM.setSmallerBlockSize
|
||||
cv.StereoBM.getROI1
|
||||
cv.StereoBM.setROI1
|
||||
cv.StereoBM.getROI2
|
||||
cv.StereoBM.setROI2
|
||||
cv.StereoBM.create
|
||||
cv.StereoSGBM.getPreFilterCap
|
||||
cv.StereoSGBM.setPreFilterCap
|
||||
cv.StereoSGBM.getUniquenessRatio
|
||||
cv.StereoSGBM.setUniquenessRatio
|
||||
cv.StereoSGBM.getP1
|
||||
cv.StereoSGBM.setP1
|
||||
cv.StereoSGBM.getP2
|
||||
cv.StereoSGBM.setP2
|
||||
cv.StereoSGBM.getMode
|
||||
cv.StereoSGBM.setMode
|
||||
cv.StereoSGBM.create
|
||||
cv.undistort
|
||||
cv.initUndistortRectifyMap
|
||||
cv.getDefaultNewCameraMatrix
|
||||
cv.undistortPoints
|
||||
cv.undistortPoints
|
||||
cv.fisheye.projectPoints
|
||||
cv.fisheye.distortPoints
|
||||
cv.fisheye.undistortPoints
|
||||
cv.fisheye.initUndistortRectifyMap
|
||||
cv.fisheye.undistortImage
|
||||
cv.fisheye.estimateNewCameraMatrixForUndistortRectify
|
||||
cv.fisheye.calibrate
|
||||
cv.fisheye.stereoRectify
|
||||
cv.fisheye.stereoCalibrate
|
||||
|
|
@@ -50,21 +50,6 @@ def handle_def_arg(inp, tp = '', ns=''):
|
||||
inp = inp.strip()
|
||||
|
||||
out = ''
|
||||
if tp in julia_types:
|
||||
out = inp
|
||||
elif not inp or inp=='Mat()':
|
||||
if tp=='Mat' or tp=='InputArray':
|
||||
out= 'CxxMat()'
|
||||
out = tp+'()'
|
||||
|
||||
elif inp=="String()":
|
||||
out= '""'
|
||||
|
||||
elif '(' in inp or ':' in inp:
|
||||
out = "cpp_to_julia("+get_var(inp)+"())"
|
||||
|
||||
else:
|
||||
print("Default not found")
|
||||
|
||||
if inp in jl_cpp_defmap[tp]:
|
||||
out = jl_cpp_defmap[tp][inp]
|
||||
|
@@ -32,6 +32,8 @@ for module in sys.argv[2:]:
|
||||
hdr_list.append(mod_path+"/videoio/include/opencv2/videoio.hpp")
|
||||
elif module =='opencv_highgui':
|
||||
hdr_list.append(mod_path+"/highgui/include/opencv2/highgui.hpp")
|
||||
elif module =='opencv_calib3d':
|
||||
hdr_list.append(mod_path+"/calib3d/include/opencv2/calib3d.hpp")
|
||||
|
||||
if not os.path.exists('autogen_cpp'):
|
||||
os.makedirs('autogen_cpp')
|
||||
|
@@ -45,3 +45,8 @@ vector<MatShape>:Array{Array{Int32, 1}, 1}
|
||||
float:Float32
|
||||
Ptr<float>:Ptr{Float32}
|
||||
vector<Vec6f>:Array{Vec{Float32, 6}, 1}
|
||||
Ptr<FeatureDetector>:Ptr{Feature2D}
|
||||
Point2d:Point{Float64}
|
||||
SolvePnPMethod:SolvePnPMethod
|
||||
CirclesGridFinderParameters:CirclesGridFinderParameters
|
||||
HandEyeCalibrationMethod:HandEyeCalibrationMethod
|
||||
|
19
modules/julia/samples/chessboard_corners.jl
Normal file
19
modules/julia/samples/chessboard_corners.jl
Normal file
@@ -0,0 +1,19 @@
|
||||
using OpenCV
|
||||
|
||||
const cv = OpenCV
|
||||
|
||||
|
||||
# chess1.png is at https://raw.githubusercontent.com/opencv/opencv_extra/master/testdata/cv/cameracalibration/chess1.png
|
||||
img = cv.imread("chess1.png",cv.IMREAD_GRAYSCALE)
|
||||
|
||||
# Find the chess board corners
|
||||
ret, corners = cv.findChessboardCorners(img, cv.Size{Int32}(7,5))
|
||||
|
||||
# If found, add object points, image points (after refining them)
|
||||
if ret
|
||||
img = cv.drawChessboardCorners(img, cv.Size{Int32}(7,5), corners,ret)
|
||||
cv.imshow("img",img)
|
||||
cv.waitKey(Int32(0))
|
||||
|
||||
cv.destroyAllWindows()
|
||||
end
|
@@ -16,7 +16,7 @@ Inspite of all this, Julia severely lacks in a lot of traditional computer visio
|
||||
|
||||
The Bindings
|
||||
-----------------------
|
||||
The OpenCV bindings for Julia are created automatically using Python scripts at configure time and then installed with the Julia package manager on the system. These bindings cover most of the important functionality present in the core, imgproc, imgcodecs, highgui, videio, and dnn modules. These bindings depend on CxxWrap.jl and the process for usage and compilation is explained in detail below. The Bindings have been tested on Ubuntu and Mac. Windows might work but is not officially tested and supported right now.
|
||||
The OpenCV bindings for Julia are created automatically using Python scripts at configure time and then installed with the Julia package manager on the system. These bindings cover most of the important functionality present in the core, imgproc, imgcodecs, highgui, videio, calib3d, and dnn modules. These bindings depend on CxxWrap.jl and the process for usage and compilation is explained in detail below. The Bindings have been tested on Ubuntu and Mac. Windows might work but is not officially tested and supported right now.
|
||||
|
||||
The generation process and the method by which the binding works are similar to the Python bindings. The only major difference is that CxxWrap.jl does not support optional arguments. As a consequence, it's necessary to define the optional arguments in Julia code which adds a lot of additional complexity.
|
||||
|
||||
|
Reference in New Issue
Block a user