mirror of
https://github.com/opencv/opencv.git
synced 2026-11-20 08:15:26 -06:00
js: bind the mcc classes under their real 5.0 names (#30409) - #30428 Fixes #30409. The JS whitelist still names the pre-5.0 mcc classes (`mcc_CheckerDetector`, `mcc_DetectorParameters`, `mcc_Checker`), but the classes now live in `modules/objdetect` as `mcc::CCheckerDetector`, `mcc::DetectorParametersMCC` and `mcc::CChecker` (`mcc_checker_detector.hpp`). The generator skips unmatched entries silently, so a default opencv.js build exports only the `mcc_ColorChart` enum. Changes, following the working entry set from the issue: - `platforms/js/opencv_js.config.py` and `modules/objdetect/misc/js/gen_dict.json` (both whitelist sources, kept identical): rename the three entries to the real class names and add `processWithROI` (the `CV_WRAP_AS` alias) and `CChecker::create`. - Per the issue's findings, `getDetectionParams()` is left out (its `const DetectorParametersMCC&` return breaks the generated `select_overload` signature) and `getListColorChecker()`/`draw()` are left out (`std::vector<Ptr<CChecker>>` has no Embind registration, so they fail when called). - `modules/js/src/core_bindings.cpp`: `using namespace cv::mcc;` in the objdetect block (next to `using namespace cv::aruco;`) and `typedef dnn::Net dnn_Net;` in the dnn block (for the `create(const dnn::Net&)` overload), mirroring the existing `aruco_DetectorParameters` / `QRCodeDetectorAruco_Params` typedef pattern. Verification: every whitelisted method name was checked against `mcc_checker_detector.hpp` (all found; `processWithROI` is the `CV_WRAP_AS` alias of `process` at line 207). `gen_dict.json` parses and `opencv_js.config.py` compiles. A full `build_js.py --build_wasm` run needs Emscripten and is left to CI; the entry set itself is the one validated end-to-end against a downstream build in the issue (synthetic MCC24 chart detected, `getChartsRGB()` exact).
32 lines
3.0 KiB
JSON
32 lines
3.0 KiB
JSON
{
|
|
"whitelist":
|
|
{
|
|
"": ["groupRectangles", "getPredefinedDictionary", "extendDictionary", "drawDetectedMarkers", "generateImageMarker", "drawDetectedCornersCharuco", "drawDetectedDiamonds"],
|
|
"HOGDescriptor": ["load", "HOGDescriptor", "getDefaultPeopleDetector", "getDaimlerPeopleDetector", "setSVMDetector", "detectMultiScale"],
|
|
"CascadeClassifier": ["load", "detectMultiScale2", "CascadeClassifier", "detectMultiScale3", "empty", "detectMultiScale"],
|
|
"GraphicalCodeDetector": ["decode", "detect", "detectAndDecode", "detectMulti", "decodeMulti", "detectAndDecodeMulti"],
|
|
"QRCodeDetector": ["QRCodeDetector", "decode", "detect", "detectAndDecode", "detectMulti", "decodeMulti", "detectAndDecodeMulti", "decodeCurved", "detectAndDecodeCurved", "setEpsX", "setEpsY"],
|
|
"aruco_PredefinedDictionaryType": [],
|
|
"aruco_Dictionary": ["Dictionary", "getDistanceToId", "generateImageMarker", "getByteListFromBits", "getBitsFromByteList"],
|
|
"aruco_Board": ["Board", "matchImagePoints", "generateImage"],
|
|
"aruco_GridBoard": ["GridBoard", "generateImage", "getGridSize", "getMarkerLength", "getMarkerSeparation", "matchImagePoints"],
|
|
"aruco_CharucoParameters": ["CharucoParameters"],
|
|
"aruco_CharucoBoard": ["CharucoBoard", "generateImage", "getChessboardCorners", "getNearestMarkerCorners", "checkCharucoCornersCollinear", "matchImagePoints", "getLegacyPattern", "setLegacyPattern"],
|
|
"aruco_DetectorParameters": ["DetectorParameters"],
|
|
"aruco_RefineParameters": ["RefineParameters"],
|
|
"aruco_ArucoDetector": ["ArucoDetector", "detectMarkers", "refineDetectedMarkers", "setDictionary", "setDetectorParameters", "setRefineParameters"],
|
|
"aruco_CharucoDetector": ["CharucoDetector", "setBoard", "setCharucoParameters", "setDetectorParameters", "setRefineParameters", "detectBoard", "detectDiamonds"],
|
|
"QRCodeDetectorAruco_Params": ["Params"],
|
|
"QRCodeDetectorAruco": ["QRCodeDetectorAruco", "decode", "detect", "detectAndDecode", "detectMulti", "decodeMulti", "detectAndDecodeMulti", "setDetectorParameters", "setArucoParameters"],
|
|
"barcode_BarcodeDetector": ["BarcodeDetector", "decode", "detect", "detectAndDecode", "detectMulti", "decodeMulti", "detectAndDecodeMulti", "decodeWithType", "detectAndDecodeWithType"],
|
|
"mcc_CCheckerDetector": ["process", "processWithROI", "getBestColorChecker", "create", "getRefColors", "setDetectionParams", "setColorChartType", "getColorChartType", "setUseDnnModel", "getUseDnnModel"],
|
|
"mcc_DetectorParametersMCC": ["DetectorParametersMCC"],
|
|
"mcc_CChecker": ["create", "setTarget", "setBox", "setChartsRGB", "setChartsYCbCr", "setCost", "setCenter", "getTarget", "getBox", "getColorCharts", "getChartsRGB", "getChartsYCbCr", "getCost", "getCenter"],
|
|
"FaceDetectorYN": ["setInputSize", "getInputSize", "setScoreThreshold", "getScoreThreshold", "setNMSThreshold", "getNMSThreshold", "setTopK", "getTopK", "detect", "create"]
|
|
},
|
|
"namespace_prefix_override":
|
|
{
|
|
"aruco": ""
|
|
}
|
|
}
|