Added option to wrap opencv_contrib into JS too.

This commit is contained in:
Alexander Smorkalov 2025-09-25 17:25:04 +03:00
parent 659106a99d
commit 5755d4f224
2 changed files with 10 additions and 0 deletions

View File

@ -107,6 +107,10 @@ typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef TrackerMIL::Params TrackerMIL_Params; typedef TrackerMIL::Params TrackerMIL_Params;
#endif #endif
#ifdef HAVE_OPENCV_XIMGPROC
typedef ximgproc::EdgeDrawing::Params EdgeDrawing_Params;
#endif
// HACK: JS generator ommits namespace for parameter types for some reason. Added typedef to handle std::string correctly // HACK: JS generator ommits namespace for parameter types for some reason. Added typedef to handle std::string correctly
typedef std::string string; typedef std::string string;

View File

@ -175,6 +175,10 @@ class Builder:
if flags: if flags:
cmd += ["-DCMAKE_C_FLAGS='%s'" % flags, cmd += ["-DCMAKE_C_FLAGS='%s'" % flags,
"-DCMAKE_CXX_FLAGS='%s'" % flags] "-DCMAKE_CXX_FLAGS='%s'" % flags]
if self.options.extra_modules:
cmd.append("-DOPENCV_EXTRA_MODULES_PATH='%s'" % self.options.extra_modules)
return cmd return cmd
def get_build_flags(self): def get_build_flags(self):
@ -260,6 +264,8 @@ if __name__ == "__main__":
# Write a path to modify file like argument of this flag # Write a path to modify file like argument of this flag
parser.add_argument('--config', help="Specify configuration file with own list of exported into JS functions") parser.add_argument('--config', help="Specify configuration file with own list of exported into JS functions")
parser.add_argument('--webnn', action="store_true", help="Enable WebNN Backend") parser.add_argument('--webnn', action="store_true", help="Enable WebNN Backend")
parser.add_argument("--extra_modules", required=False, help="Path extra modules location (OPENCV_EXTRA_MODULES_PATH)")
transformed_args = ["--cmake_option={}".format(arg) if arg[:2] == "-D" else arg for arg in sys.argv[1:]] transformed_args = ["--cmake_option={}".format(arg) if arg[:2] == "-D" else arg for arg in sys.argv[1:]]
args = parser.parse_args(transformed_args) args = parser.parse_args(transformed_args)