5 Star 0 Fork 0

Root/Detection

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
DaHengCamera.h 2.85 KB
Copy Edit Raw Blame History
Root authored 2022-05-04 19:28 +08:00 . 相机代码
#pragma once
#include <string>
//#include "opencv2/opencv.hpp"
#include "GalaxyIncludes.h"
#include"../Common/Camera/CameraDevice.h"
#include "dahengcamera_global.h"
class DAHENGCAMERA_EXPORT DaHengCamera :public CameraDevice
{
class DaHengCaptureEventHandler :public ICaptureEventHandler
{
/**
\brief The capture callback function
\param objImageDataPointer image process parameter
\param pFrame custom defined parameter
\return void
*/
void DoOnImageCaptured(CImageDataPointer& objImageDataPointer, void* pUserParam)
{
/**
\获取当前帧状态,是否完整帧
\ GX_FRAME_STATUS_SUCCESS 0 正常帧
\ GX_FRAME_STATUS_INCOMPLETE -1 残帧
*/
GX_FRAME_STATUS_LIST status = objImageDataPointer->GetStatus();
if (status == GX_FRAME_STATUS_SUCCESS)
{
UINT64 width = objImageDataPointer->GetWidth();
UINT64 height = objImageDataPointer->GetHeight();
UINT64 timestamp = objImageDataPointer->GetTimeStamp();
void* pRaw8Buffer = NULL;
//假设原始数据是Mono8图像
pRaw8Buffer = objImageDataPointer->ConvertToRaw8(GX_BIT_0_7);
auto cameraDevice = static_cast<DaHengCamera*>(pUserParam);
cameraDevice->imgCapturedCallback(pRaw8Buffer, width, height, cameraDevice->imgCapturedCallbackUserParam);
/**
//Mat mat = cv::Mat(objImageDataPointer->GetHeight(), objImageDataPointer->GetWidth(), CV_8UC1);
//memcpy(mat.data, pRaw8Buffer, (objImageDataPointer->GetHeight())*(objImageDataPointer->GetWidth()));
//vie->mattr->conti = 1;
//cv::resize(mat, matt, cv::Size(500, 500));
//img = QImage((const uchar*)(vie->matt.data), vie->matt.cols, vie->matt.rows, vie->matt.cols * vie->matt.channels(), QImage::Format_Indexed8);
//vie->update();
//cv::waitKey(30);
// vie->Dcam->m_objFeatureControlPtr->GetEnumFeature("ExposureAuto")->SetValue("Off");
//std::cout<<"帧率:"<<vie->Dcam->m_objFeatureControlPtr->GetFloatFeature("CurrentAcquisitionFrameRate")->GetValue()<<std::endl;
*/
}
else
{
qDebug() << "Incomplete image captured";
}
}
};
public:
DaHengCamera(const string id, const string sn);
~DaHengCamera();
virtual void OpenCamera();
virtual void CloseCamera();
virtual void StartGrab();
virtual void StopGrab();
virtual void GrabOneSnapshot();
virtual void SetExposure(double);
virtual double GetExposure();
virtual CameraTriggerMode GetTriggerMode();
virtual void SetTriggerMode(CameraTriggerMode triggerMode);
virtual string GetPropertyValue(CameraProperty property);
virtual void SetPropertyValue(CameraProperty property, string& value);
private:
CGXDevicePointer devicePtr; ///< The device handle
CGXStreamPointer streamPtr; ///< The stream handle
CGXFeatureControlPointer controlPtr; ///< The object for device feature control
DaHengCaptureEventHandler* captureEventHandlerPtr;
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ZhangRoot/detection.git
git@gitee.com:ZhangRoot/detection.git
ZhangRoot
detection
Detection
master

Search