                         int label = new_labels[i][j];
 
                         if (c & UP)
-                           label = min(label, labelsTile[yloc - 1][xloc]);
+                           label = ::min(label, labelsTile[yloc - 1][xloc]);
 
                         if (c &  DOWN)
-                           label = min(label, labelsTile[yloc + 1][xloc]);
+                           label = ::min(label, labelsTile[yloc + 1][xloc]);
 
                         if (c & LEFT)
-                           label = min(label, labelsTile[yloc][xloc - 1]);
+                           label = ::min(label, labelsTile[yloc][xloc - 1]);
 
                         if (c & RIGHT)
-                           label = min(label, labelsTile[yloc][xloc + 1]);
+                           label = ::min(label, labelsTile[yloc][xloc + 1]);
 
                        new_labels[i][j] = label;
                     }

// the use of this software, even if advised of the possibility of such damage.
//M*/

#include "opencv2/gpu/device/common.hpp"
#include <iostream>
#include <stdio.h>



            template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
            {
                I d = a - b;
                return lo <= d && d <= hi;
            }
        };

        template<typename T> struct InInterval<T, 3>
        {
            __host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi)
            : lo (VecTraits<T>::make(-_lo.x, -_lo.y, -_lo.z)), hi (VecTraits<T>::make(_hi.x, _hi.y, _hi.z)){};
            T lo, hi;

            template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
            {
                I d = a - b;
                return lo.x <= d.x && d.x <= hi.x &&
                       lo.y <= d.y && d.y <= hi.y &&
                       lo.z <= d.z && d.z <= hi.z;
            }
        };

        template<typename T> struct InInterval<T, 4>
        {
            __host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi)
            : lo (VecTraits<T>::make(-_lo.x, -_lo.y, -_lo.z, -_lo.w)), hi (VecTraits<T>::make(_hi.x, _hi.y, _hi.z, -_hi.w)){};
            T lo, hi;

            template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
            {
                I d = a - b;
                return lo.x <= d.x && d.x <= hi.x &&
                       lo.y <= d.y && d.y <= hi.y &&
                       lo.z <= d.z && d.z <= hi.z &&
                       lo.w <= d.w && d.w <= hi.w;
            }
        };

