Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f22d1e3a
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f22d1e3a
编写于
9月 28, 2018
作者:
Z
ZeusJupiter
提交者:
fengqikai1414
9月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modules: fix camera issue of cyber_visualizer
上级
0b317977
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
24 deletion
+45
-24
modules/tools/visualizer/main_window.cc
modules/tools/visualizer/main_window.cc
+16
-20
modules/tools/visualizer/main_window.h
modules/tools/visualizer/main_window.h
+1
-1
modules/tools/visualizer/shaders/video_image_plane.frag
modules/tools/visualizer/shaders/video_image_plane.frag
+2
-3
modules/tools/visualizer/texture.cc
modules/tools/visualizer/texture.cc
+25
-0
modules/tools/visualizer/texture.h
modules/tools/visualizer/texture.h
+1
-0
未找到文件。
modules/tools/visualizer/main_window.cc
浏览文件 @
f22d1e3a
...
...
@@ -92,7 +92,7 @@ struct MainWindow::VideoImgProxy {
QMutex
reader_mutex_
;
std
::
shared_ptr
<
Texture
>
dynamic_texture_
;
CyberChannReader
<
apollo
::
drivers
::
Compressed
Image
>*
channel_reader_
;
CyberChannReader
<
apollo
::
drivers
::
Image
>*
channel_reader_
;
};
MainWindow
::
MainWindow
(
QWidget
*
parent
)
...
...
@@ -692,25 +692,20 @@ void MainWindow::PlayRenderableObject(bool b) {
}
void
MainWindow
::
ImageReaderCallback
(
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Compressed
Image
>&
imgData
,
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Image
>&
imgData
,
VideoImgProxy
*
theVideoImgProxy
)
{
theVideoImgProxy
->
reader_mutex_
.
lock
();
if
(
theVideoImgProxy
->
dynamic_texture_
!=
nullptr
&&
imgData
!=
nullptr
)
{
QImage
img
;
if
(
img
.
loadFromData
((
const
unsigned
char
*
)(
imgData
->
data
().
c_str
()),
imgData
->
ByteSize
()))
{
if
(
theVideoImgProxy
->
dynamic_texture_
->
UpdateData
(
img
))
{
theVideoImgProxy
->
video_image_viewer_
.
SetupDynamicTexture
(
theVideoImgProxy
->
dynamic_texture_
);
}
else
{
std
::
cerr
<<
"--------Cannot update dynamic Texture Data--------"
<<
std
::
endl
;
}
if
(
theVideoImgProxy
->
dynamic_texture_
->
UpdateData
(
imgData
))
{
theVideoImgProxy
->
video_image_viewer_
.
SetupDynamicTexture
(
theVideoImgProxy
->
dynamic_texture_
);
}
else
{
std
::
cerr
<<
"-----------Cannot load compressed image from data with QImage"
<<
std
::
endl
;
std
::
cerr
<<
"--------Cannot update dynamic Texture Data--------"
<<
std
::
endl
;
}
}
else
{
std
::
cerr
<<
"----Dynamic Texture is nullptr or apollo.drivers.Image is nullptr"
<<
std
::
endl
;
}
theVideoImgProxy
->
reader_mutex_
.
unlock
();
}
...
...
@@ -735,7 +730,7 @@ void MainWindow::DoPlayVideoImage(bool b, VideoImgProxy* theVideoImg) {
if
(
!
theVideoImg
->
channel_reader_
)
{
theVideoImg
->
channel_reader_
=
new
CyberChannReader
<
apollo
::
drivers
::
Compressed
Image
>
();
new
CyberChannReader
<
apollo
::
drivers
::
Image
>
();
if
(
!
theVideoImg
->
channel_reader_
)
{
QMessageBox
::
warning
(
this
,
tr
(
"Create Cybertron Channel Reader"
),
...
...
@@ -745,10 +740,11 @@ void MainWindow::DoPlayVideoImage(bool b, VideoImgProxy* theVideoImg) {
return
;
}
auto
videoCallback
=
[
this
,
theVideoImg
](
const
std
::
shared_ptr
<
apollo
::
drivers
::
CompressedImage
>&
pdata
)
{
this
->
ImageReaderCallback
(
pdata
,
theVideoImg
);
};
auto
videoCallback
=
[
this
,
theVideoImg
](
const
std
::
shared_ptr
<
apollo
::
drivers
::
Image
>&
pdata
)
{
this
->
ImageReaderCallback
(
pdata
,
theVideoImg
);
};
if
(
!
theVideoImg
->
channel_reader_
->
InstallCallbackAndOpen
(
videoCallback
,
theVideoImg
->
channel_name_combobox_
.
currentText
()
...
...
modules/tools/visualizer/main_window.h
浏览文件 @
f22d1e3a
...
...
@@ -96,7 +96,7 @@ class MainWindow : public QMainWindow {
void
PointCloudReaderCallback
(
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
PointCloud
>&
pdata
);
void
ImageReaderCallback
(
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Compressed
Image
>&
imgData
,
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Image
>&
imgData
,
VideoImgProxy
*
proxy
);
void
InsertAllChannelNames
(
void
);
...
...
modules/tools/visualizer/shaders/video_image_plane.frag
浏览文件 @
f22d1e3a
...
...
@@ -21,8 +21,7 @@ out vec4 FragColor;
uniform
sampler2D
texture
;
void
main
(
void
)
{
void
main
(
void
)
{
vec4
v4
=
texture2D
(
texture
,
TexCoord
);
FragColor
=
vec4
(
v4
.
bgra
);
FragColor
=
vec4
(
v4
.
rgb
,
1
.
0
);
}
modules/tools/visualizer/texture.cc
浏览文件 @
f22d1e3a
...
...
@@ -50,3 +50,28 @@ bool Texture::UpdateData(const QImage &img) {
texture_format_
=
GL_RGBA
;
return
true
;
}
bool
Texture
::
UpdateData
(
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Image
>&
imgData
){
std
::
size_t
imgSize
=
imgData
->
data
().
size
();
if
(
static_cast
<
std
::
size_t
>
(
data_size_
)
<
imgSize
)
{
if
(
!
data_
)
{
delete
[]
data_
;
}
data_
=
new
GLubyte
[
imgSize
];
if
(
data_
==
nullptr
)
{
data_size_
=
0
;
return
false
;
}
data_size_
=
imgSize
;
is_size_changed_
=
true
;
}
memcpy
(
data_
,
imgData
->
data
().
c_str
(),
imgSize
);
is_dirty_
=
true
;
image_width_
=
imgData
->
width
();
image_height_
=
imgData
->
height
();
texture_format_
=
GL_RGB
;
return
true
;
}
modules/tools/visualizer/texture.h
浏览文件 @
f22d1e3a
...
...
@@ -44,6 +44,7 @@ class Texture {
GLsizei
data_size
(
void
)
const
{
return
data_size_
;
}
bool
UpdateData
(
const
QImage
&
img
);
bool
UpdateData
(
const
std
::
shared_ptr
<
const
apollo
::
drivers
::
Image
>&
);
const
GLubyte
*
data
(
void
)
const
{
return
data_
;
}
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录