(matrix)
| 1391 | return reduce(mul, size) |
| 1392 | |
| 1393 | def find_anchors(matrix): |
| 1394 | matrix = [[*x] for x in matrix] |
| 1395 | mh, mw = max_size(matrix) |
| 1396 | matrix = np.array(matrix) |
| 1397 | # element = np.zeros((mh, mw)) |
| 1398 | for i in range(matrix.shape[0] + 1 - mh): |
| 1399 | for j in range(matrix.shape[1] + 1 - mw): |
| 1400 | if matrix[i:i + mh, j:j + mw].max() == 0: |
| 1401 | return i, i + mh, j, j + mw |
| 1402 | |
| 1403 | def find_largest_rect(dst_img, bg_color=(128, 128, 128)): |
| 1404 | valid = np.any(dst_img[..., :3] != bg_color, axis=-1) |
no test coverage detected