Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
ARCS2-Components
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2013-05-14 17:10:43 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e924a7087dfcd31e875cb95daaa86e6caad0bb50
e924a708
1 parent
f1cff132
Modification pour faire fonctionner ARUCO avec ARCS
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
134 additions
and
17 deletions
applications/arcsviewer_aruco.xml
applications/arcsviewer_pattern.xml
imageprocessing/aruco/aruco.cpp
legacy/applications/testmtiqt.xml
scene/coinutils/arcsviewer.cpp
scene/coinutils/arcsviewer.h
scene/coinutils/poseinverter.h
scene/cv2so/imagecv2so.cpp
applications/arcsviewer_aruco.xml
0 → 100644
View file @
e924a70
<!-- Integration test of OpenInventor and OpenCV -->
<application
mode=
"gui"
>
<context>
<libraries>
<library
path=
"../libs/cv2so"
/>
<library
path=
"../libs/arcscoin"
/>
<library
path=
"../libs/coinutils"
/>
<library
path=
"../libs/arcsutils"
/>
<library
path=
"../legacy/libs/ocvcam"
/>
<library
path=
"../libs/opencv"
/>
<library
path=
"../libs/obj2so"
/>
<library
path=
"../libs/aruco"
/>
<library
path=
"../legacy/libs/libocv.so"
/>
</libraries>
<components>
<component
id=
"camera"
type=
"CameraOpenCV"
/>
<component
id=
"viewer"
type=
"ARCSViewer"
/>
<component
id=
"converter"
type=
"ImageCv2So"
/>
<component
id=
"monitor"
type=
"ARCSMonitor"
/>
<component
id=
"al"
type=
"Obj2So"
/>
<component
id=
"scene"
type=
"Separator"
>
Separator {
Translation { translation 0 0 0.03}
#Separator {
#Translation { translation 0 0 0.06 }
# Material { diffuseColor 1 0 0 }
# Sphere { radius 0.01 }
# }
TrackballManip {}
}
</component>
<component
id=
"fgscene"
type=
"Separator"
>
Separator {
Translation { translation -1. -0.9 0.1 }
Font { name "Helvetica:bold" size 24 }
BaseColor { rgb 0.3 0.3 0.7 }
Text2 {
#string "Cliquez au demarrage"
}
Translation { translation 0 0 -10 }
Cube{}
}
</component>
<component
id=
"inverter"
type=
"PoseInverter"
/>
<component
id=
"detector"
type=
"ArucoDetector"
/>
<component
id=
"statemachine"
type=
"StateMachine"
>
<statemachine>
<first
name=
"a"
/>
<last
name=
"end"
/>
<transitions>
<transition
source=
"a"
token=
"end"
destination=
"end"
/>
</transitions>
</statemachine>
</component>
</components>
<constants>
<constant
id=
"camParams"
type=
"CvCamera"
>
640 480 0 0 0 0 800 0 320 0 800 240 0 0 1
</constant>
</constants>
</context>
<processes>
<process
controller=
"statemachine"
>
<sheet
id=
"a"
>
<preconnections>
<invoke
destination=
"camera"
slot=
"setThreaded(bool)"
type=
"bool"
>
true
</invoke>
<invoke
destination=
"camera"
slot=
"setHeight(int)"
type=
"int"
>
480
</invoke>
<invoke
destination=
"camera"
slot=
"setWidth(int)"
type=
"int"
>
640
</invoke>
<invoke
destination=
"camera"
slot=
"setFrameRate(float)"
type=
"float"
>
25
</invoke>
<invoke
destination=
"camera"
slot=
"initDevice()"
type=
"void"
/>
<invoke
destination=
"al"
slot=
"load(QString)"
type=
"string"
>
../legacy/applications/al2.obj
</invoke>
<invoke
destination=
"al"
slot=
"unitize()"
type=
"void"
/>
<invoke
destination=
"al"
slot=
"scale(float)"
type=
"float"
>
0.03
</invoke>
<invoke
destination=
"viewer"
slot=
"setSize(QSize)"
type=
"size"
>
640x480
</invoke>
<invoke
destination=
"viewer"
slot=
"addUserScene(SoFieldContainer*)"
type=
"component"
>
scene
</invoke>
<invoke
destination=
"viewer"
slot=
"addForegroundScene(SoFieldContainer*)"
type=
"component"
>
fgscene
</invoke>
<invoke
destination=
"viewer"
slot=
"setBGRtoRGB(bool)"
type=
"bool"
>
1
</invoke>
<!-- invocations imported from pattern example -->
<invoke
destination=
"detector"
slot=
"setCamera(CvCamera)"
type=
"constant"
>
camParams
</invoke>
<invoke
destination=
"detector"
slot=
"setMarkerSize(float)"
type=
"float"
>
0.07
</invoke>
<invoke
destination=
"viewer"
slot=
"setIntrinsics(Camera)"
type=
"constant"
>
camParams
</invoke>
</preconnections>
<connections>
<link
source=
"camera"
signal=
"sendImage(IplImage*)"
destination=
"converter"
slot=
"setCvImage(IplImage*)"
/>
<link
source=
"viewer"
signal=
"sendImageNode(SoFieldContainer*)"
destination=
"converter"
slot=
"setNode(SoFieldContainer*)"
/>
<link
source=
"al"
signal=
"sendScene(SoFieldContainer*)"
destination=
"scene"
slot=
"addChild(SoFieldContainer*)"
/>
<!--link source="converter" signal="ready()" destination="viewer" slot="redraw()"/-->
<link
source=
"camera"
signal=
"sendImage(IplImage*)"
destination=
"detector"
slot=
"setImage(IplImage*)"
/>
<link
source=
"detector"
signal=
"sendPose(float*,float*)"
destination=
"inverter"
slot=
"setPose(float*,float*)"
/>
<link
source=
"inverter"
signal=
"sendPose(float*,float*)"
destination=
"viewer"
slot=
"setExtrinsics(float*,float*)"
/>
</connections>
<postconnections>
<invoke
destination=
"al"
slot=
"generate()"
type=
"void"
/>
<invoke
destination=
"viewer"
slot=
"show()"
type=
"void"
/>
<invoke
destination=
"viewer"
slot=
"viewAll()"
type=
"void"
/>
<invoke
destination=
"camera"
slot=
"start()"
type=
"void"
/>
</postconnections>
</sheet>
<sheet
id=
"end"
/>
</process>
</processes>
</application>
applications/arcsviewer_pattern.xml
View file @
e924a70
...
...
@@ -77,7 +77,7 @@
<invoke
destination=
"camera"
slot=
"setWidth(int)"
type=
"int"
>
640
</invoke>
<invoke
destination=
"camera"
slot=
"setFrameRate(float)"
type=
"float"
>
25
</invoke>
<invoke
destination=
"camera"
slot=
"initDevice()"
type=
"void"
/>
<invoke
destination=
"al"
slot=
"load(QString)"
type=
"constant"
>
model
2
</invoke>
<!-- ../legacy/applications/al2.obj -->
<invoke
destination=
"al"
slot=
"load(QString)"
type=
"constant"
>
model
</invoke>
<!-- ../legacy/applications/al2.obj -->
<invoke
destination=
"al"
slot=
"unitize()"
type=
"void"
/>
<invoke
destination=
"al"
slot=
"scale(float)"
type=
"float"
>
0.03
</invoke>
<invoke
destination=
"viewer"
slot=
"setSize(QSize)"
type=
"size"
>
640x480
</invoke>
...
...
@@ -101,7 +101,7 @@
<link
source=
"viewer"
signal=
"sendImageNode(SoFieldContainer*)"
destination=
"converter"
slot=
"setNode(SoFieldContainer*)"
/>
<link
source=
"al"
signal=
"sendScene(SoFieldContainer*)"
destination=
"scene"
slot=
"addChild(SoFieldContainer*)"
/>
<
link
source=
"converter"
signal=
"ready()"
destination=
"viewer"
slot=
"redraw()"
/
>
<
!--link source="converter" signal="ready()" destination="viewer" slot="redraw()"/--
>
<link
source=
"camera"
signal=
"sendImage(IplImage*)"
destination=
"ts"
slot=
"setImage(IplImage*)"
/>
<link
source=
"camera"
signal=
"sendImage(IplImage*)"
destination=
"pattern"
slot=
"setImage(IplImage*)"
/>
...
...
imageprocessing/aruco/aruco.cpp
View file @
e924a70
#include "aruco.h"
#include <aruco/cvdrawingutils.h>
#include <vector>
#include <iostream>
#include <cmath>
...
...
@@ -26,7 +27,7 @@ void ArucoDetector::setImage(IplImage *img)
std
::
vector
<
aruco
::
Marker
>
markers
;
try
{
md
.
detect
(
image
,
markers
,
cp
,
size
);
md
.
detect
(
image
,
markers
,
cp
,
size
,
false
);
}
catch
(
std
::
exception
&
ex
)
{
...
...
@@ -35,7 +36,7 @@ void ArucoDetector::setImage(IplImage *img)
if
(
markers
.
size
()
>
0
)
{
markers
[
0
].
calculateExtrinsics
(
size
,
cp
);
//markers[0].calculateExtrinsics(size, cp,false
);
cv
::
Mat
rot
(
3
,
3
,
CV_32FC1
),
jacob
;
cv
::
Rodrigues
(
markers
[
0
].
Rvec
,
rot
,
jacob
);
float
r
[
9
];
...
...
@@ -44,17 +45,17 @@ void ArucoDetector::setImage(IplImage *img)
r
[
0
]
=
rot
.
at
<
float
>
(
0
,
0
);
r
[
1
]
=
rot
.
at
<
float
>
(
0
,
1
);
r
[
2
]
=
rot
.
at
<
float
>
(
0
,
2
);
r
[
3
]
=
rot
.
at
<
float
>
(
1
,
0
);
r
[
4
]
=
rot
.
at
<
float
>
(
1
,
1
);
r
[
5
]
=
rot
.
at
<
float
>
(
1
,
2
);
r
[
3
]
=
-
rot
.
at
<
float
>
(
1
,
0
);
r
[
4
]
=
-
rot
.
at
<
float
>
(
1
,
1
);
r
[
5
]
=
-
rot
.
at
<
float
>
(
1
,
2
);
r
[
6
]
=-
rot
.
at
<
float
>
(
2
,
0
);
r
[
7
]
=-
rot
.
at
<
float
>
(
2
,
1
);
r
[
8
]
=-
rot
.
at
<
float
>
(
2
,
2
);
t
[
0
]
=
markers
[
0
].
Tvec
.
at
<
float
>
(
0
,
0
);
t
[
1
]
=
markers
[
0
].
Tvec
.
at
<
float
>
(
0
,
1
);
t
[
0
]
=-
markers
[
0
].
Tvec
.
at
<
float
>
(
0
,
2
);
t
[
0
]
=
markers
[
0
].
Tvec
.
ptr
<
float
>
(
0
)[
0
];
t
[
1
]
=-
markers
[
0
].
Tvec
.
ptr
<
float
>
(
0
)[
1
];
t
[
2
]
=-
markers
[
0
].
Tvec
.
ptr
<
float
>
(
0
)[
2
];
//std::cout << markers[0] << std::endl;
//cv::Mat reverse = (cv::Mat_<float>(3,3) << 0,1,0, 0,0,-1,-1,0,0) ;
...
...
legacy/applications/testmtiqt.xml
View file @
e924a70
...
...
@@ -27,7 +27,8 @@
<invoke
destination=
"mti"
slot=
"setQuaternionOutput()"
type=
"void"
/>
<invoke
destination=
"mti"
slot=
"setThreaded(bool)"
type=
"bool"
>
true
</invoke>
<invoke
destination=
"mti"
slot=
"setTimeStampedOutput()"
type=
"void"
/>
<invoke
destination=
"mti"
slot=
"setMagneticFilter(bool)"
type=
"bool"
>
true
</invoke>
<invoke
destination=
"mti"
slot=
"setMagneticFilter(bool)"
type=
"bool"
>
false
</invoke>
<invoke
destination=
"mti"
slot=
"setCalibratedOutput(bool)"
type=
"bool"
>
true
</invoke>
</preconnections>
<connections>
<link
source=
"mti"
signal=
"sendQuaternion(float*)"
destination=
"repere"
slot=
"setQuaternion(float*)"
/>
...
...
scene/coinutils/arcsviewer.cpp
View file @
e924a70
...
...
@@ -231,6 +231,9 @@ void ARCSViewer::buildSceneGraph()
// handling textures
SoSeparator
*
bgTextureGroup
=
new
SoSeparator
;
bgTextureGroup
->
renderCaching
=
SoSeparator
::
OFF
;
bgGroup
->
renderCaching
=
SoSeparator
::
OFF
;
scene2D
->
renderCaching
=
SoSeparator
::
OFF
;
bgTextureScale
=
new
SoTransform
;
SoCoordinate3
*
bgCoord
=
new
SoCoordinate3
;
bgCoord
->
point
.
setValues
(
0
,
4
,
_coords3
);
...
...
scene/coinutils/arcsviewer.h
View file @
e924a70
...
...
@@ -11,6 +11,7 @@
#include <Inventor/SbRotation.h>
#include <Quarter/QuarterWidget.h>
#include <QImage>
#include <iostream>
#include "../../include/camera.h"
...
...
@@ -37,6 +38,7 @@ public:
public
slots
:
void
setSize
(
QSize
s
);
void
viewAll
();
//void redraw() { std::cout << "redraw" << std::endl; SIM::Coin3D::Quarter::QuarterWidget::redraw(); }
void
setIntrinsics
(
CvCamera
c
);
...
...
scene/coinutils/poseinverter.h
View file @
e924a70
...
...
@@ -23,7 +23,7 @@ public slots:
t
[
1
]
=-
(
r
[
3
]
*
tr
[
0
]
+
r
[
4
]
*
tr
[
1
]
+
r
[
5
]
*
tr
[
2
]);
t
[
2
]
=-
(
r
[
6
]
*
tr
[
0
]
+
r
[
7
]
*
tr
[
1
]
+
r
[
8
]
*
tr
[
2
]);
int
i
,
j
;
/*
int i,j;
std::cout << "Obtained pose " << tr[0] << ", " << tr[1] << ", "<< tr[2] << std::endl;
std::cout << "Obtained matrix " << std::endl;
for (i=0; i<3; i++)
...
...
@@ -45,7 +45,7 @@ public slots:
std::cout << r[i*3+j] << " " ;
}
std::cout << std::endl;
}
}
*/
emit
sendPose
(
r
,
t
);
}
...
...
scene/cv2so/imagecv2so.cpp
View file @
e924a70
#include "imagecv2so.h"
#include <cmath>
#include <cstring>
#include <iostream>
#include <Inventor/nodes/SoTexture2.h>
#include <Inventor/nodes/SoImage.h>
...
...
@@ -19,8 +18,7 @@ void ImageCv2So::setCvImage(IplImage* img)
for (texWidth = 1; texWidth < img->width; texWidth = texWidth<<1) ;
int texHeight;
for (texHeight = 1; texHeight < img->height; texHeight = texHeight<<1) ;*/
// test if we must create a nice image
//if (size != SbVec2s(texWidth,texHeight) || channels != img->nChannels) {
// unsigned char* nullImg=new unsigned char[texWidth*texHeight*channels];
...
...
Please
register
or
login
to post a comment