上記説明は間違いです。正しくは、
OpenCVでWebカメラから画像を取り込み、Pictureboxに表示させ、OpenCVの画像をARToolKitで使用できるものに変換し、ARToolKit内部の関数で処理を行う。
でした。
//cv::MatからARUint8へ変換 void Cvt_AR_CV(const cv::Mat& cvImage, ARUint8* arImage) { int width = cvImage.cols; int height = cvImage.rows; int channels = cvImage.channels(); int cvStep = cvImage.step; int arStep = width * 4; for(int i = 0; i < height; i++){ for(int j = 0; j < width; j++){ for(int c = 0; c < channels; c++){ arImage[arStep * i + j * 4 + c] = cvImage.data[cvStep * i + j * channels + c]; } } } } //IplImageからARUint8へ変換 void Cvt_AR_CV(IplImage* cvImage, ARUint8* arImage) { int width = cvImage->width; int height = cvImage->height; int channels = cvImage->nChannels; int cvStep = cvImage->widthStep; int arStep = width * 4; for(int i = 0; i < height; i++){ for(int j = 0; j < width; j++){ for(int c = 0; c < channels; c++){ arImage[arStep * i + j * 4 + c] = cvImage->imageData[cvStep * i + j * channels + c]; } } } }
0 件のコメント:
コメントを投稿