cv::mat

//C++: template<typename T> T& Mat::at(int i, int j)
//其作用是Returns a reference to the specified array element.
depthcolorImg.at<cv::Vec3b>(i, j)[0] = colorImg.at<cv::Vec3b>(i, j)[0];
depthcolorImg.at<cv::Vec3b>(i, j)[1] = colorImg.at<cv::Vec3b>(i, j)[1];
depthcolorImg.at<cv::Vec3b>(i, j)[2] = colorImg.at<cv::Vec3b>(i, j)[2];

cv::Mat depthImg = cv::Mat::zeros(2, 3, CV_8UC3);//the depth image
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
depthImg.at<cv::Vec3b>(i, j)[1] = i * 3 + j;
}
}
//则rows = 2

  //cols  = 3

//注意kinect colormap输出的坐标是图像的(x,y)实际上是这里的(rows, cols)

//也就是

depthcolorImg.at<cv::Vec3b>(i, j)[0] = colorImg.at<cv::Vec3b>(y, x)[0];
depthcolorImg.at<cv::Vec3b>(i, j)[1] = colorImg.at<cv::Vec3b>(y, x)[1];
depthcolorImg.at<cv::Vec3b>(i, j)[2] = colorImg.at<cv::Vec3b>(y, x)[2];

float * data = (float *)cloud_host.data;
			float * norm = (float *)norm_host.data;
			if (outfile.is_open())
			{
				for (int i = 0; i < size; i++)
				{
					outfile<<(float)(*data)/7.0<<" ";
					data++;
					outfile<<(float)(*data)/7.0<<" ";
					data++;
					outfile<<(float)(*data)/7.0<<" ";
					data++;
					data++;


					outfile<<(float)(*norm)<<" ";
					data++;
					outfile<<(float)(*norm)<<" ";
					data++;
					outfile<<(float)(*norm)<<" ";
					data++;

					outfile<<std::endl;
					
				}}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值