| 1095 | }; |
| 1096 | |
| 1097 | void test_potts_pair_grid() |
| 1098 | { |
| 1099 | array2d<int> img1(40,40); |
| 1100 | array2d<double> img2(40,40); |
| 1101 | |
| 1102 | assign_all_pixels(img1, -1); |
| 1103 | assign_all_pixels(img2, -1); |
| 1104 | |
| 1105 | img1[4][4] = 1000; |
| 1106 | |
| 1107 | img2[4][3] = 1; |
| 1108 | img2[4][4] = 1; |
| 1109 | img2[4][5] = 1; |
| 1110 | img2[3][3] = 1; |
| 1111 | img2[3][4] = 1; |
| 1112 | img2[3][5] = 1; |
| 1113 | img2[5][3] = 1; |
| 1114 | img2[5][4] = 1; |
| 1115 | img2[5][5] = 1; |
| 1116 | |
| 1117 | array2d<unsigned char> labels; |
| 1118 | find_max_factor_graph_potts(make_potts_grid_problem(potts_pair_image_model(),img2,img1), labels); |
| 1119 | |
| 1120 | dlog << LINFO << "num true labels: " << sum(matrix_cast<int>(mat(labels)!=0)); |
| 1121 | DLIB_TEST(sum(matrix_cast<int>(mat(labels)!=0)) == 9); |
| 1122 | DLIB_TEST(sum(matrix_cast<int>(mat(labels)==0)) == (int)img1.size()-9); |
| 1123 | |
| 1124 | DLIB_TEST(labels[4][3] != 0); |
| 1125 | DLIB_TEST(labels[4][4] != 0); |
| 1126 | DLIB_TEST(labels[4][5] != 0); |
| 1127 | DLIB_TEST(labels[3][3] != 0); |
| 1128 | DLIB_TEST(labels[3][4] != 0); |
| 1129 | DLIB_TEST(labels[3][5] != 0); |
| 1130 | DLIB_TEST(labels[5][3] != 0); |
| 1131 | DLIB_TEST(labels[5][4] != 0); |
| 1132 | DLIB_TEST(labels[5][5] != 0); |
| 1133 | } |
| 1134 | |
| 1135 | // ---------------------------------------------------------------------------------------- |
| 1136 | // ---------------------------------------------------------------------------------------- |
no test coverage detected