slist * split(char *msg, char *delim, int strict) { slist *sl; sl = sinit(); if(!sl) return NULL; if(splitf(sl, msg, delim, strict) == -1) { sfree(sl); return NULL; } return sl; }
static std::vector<cv::Rect> read_boxes(const std::string &box_path) { std::vector<cv::Rect> result; std::ifstream ifs(box_path.c_str()); std::string line; while (std::getline(ifs, line)) { std::vector<float> box = splitf(line, ','); if (box.size() == 4) { cv::Rect rect(box[0], box[1], box[2] + 1, box[3] + 1); // make the height a bit bigger result.push_back(rect); } else { std::cerr << "Box has not length 4!" << std::endl; } } return result; }