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
b032b4dd
Commit
b032b4dd
authored
Aug 22, 2013
by
ozantonkal
Committed by
Ozan Tonkal
Sep 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move frompolyfile to widget class as static method, remove addpolygon and its alikes
parent
0bbaf5d4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
73 deletions
+43
-73
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+0
-7
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+2
-0
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+0
-1
viz3d.cpp
modules/viz/src/viz3d.cpp
+1
-22
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+0
-0
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+0
-43
widget.cpp
modules/viz/src/widget.cpp
+40
-0
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
b032b4dd
...
...
@@ -27,13 +27,6 @@ namespace cv
void
setBackgroundColor
(
const
Color
&
color
=
Color
::
black
());
//to refactor
bool
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
=
"polygon"
);
bool
updatePolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
=
"polygon"
);
bool
addPolylineFromPolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
=
"polyline"
);
bool
addPolygon
(
const
Mat
&
cloud
,
const
Color
&
color
,
const
String
&
id
=
"polygon"
);
void
showWidget
(
const
String
&
id
,
const
Widget
&
widget
,
const
Affine3f
&
pose
=
Affine3f
::
Identity
());
void
removeWidget
(
const
String
&
id
);
Widget
getWidget
(
const
String
&
id
)
const
;
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
b032b4dd
...
...
@@ -16,6 +16,8 @@ namespace cv
Widget
();
Widget
(
const
Widget
&
other
);
Widget
&
operator
=
(
const
Widget
&
other
);
static
Widget
fromPlyFile
(
const
String
&
file_name
);
~
Widget
();
...
...
modules/viz/src/shape_widgets.cpp
View file @
b032b4dd
...
...
@@ -969,7 +969,6 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, const Mat
// Create a camera
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f_x
=
K
(
0
,
0
);
float
f_y
=
K
(
1
,
1
);
float
c_y
=
K
(
1
,
2
);
float
aspect_ratio
=
float
(
image
.
cols
)
/
float
(
image
.
rows
);
...
...
modules/viz/src/viz3d.cpp
View file @
b032b4dd
...
...
@@ -44,26 +44,6 @@ void cv::viz::Viz3d::release()
void
cv
::
viz
::
Viz3d
::
setBackgroundColor
(
const
Color
&
color
)
{
impl_
->
setBackgroundColor
(
color
);
}
bool
cv
::
viz
::
Viz3d
::
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
)
{
return
impl_
->
addPolygonMesh
(
mesh
,
Mat
(),
id
);
}
bool
cv
::
viz
::
Viz3d
::
updatePolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
)
{
return
impl_
->
updatePolygonMesh
(
mesh
,
Mat
(),
id
);
}
bool
cv
::
viz
::
Viz3d
::
addPolylineFromPolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
)
{
return
impl_
->
addPolylineFromPolygonMesh
(
mesh
,
id
);
}
bool
cv
::
viz
::
Viz3d
::
addPolygon
(
const
Mat
&
cloud
,
const
Color
&
color
,
const
String
&
id
)
{
return
impl_
->
addPolygon
(
cloud
,
color
,
id
);
}
void
cv
::
viz
::
Viz3d
::
spin
()
{
impl_
->
spin
();
}
void
cv
::
viz
::
Viz3d
::
spinOnce
(
int
time
,
bool
force_redraw
)
{
impl_
->
spinOnce
(
time
,
force_redraw
);
}
bool
cv
::
viz
::
Viz3d
::
wasStopped
()
const
{
return
impl_
->
wasStopped
();
}
...
...
@@ -94,4 +74,4 @@ void cv::viz::Viz3d::converTo3DRay(const Point3d &window_coord, Point3d &origin,
cv
::
Size
cv
::
viz
::
Viz3d
::
getWindowSize
()
const
{
return
impl_
->
getWindowSize
();
}
void
cv
::
viz
::
Viz3d
::
setWindowSize
(
const
Size
&
window_size
)
{
impl_
->
setWindowSize
(
window_size
.
width
,
window_size
.
height
);
}
cv
::
String
cv
::
viz
::
Viz3d
::
getWindowName
()
const
{
return
impl_
->
getWindowName
();
}
\ No newline at end of file
cv
::
String
cv
::
viz
::
Viz3d
::
getWindowName
()
const
{
return
impl_
->
getWindowName
();
}
modules/viz/src/viz3d_impl.cpp
View file @
b032b4dd
This diff is collapsed.
Click to expand it.
modules/viz/src/viz3d_impl.hpp
View file @
b032b4dd
...
...
@@ -19,30 +19,11 @@ public:
void
removeAllWidgets
();
//to refactor
bool
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
cv
::
Mat
&
mask
,
const
String
&
id
=
"polygon"
);
bool
updatePolygonMesh
(
const
Mesh3d
&
mesh
,
const
cv
::
Mat
&
mask
,
const
String
&
id
=
"polygon"
);
bool
addPolylineFromPolygonMesh
(
const
Mesh3d
&
mesh
,
const
String
&
id
=
"polyline"
);
// to refactor: Widget3D:: & Viz3d::
bool
setPointCloudRenderingProperties
(
int
property
,
double
value
,
const
String
&
id
=
"cloud"
);
bool
getPointCloudRenderingProperties
(
int
property
,
double
&
value
,
const
String
&
id
=
"cloud"
);
bool
setShapeRenderingProperties
(
int
property
,
double
value
,
const
String
&
id
);
/** \brief Set whether the point cloud is selected or not
* \param[in] selected whether the cloud is selected or not (true = selected)
* \param[in] id the point cloud object id (default: cloud)
*/
// probably should just remove
bool
setPointCloudSelected
(
const
bool
selected
,
const
String
&
id
=
"cloud"
);
/** \brief Returns true when the user tried to close the window */
bool
wasStopped
()
const
{
if
(
interactor_
!=
NULL
)
return
(
stopped_
);
else
return
true
;
}
...
...
@@ -60,30 +41,6 @@ public:
}
}
// to refactor
bool
addPolygon
(
const
cv
::
Mat
&
cloud
,
const
Color
&
color
,
const
String
&
id
=
"polygon"
);
bool
addArrow
(
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
,
bool
display_length
,
const
String
&
id
=
"arrow"
);
bool
addArrow
(
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color_line
,
const
Color
&
color_text
,
const
String
&
id
=
"arrow"
);
// Probably remove this
bool
addModelFromPolyData
(
vtkSmartPointer
<
vtkPolyData
>
polydata
,
const
String
&
id
=
"PolyData"
);
bool
addModelFromPolyData
(
vtkSmartPointer
<
vtkPolyData
>
polydata
,
vtkSmartPointer
<
vtkTransform
>
transform
,
const
String
&
id
=
"PolyData"
);
// I think this should be moved to 'static Widget Widget::fromPlyFile(const String&)';
bool
addModelFromPLYFile
(
const
String
&
filename
,
const
String
&
id
=
"PLYModel"
);
bool
addModelFromPLYFile
(
const
String
&
filename
,
vtkSmartPointer
<
vtkTransform
>
transform
,
const
String
&
id
=
"PLYModel"
);
// to implement in Viz3d with shorter name
void
setRepresentationToSurfaceForAllActors
();
void
setRepresentationToPointsForAllActors
();
...
...
modules/viz/src/widget.cpp
View file @
b032b4dd
...
...
@@ -54,6 +54,46 @@ void cv::viz::Widget::release()
}
}
cv
::
viz
::
Widget
cv
::
viz
::
Widget
::
fromPlyFile
(
const
String
&
file_name
)
{
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file_name
.
c_str
());
vtkSmartPointer
<
vtkDataSet
>
data
=
reader
->
GetOutput
();
CV_Assert
(
data
);
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkSmartPointer
<
vtkLODActor
>::
New
();
vtkSmartPointer
<
vtkDataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSetMapper
>::
New
();
mapper
->
SetInput
(
data
);
vtkSmartPointer
<
vtkDataArray
>
scalars
=
data
->
GetPointData
()
->
GetScalars
();
if
(
scalars
)
{
cv
::
Vec3d
minmax
(
scalars
->
GetRange
());
mapper
->
SetScalarRange
(
minmax
.
val
);
mapper
->
SetScalarModeToUsePointData
();
// interpolation OFF, if data is a vtkPolyData that contains only vertices, ON for anything else.
vtkPolyData
*
polyData
=
vtkPolyData
::
SafeDownCast
(
data
);
bool
interpolation
=
(
polyData
&&
polyData
->
GetNumberOfCells
()
!=
polyData
->
GetNumberOfVerts
());
mapper
->
SetInterpolateScalarsBeforeMapping
(
interpolation
);
mapper
->
ScalarVisibilityOn
();
}
mapper
->
ImmediateModeRenderingOff
();
actor
->
SetNumberOfCloudPoints
(
int
(
std
::
max
<
vtkIdType
>
(
1
,
data
->
GetNumberOfPoints
()
/
10
)));
actor
->
GetProperty
()
->
SetInterpolationToFlat
();
actor
->
GetProperty
()
->
BackfaceCullingOn
();
actor
->
SetMapper
(
mapper
);
Widget
widget
;
widget
.
impl_
->
prop
=
actor
;
return
widget
;
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// widget accessor implementaion
...
...
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