8 this->resize(_parent->size());
14 m_rgb.resize(640*480*3);
20 glClearColor(0.0f,0.0f,0.0f,1.0f);
43 cv::Mat depthMat(cv::Size(640,480), CV_16UC1);
44 cv::Mat rgbMat(cv::Size(640,480), CV_8UC3, cv::Scalar(0));
47 memcpy(rgbMat.data, &
m_rgb[0], 640*480*3);
55 glClear (GL_COLOR_BUFFER_BIT);
56 glClearColor (0.0,0.0,0.0,1.0);
60 qframe =
qframe.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
64 glDisable(GL_DEPTH_TEST);
65 glMatrixMode(GL_PROJECTION);
68 glMatrixMode(GL_MODELVIEW);
70 glEnable(GL_TEXTURE_2D);
71 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
72 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
73 glTexImage2D( GL_TEXTURE_2D, 0, 4,
qframe.width(),
qframe.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
qframe.bits() );
75 glTexCoord2f(0,0); glVertex2f(0,
qframe.height());
76 glTexCoord2f(0,1); glVertex2f(0,0);
77 glTexCoord2f(1,1); glVertex2f(
qframe.width(),0);
78 glTexCoord2f(1,0); glVertex2f(
qframe.width(),
qframe.height());
80 glDisable(GL_TEXTURE_2D);
95 glViewport (0, 0, (GLsizei)w, (GLsizei)h);
96 glMatrixMode (GL_PROJECTION);
98 gluPerspective (60, (GLfloat)w / (GLfloat)h, 1.0, 100.0);
99 glMatrixMode (GL_MODELVIEW);
106 qframe = QImage((
const unsigned char*)(img->data), img->cols, img->rows, img->step, QImage::Format_RGB888).rgbSwapped();
115 cv::Mat mat = cv::Mat(qimage.height(), qimage.width(), CV_8UC4, (uchar*)qimage.bits(), qimage.bytesPerLine());
116 cv::Mat mat2 = cv::Mat(mat.rows, mat.cols, CV_8UC3 );
117 int from_to[] = { 0,0, 1,1, 2,2 };
118 cv::mixChannels( &mat, 1, &mat2, 1, from_to, 3 );
127 cv::cvtColor(mat, rgb, CV_BGR2RGB);
129 return QImage((
const unsigned char*)(rgb.data), rgb.cols, rgb.rows, QImage::Format_RGB888);
135 QImage qimage = QImage((
const unsigned char*)(&
m_rgb[0]), 640, 480, QImage::Format_RGB888);
151 cv::Mat mat = cv::Mat(qimage.height(), qimage.width(), CV_8UC4, (uchar*)qimage.bits(), qimage.bytesPerLine());
152 cv::Mat mat2 = cv::Mat(mat.rows, mat.cols, CV_8UC3 );
153 int from_to[] = { 0,0, 1,1, 2,2 };
154 cv::mixChannels( &mat, 1, &mat2, 1, from_to, 3 );
161 cv::cvtColor( mat2,
mImage, CV_BGR2RGB);
170 cv::cvtColor(
mImage, gray, CV_RGB2GRAY );
171 cv::Canny( gray, gray, 10, 30, 3 );