matlab to opencv(CV::Mat)

1.D=M(:,[2:3 3])

  int main()
  {
	 Mat M = (Mat_<double>(3,3) << 0, 1,2,3,4,5,6,7,8); 
	cout<<M<<endl;
	Mat D(3,3,CV_32FC1);
	for(int i=1;i<3;i++)
	{
		M.col(i).copyTo(D.col(i-1));		
	}
	M.col(2).copyTo(D.col(2));
	cout<<D<<endl;
	return 0;
  }

2.D=M([2:3 3],[2:3 3])

  int main()
  {
	 Mat M = (Mat_<double>(3,3) << 0, 1,2,3,4,5,6,7,8); 
	cout<<M<<endl;
	Mat C(3,3,CV_32FC1);
	Mat D(3,3,CV_32FC1);
	for(int i=1;i<3;i++)
		M.row(i).copyTo(C.row(i-1));
	M.row(2).copyTo(C.row(2));
	for(int i=1;i<3;i++)
		C.col(i).copyTo(D.col(i-1));
	C.col(2).copyTo(D.col(2));
	cout<<D<<endl;
	return 0;
  }
3.I=I+I*t  同

4.I.^2     pow(I,2,I)   

I.^(3/2)  pow(I,3/2.0,I)

5.2*A.*B   2*A.mul(B)

你可能感兴趣的:(matlab to opencv(CV::Mat))