|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
各位大佬,我太久不用c了,有点疑惑
像下面这个调用compare_bt_lefts
不需要加参数调用吗?像这样:compare_bt_lefts(a,b);
是因为都是const吗?
- qsort(selected_detections, selected_detections_num, sizeof(*selected_detections), compare_by_lefts);
复制代码
- int compare_by_lefts(const void *a_ptr, const void *b_ptr) {
- const detection_with_class* a = (detection_with_class*)a_ptr;
- const detection_with_class* b = (detection_with_class*)b_ptr;
- const float delta = (a->det.bbox.x - a->det.bbox.w/2) - (b->det.bbox.x - b->det.bbox.w/2);
- return delta < 0 ? -1 : delta > 0 ? 1 : 0;
- }
复制代码
|
|