プログラミングに関する私的メモ(現在:OpenGL・OpenCV・ARToolKit・Kinect・Unity)

ARUint8* = uchar*
image[ 4 * ( y * arImXsize + x ) ] = B;
image[ 4 * ( y * arImXsize + x ) + 1 ] = G;
image[ 4 * ( y * arImXsize + x ) + 2 ] = R;
image[ 4 * ( y * arImXsize + x ) + 3 ] = A;

OpenCV(cv::Mat)⇒ARToolKit
cv::Mat matAR( matCV.rows, matCV.cols , IPL_DEPTH_8U, 4 );
cv::cvtColor( matCV, matAR, CV_BGR2BGRA );      // カラー画像
//cv::cvtColor( matCV, matAR, CV_GRAY2BGRA );   // グレイスケール画像
image = (ARUint8*)( matAR.data );

ARToolKit⇒OpenCV(cv::Mat)
cv::Mat matCV( arImYsize, arImXsize, IPL_DEPTH_8U, 4 );
memcpy( matCV.data, image, matCV.rows * matCV.cols * matCV.channels() );

参考サイト:
ARtoolkitとOpenCVの画像の変換

このページへのコメント

MjlQlU A round of applause for your blog.Really thank you! Awesome.

0
Posted by watch for this 2013年12月21日(土) 11:12:13 返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます