예제 #1
0
def test_heatmap_to_image_invalid():
    # heatmap must have rank 2 or rank 3
    with pytest.raises(ValueError):
        heatmap_to_image(np.zeros((1, )))
    # coloured heatmap must have 4 or 3 channels
    with pytest.raises(ValueError):
        heatmap_to_image(np.zeros((1, 1, 10)))
예제 #2
0
def test_heatmap_to_image_rgba(heatmap, boxrgba):
    rgba_heatmap = heatmap_to_image(heatmap)
    assert heatmap.shape[:2] == (rgba_heatmap.width, rgba_heatmap.height)
    assert_pixel_by_pixel_equal(rgba_heatmap, boxrgba)
예제 #3
0
def test_heatmap_to_image_grayscale(heatmap, boxl):
    gray_heatmap = heatmap_to_image(heatmap)
    assert heatmap.shape == (gray_heatmap.width, gray_heatmap.height)
    assert_pixel_by_pixel_equal(gray_heatmap, boxl)