0
0
mirror of https://github.com/opencv/opencv.git synced 2026-01-18 17:21:42 +01:00

Revert "Merge pull request #27985 from happy-capybara-man:docs/fix-mat-clone-js"

This reverts commit db207c88b0.
This commit is contained in:
happy-capybara-man
2025-12-20 15:23:15 +08:00
committed by GitHub
parent 9f9b6e8dd3
commit 78c27ba4a6
5 changed files with 6 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ cv.bitwise_and(logo, logo, imgFg, mask);
// Put logo in ROI and modify the main image
cv.add(imgBg, imgFg, sum);
dst = src.mat_clone();
dst = src.clone();
for (let i = 0; i < logo.rows; i++) {
for (let j = 0; j < logo.cols; j++) {
dst.ucharPtr(i, j)[0] = sum.ucharPtr(i, j)[0];

View File

@@ -248,7 +248,7 @@ function backprojection(src) {
if (base instanceof cv.Mat) {
base.delete();
}
base = src.mat_clone();
base = src.clone();
cv.cvtColor(base, base, cv.COLOR_RGB2HSV, 0);
}
cv.cvtColor(src, dstC3, cv.COLOR_RGB2HSV, 0);

View File

@@ -53,7 +53,7 @@ canvas.addEventListener('click', e => {
});
canvas.addEventListener('mousemove', e => {
let x = e.offsetX, y = e.offsetY; //console.log(x, y);
let dst = src.mat_clone();
let dst = src.clone();
if (hasMap && x >= 0 && x < src.cols && y >= 0 && y < src.rows)
{
let contour = new cv.Mat();

View File

@@ -77,14 +77,12 @@ How to copy Mat
There are 2 ways to copy a Mat:
@code{.js}
// 1. Clone (deep copy)
let dst = src.mat_clone();
// 1. Clone
let dst = src.clone();
// 2. CopyTo(only entries indicated in the mask are copied)
src.copyTo(dst, mask);
@endcode
@note In OpenCV.js, use `mat_clone()` instead of `clone()` to ensure deep copy behavior. The `clone()` method may perform shallow copy due to Emscripten embind limitations.
How to convert the type of Mat
------------------------------

View File

@@ -132,7 +132,7 @@ function main() {
var cell = document.getElementById("targetNames").insertCell(0);
cell.innerHTML = name;
persons[name] = face2vec(face).mat_clone();
persons[name] = face2vec(face).clone();
var canvas = document.createElement("canvas");
canvas.setAttribute("width", 112);