qt之开发大恒usb3.0相机二

基于qt开发的大恒usb3.0相机应用软件。 目前打开设备和采集数据功能已经完善,相机图像可以正常显示。图像数据采集使用的回调函数。核心代码如下

cpp 复制代码
 class CSampleCaptureEventHandler:public ICaptureEventHandler
    {
        void DoOnImageCaptured(CImageDataPointer& objImageDataPointer,void* pUserParam)
        {
            Widget* pWidget=static_cast<Widget*>(pUserParam);
            try {
                int width=objImageDataPointer->GetWidth();
                int height=objImageDataPointer->GetHeight();

                GX_PIXEL_FORMAT_ENTRY pixelFormat=objImageDataPointer->GetPixelFormat();
                BYTE *pRawBuffer=(BYTE*)(objImageDataPointer)->GetBuffer();
                if(objImageDataPointer==nullptr)
                {
                    throw std::runtime_error("NULL pointer dereferenced");
                }

               QImage img(pRawBuffer,width,height,QImage::Format_Indexed8);
                emit pWidget->imageReady(img);
                //pWidget->ui->labelShow->setPixmap(QPixmap::fromImage(img));
                //pWidget->ui->labelShow->size(Qt::KeepAspectRatio);
            }
            catch (...)
            {
            }
        }
    };

有需要的欢迎联系我。

相关推荐
一百天成为python专家11 分钟前
python库之jieba 库
开发语言·人工智能·python·深度学习·机器学习·pycharm·python3.11
Go Dgg33 分钟前
【Go + Gin 实现「双 Token」管理员登录】
开发语言·golang·gin
圆头猫爹1 小时前
第34次CCF-CSP认证第4题,货物调度
c++·算法·动态规划
十五年专注C++开发1 小时前
hiredis: 一个轻量级、高性能的 C 语言 Redis 客户端库
开发语言·数据库·c++·redis·缓存
WJ.Polar1 小时前
Python数据容器-集合set
开发语言·python
晓13131 小时前
JavaScript加强篇——第七章 浏览器对象与存储要点
开发语言·javascript·ecmascript
nbsaas-boot1 小时前
Go语言生态成熟度分析:为何Go还无法像Java那样实现注解式框架?
java·开发语言·golang
hi0_61 小时前
03 数组 VS 链表
java·数据结构·c++·笔记·算法·链表
xiaocainiao8812 小时前
Python 实战:构建可扩展的命令行插件引擎
开发语言·python
碧海蓝天20222 小时前
C++法则21:避免将#include放在命名空间内部。
开发语言·c++