Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
7e2643ab
Commit
7e2643ab
authored
Jul 04, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed shape files
parent
4c3d1d58
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
175 deletions
+0
-175
precomp.hpp
modules/viz/src/precomp.hpp
+0
-1
shapes.h
modules/viz/src/q/shapes.h
+0
-19
shapes.cpp
modules/viz/src/shapes.cpp
+0
-153
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+0
-1
viz_main.cpp
modules/viz/src/viz_main.cpp
+0
-1
No files found.
modules/viz/src/precomp.hpp
View file @
7e2643ab
...
@@ -153,6 +153,5 @@
...
@@ -153,6 +153,5 @@
#endif
#endif
#include <q/shapes.h>
#include "opencv2/viz/widget_accessor.hpp"
#include "opencv2/viz/widget_accessor.hpp"
#include <opencv2/viz/widgets.hpp>
#include <opencv2/viz/widgets.hpp>
modules/viz/src/q/shapes.h
deleted
100644 → 0
View file @
4c3d1d58
#pragma once
#include <opencv2/viz/types.hpp>
namespace
temp_viz
{
vtkSmartPointer
<
vtkDataSet
>
createLine
(
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
);
vtkSmartPointer
<
vtkDataSet
>
createSphere
(
const
cv
::
Point3f
&
center
,
float
radius
,
int
sphere_resolution
=
10
);
vtkSmartPointer
<
vtkDataSet
>
createCylinder
(
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
numsides
=
30
);
vtkSmartPointer
<
vtkDataSet
>
createPlane
(
const
Vec4f
&
coefs
);
vtkSmartPointer
<
vtkDataSet
>
createPlane
(
const
Vec4f
&
coefs
,
const
Point3f
&
pt
);
vtkSmartPointer
<
vtkDataSet
>
create2DCircle
(
const
Point3f
&
pt
,
double
radius
);
vtkSmartPointer
<
vtkDataSet
>
createCube
(
const
Point3f
&
pt_min
,
const
Point3f
&
pt_max
);
vtkSmartPointer
<
vtkDataSet
>
createSphere
(
const
Point3f
&
pt
,
double
radius
);
vtkSmartPointer
<
vtkDataSet
>
createArrow
(
const
Point3f
&
pt1
,
const
Point3f
&
pt2
);
//brief Allocate a new unstructured grid smartpointer. For internal use only.
void
allocVtkUnstructuredGrid
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
&
polydata
);
}
modules/viz/src/shapes.cpp
deleted
100644 → 0
View file @
4c3d1d58
#include "precomp.hpp"
inline
float
rad2deg
(
float
alpha
)
{
return
(
alpha
*
57.29578
f
);
}
inline
double
rad2deg
(
double
alpha
)
{
return
(
alpha
*
57.29578
);
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createCylinder
(
const
cv
::
Point3f
&
pt_on_axis
,
const
cv
::
Point3f
&
axis_direction
,
double
radius
,
int
numsides
)
{
const
cv
::
Point3f
pt2
=
pt_on_axis
+
axis_direction
;
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
line
->
SetPoint1
(
pt_on_axis
.
x
,
pt_on_axis
.
y
,
pt_on_axis
.
z
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
vtkSmartPointer
<
vtkTubeFilter
>
tuber
=
vtkSmartPointer
<
vtkTubeFilter
>::
New
();
tuber
->
SetInputConnection
(
line
->
GetOutputPort
());
tuber
->
SetRadius
(
radius
);
tuber
->
SetNumberOfSides
(
numsides
);
return
(
tuber
->
GetOutput
());
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createPlane
(
const
cv
::
Vec4f
&
coefs
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
plane
->
SetNormal
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
norm
=
cv
::
norm
(
cv
::
Vec3f
(
coefs
.
val
));
plane
->
Push
(
-
coefs
[
3
]
/
norm
);
return
plane
->
GetOutput
();
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createPlane
(
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
cv
::
Point3f
coefs3
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
norm_sqr
=
1.0
/
coefs3
.
dot
(
coefs3
);
plane
->
SetNormal
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
t
=
coefs3
.
dot
(
pt
)
+
coefs
[
3
];
cv
::
Vec3f
p_center
=
pt
-
coefs3
*
t
*
norm_sqr
;
plane
->
SetCenter
(
p_center
[
0
],
p_center
[
1
],
p_center
[
2
]);
return
(
plane
->
GetOutput
());
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
create2DCircle
(
const
cv
::
Point3f
&
pt
,
double
radius
)
{
vtkSmartPointer
<
vtkDiskSource
>
disk
=
vtkSmartPointer
<
vtkDiskSource
>::
New
();
// Maybe the resolution should be lower e.g. 50 or 25
disk
->
SetCircumferentialResolution
(
100
);
disk
->
SetInnerRadius
(
radius
-
0.001
);
disk
->
SetOuterRadius
(
radius
+
0.001
);
disk
->
SetCircumferentialResolution
(
20
);
// Set the circle origin
vtkSmartPointer
<
vtkTransform
>
t
=
vtkSmartPointer
<
vtkTransform
>::
New
();
t
->
Identity
();
t
->
Translate
(
pt
.
x
,
pt
.
y
,
pt
.
z
);
vtkSmartPointer
<
vtkTransformPolyDataFilter
>
tf
=
vtkSmartPointer
<
vtkTransformPolyDataFilter
>::
New
();
tf
->
SetTransform
(
t
);
tf
->
SetInputConnection
(
disk
->
GetOutputPort
());
return
tf
->
GetOutput
();
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createCube
(
const
cv
::
Point3f
&
pt_min
,
const
cv
::
Point3f
&
pt_max
)
{
vtkSmartPointer
<
vtkCubeSource
>
cube
=
vtkSmartPointer
<
vtkCubeSource
>::
New
();
cube
->
SetBounds
(
pt_min
.
x
,
pt_max
.
x
,
pt_min
.
y
,
pt_max
.
y
,
pt_min
.
z
,
pt_max
.
z
);
return
cube
->
GetOutput
();
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createSphere
(
const
Point3f
&
pt
,
double
radius
)
{
vtkSmartPointer
<
vtkSphereSource
>
sphere
=
vtkSmartPointer
<
vtkSphereSource
>::
New
();
sphere
->
SetRadius
(
radius
);
sphere
->
SetCenter
(
pt
.
x
,
pt
.
y
,
pt
.
z
);
sphere
->
SetPhiResolution
(
10
);
sphere
->
SetThetaResolution
(
10
);
sphere
->
LatLongTessellationOff
();
sphere
->
Update
();
return
sphere
->
GetOutput
();
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createArrow
(
const
Point3f
&
pt1
,
const
Point3f
&
pt2
)
{
vtkSmartPointer
<
vtkArrowSource
>
arrowSource
=
vtkSmartPointer
<
vtkArrowSource
>::
New
();
float
startPoint
[
3
],
endPoint
[
3
];
startPoint
[
0
]
=
pt1
.
x
;
startPoint
[
1
]
=
pt1
.
y
;
startPoint
[
2
]
=
pt1
.
z
;
endPoint
[
0
]
=
pt2
.
x
;
endPoint
[
1
]
=
pt2
.
y
;
endPoint
[
2
]
=
pt2
.
z
;
float
normalizedX
[
3
],
normalizedY
[
3
],
normalizedZ
[
3
];
// The X axis is a vector from start to end
vtkMath
::
Subtract
(
endPoint
,
startPoint
,
normalizedX
);
float
length
=
vtkMath
::
Norm
(
normalizedX
);
vtkMath
::
Normalize
(
normalizedX
);
// The Z axis is an arbitrary vecotr cross X
float
arbitrary
[
3
];
arbitrary
[
0
]
=
vtkMath
::
Random
(
-
10
,
10
);
arbitrary
[
1
]
=
vtkMath
::
Random
(
-
10
,
10
);
arbitrary
[
2
]
=
vtkMath
::
Random
(
-
10
,
10
);
vtkMath
::
Cross
(
normalizedX
,
arbitrary
,
normalizedZ
);
vtkMath
::
Normalize
(
normalizedZ
);
// The Y axis is Z cross X
vtkMath
::
Cross
(
normalizedZ
,
normalizedX
,
normalizedY
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
// Create the direction cosine matrix
matrix
->
Identity
();
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
matrix
->
SetElement
(
i
,
0
,
normalizedX
[
i
]);
matrix
->
SetElement
(
i
,
1
,
normalizedY
[
i
]);
matrix
->
SetElement
(
i
,
2
,
normalizedZ
[
i
]);
}
// Apply the transforms
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
Translate
(
startPoint
);
transform
->
Concatenate
(
matrix
);
transform
->
Scale
(
length
,
length
,
length
);
// Transform the polydata
vtkSmartPointer
<
vtkTransformPolyDataFilter
>
transformPD
=
vtkSmartPointer
<
vtkTransformPolyDataFilter
>::
New
();
transformPD
->
SetTransform
(
transform
);
transformPD
->
SetInputConnection
(
arrowSource
->
GetOutputPort
());
return
transformPD
->
GetOutput
();
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createLine
(
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
)
{
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
line
->
SetPoint1
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
line
->
Update
();
return
line
->
GetOutput
();
}
void
temp_viz
::
allocVtkUnstructuredGrid
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
&
polydata
)
{
polydata
=
vtkSmartPointer
<
vtkUnstructuredGrid
>::
New
();
}
modules/viz/src/viz3d_impl.cpp
View file @
7e2643ab
#include "precomp.hpp"
#include "precomp.hpp"
#include <q/shapes.h>
#include <q/viz3d_impl.hpp>
#include <q/viz3d_impl.hpp>
namespace
temp_viz
namespace
temp_viz
...
...
modules/viz/src/viz_main.cpp
View file @
7e2643ab
#include "precomp.hpp"
#include "precomp.hpp"
#include <opencv2/calib3d.hpp>
#include <opencv2/calib3d.hpp>
#include <q/shapes.h>
#include <q/viz3d_impl.hpp>
#include <q/viz3d_impl.hpp>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderWindowInteractor.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment