what is cv::setTo function

后端 未结 1 748
名媛妹妹
名媛妹妹 2021-01-05 13:51

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::Ma         


        
相关标签:
1条回答
  • 2021-01-05 14:11

    yy.setTo(0) will set all the pixels to 0.

    yy.setTo(0, xx) will set all the pixels who have a corresponding pixel with a non-zero value in the xx Mat to 0.

    Example:

    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
    
    0 讨论(0)
提交回复
热议问题