Added a have_same_dimensions() for image types.

This commit is contained in:
Davis King 2018-06-02 18:52:20 -04:00
parent 5dc918581e
commit 85fc0e0b91
1 changed files with 17 additions and 0 deletions

View File

@ -443,6 +443,23 @@ namespace dlib
objects should provide their own overload of num_rows() if needed.
!*/
template <typename image_type1, typename image_type2>
bool have_same_dimensions (
const image_type1& img1,
const image_type2& img2
) { return num_rows(img1)==num_rows(img2) && num_columns(img1)==num_columns(img2); }
/*!
ensures
- returns true if and only if the two given images have the same dimensions.
!*/
template <typename image_type1, typename image_type2, typename ...T>
bool have_same_dimensions (
const image_type1& img1,
const image_type2& img2,
T&& ...args
) { return have_same_dimensions(img1,img2) && have_same_dimensions(img1,args...); }
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// Make the image views implement the generic image interface