本文介绍了什么是cv :: setTo函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用OpenCV在C ++中编写的代码,并且此代码使用函数setTo。基本上,它用作:
I have a code written using OpenCV in C++, and this code uses a function setTo. Basically, it is used as:
cv::Mat xx; //prefedined and has some values
cv::Mat yy; // initially empty
yy.setTo(0,xx);
那么你能解释一下这里的setTo是什么意思?是否将所有零值放在yy中,或者它放置1其中xx是非零和0,其中xx也是零?
So can you explain what does this setTo means here? Does is put all zero values in yy, or it puts 1 where xx is non-zero and 0 where xx is zero too?
推荐答案
p> yy.setTo(0)
会将所有像素设置为0。
yy.setTo(0)
will set all the pixels to 0.
yy.setTo(0,xx)
将把xx Mat
中具有值为1的对应像素的所有像素设置为0。
yy.setTo(0, xx)
will set all the pixels who have a corresponding pixel with a value of 1 in the xx Mat
to 0.
示例:
yy =
2 2 2
2 2 2
2 2 2
xx =
0 0 0
0 1 0
0 0 0
yy.setTo(0, xx) =>
yy =
2 2 2
2 0 2
2 2 2
这篇关于什么是cv :: setTo函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!