[opencv] Mat Depth




openCV Mat을 사용하면서 Mat을 초기화 하는 방법으로. 아래와 같은 파라미터들이 들어감. <초기화하는 방법>
double m[3][3] = {{a, b, c}, {d, e, f}, {g, h, i}};
Mat M = Mat(3, 3, CV_64F, m).inv();
view raw Matinit hosted with ❤ by GitHub
 

C++: int Mat::depth() const
The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed 3-channel array, the method returns CV_16S . A complete list of matrix types contains the following values:
CV_8U - 8-bit unsigned integers ( 0..255 )
CV_8S - 8-bit signed integers ( -128..127 )
CV_16U - 16-bit unsigned integers ( 0..65535 )
CV_16S - 16-bit signed integers ( -32768..32767 )
CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )
view raw Mat_Depth hosted with ❤ by GitHub

파라미터 정보는 참고하여 항상 생성하도록 하자. 




Mat을 사용할 때는 아래와 같이 사용함.
double dml1[3] = { 0, 340, 0 };
double dmr2[3] = { 640, 330, 0 };
Mat Lm = Mat(3,1,CV_64F, dml1);
Mat Rm = Mat(3,1,CV_64F, dmr2);
// method
//const double *data = Lm.ptr<double>(0);
Point2f tLRpt[2];
tLRpt[0].x = Lm.at<double>(0,0);
tLRpt[0] = Point2f( Lm.at<double>(0,0), Lm.at<double>(1,0) );
tLRpt[1] = Point2f( Rm.at<double>(0,0), Rm.at<double>(1,0) );
Mat m1 = H * Lm;
Mat m2 = H * Rm;
view raw Matusing hosted with ❤ by GitHub


댓글

Designed by JB FACTORY