/** * 版权声明 */ #ifndef __MV_GMSL_CAMERA_H__ #define __MV_GMSL_CAMERA_H__ #include #ifdef MIIVII_NO_OPENCV #else #include #endif #include "MvGmslCameraVersion.h" #define CAMERA_NUM 8 struct sync_out_a_cfg_client_t { uint8_t sync_camera_num; //sync access camera num uint8_t sync_freq; //sync camera frequency uint8_t sync_camera_bit_draw; //assign camera to sync uint8_t async_camera_num; //async access camera num uint8_t async_freq; //async camera frequency uint8_t async_camera_bit_draw; //assign camera to async uint8_t async_camera_pos[CAMERA_NUM]; }; typedef struct { std::string dev_node; std::string camera_fmt_str; std::string output_fmt_str; uint cam_w; uint cam_h; uint out_w; uint out_h; } camera_context_t; namespace miivii { class MvGmslCamera { public: /** * Init GMSL camera with input patameters. * * * @param[in] &devName Camera's device node name. * @param[in] camCount Number of cameras plugged into the device node. * @param[in] camWidth Single camera output width. * @param[in] camHeight Single camera output height. * @param[in] fps Frame rate(expressed in frames per second or FPS) . * @param[in] imgWidth Output image width. * @param[in] imgHeight Output image height. * @param[in] format Image format. * * The SDK makes it easy to convert the camera output resolution to customize output image resolution you want. * It uses the VIC(Video Image Compositor) for conversion, Therefore faster and more power-efficient. * * The GMSL-SDK supports following image format. * UYVY, VYUY, YUYV, YUV420M, * ABGR32, XBGR32, ARGB32. * The code bellow demonstrate how set the SDK for ABGR32 format image: * MvGmslCamera(_devName, 4, 1280, 720, 25, 1024, 576, string("ABGR32") ); * */ MvGmslCamera(struct sync_out_a_cfg_client_t camera_cfg); MvGmslCamera(camera_context_t *cam_ctx, uint32_t camCount, struct sync_out_a_cfg_client_t camera_cfg); /** * Terminate camera call. * */ ~MvGmslCamera(); /** * Get output RAW image. * * @param[in] *ppdata[] A pointer to get the image memory. * @param[out] timestamp[] The exact time when this photo exposured. * * * */ bool GetImagePtr(uint8_t *ppdata[], uint64_t *timestamp,uint8_t camera_no); #ifdef MIIVII_NO_OPENCV #else /** * Get cv::Mat type output image. * * @param[in] outMat[] A mat array whose size corresponding to camera count. * @param[out] timestamp[] The exact time when the photos exposured. * * */ bool GetImageCvMat(cv::Mat out_mat[], uint64_t *timestamp,uint8_t camera_no); #endif /** * Get output RAW image. * * @param[in] *ppdata[] A pointer to get the image memory. * @param[out] timestamp The exact time when this photo exposured. * * * */ bool GetImagePtr(uint8_t *ppdata[], uint64_t ×tamp,uint8_t camera_no,std::string camera_dev); #ifdef MIIVII_NO_OPENCV #else /** * Get cv::Mat type output image. * * @param[in] outMat[] A mat array whose size corresponding to camera count. * @param[out] timestamp The exact time when the photos exposured. * * */ bool GetImageCvMat(cv::Mat out_mat[], uint64_t ×tamp,uint8_t camera_no,std::string camera_dev); #endif /** * Get cv::Mat type output image. * * @param[in] CameraNum Camera namber.example:/dev/video1 CameraNum = 1 * @param[out] ×tamp The exact time when the photos exposured. * The demo is in the cameras_opencv_demo.cpp * Getting the timestamp needs to be called after getting the image. * */ bool GetGmslTimeStamp(const uint8_t CameraNum,uint64_t ×tamp); MvGmslCamera() = delete; MvGmslCamera(const MvGmslCamera &) = delete; MvGmslCamera &operator=(const MvGmslCamera &) = delete; private: void *handle_; }; } #endif //__MV_GMSL_CAMERA_H__