Return JSON string for the tracker effect
| 208 | |
| 209 | // Return JSON string for the tracker effect |
| 210 | string trackerJson(cv::Rect2d r, bool onlyProtoPath){ |
| 211 | |
| 212 | // Define path to save tracked data |
| 213 | string protobufDataPath = "kcf_tracker.data"; |
| 214 | // Set the tracker |
| 215 | string tracker = "KCF"; |
| 216 | |
| 217 | // Construct all the composition of the JSON string |
| 218 | string protobuf_data_path = jsonFormat("protobuf_data_path", protobufDataPath); |
| 219 | string trackerType = jsonFormat("tracker-type", tracker); |
| 220 | string bboxCoords = jsonFormat( |
| 221 | "region", |
| 222 | "{" + jsonFormat("x", to_string(r.x), "int") + |
| 223 | "," + jsonFormat("y", to_string(r.y), "int") + |
| 224 | "," + jsonFormat("width", to_string(r.width), "int") + |
| 225 | "," + jsonFormat("height", to_string(r.height), "int") + |
| 226 | "," + jsonFormat("first-frame", to_string(0), "int") + |
| 227 | "}", |
| 228 | "rstring"); |
| 229 | |
| 230 | // Return only the the protobuf path in JSON format |
| 231 | if(onlyProtoPath) |
| 232 | return "{" + protobuf_data_path + "}"; |
| 233 | // Return all the parameters for the pre-processing effect |
| 234 | else |
| 235 | return "{" + protobuf_data_path + "," + trackerType + "," + bboxCoords + "}"; |
| 236 | } |
| 237 | |
| 238 | // Return JSON string for the stabilizer effect |
| 239 | string stabilizerJson(bool onlyProtoPath){ |