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
771d9509
Commit
771d9509
authored
Jan 07, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polyline now uses scalars for color data (for reuse by other widgets)
parent
e94ee94b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
shapes.cpp
modules/viz/src/shapes.cpp
+12
-1
No files found.
modules/viz/src/shapes.cpp
View file @
771d9509
...
...
@@ -400,18 +400,29 @@ cv::viz::WPolyLine::WPolyLine(InputArray _points, const Color &color)
for
(
size_t
i
=
0
;
i
<
total
;
++
i
)
cell_array
->
InsertCellPoint
(
i
);
Vec3b
rgb
=
Vec3d
(
color
[
2
],
color
[
1
],
color
[
0
]);
Vec3b
*
color_data
=
new
Vec3b
[
total
];
std
::
fill
(
color_data
,
color_data
+
total
,
rgb
);
vtkSmartPointer
<
vtkUnsignedCharArray
>
scalars
=
vtkSmartPointer
<
vtkUnsignedCharArray
>::
New
();
scalars
->
SetName
(
"Colors"
);
scalars
->
SetNumberOfComponents
(
3
);
scalars
->
SetNumberOfTuples
(
total
);
scalars
->
SetArray
(
color_data
->
val
,
total
*
3
,
0
);
vtkSmartPointer
<
vtkPolyData
>
polydata
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
polydata
->
SetPoints
(
points
);
polydata
->
SetLines
(
cell_array
);
polydata
->
GetPointData
()
->
SetScalars
(
scalars
);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInputConnection
(
polydata
->
GetProducerPort
());
mapper
->
SetScalarRange
(
0
,
255
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
color
);
}
template
<>
cv
::
viz
::
WPolyLine
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WPolyLine
>
()
...
...
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