mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
js: restore deep copy behavior for Mat.clone()
Emscripten 3.1.71+ introduced ClassHandle.clone() which performs a shallow copy. This shadowed the original OpenCV clone() method which was intended for deep copying. This patch: 1. Hooks into onRuntimeInitialized in helpers.js 2. Overrides cv.Mat.prototype.clone to point to mat_clone (deep copy) 3. Updates JS tests to use clone() to verify the fix
This commit is contained in:
@@ -173,7 +173,7 @@ QUnit.test('test_mat_creation', function(assert) {
|
||||
// clone
|
||||
{
|
||||
let mat = cv.Mat.ones(5, 5, cv.CV_8UC1);
|
||||
let mat2 = mat.mat_clone();
|
||||
let mat2 = mat.clone();
|
||||
|
||||
assert.equal(mat.channels, mat2.channels);
|
||||
assert.equal(mat.size().height, mat2.size().height);
|
||||
|
||||
Reference in New Issue
Block a user