33 #include <GLUT/glut.h> 38 #include <opencv2/highgui/highgui.hpp> 39 #include <opencv2/imgproc/imgproc.hpp> 42 using namespace aruco;
59 void vResize( GLsizei iWidth, GLsizei iHeight );
60 void vMouse(
int b,
int s,
int x,
int y);
73 cerr<<
"Invalid number of arguments"<<endl;
74 cerr<<
"Usage: (in.avi|live) intrinsics.yml size "<<endl;
91 int main(
int argc,
char **argv)
101 cerr<<
"Could not open video"<<endl;
110 TheCameraParams.
resize(TheInputImage.size());
112 glutInit(&argc, argv);
113 glutInitWindowPosition( 0, 0);
114 glutInitWindowSize(TheInputImage.size().width,TheInputImage.size().height);
115 glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
116 glutCreateWindow(
"AruCo" );
118 glutIdleFunc(
vIdle );
121 glClearColor( 0.0, 0.0, 0.0, 1.0 );
127 }
catch (std::exception &ex)
130 cout<<
"Exception :"<<ex.what()<<endl;
143 if (b==GLUT_LEFT_BUTTON && s==GLUT_DOWN) {
159 glVertex3f(0.0
f, 0.0
f, 0.0
f);
160 glVertex3f(size,0.0
f, 0.0
f);
165 glVertex3f(0.0
f, 0.0
f, 0.0
f);
166 glVertex3f( 0.0
f,size, 0.0
f);
172 glVertex3f(0.0
f, 0.0
f, 0.0
f);
173 glVertex3f(0.0
f, 0.0
f, size);
189 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
191 glMatrixMode(GL_MODELVIEW);
193 glMatrixMode(GL_PROJECTION);
197 glDisable(GL_TEXTURE_2D);
203 glMatrixMode(GL_PROJECTION);
204 double proj_matrix[16];
207 glLoadMatrixd(proj_matrix);
210 double modelview_matrix[16];
211 for (
unsigned int m=0;m<
TheMarkers.size();m++)
213 TheMarkers[m].glGetModelViewMatrix(modelview_matrix);
214 glMatrixMode(GL_MODELVIEW);
216 glLoadMatrixd(modelview_matrix);
221 glColor3f(1,0.4,0.4);
266 void vResize( GLsizei iWidth, GLsizei iHeight )
bool readIntrinsicFile(string TheIntrinsicFile, Mat &TheIntriscCameraMatrix, Mat &TheDistorsionCameraParams, Size size)
void resize(cv::Size size)
MarkerDetector PPDetector
bool readArguments(int argc, char **argv)
void vResize(GLsizei iWidth, GLsizei iHeight)
int main(int argc, char **argv)
void glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, double proj_matrix[16], double gnear, double gfar, bool invert=false)
std::vector< aruco::Marker > detect(const cv::Mat &input)
void readFromXMLFile(string filePath)
void vMouse(int b, int s, int x, int y)
CameraParameters TheCameraParams
VideoCapture TheVideoCapturer
Main class for marker detection.
Parameters of the camera.
vector< Marker > TheMarkers