为什么使用CvScalar [英] Why CvScalar is used

查看:62
本文介绍了为什么使用CvScalar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助来了解CvScalar的确切功能是什么,例如在以下代码中,标量的任务是什么?

I need help in understanding what is exactly is the function of CvScalar for example in the following code what is the task of scalar ?

 for( int i = 0; i < faces.size(); i++ )
{
    Point center=Point( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
    circle( image, center,faces[i].width/2,Scalar( 255, 0, 255 ), 4, 8, 0 );
}

推荐答案

cvScalar只是一个方便的容器,用于存储1、2、3或4个浮点值. 这样的元组中的数据含义留给cvScalar的用户使用. 例如,它们可以用于保存平面中的点(2元组),矩形(4元组),RGB颜色(3元组),3D世界中的点(3元组)等. cvScalar被系统地实现为一个四元组,未使用的值设置为0.并且您在cvScalar()中分配了3个值,通过组合这3个值Blue = 255, Green = 0, Red = 255将产生颜色. 您将在types_c.h

The cvScalar is simply a convenient container for 1, 2, 3 or 4 floating point values. The meaning of the data in such tuples is left to the user of the cvScalar. For example they can be used to hold, say, Points in the plane (2-tuple), Rectangles (4-tuple), RGB colors (3-tuple), Points in a 3-D world (3-tuple) etc. The cvScalar is systematically implemented as a 4-tuple, with the unused values set to 0. And you are assigning 3 values in cvScalar() , it will result in the color made by combining these 3 values Blue = 255, Green = 0, Red = 255 You will get definition of cvScalar inside types_c.h

这篇关于为什么使用CvScalar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆