def test_match_channel(hist_match: HistogramMatching) -> None:
    # pylint: disable=protected-access (W0212)
    result = hist_match._match_channel(TEST_SRC_IMAGE, TEST_REF_IMAGE)

    # we test against scikit image histogram matching
    assert result.shape == TEST_SRC_IMAGE.shape
    np.testing.assert_array_equal(result, TEST_RES_IMAGE)
def test_match_channel_prop(match_prop: float,
                            expected_result: np.ndarray) -> None:
    # pylint: disable=protected-access (W0212)
    hist_match = HistogramMatching(CHANNELS_DEFAULT, check_input=True,
                                   match_prop=match_prop)
    result = hist_match._match_channel(TEST_SRC_IMAGE, TEST_REF_IMAGE)

    assert result.shape == TEST_SRC_IMAGE.shape
    np.testing.assert_array_almost_equal(result, expected_result)
def test_match_channel_images(source_path: str, reference_path: str,
                              hist_match: HistogramMatching) -> None:
    # pylint: disable=protected-access (W0212)
    source = cv2.imread(source_path)
    reference = cv2.imread(reference_path)

    for channel in range(source.shape[-1]):
        source_c = source[:, :, channel]
        reference_c = reference[:, :, channel]
        result = hist_match._match_channel(source_c, reference_c)

        # we test against scikit image histogram matching
        expected_result = match_histograms(source_c, reference_c)

        assert result.shape == source_c.shape
        np.testing.assert_array_equal(result, expected_result)