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
4b85c849
Commit
4b85c849
authored
Jul 15, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rgb and bgr incompatibility
parent
1bfd7ad1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
6 deletions
+42
-6
cloud_widgets.cpp
modules/viz/src/cloud_widgets.cpp
+2
-2
types.cpp
modules/viz/src/types.cpp
+1
-1
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+3
-3
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+36
-0
No files found.
modules/viz/src/cloud_widgets.cpp
View file @
4b85c849
...
...
@@ -116,7 +116,7 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
// Filter colors
Vec3b
*
colors_data
=
new
Vec3b
[
nr_points
];
NanFilter
::
copy
(
colors
,
colors_data
,
cloud
);
NanFilter
::
copy
Color
(
colors
,
colors_data
,
cloud
);
vtkSmartPointer
<
vtkUnsignedCharArray
>
scalars
=
vtkSmartPointer
<
vtkUnsignedCharArray
>::
New
();
scalars
->
SetNumberOfComponents
(
3
);
...
...
@@ -384,7 +384,7 @@ cv::viz::MeshWidget::MeshWidget(const Mesh3d &mesh)
{
Vec3b
*
colors_data
=
0
;
colors_data
=
new
Vec3b
[
nr_points
];
NanFilter
::
copy
(
mesh
.
colors
,
colors_data
,
mesh
.
cloud
);
NanFilter
::
copy
Color
(
mesh
.
colors
,
colors_data
,
mesh
.
cloud
);
scalars
=
vtkSmartPointer
<
vtkUnsignedCharArray
>::
New
();
scalars
->
SetNumberOfComponents
(
3
);
...
...
modules/viz/src/types.cpp
View file @
4b85c849
...
...
@@ -111,7 +111,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
Vec3b
point_color
;
poly_colors
->
GetTupleValue
(
i
,
point_color
.
val
);
//RGB or BGR? should we swap channels????
std
::
swap
(
point_color
[
0
],
point_color
[
2
]);
// RGB -> BGR
mesh_colors
[
i
]
=
point_color
;
}
}
...
...
modules/viz/src/viz3d_impl.cpp
View file @
4b85c849
...
...
@@ -847,7 +847,7 @@ bool cv::viz::Viz3d::VizImpl::addModelFromPLYFile (const std::string &filename,
return
(
true
);
}
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
addPolylineFromPolygonMesh
(
const
Mesh3d
&
mesh
,
const
std
::
string
&
id
)
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
addPolylineFromPolygonMesh
(
const
Mesh3d
&
/*mesh*/
,
const
std
::
string
&
/*id*/
)
{
// CV_Assert(mesh.cloud.rows == 1 && mesh.cloud.type() == CV_32FC3);
//
...
...
@@ -1017,7 +1017,7 @@ void cv::viz::Viz3d::VizImpl::setWindowName (const std::string &name)
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
int
x
,
int
y
)
{
window_
->
SetPosition
(
x
,
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowSize
(
int
xw
,
int
yw
)
{
window_
->
SetSize
(
xw
,
yw
);
}
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
Mat
&
mask
,
const
std
::
string
&
id
)
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
addPolygonMesh
(
const
Mesh3d
&
/*mesh*/
,
const
Mat
&
/*mask*/
,
const
std
::
string
&
/*id*/
)
{
// CV_Assert(mesh.cloud.type() == CV_32FC3 && mesh.cloud.rows == 1 && !mesh.polygons.empty ());
// CV_Assert(mesh.colors.empty() || (!mesh.colors.empty() && mesh.colors.size() == mesh.cloud.size() && mesh.colors.type() == CV_8UC3));
...
...
@@ -1205,7 +1205,7 @@ return true;
}
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
updatePolygonMesh
(
const
Mesh3d
&
mesh
,
const
cv
::
Mat
&
mask
,
const
std
::
string
&
id
)
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
updatePolygonMesh
(
const
Mesh3d
&
/*mesh*/
,
const
cv
::
Mat
&
/*mask*/
,
const
std
::
string
&
/*id*/
)
{
// CV_Assert(mesh.cloud.type() == CV_32FC3 && mesh.cloud.rows == 1 && !mesh.polygons.empty ());
// CV_Assert(mesh.colors.empty() || (!mesh.colors.empty() && mesh.colors.size() == mesh.cloud.size() && mesh.colors.type() == CV_8UC3));
...
...
modules/viz/src/viz3d_impl.hpp
View file @
4b85c849
...
...
@@ -327,6 +327,31 @@ namespace cv
}
return
output
;
}
static
_Out
*
copyColor
(
const
Mat
&
source
,
_Out
*
output
,
const
Mat
&
nan_mask
)
{
CV_Assert
(
DataDepth
<
_Tp
>::
value
==
source
.
depth
()
&&
source
.
size
()
==
nan_mask
.
size
());
CV_Assert
(
nan_mask
.
channels
()
==
3
||
nan_mask
.
channels
()
==
4
);
CV_DbgAssert
(
DataDepth
<
_Msk
>::
value
==
nan_mask
.
depth
());
int
s_chs
=
source
.
channels
();
int
m_chs
=
nan_mask
.
channels
();
for
(
int
y
=
0
;
y
<
source
.
rows
;
++
y
)
{
const
_Tp
*
srow
=
source
.
ptr
<
_Tp
>
(
y
);
const
_Msk
*
mrow
=
nan_mask
.
ptr
<
_Msk
>
(
y
);
for
(
int
x
=
0
;
x
<
source
.
cols
;
++
x
,
srow
+=
s_chs
,
mrow
+=
m_chs
)
if
(
!
isNan
(
mrow
[
0
])
&&
!
isNan
(
mrow
[
1
])
&&
!
isNan
(
mrow
[
2
]))
{
*
output
=
_Out
(
srow
);
std
::
swap
((
*
output
)[
0
],
(
*
output
)[
2
]);
// BGR -> RGB
++
output
;
}
}
return
output
;
}
};
template
<
typename
_Tp
>
...
...
@@ -339,6 +364,17 @@ namespace cv
return
table
[
nan_mask
.
depth
()
-
5
](
source
,
output
,
nan_mask
);
}
template
<
typename
_Tp
>
static
inline
Vec
<
_Tp
,
3
>*
copyColor
(
const
Mat
&
source
,
Vec
<
_Tp
,
3
>*
output
,
const
Mat
&
nan_mask
)
{
CV_Assert
(
nan_mask
.
depth
()
==
CV_32F
||
nan_mask
.
depth
()
==
CV_64F
);
typedef
Vec
<
_Tp
,
3
>*
(
*
copy_func
)(
const
Mat
&
,
Vec
<
_Tp
,
3
>*
,
const
Mat
&
);
const
static
copy_func
table
[
2
]
=
{
&
NanFilter
::
Impl
<
_Tp
,
float
>::
copyColor
,
&
NanFilter
::
Impl
<
_Tp
,
double
>::
copyColor
};
return
table
[
nan_mask
.
depth
()
-
5
](
source
,
output
,
nan_mask
);
}
};
struct
ApplyAffine
...
...
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