added ximgproc edgedrawing to opencvjs, fixed external constructor from function which returns a Ptr<class>

This commit is contained in:
Gerold Meisinger 2024-05-27 23:36:17 +02:00
parent b6593517c4
commit 693bf019a2
3 changed files with 14 additions and 7 deletions

View File

@ -802,14 +802,13 @@ class JSWrapperGenerator(object):
# Register the smart pointer
base_class_name = variant.rettype
base_class_name = base_class_name.replace("Ptr<","").replace(">","").strip()
self.classes[base_class_name].has_smart_ptr = True
prefix_class_name = base_class_name if base_class_name in self.classes else ns_id + '_' + base_class_name
self.classes[prefix_class_name].has_smart_ptr = True
# Adds the external constructor
class_name = func.name.replace("create", "")
if not class_name in self.classes:
self.classes[base_class_name].methods[func.cname] = func
else:
self.classes[class_name].methods[func.cname] = func
self.classes[prefix_class_name].methods[func.cname] = func
ext_cnst = True
if ext_cnst:
continue

View File

@ -95,6 +95,11 @@ typedef aruco::DetectorParameters aruco_DetectorParameters;
typedef QRCodeDetectorAruco::Params QRCodeDetectorAruco_Params;
#endif
#ifdef HAVE_OPENCV_IMGCODECS
using namespace cv::ximgproc;
typedef ximgproc::EdgeDrawing::Params EdgeDrawing_Params;
#endif
#ifdef HAVE_OPENCV_DNN
using namespace cv::dnn;
#endif

View File

@ -210,7 +210,10 @@ calib3d = {
],
}
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, calib3d])
ximgproc = { '': ['createEdgeDrawing'], 'ximgproc_EdgeDrawing': ["setParams", "detectEdges", "getEdgeImage"], 'ximgproc_EdgeDrawing_Params': ["Params", "PFmode"] }
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, calib3d, ximgproc])
namespace_prefix_override['ximgproc'] = ''
# namespace_prefix_override['dnn'] = '' # compatibility stuff (enabled by default)
# namespace_prefix_override['aruco'] = '' # compatibility stuff (enabled by default)