22#include " infinite_sense.h"
33#include " MvCameraControl.h"
44#include " log.h"
5-
5+ # include " trigger.h "
66namespace infinite_sense {
77bool IsColor (const MvGvspPixelType type) {
88 switch (type) {
@@ -190,7 +190,7 @@ void CamManger::Stop() {
190190 LOG (INFO) << " Exit " << i << " cam " ;
191191 }
192192}
193- void CamManger::Receive (void *handle, const std::string &name) const {
193+ void CamManger::Receive (void *handle, const std::string &name) {
194194 unsigned int last_count = 0 ;
195195 MV_FRAME_OUT st_out_frame;
196196 CamData cam_data;
@@ -204,10 +204,18 @@ void CamManger::Receive(void *handle, const std::string &name) const {
204204 if (n_ret != MV_OK) {
205205 LOG (ERROR) << " Get ExposureTime fail! n_ret [0x" << std::hex << n_ret << " ]" ;
206206 }
207- // {
208- // cam_data.time_stamp_us =
209- // DataManger::GetInstance().GetLastTiggerTime() + static_cast<uint64_t>(expose_time.fCurValue / 2.);
210- // }
207+ // 这里的time_stamp_us是相机触发时间,需要加上曝光时间的一半,以获得相机拍摄的时间
208+ if (params_.find (name) == params_.end ()) {
209+ LOG (ERROR) << " cam " << name << " not found!" ;
210+ }
211+ else {
212+ if (uint64_t time; GET_LAST_TRIGGER_STATUS (params_[name], time)) {
213+ cam_data.time_stamp_us = time + static_cast <uint64_t >(expose_time.fCurValue / 2 .);
214+ }
215+ else {
216+ LOG (ERROR) << " cam " << name << " not found!" ;
217+ }
218+ }
211219 MvGvspPixelType en_dst_pixel_type = PixelType_Gvsp_Undefined;
212220 unsigned int n_channel_num = 0 ;
213221 // 如果是彩色则转成RGB8
0 commit comments