Comments (7)
i know what's wrong. my png image has problem.
Thank you again.
from opencv4nodejs.
It is not really clear to me what you are trying to achieve and what you expect the output to be. Could you please give some more details?
from opencv4nodejs.
getRegion will return a Mat pointing to the subregion, meaning if you change the data of the "region" Mat, the changes will reflect on the original Mat "mat".
i just want to know copyTo function can be change orignal Mat?.
in opencv3 C++
cv::Mat image = cv::imread("D:/imagewarping/testresult/hansome.jpg");
cv::Mat logo = cv::imread("D:/imagewarping/testresult/trans.jpg");
cv::Mat mask = cv::imread("D:/imagewarping/testresult/trans.jpg", 0);
cv::Mat imageROI;
imageROI = image(cv::Rect(182, 63, 215, 235));
logo.copyTo(imageROI, mask);
cv::namedWindow("result");
cv::imshow("result", image);
now i want to do something like C++ Code can do.
my english is so poor. sorry
from opencv4nodejs.
I see. CopyTo should work as expected. I think the problem here is that newFrame.cvtColor returns a new Mat (e.g. a new copy) as well.
In order to copy it into the "newFrame" try the following:
let newFrame = frame.getRegion(new cv.Rect(400, 0, 480, 720)).cvtColor(cv.COLOR_BGR2RGBA);
let imageROI = newFrame.getRegion(new cv.Rect(0, 0, addMat.cols, addMat.rows));
let cpTo = addMat.copyTo(imageROI, mask);
from opencv4nodejs.
ok this is work .
thank you very much.
the last quesiotn.
my '/assets/images/1_4.png' has Transparent partγ
but when i do addMat.copyTo. Transparent part change to white color.
from opencv4nodejs.
Hmm actually I am not sure how to process images with transparency in OpenCV. How do you know the transparent part is changed to white, isn't the transparency expressed by the alpha channel in RGBA? Maybe imshow can not display RGBA images properly, is it also white when saving the output with imsave?
from opencv4nodejs.
OK. i use canvas to display image.
ctx.putImageData(imgData, 0, 0).
in canvas display white.
from opencv4nodejs.
Related Issues (20)
- Install failing at 55% MacOS Monterey HOT 2
- [!] RollupError: Could not resolve "../build/Release/opencv4nodejs.node" from "../build/Release/opencv4nodejs.node?commonjs-external" HOT 1
- Cannot find module 'C:\Users\pierr\Desktop\onnxjs\node_modules\opencv4nodejs\build\Release\opencv4nodejs' HOT 2
- Imencode - OpenCV Error: (!image.empty()) in imencode, in file... RPI4 HOT 1
- Correct the state of the `opencv4nodejs` package on the NPM. HOT 5
- canot load opencv4nodejs after install HOT 1
- Cannot find module 'D:\Web\opencv\node_modules\opencv4nodejs\build\Release\opencv4nodejs' HOT 2
- Error: CalcHist - object has no property: ranges HOT 1
- Can't resolve '../build/Release/opencv4nodejs.node' HOT 1
- Cannot find module /node_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs'
- why no cv.compare or mat.compare function?
- how to catch mouse event on imshow
- ar
- Type error with mat.drawCountours()
- Unable to install opencv4nodejs HOT 1
- Unable to install in Ubuntu 22.05
- Ssim library
- Issues with node-gyp
- Issue with cv.Mat
- Issue with importing cv
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv4nodejs.