|
@@ -32,6 +32,7 @@ int gindex = 0;
|
|
|
|
|
|
int gwidth = 1920;
|
|
int gwidth = 1920;
|
|
int gheight = 1080;
|
|
int gheight = 1080;
|
|
|
|
+int wait_fake = 2;
|
|
|
|
|
|
|
|
|
|
void * gpcamera;
|
|
void * gpcamera;
|
|
@@ -209,8 +210,10 @@ void ObsToNormal(iv::fusion::fusionobjectarray& lidar_radar_fusion_object_array)
|
|
//std::cout<<"nomal_centroid:"<<nomal_centroid.nomal_x()<<","<<nomal_centroid.nomal_y()<<std::endl;
|
|
//std::cout<<"nomal_centroid:"<<nomal_centroid.nomal_x()<<","<<nomal_centroid.nomal_y()<<std::endl;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}}
|
|
|
|
|
|
+ std::cout<<"ObsToNormal end:"<<std::endl;
|
|
|
|
+}
|
|
|
|
|
|
void datafusion(iv::vision::Visionyolov8 yolo_obj){
|
|
void datafusion(iv::vision::Visionyolov8 yolo_obj){
|
|
iv::fusion::fusionobjectarray out_fusion;
|
|
iv::fusion::fusionobjectarray out_fusion;
|
|
@@ -250,7 +253,6 @@ void datafusion(iv::vision::Visionyolov8 yolo_obj){
|
|
string out;
|
|
string out;
|
|
if(out_fusion.obj_size() == 0)
|
|
if(out_fusion.obj_size() == 0)
|
|
{
|
|
{
|
|
- // std::cout<<" fake obj"<<std::endl;
|
|
|
|
|
|
|
|
iv::fusion::fusionobject fake_obj;
|
|
iv::fusion::fusionobject fake_obj;
|
|
iv::fusion::fusionobject *fake_obj_;
|
|
iv::fusion::fusionobject *fake_obj_;
|
|
@@ -281,7 +283,7 @@ int main(int argc, char *argv[]) {
|
|
QCoreApplication a(argc, argv);
|
|
QCoreApplication a(argc, argv);
|
|
QString strpath = QCoreApplication::applicationDirPath();
|
|
QString strpath = QCoreApplication::applicationDirPath();
|
|
if(argc < 2)
|
|
if(argc < 2)
|
|
- strpath = strpath + "/fusion_vision.xml";
|
|
|
|
|
|
+ strpath = strpath + "/camera_obs.xml";
|
|
else
|
|
else
|
|
strpath = argv[1];
|
|
strpath = argv[1];
|
|
std::cout<<strpath.toStdString()<<std::endl;
|
|
std::cout<<strpath.toStdString()<<std::endl;
|
|
@@ -291,18 +293,20 @@ int main(int argc, char *argv[]) {
|
|
std::string strwidth = xp.GetParam("width","1280");
|
|
std::string strwidth = xp.GetParam("width","1280");
|
|
std::string strheight = xp.GetParam("height","720");
|
|
std::string strheight = xp.GetParam("height","720");
|
|
std::string showFlag = xp.GetParam("show_flag","0");
|
|
std::string showFlag = xp.GetParam("show_flag","0");
|
|
|
|
+ std::string waitFake = xp.GetParam("wait_fake","2");
|
|
cameraname = xmlmsgname;
|
|
cameraname = xmlmsgname;
|
|
gwidth = atoi(strwidth.data());
|
|
gwidth = atoi(strwidth.data());
|
|
gheight = atoi(strheight.data());
|
|
gheight = atoi(strheight.data());
|
|
show_flag = atoi(showFlag.data());
|
|
show_flag = atoi(showFlag.data());
|
|
-
|
|
|
|
- if(show_flag)
|
|
|
|
- gpcamera= iv::modulecomm::RegisterRecv(&cameraname[0],Listenpic);
|
|
|
|
|
|
+ wait_fake = atoi(waitFake.data());
|
|
|
|
+ gpcamera= iv::modulecomm::RegisterRecv(&cameraname[0],Listenpic);
|
|
|
|
|
|
double waittime = (double)cv::getTickCount();
|
|
double waittime = (double)cv::getTickCount();
|
|
|
|
+ double fake_time, wait_fake_time, total_fake_time;
|
|
|
|
+
|
|
while (1)
|
|
while (1)
|
|
{
|
|
{
|
|
- if(yolov8Buffer->isEmpty())
|
|
|
|
|
|
+ if(imageBuffer->isEmpty())
|
|
{
|
|
{
|
|
double waittotal = (double)cv::getTickCount() - waittime;
|
|
double waittotal = (double)cv::getTickCount() - waittime;
|
|
double totaltime = waittotal/cv::getTickFrequency();
|
|
double totaltime = waittotal/cv::getTickFrequency();
|
|
@@ -320,13 +324,23 @@ int main(int argc, char *argv[]) {
|
|
}
|
|
}
|
|
|
|
|
|
iv::vision::Visionyolov8 res;
|
|
iv::vision::Visionyolov8 res;
|
|
- yolov8Buffer->consume(res);
|
|
|
|
- datafusion(res);
|
|
|
|
|
|
+ if(yolov8Buffer->length()>0){
|
|
|
|
+ yolov8Buffer->consume(res);
|
|
|
|
+ datafusion(res);
|
|
|
|
+ fake_time = (double)cv::getTickCount();
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ wait_fake_time = (double)cv::getTickCount() - fake_time;
|
|
|
|
+ total_fake_time = wait_fake_time/cv::getTickFrequency();
|
|
|
|
+ if(total_fake_time > wait_fake){
|
|
|
|
+ datafusion(res);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if(show_flag){
|
|
|
|
- cv::Mat mat;
|
|
|
|
- imageBuffer->consume(mat);
|
|
|
|
|
|
+ cv::Mat mat;
|
|
|
|
+ imageBuffer->consume(mat);
|
|
|
|
|
|
|
|
+ if(show_flag){
|
|
// Draw bounding boxes
|
|
// Draw bounding boxes
|
|
draw_bbox(mat, res);
|
|
draw_bbox(mat, res);
|
|
cv::namedWindow("camera_obs",cv::WINDOW_NORMAL);
|
|
cv::namedWindow("camera_obs",cv::WINDOW_NORMAL);
|