Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use canon edsdk to realize Real-time Preview in Qt

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to use canon edsdk to achieve real-time preview in Qt". In daily operation, I believe many people have doubts about how to use canon edsdk to achieve real-time preview in Qt. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubt of "how to use canon edsdk to achieve real-time preview in Qt". Next, please follow the editor to study!

Real-time preview step StartLiveView

Declare a variable to mark m_isLiveView to identify whether liveview is turned on.

Output live preview to PC

Device | = kEdsEvfOutputDevice_PC

/ /-- void MainWindow::StartLiveView () {/ / Change settings because live view cannot be started / / when camera settings are set to "do not perform live view." / / Open EdsError err = EDS_ERR_OK; uint evfMode = 1; / / write 1 to enable err = EdsSetPropertyData (m_camera, kEdsPropID_Evf_Mode, 1, sizeof (uint), & evfMode) M_isLiveView = true; / / Get the output device for the live view image EdsUInt32 device; err = EdsGetPropertyData (m_camera, kEdsPropID_Evf_OutputDevice, 0, sizeof (device), & device); if (err = = EDS_ERR_OK) {device | = kEdsEvfOutputDevice_PC; err = EdsSetPropertyData (m_camera, kEdsPropID_Evf_OutputDevice, 0, sizeof (device), & device);}} convert the previewed image stream to QImage and then to Mat

QImage img = QImage::fromData (data, length, "JPG")

The most important thing is to convert the image stream to QImage format. I have searched the Internet for a long time. I don't know how to use data and length. Many of the images on the Internet are processed with vb and c #, and there is no C++.

/ /-- bool MainWindow::requestLiveViewImage () {EdsError error = EDS_ERR_OK; EdsStreamRef stream = NULL; EdsEvfImageRef evfImage = NULL; EdsUInt64 length; if (! m_isLiveView) {error = EDS_ERR_INTERNAL_ERROR; qDebug ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report