Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义控件绘制本地摄像头数据没有颜色 #108

Open
ManyFish opened this issue May 25, 2023 · 4 comments
Open

自定义控件绘制本地摄像头数据没有颜色 #108

ManyFish opened this issue May 25, 2023 · 4 comments

Comments

@ManyFish
Copy link

参考demo的视频通话部分,使用opencv获取本地摄像头数据对自定义控件进行绘制后,发现绘制的画面没有颜色,本地是灰度图画面;opencv获取的视频帧是正确的,是格式还是绘制问题呢?请问该如何解决?感谢

@nmgwddj
Copy link
Collaborator

nmgwddj commented May 25, 2023

opencv 拿出来的是什么格式的帧数据?是否已经正确转换为 RGB 数据进行渲染?

@ManyFish
Copy link
Author

opencv使用MJPG视频编码格式,然后对视频帧做了cv::cvtColor(frame, rgbFrame, cv::COLOR_BGR2RGB)操作,绘制后还是没有颜色

@ManyFish
Copy link
Author

请问保存时是要转成YUV_I420格式吗?

@nmgwddj
Copy link
Collaborator

nmgwddj commented May 29, 2023

bitmap_control 的实现主要还是围绕 Windows DC 来操作的,所以他不认识 YUV 格式的数据,最终都要转为 ARGB 才可以。参考:https://github.com/netease-kit/NIM_PC_Demo/blob/master/tool_kits/ui_component/g2_kit/gui/bitmap_control_g2.cpp

我建议你先脱离 duilib 框架,使用原生 Windows API 写一个简单的示例从图片读取到内存然后渲染到 UI 界面上,了解清楚整个流程后再通过 UI 框架处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants