构造更适合 ORB 的随机纹理块测试数据。
| 246 | |
| 247 | // 构造更适合 ORB 的随机纹理块测试数据。 |
| 248 | void BuildFeaturePatternData( |
| 249 | std::vector<uchar> &source_bgra, |
| 250 | int &source_width, |
| 251 | int &source_height, |
| 252 | int &template_x, |
| 253 | int &template_y, |
| 254 | int &template_width, |
| 255 | int &template_height, |
| 256 | std::wstring &template_path) { |
| 257 | source_width = 64; |
| 258 | source_height = 64; |
| 259 | cv::Mat source(source_height, source_width, CV_8UC4, cv::Scalar(0, 0, 0, 255)); |
| 260 | |
| 261 | template_x = 18; |
| 262 | template_y = 16; |
| 263 | template_width = 24; |
| 264 | template_height = 24; |
| 265 | |
| 266 | const cv::Rect roi(template_x, template_y, template_width, template_height); |
| 267 | cv::rectangle(source, roi, cv::Scalar(40, 40, 40, 255), cv::FILLED); |
| 268 | cv::rectangle(source, roi, cv::Scalar(255, 255, 255, 255), 2); |
| 269 | cv::line( |
| 270 | source, |
| 271 | cv::Point(template_x + 3, template_y + 3), |
| 272 | cv::Point(template_x + template_width - 4, template_y + template_height - 4), |
| 273 | cv::Scalar(255, 255, 255, 255), |
| 274 | 2); |
| 275 | cv::line( |
| 276 | source, |
| 277 | cv::Point(template_x + template_width - 4, template_y + 3), |
| 278 | cv::Point(template_x + 3, template_y + template_height - 4), |
| 279 | cv::Scalar(200, 200, 200, 255), |
| 280 | 2); |
| 281 | cv::circle( |
| 282 | source, |
| 283 | cv::Point(template_x + template_width / 2, template_y + template_height / 2), |
| 284 | 4, |
| 285 | cv::Scalar(255, 255, 255, 255), |
| 286 | 2); |
| 287 | cv::rectangle( |
| 288 | source, |
| 289 | cv::Rect(template_x + 4, template_y + 9, 5, 5), |
| 290 | cv::Scalar(255, 255, 255, 255), |
| 291 | cv::FILLED); |
| 292 | cv::rectangle( |
| 293 | source, |
| 294 | cv::Rect(template_x + 15, template_y + 6, 4, 8), |
| 295 | cv::Scalar(180, 180, 180, 255), |
| 296 | cv::FILLED); |
| 297 | cv::circle( |
| 298 | source, |
| 299 | cv::Point(template_x + 7, template_y + 18), |
| 300 | 2, |
| 301 | cv::Scalar(255, 255, 255, 255), |
| 302 | cv::FILLED); |
| 303 | cv::circle( |
| 304 | source, |
| 305 | cv::Point(template_x + 17, template_y + 18), |
no test coverage detected