91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 78.14MB
    文件類型: .7z
    金幣: 2
    下載: 1 次
    發布日期: 2023-05-09
  • 語言: 其他
  • 標簽: Balser??

資源簡介

Basler相機實時圖像顯示的Qt版本的代碼,代碼中具體的說明請參考我的博客

資源截圖

代碼片段和文件信息

#include?“BaslerCamera_RealTimeShow.h“
#include?
#include?
#include?

BaslerCamera_RealTimeShow::BaslerCamera_RealTimeShow(QWidget?*parent)
????:?QMainWindow(parent)
{
????ui.setupUi(this);

????m_camera.RegisterImageEventHandler(this?Pylon::RegistrationMode_ReplaceAll?Pylon::Ownership_ExternalOwnership);
????//?Register?this?object?as?a?configuration?event?handler?so?we?will?be?notified?of?camera?state?changes.
????//?See?Pylon::CConfigurationEventHandler?for?details
????m_camera.RegisterConfiguration(this?Pylon::RegistrationMode_ReplaceAll?Pylon::Ownership_ExternalOwnership);

????//?Add?the?AutoPacketSizeConfiguration?and?let?pylon?delete?it?when?not?needed?anymore.
????m_camera.RegisterConfiguration(new?CAutoPacketSizeConfiguration()?Pylon::RegistrationMode_Append?Pylon::Cleanup_Delete);

?? m_camera.Attach(Pylon::CTlFactory::GetInstance().CreateFirstDevice()?Pylon::Cleanup_Delete);

????m_camera.Open();

????//?Camera?may?have?been?disconnected.
????if?(!m_camera.IsOpen()?||?m_camera.IsGrabbing())
????{
??????return;
????}

????//?Since?we?may?switch?between?single?and?continuous?shot?we?must?configure?the?camera?accordingly.
????//?The?predefined?configurations?are?only?executed?once?when?the?camera?is?opened.
????//?To?be?able?to?use?them?in?our?use?case?we?just?call?them?explicitly?to?apply?the?configuration.
????m_continousConfiguration.OnOpened(m_camera);

????//?Start?grabbing?until?StopGrabbing()?is?called.
????m_camera.StartGrabbing(Pylon::GrabStrategy_OneByOne?Pylon::GrabLoop_ProvidedByInstantCamera);

????ui.centralWidget->installEventFilter(this);

????connect(this?SIGNAL(OneImageFinishSignal())?this?SLOT(OneImageFinishSlot()));

}

void?BaslerCamera_RealTimeShow::OnImagesSkipped(Pylon::CInstantCamera&?camera?size_t?countOfSkippedImages)
{

}
void?BaslerCamera_RealTimeShow::OnImageGrabbed(Pylon::CInstantCamera&?camera?const?Pylon::CGrabResultPtr&?grabResult)
{

??m_mutexLock.lock();

??m_ptrGrabResult?=?grabResult;

??//qDebug()?<
??emit?OneImageFinishSignal();

??m_mutexLock.unlock();
??
}

void?BaslerCamera_RealTimeShow::OneImageFinishSlot()
{
??//qDebug()?<??ui.centralWidget->update();
}
bool?BaslerCamera_RealTimeShow::eventFilter(Qobject?*watched?QEvent?*event)
{
??if?(watched?==?ui.centralWidget?&&?event->type()?==?QEvent::Paint)
??{
????showImage();
??}
??return?false;
}
void?BaslerCamera_RealTimeShow::showImage()
{
??
??m_mutexLock.lock();

??//qDebug()?<
//?新建pylon?ImageFormatConverter對象.
CImageFormatConverter?formatConverter;

Mat?openCvImage;
QPainter?painter(ui.centralWidget);

//確定輸出像素格式
formatConverter.OutputPixelFormat?=?PixelType_BGR8packed;
//將抓取的緩沖數據轉化成pylon?image.
formatConverter.Convert(m_bitmapImage?m_ptrGrabResult);

//?將?pylon?image轉成OpenCV?image.
openCvImage?=?cv::Mat(m_ptrGrabResult->GetHeight()?m_ptrGrabResult->G

評論

共有 條評論