Jean-Yves Didier

Ajout de quelques fonctionnalités

...@@ -63,7 +63,9 @@ ...@@ -63,7 +63,9 @@
63 </component> 63 </component>
64 </components> 64 </components>
65 <constants> 65 <constants>
66 - <constant id="camParams" type="CvCamera">640 480 0 0 0 0 800 0 320 0 800 240 0 0 1</constant> 66 + <constant id="camParams" type="CvCamera">640 480 0 0 0 0 800 0 320 0 800 240 0 0 1</constant>
67 + <constant id="model" type="string">../legacy/applications/al2.obj</constant>
68 + <constant id="model2" type="string">../../../projets/Kalray/PANO1.obj</constant>
67 </constants> 69 </constants>
68 </context> 70 </context>
69 <processes> 71 <processes>
...@@ -75,7 +77,7 @@ ...@@ -75,7 +77,7 @@
75 <invoke destination="camera" slot="setWidth(int)" type="int">640</invoke> 77 <invoke destination="camera" slot="setWidth(int)" type="int">640</invoke>
76 <invoke destination="camera" slot="setFrameRate(float)" type="float">25</invoke> 78 <invoke destination="camera" slot="setFrameRate(float)" type="float">25</invoke>
77 <invoke destination="camera" slot="initDevice()" type="void"/> 79 <invoke destination="camera" slot="initDevice()" type="void"/>
78 - <invoke destination="al" slot="load(QString)" type="string">../legacy/applications/al2.obj</invoke> 80 + <invoke destination="al" slot="load(QString)" type="constant">model2</invoke> <!-- ../legacy/applications/al2.obj -->
79 <invoke destination="al" slot="unitize()" type="void"/> 81 <invoke destination="al" slot="unitize()" type="void"/>
80 <invoke destination="al" slot="scale(float)" type="float">0.03</invoke> 82 <invoke destination="al" slot="scale(float)" type="float">0.03</invoke>
81 <invoke destination="viewer" slot="setSize(QSize)" type="size">640x480</invoke> 83 <invoke destination="viewer" slot="setSize(QSize)" type="size">640x480</invoke>
......
1 +#include "aruco.h"
2 +#include <vector>
3 +#include <iostream>
4 +#include <cmath>
5 +
6 +void ArucoDetector::setCamera(CvCamera cam)
7 +{
8 + cp = aruco::CameraParameters(cv::Mat(3,3,CV_32F,cam.matrix),cv::Mat(4,1,CV_32F,cam.distortion),cv::Size(cam.imgSize[0],cam.imgSize[1]) );
9 +
10 +
11 +/* cp.CameraMatrix = cv::Mat(3,3,CV_32F,cam.matrix);
12 + cp.Distorsion = cv::Mat(4,1,CV_32F,cam.distortion);
13 + cp.CamSize = cv::Size(cam.imgSize[0],cam.imgSize[1]);*/
14 +}
15 +
16 +
17 +void ArucoDetector::setMarkerSize(float f)
18 +{
19 + size = f;
20 +}
21 +
22 +
23 +void ArucoDetector::setImage(IplImage *img)
24 +{
25 + cv::Mat image(img);
26 + std::vector<aruco::Marker> markers;
27 + try {
28 +
29 + md.detect(image, markers, cp, size);
30 +
31 +} catch (std::exception &ex)
32 + {
33 + std::cout << "Exception " << ex.what() << std::endl;
34 +}
35 +
36 + if (markers.size() > 0)
37 + {
38 + markers[0].calculateExtrinsics(size, cp);
39 + cv::Mat rot(3,3,CV_32FC1),jacob;
40 + cv::Rodrigues(markers[0].Rvec,rot,jacob);
41 + float r[9];
42 + float t[3];
43 +
44 + r[0]=rot.at<float>(0,0);
45 + r[1]=rot.at<float>(0,1);
46 + r[2]=rot.at<float>(0,2);
47 + r[3]=rot.at<float>(1,0);
48 + r[4]=rot.at<float>(1,1);
49 + r[5]=rot.at<float>(1,2);
50 + r[6]=-rot.at<float>(2,0);
51 + r[7]=-rot.at<float>(2,1);
52 + r[8]=-rot.at<float>(2,2);
53 + t[0]=markers[0].Tvec.at<float>(0,0);
54 + t[1]=markers[0].Tvec.at<float>(0,1);
55 + t[0]=-markers[0].Tvec.at<float>(0,2);
56 +
57 +
58 +
59 +
60 + //cv::Mat reverse = (cv::Mat_<float>(3,3) << 0,1,0, 0,0,-1,-1,0,0) ;
61 + //(Mat_<double>(3,3) << 1, 0, 0, 0, 1, 0, 0, 0, 1);
62 + //rot = rot.inv();
63 + //rot = reverse.t() * rot ;
64 +
65 + /*float x = markers[0].Tvec.at<float>(0,0);
66 + float y = markers[0].Tvec.at<float>(0,1);
67 +
68 + markers[0].Tvec.at<float>(0,0) = y;
69 + markers[0].Tvec.at<float>(0,1) = x;*/
70 +
71 + emit sendPose(r,t);
72 +
73 +
74 + /*std::cout << "Marker detected " << markers[0] << std::endl;
75 + std::cout << "Rx" << rot.at<float>(0,0) << ", "
76 + << rot.at<float>(0,1) << ", "
77 + << rot.at<float>(0,2) << std::endl;*/
78 + }
79 +}
1 +#ifndef __ARUCO_H__
2 +#define __ARUCO_H__
3 +
4 +#include <QObject>
5 +#include <opencv/cvaux.h>
6 +#include <aruco/aruco.h>
7 +#include <aruco/cameraparameters.h>
8 +#include <aruco/markerdetector.h>
9 +
10 +class ArucoDetector : public QObject
11 +{
12 + Q_OBJECT
13 +public:
14 + ArucoDetector(QObject* parent=0) : QObject(parent) {}
15 +
16 +public slots:
17 + void setCamera(CvCamera params);
18 + void setImage(IplImage* img);
19 + void setMarkerSize(float f);
20 +
21 +signals:
22 + //void sendMarkers();
23 + void sendPose(float*,float*);
24 +
25 +private:
26 + aruco::MarkerDetector md;
27 + aruco::CameraParameters cp;
28 + float size;
29 +};
30 +
31 +
32 +#endif // __ARUCO_H__
1 +unix: TEMPLATE = lib
2 +win32: TEMPLATE = vclib
3 +
4 +# library dependencies
5 +INCLUDEPATH += $$(ARCSDIR)/include
6 +INCLUDE_OPENCV = $$system(pkg-config opencv --cflags-only-I)
7 +INCLUDEPATH += $$replace(INCLUDE_OPENCV,"-I","")
8 +
9 +# to replace with a better thing
10 +unix: INCLUDEPATH += /usr/local/lib
11 +unix: LIBS += -L/usr/local/lib -laruco
12 +
13 +LIBS += -L$$(ARCSDIR)/lib -larcs
14 +LIBS += $$system(pkg-config opencv --libs)
15 +
16 +
17 +
18 +CONFIG += dll
19 +QT = core
20 +
21 +HEADERS += aruco.h
22 +SOURCES += aruco.cpp
23 +
24 +DLLDESTDIR=../../libs
25 +DESTDIR=../../libs
26 +
27 +ALXFILE = libaruco.alx
28 +OTHER_FILES += libaruco.alx
29 +arcslibrary.output = alm_${QMAKE_FILE_BASE}.cpp
30 +arcslibrary.input = ALXFILE
31 +arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME}
32 +arcslibrary.variable_out = SOURCES
33 +QMAKE_EXTRA_COMPILERS += arcslibrary
34 +
1 +<!-- ALX File skeleton generated by ARCSLibMaker -->
2 +
3 +<library>
4 + <!-- Headers section -->
5 + <!-- Put here all the needed headers of your components/families/types -->
6 + <headers>
7 + <header name="aruco.h"/>
8 + </headers>
9 +
10 + <!-- Components section -->
11 + <!-- Put here all the native components your library should export -->
12 + <components>
13 + <component name="ArucoDetector"/>
14 + </components>
15 +
16 + <!-- Families section -->
17 + <!-- Put here all the exogeneous component families your library should export -->
18 + <families>
19 + <!--family name="MyComponent"/-->
20 + </families>
21 +
22 + <!-- Types section -->
23 + <!-- Put here all the new types your library should export -->
24 + <types>
25 + <!--type name="MyType"/-->
26 + </types>
27 +</library>
1 +<composite>
2 + <context>
3 + <libraries>
4 + <library path="../libs/raxenvrecalage"/>
5 + </libraries>
6 + <components>
7 + <component id="corPose" type="PoseCorrection"/>
8 + <component id="tmp" type="Tempon"/>
9 + <component id="ppe" type="ErrorPrediction"/>
10 + </components>
11 + <constants/>
12 + </context>
13 + <sheet>
14 + <preconnections>
15 + <invoke destination="ppe" slot="setNbDataPos(int)" type="int">5</invoke>
16 + <invoke destination="ppe" slot="setNbDataRot(int)" type="int">10</invoke>
17 + </preconnections>
18 + <connections>
19 + <link source="tmp" signal="sendPositionGPS(CvMat *)" destination="ppe" slot="setPositionGPS(CvMat *)"/>
20 + <link source="ppe" signal="sendPosError(double, double )" destination="corPose" slot="setPredictedPosError(double, double)"/>
21 + <link source="ppe" signal="sendRotError(double, double, double )" destination="corPose" slot="setPredictedRotError(double, double, double)"/>
22 + <link source="tmp" signal="sendRotationIMU(CvMat *)" destination="ppe" slot="setRotCI(CvMat *)"/>
23 + <link source="tmp" signal="sendPositionGPS(CvMat *)" destination="corPose" slot="setPositionGPS(CvMat *)"/>
24 + <link source="tmp" signal="sendRotationIMU(CvMat *)" destination="corPose" slot="setRotCI(CvMat*)"/>
25 + </connections>
26 + <postconnections/>
27 + </sheet>
28 + <interface>
29 + <slots>
30 + <method alias="setRotCam(CvMat*)" component="ppe" method="setRotCam(CvMat*)"/>
31 + <method alias="setRotationIMU(CvMat*)" component="tmp" method="setRotationIMU(CvMat*)"/>
32 + <method alias="PredireError()" component="ppe" method="PredireError()"/>
33 + <method alias="setPositionGPS(CvMat*)" component="tmp" method="setPositionGPS(CvMat*)"/>
34 + <method alias="getCorrectedRotation()" component="corPose" method="getCorrectedRotation()"/>
35 + <method alias="setPositionCam(CvMat*)" component="ppe" method="setPositionCam(CvMat*)"/>
36 + <method alias="getCorrectedPose()" component="corPose" method="getCorrectedPose()"/>
37 + <method alias="setPreviousPosition(CvMat*)" component="corPose" method="setPreviousPosition(CvMat*)"/>
38 + <method alias="PredirePositionError()" component="ppe" method="PredirePositionError()"/>
39 + </slots>
40 + <signals>
41 + <method alias="sendDataNotAvailable()" component="ppe" method="sendDataNotAvailable()"/>
42 + <method alias="dataReady()" component="ppe" method="sendDataReady()"/>
43 + <method alias="sendCorrectedPose(CvMat*,CvMat*)" component="corPose" method="sendCorrectedPose(CvMat*,CvMat*)"/>
44 + <method alias="sendDataNotReady()" component="ppe" method="sendDataNotReady()"/>
45 + <method alias="dataRotationReady()" component="ppe" method="sendCorrecteRotation()"/>
46 + <method alias="sendDataCorrected()" component="corPose" method="sendDataCorrected()"/>
47 + <method alias="sendCorrectedOrientation(CvMat*)" component="corPose" method="sendCorrectedOrientation(CvMat*)"/>
48 + <method alias="sendCorrectedPosition(CvMat*)" component="corPose" method="sendCorrectedPosition(CvMat*)"/>
49 + </signals>
50 + </interface>
51 +</composite>
This diff is collapsed. Click to expand it.
1 +<composite>
2 + <context>
3 + <libraries>
4 + <library path="../libs/raxenvrecalage"/>
5 + <library path="../libs/gps"/>
6 + <library path="../libs/ocv"/>
7 + <library path="../libs/hmi"/>
8 + <library path="../libs/gps"/>
9 + <library path="../libs/arcsogr"/>
10 + <library path="../libs/mti"/>
11 + <library path="../libs/ueye"/>
12 + <library path="../libs/common"/>
13 + <library path="../libs/images"/>
14 + </libraries>
15 + <components>
16 + <component id="ss" type="Synchronisation"/>
17 + <component id="mti" type="MTiTracker"/>
18 + <component id="arf" type="AlignRefFrame"/>
19 + <component id="gpstrack" type="GPSTracker"/>
20 + <component id="met" type="UEyeCamera"/>
21 + <component id="gpsT" type="GPSTranslator"/>
22 + <component id="rd" type="GpsToOgr"/>
23 + <component id="cc" type="CoordConverter"/>
24 + <component id="sa" type="SetAltitude"/>
25 + <component id="tn_rtc" type="PeriodicThread"/>
26 + <component id="tn_cam" type="PeriodicThread"/>
27 + <component id="rcv" type="RawCVImageConvertor"/>
28 + <component id="tn_gps" type="PeriodicThread"/>
29 + </components>
30 + <constants/>
31 + </context>
32 + <sheet>
33 + <preconnections>
34 + <invoke destination="gpstrack" slot="setBaudrate(int)" type="int">115200</invoke>
35 + <invoke destination="gpstrack" slot="setFrameCount(int)" type="int">5</invoke>
36 + <invoke destination="gpsT" slot="setFrameAmount(int)" type="int">5</invoke>
37 + <invoke destination="gpstrack" slot="setDevice(QString)" type="string">/dev/rfcomm0</invoke>
38 + <invoke destination="gpstrack" slot="setPeriod(int)" type="int">1000</invoke>
39 + <invoke destination="tn_gps" slot="setTimeStamp(int)" type="int">900</invoke>
40 + <invoke destination="gpstrack" slot="setThreaded(bool)" type="bool">false</invoke>
41 + <invoke destination="cc" slot="setInputGeogCS(QString)" type="string">WGS84</invoke>
42 + <invoke destination="cc" slot="setOutputGeogCS(QString)" type="string">EPSG:27572</invoke>
43 + <invoke destination="mti" slot="setQuaternionOutput()" type="void"/>
44 + <invoke destination="mti" slot="setCalibratedOutput(bool)" type="bool">true</invoke>
45 + <invoke destination="mti" slot="setOrientationOutput(bool)" type="bool">true</invoke>
46 + <invoke destination="mti" slot="setTimeStampedOutput()" type="void"/>
47 + <invoke destination="mti" slot="setThreaded(bool)" type="bool">false</invoke>
48 + <invoke destination="mti" slot="setMagneticFilter(bool)" type="bool">true</invoke>
49 + <invoke destination="mti" slot="setSampleFrequency(int)" type="int">100</invoke>
50 + <invoke destination="mti" slot="setKeepUpdate(bool)" type="bool">false</invoke>
51 + <invoke destination="mti" slot="setDevice(QString)" type="string">/dev/tts/USB0</invoke>
52 + <invoke destination="tn_rtc" slot="setTimeStamp(int)" type="int">10</invoke>
53 + <invoke destination="met" slot="setThreaded(bool)" type="bool">false</invoke>
54 + <invoke destination="met" slot="setAutoAdjustment(bool)" type="bool">true</invoke>
55 + <invoke destination="tn_cam" slot="setTimeStamp(int)" type="int">100</invoke>
56 + <invoke destination="rcv" slot="setChannels(int)" type="int">4</invoke>
57 + <invoke destination="ss" slot="setElapsedTimeMax(double)" type="double">0.25</invoke>
58 + <invoke destination="sa" slot="setZ(double)" type="double">1.4</invoke>
59 + </preconnections>
60 + <connections>
61 + <link source="rd" signal="sendDOP(float)" destination="ss" slot="setDOP(float)"/>
62 + <link source="mti" signal="sendStartTime(double)" destination="ss" slot="setStartTimeCI(double)"/>
63 + <link source="met" signal="sendImage(int,int,char*)" destination="rcv" slot="convertRaw(int,int,char*)"/>
64 + <link source="mti" signal="sendTimeStamp(int)" destination="ss" slot="setElapsedTimeCI(int)"/>
65 + <link source="gpstrack" signal="sendTimeStamp(double)" destination="ss" slot="setTimeGPS(double)"/>
66 + <link source="gpstrack" signal="sendNMEAFrame(NMEAFrame)" destination="rd" slot="setNMEAFrame(NMEAFrame)"/>
67 + <link source="mti" signal="sendQuaternion(float*)" destination="ss" slot="setQuaternion(float*)"/>
68 + <link source="rd" signal="sendSVNumber(int)" destination="ss" slot="setSVNumber(int)"/>
69 + <link source="rd" signal="sendCoordinates(double,double)" destination="cc" slot="setCoordinates(double,double)"/>
70 + <link source="met" signal="sendStartTime(double)" destination="ss" slot="setStartTimeCam(double)"/>
71 + <link source="cc" signal="sendCoordinates(double, double)" destination="sa" slot="setCoordinates(double, double)"/>
72 + <link source="met" signal="elapsedTime(int)" destination="ss" slot="setElapsedTimeCam(int)"/>
73 + <link source="sa" signal="sendCoordinates(CvMat *)" destination="arf" slot="setPosGps(CvMat *)"/>
74 + <link source="arf" signal="sendPosCam(CvMat *)" destination="ss" slot="setPosCam(CvMat *)"/>
75 + <link source="gpstrack" signal="sendNMEAFrame(NMEAFrame)" destination="gpsT" slot="setNMEAFrame(NMEAFrame)"/>
76 + <link source="tn_rtc" signal="launchThread()" destination="mti" slot="sendData()"/>
77 + <link source="tn_cam" signal="launchThread()" destination="met" slot="queryImage()"/>
78 + <link source="tn_gps" signal="launchThread()" destination="gpstrack" slot="sendData()"/>
79 + </connections>
80 + <postconnections/>
81 + </sheet>
82 + <interface>
83 + <slots>
84 + <method alias="setTranGpsMon(CvMat*)" component="arf" method="setTranGpsMon(CvMat*)"/>
85 + <method alias="initGPS()" component="gpstrack" method="init()"/>
86 + <method alias="setRotGloMon(CvMat*)" component="arf" method="setRotGloMon(CvMat*)"/>
87 + <method alias="startGPS()" component="gpstrack" method="start()"/>
88 + <method alias="startMti()" component="mti" method="start()"/>
89 + <method alias="startThreadGPS()" component="tn_gps" method="startThread()"/>
90 + <method alias="initMti()" component="mti" method="init()"/>
91 + <method alias="startThreadMti()" component="tn_rtc" method="startThread()"/>
92 + <method alias="initCam()" component="met" method="initDevice()"/>
93 + <method alias="startCam()" component="met" method="start()"/>
94 + <method alias="startThreadCam()" component="tn_cam" method="startThread()"/>
95 + </slots>
96 + <signals>
97 + <method alias="sendQuaternion(float*)" component="ss" method="sendQuaternion(float*)"/>
98 + <method alias="sendDOP(float)" component="ss" method="sendDOP(float)"/>
99 + <method alias="sendSVNumber(int)" component="ss" method="sendSVNumber(int)"/>
100 + <method alias="sendPosition(CvMat*)" component="ss" method="sendPosition(CvMat*)"/>
101 + <method alias="sendAcceleration(float*)" component="mti" method="sendAcceleration(float*)"/>
102 + <method alias="sendImage(IplImage*)" component="rcv" method="rawProcessed(IplImage*)"/>
103 + <method alias="sendQuaternion(float*)" component="mti" method="sendQuaternion(float*)"/>
104 + <method alias="sendGyro(float*)" component="mti" method="sendGyro(float*)"/>
105 + <method alias="sendMag(float*)" component="mti" method="sendMag(float*)"/>
106 + <method alias="sendTimeStamp(int)" component="mti" method="sendTimeStamp(int)"/>
107 + <method alias="sendGPSData(GPSData)" component="gpsT" method="sendGPSData(GPSData)"/>
108 + <method alias="sendStartTime(double)" component="mti" method="sendStartTime(double)"/>
109 + <method alias="initFailed()" component="mti" method="initFailed()"/>
110 + <method alias="sendGPSCoordinates(CvMat*)" component="sa" method="sendCoordinates(CvMat*)"/>
111 + <method alias="sendNMEAFrame(NMEAFrame)" component="gpstrack" method="sendNMEAFrame(NMEAFrame)"/>
112 + </signals>
113 + </interface>
114 +</composite>
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +<composite>
2 + <context>
3 + <libraries>
4 + <library path="../libs/pattern"/>
5 + <library path="../libs/images"/>
6 + <library path="../libs/common"/>
7 + <library path="../libs/hmi"/>
8 + <library path="../libs/raxenvrecalage"/>
9 + </libraries>
10 + <components>
11 + <component id="tmpS" type="Tempon"/>
12 + <component id="bufImg" type="BufferImage"/>
13 + <component id="PAC" type="PoseAndCheck"/>
14 + <component id="fc" type="FindCorners"/>
15 + <component id="p3d1" type="Projection3D"/>
16 + <component id="p3d" type="Projection3D"/>
17 + </components>
18 + <constants/>
19 + </context>
20 + <sheet>
21 + <preconnections>
22 + <invoke destination="fc" slot="setMinDist(double)" type="double">2</invoke>
23 + <invoke destination="fc" slot="setNbMaxPointHarris(int)" type="int">10</invoke>
24 + <invoke destination="fc" slot="setBlockSize(int)" type="int">3</invoke>
25 + <invoke destination="fc" slot="setQuality(double)" type="double">0.01</invoke>
26 + <invoke destination="fc" slot="setMatchingMode()" type="void"/>
27 + <invoke destination="fc" slot="setParHarris(double)" type="double">0.04</invoke>
28 + <invoke destination="fc" slot="setCornerMode()" type="void"/>
29 + <invoke destination="fc" slot="setAperture(int)" type="int">5</invoke>
30 + <invoke destination="p3d1" slot="setTestMode()" type="void"/>
31 + <invoke destination="fc" slot="setThDistanceMatchingSURF(int)" type="int">1200</invoke>
32 + <invoke destination="fc" slot="setWindowSizeSubPixelHArris(int)" type="int">1</invoke>
33 + <invoke destination="fc" slot="setThresholdRatioMatchingSURF(double)" type="double">1.2</invoke>
34 + <invoke destination="fc" slot="setNumberMinOfPoints(int)" type="int">10</invoke>
35 + <invoke destination="fc" slot="setDescriptorMode()" type="void"/>
36 + <invoke destination="p3d" slot="setTestMode()" type="void"/>
37 + <invoke destination="PAC" slot="setTrace(float)" type="float">3.9</invoke>
38 + <invoke destination="bufImg" slot="setBufferSize(int)" type="int">10</invoke>
39 + <invoke destination="bufImg" slot="setNumIntervalImage(int)" type="int">5</invoke>
40 + </preconnections>
41 + <connections>
42 + <link source="tmpS" signal="sendCamera(CvCamera)" destination="PAC" slot="setCamera(CvCamera)"/>
43 + <link source="tmpS" signal="sendCamera(CvCamera)" destination="p3d" slot="setMatInt(CvCamera)"/>
44 + <link source="tmpS" signal="sendPoint3D(int,CvPoint3D32f*)" destination="p3d" slot="setPoints3D(int,CvPoint3D32f*)"/>
45 + <link source="tmpS" signal="sendCamera(CvCamera)" destination="p3d1" slot="setMatInt(CvCamera)"/>
46 + <link source="tmpS" signal="sendPoseEstimator(QObject*)" destination="PAC" slot="setPoseEstimator(QObject*)"/>
47 + <link source="tmpS" signal="sendPoint3D(int,CvPoint3D32f*)" destination="fc" slot="setPoint3D(int,CvPoint3D32f*)"/>
48 + <link source="tmpS" signal="sendPoint3D(int,CvPoint3D32f*)" destination="p3d1" slot="setPoints3D(int,CvPoint3D32f*)"/>
49 + <link source="tmpS" signal="sendSignal()" destination="bufImg" slot="getData()"/>
50 + <link source="bufImg" signal="sendPose(CvMat *, CvMat *)" destination="PAC" slot="setMatchPose(CvMat *, CvMat *)"/>
51 + <link source="bufImg" signal="sendPose(CvMat *, CvMat *)" destination="p3d" slot="setPose(CvMat *, CvMat *)"/>
52 + <link source="bufImg" signal="dataReady()" destination="fc" slot="findCorners()"/>
53 + <link source="p3d" signal="sendPoint2D(int, CvPoint2D32f*)" destination="fc" slot="setPoints(int, CvPoint2D32f *)"/>
54 + <link source="bufImg" signal="sendImage(IplImage*)" destination="fc" slot="setImage(IplImage*)"/>
55 + <link source="fc" signal="sendCorner(int,CvPoint2D32f*)" destination="tmpS" slot="setPoint2D(int, CvPoint2D32f*)"/>
56 + <link source="fc" signal="sendPoint3D(int,CvPoint3D32f*)" destination="tmpS" slot="setPoint3D(int, CvPoint3D32f *)"/>
57 + <link source="fc" signal="sendCornerDetected()" destination="tmpS" slot="getMatching()"/>
58 + <link source="tmpS" signal="sendMatching(int, CvPoint2D32f *,CvPoint3D32f*)" destination="PAC" slot="setMatchPoints(int,CvPoint2D32f*,CvPoint3D32f*)"/>
59 + <link source="PAC" signal="lost()" destination="bufImg" slot="getData()"/>
60 + <link source="PAC" signal="sendPose(CvMat*,CvMat*)" destination="p3d1" slot="setPose(CvMat*,CvMat*)"/>
61 + <link source="fc" signal="sendNotCornerDetected()" destination="bufImg" slot="getData()"/>
62 + </connections>
63 + <postconnections/>
64 + </sheet>
65 + <interface>
66 + <slots>
67 + <method alias="setCamera(CvCamera)" component="tmpS" method="setCamera(CvCamera)"/>
68 + <method alias="setImageRef(IplImage*)" component="fc" method="setImageRef(IplImage*)"/>
69 + <method alias="setDescriptor(int,int*)" component="fc" method="setDescriptor(int,int*)"/>
70 + <method alias="setPoseEstimator(QObject*)" component="tmpS" method="setPoseEstimator(QObject*)"/>
71 + <method alias="setPointRef(int,CvPoint2D32f*)" component="fc" method="setPointRef(int,CvPoint2D32f*)"/>
72 + <method alias="setPoints3D(int,CvPoint3D32f*)" component="tmpS" method="setPoint3DS(int,CvPoint3D32f*)"/>
73 + <method alias="reInitialiser()" component="tmpS" method="setSignal()"/>
74 + <method alias="setPose(CvMat*,CvMat*)" component="bufImg" method="setPose(CvMat*,CvMat*)"/>
75 + <method alias="setImage(IplImage*)" component="bufImg" method="setImage(IplImage*)"/>
76 + <method alias="reset()" component="bufImg" method="reset()"/>
77 + <method alias="reinit()" component="bufImg" method="reinit()"/>
78 + </slots>
79 + <signals>
80 + <method alias="sendPoint3D(int,CvPoint3D32f*)" component="p3d1" method="sendPoint3D(int,CvPoint3D32f*)"/>
81 + <method alias="sendSucceeded()" component="PAC" method="match()"/>
82 + <method alias="sendFailed()" component="bufImg" method="sendEnd()"/>
83 + <method alias="sendImage(IplImage*)" component="fc" method="sendImage(IplImage*)"/>
84 + <method alias="sendCorner(int,CvPoint2D32f*)" component="p3d1" method="sendPoint2D(int,CvPoint2D32f*)"/>
85 + </signals>
86 + </interface>
87 +</composite>
This diff is collapsed. Click to expand it.
...@@ -16,6 +16,7 @@ Q_OBJECT ...@@ -16,6 +16,7 @@ Q_OBJECT
16 public: 16 public:
17 PoseEstimator(QObject* parent=0) : QObject(parent) {} //!< ARCS Constructor 17 PoseEstimator(QObject* parent=0) : QObject(parent) {} //!< ARCS Constructor
18 18
19 +public slots:
19 /*! \brief Sets the camera intrinsic parameters needed to compute pose estimation. 20 /*! \brief Sets the camera intrinsic parameters needed to compute pose estimation.
20 * \param cam an OpenCV structure describing camera intrinsic parameters. 21 * \param cam an OpenCV structure describing camera intrinsic parameters.
21 */ 22 */
......
...@@ -83,7 +83,7 @@ void CameraOpenCVHighgui::initDevice() ...@@ -83,7 +83,7 @@ void CameraOpenCVHighgui::initDevice()
83 if (cvSetCaptureProperty(capture,CV_CAP_PROP_FPS, frameRate) ) 83 if (cvSetCaptureProperty(capture,CV_CAP_PROP_FPS, frameRate) )
84 std::cout << "[Ccv] Framerate set successfully" << std::endl; 84 std::cout << "[Ccv] Framerate set successfully" << std::endl;
85 cvSetCaptureProperty(capture,CV_CAP_PROP_CONVERT_RGB, 1); 85 cvSetCaptureProperty(capture,CV_CAP_PROP_CONVERT_RGB, 1);
86 - cvSetCaptureProperty(capture,CV_CAP_PROP_WHITE_BALANCE, 1); 86 + //cvSetCaptureProperty(capture,CV_CAP_PROP_WHITE_BALANCE, 1);
87 cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS, brightness); 87 cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS, brightness);
88 float fr = (float)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); 88 float fr = (float)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS);
89 if (fr > 0.0) 89 if (fr > 0.0)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 <header name="staticNoiseImg.h"/> 19 <header name="staticNoiseImg.h"/>
20 <header name="colorlocator.h"/> 20 <header name="colorlocator.h"/>
21 <header name="movereader.h"/> 21 <header name="movereader.h"/>
22 - <!--header name="poseandcheck.h"/--> 22 + <header name="poseandcheck.h"/>
23 </headers> 23 </headers>
24 <components> 24 <components>
25 <component name="ChannelExtractor"/> 25 <component name="ChannelExtractor"/>
...@@ -45,6 +45,6 @@ ...@@ -45,6 +45,6 @@
45 <component name="StaticNoiseImg"/> 45 <component name="StaticNoiseImg"/>
46 <component name="ColorLocator"/> 46 <component name="ColorLocator"/>
47 <component name="MoveReader"/> 47 <component name="MoveReader"/>
48 - <!--component name="PoseAndCheck"/--> 48 + <component name="PoseAndCheck"/>
49 </components> 49 </components>
50 </library> 50 </library>
......
...@@ -24,7 +24,7 @@ HEADERS+= staticNoiseImg.h ...@@ -24,7 +24,7 @@ HEADERS+= staticNoiseImg.h
24 HEADERS+= imagepointselector.h 24 HEADERS+= imagepointselector.h
25 HEADERS+= colorlocator.h 25 HEADERS+= colorlocator.h
26 HEADERS+= movereader.h 26 HEADERS+= movereader.h
27 -# HEADERS+= poseandcheck.h 27 +HEADERS+= poseandcheck.h
28 28
29 SOURCES = cvutils.cpp 29 SOURCES = cvutils.cpp
30 SOURCES+= basicprocessing.cpp 30 SOURCES+= basicprocessing.cpp
...@@ -44,7 +44,7 @@ SOURCES+= staticNoiseImg.cpp ...@@ -44,7 +44,7 @@ SOURCES+= staticNoiseImg.cpp
44 SOURCES+= imagepointselector.cpp 44 SOURCES+= imagepointselector.cpp
45 SOURCES+= colorlocator.cpp 45 SOURCES+= colorlocator.cpp
46 SOURCES+= movereader.cpp 46 SOURCES+= movereader.cpp
47 -# SOURCES+= poseandcheck.cpp 47 +SOURCES+= poseandcheck.cpp
48 48
49 MOC_DIR = ./moc 49 MOC_DIR = ./moc
50 OBJECTS_DIR = ./obj 50 OBJECTS_DIR = ./obj
...@@ -117,5 +117,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} ...@@ -117,5 +117,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME}
117 arcslibrary.variable_out = SOURCES 117 arcslibrary.variable_out = SOURCES
118 QMAKE_EXTRA_COMPILERS += arcslibrary 118 QMAKE_EXTRA_COMPILERS += arcslibrary
119 INCLUDEPATH += $$(ARCSDIR)/include 119 INCLUDEPATH += $$(ARCSDIR)/include
120 -LIBS += -L$$(ARCSDIR)/lib -larcs -lGLU 120 +LIBS += -L$$(ARCSDIR)/lib -larcs -lGLU -L../libs -lposeestimators
121 CONFIG += dll 121 CONFIG += dll
......
1 #include "poseandcheck.h" 1 #include "poseandcheck.h"
2 #include <string.h> 2 #include <string.h>
3 //#include "utils.h" 3 //#include "utils.h"
4 -#include "ioposeestimator.h" 4 +#include "../poseestimators/ioposeestimator.h"
5 //#include "didierposeestimator.h" 5 //#include "didierposeestimator.h"
6 -#include "classicalposeestimator.h" 6 +#include "../poseestimators/classicalposeestimator.h"
7 //#include "patternposeestimator.h" 7 //#include "patternposeestimator.h"
8 #include <math.h> 8 #include <math.h>
9 #include <iostream> 9 #include <iostream>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 #define __POSEANDCHECK_H__ 2 #define __POSEANDCHECK_H__
3 3
4 #include "../include/poseestimator.h" 4 #include "../include/poseestimator.h"
5 -#include "pattern.h" 5 +#include "../pattern/pattern.h"
6 6
7 using namespace std; 7 using namespace std;
8 8
......
...@@ -141,5 +141,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} ...@@ -141,5 +141,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME}
141 arcslibrary.variable_out = SOURCES 141 arcslibrary.variable_out = SOURCES
142 QMAKE_EXTRA_COMPILERS += arcslibrary 142 QMAKE_EXTRA_COMPILERS += arcslibrary
143 INCLUDEPATH += $$(ARCSDIR)/include 143 INCLUDEPATH += $$(ARCSDIR)/include
144 -LIBS += -L$$(ARCSDIR)/lib -larcs 144 +LIBS += -L$$(ARCSDIR)/lib -larcs -lGLU
145 - CONFIG += dll 145 +CONFIG += dll
......
1 #ifndef __CLASSICALPOSEESTIMATOR_H__ 1 #ifndef __CLASSICALPOSEESTIMATOR_H__
2 #define __CLASSICALPOSEESTIMATOR_H__ 2 #define __CLASSICALPOSEESTIMATOR_H__
3 3
4 -#include "poseestimator.h" 4 +#include "../include/poseestimator.h"
5 //#include "pattern.h" 5 //#include "pattern.h"
6 //#include "patternspace.h" 6 //#include "patternspace.h"
7 7
......
1 #ifndef __IOPOSEESTIMATOR_H__ 1 #ifndef __IOPOSEESTIMATOR_H__
2 #define __IOPOSEESTIMATOR_H__ 2 #define __IOPOSEESTIMATOR_H__
3 3
4 -#include "poseestimator.h" 4 +#include "../include/poseestimator.h"
5 //#include "pattern.h" 5 //#include "pattern.h"
6 //#include "patternspace.h" 6 //#include "patternspace.h"
7 7
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 6
7 #include "pipereader.h" 7 #include "pipereader.h"
8 #include <iostream> 8 #include <iostream>
9 +#include <unistd.h>
9 10
10 11
11 PipeReader::PipeReader(QObject* parent) : QObject(parent) 12 PipeReader::PipeReader(QObject* parent) : QObject(parent)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <iostream> 10 #include <iostream>
11 #include <errno.h> 11 #include <errno.h>
12 +#include <unistd.h>
12 13
13 RtcLow::RtcLow() 14 RtcLow::RtcLow()
14 { 15 {
......
...@@ -26,6 +26,7 @@ SOURCES+=searchaction.cpp \ ...@@ -26,6 +26,7 @@ SOURCES+=searchaction.cpp \
26 SOURCES+=ivloader.cpp 26 SOURCES+=ivloader.cpp
27 SOURCES+=arcsviewer.cpp 27 SOURCES+=arcsviewer.cpp
28 28
29 +QMAKE_CXXFLAGS+= -fpermissive
29 30
30 ALXFILE = libcoinutils.alx 31 ALXFILE = libcoinutils.alx
31 OTHER_FILES += libcoinutils.alx 32 OTHER_FILES += libcoinutils.alx
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
2 #define __POSEINVERTER_H__ 2 #define __POSEINVERTER_H__
3 3
4 #include <QObject> 4 #include <QObject>
5 +#include <iostream>
5 6
6 class PoseInverter : public QObject 7 class PoseInverter : public QObject
7 { 8 {
...@@ -22,6 +23,30 @@ public slots: ...@@ -22,6 +23,30 @@ public slots:
22 t[1]=-(r[3]*tr[0]+r[4]*tr[1]+r[5]*tr[2]); 23 t[1]=-(r[3]*tr[0]+r[4]*tr[1]+r[5]*tr[2]);
23 t[2]=-(r[6]*tr[0]+r[7]*tr[1]+r[8]*tr[2]); 24 t[2]=-(r[6]*tr[0]+r[7]*tr[1]+r[8]*tr[2]);
24 25
26 + int i,j;
27 + std::cout << "Obtained pose " << tr[0] << ", " << tr[1] << ", "<< tr[2] << std::endl;
28 + std::cout << "Obtained matrix " << std::endl;
29 + for (i=0; i<3; i++)
30 + {
31 + for (j=0;j<3; j++)
32 + {
33 + std::cout << rot[i*3+j] << " ";
34 + }
35 + std::cout << std::endl;
36 + }
37 +
38 +
39 + std::cout << "Converted pose " << t[0] << ", " << t[1] << ", " << t[2] << std::endl;
40 + std::cout << "Converted matrix" << std::endl;
41 + for (i=0; i<3; i++)
42 + {
43 + for (j=0; j<3; j++)
44 + {
45 + std::cout << r[i*3+j] << " " ;
46 + }
47 + std::cout << std::endl;
48 + }
49 +
25 emit sendPose(r,t); 50 emit sendPose(r,t);
26 } 51 }
27 52
......
...@@ -10,6 +10,8 @@ LIBS += $$system(pkg-config --libs Coin) ...@@ -10,6 +10,8 @@ LIBS += $$system(pkg-config --libs Coin)
10 INCLUDEPATH += $$system(pkg-config --cflags-only-I opencv) 10 INCLUDEPATH += $$system(pkg-config --cflags-only-I opencv)
11 INCLUDEPATH += $$system(pkg-config --cflags-only-I Coin) 11 INCLUDEPATH += $$system(pkg-config --cflags-only-I Coin)
12 12
13 +QMAKE_CXXFLAGS += -fpermissive
14 +
13 DESTDIR= ../../libs 15 DESTDIR= ../../libs
14 DLLDESTDIR= ../../libs 16 DLLDESTDIR= ../../libs
15 17
......
...@@ -19,7 +19,7 @@ HEADERS+=gltx.h ...@@ -19,7 +19,7 @@ HEADERS+=gltx.h
19 19
20 DESTDIR=../../libs 20 DESTDIR=../../libs
21 DLLDESTDIR=../../libs 21 DLLDESTDIR=../../libs
22 - 22 +QMAKE_CXXFLAGS=-fpermissive
23 23
24 24
25 ALXFILE = libobj2so.alx 25 ALXFILE = libobj2so.alx
......