In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to use the OpenCV copyTo () function". In the daily operation, I believe that many people have doubts about how to use the OpenCV copyTo () function. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use the OpenCV copyTo () function". Next, please follow the editor to study!
CopyTo () function prototype
The function copyTo can be defined in two ways, namely:
Void copyTo (OutputArray m) const;void copyTo (OutputArray m, InputArray mask) const
Parameters:
One parameter: one output image
Two parameters: an output image and a mask image
Simple exampl
For example:
Image_in.copyTo (image_out)
Is to copy (copy to) the picture of image_in to image_out.
Another example is:
Image_in.copyTo (image_out,mask)
Not only will the image_in image be copied (copy to) to the image_out, but also the pixels with a value of 0 in the mask corresponding to the image_in will not be pasted to the image_out.
Summarize the usefulness of the above two functions:
One parameter: indicates that the image_in matrix is copied into image_out.
Two parameters: a matrix image_out that represents an additional mask mask.
A parameter is very simple to copy the image, the above reading mask usage is not deep, then we continue to explore the use of the mask parameter
An in-depth study of mask parameters
For example, the following usage code:
A.copyTo (B, mask)
As a mask, if mask has a value of 1 at a pixel (I, j) (only look at the first channel, so mask single channel is OK), then assign the value at A.at (I, j) directly to B.at (I, j), and if its value is 0, then B.at (I, j) retains its original pixel value. This makes the color of the edge of the icon consistent with the original image.
For example, the following specific usage
# include # include using namespace cv;using namespace std;int main () {Mat srcImage = imread (". / test1.jpg"); Mat dstImage = imread (". / test.jpg"); if (! srcImage.data | |! dstImage.data) {cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.