简体   繁体   中英

how to fill color into image, by considering small matrix size 3*3 or 6*6? in opencv

我如何通过考虑3 * 3的小矩阵为Mat类型的所需图像填充颜色,我在网上搜索了一下,但找不到正确的答案来实现,希望你们能有所帮助,在此先感谢,或者否则,请上传一些链接。

How can i fill color to required image of type Mat?

If you want to change the value of a Mat image, you can do as follows:

  • Grayscale ( 8UC1 ):

     uchar intensity = img.at<uchar>(y, x) = value_you_want_to_fill; 
  • Color image ( BGR color ordering, the default format returned by imread ):

     img.at<Vec3b>(y, x) = Vec3b(B_value, G_value, R_value); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM