module OpenCV.Internal.Core.ArrayOps
( CmpType(..)
, marshalCmpType
, NormType(..)
, NormAbsRel(..)
, marshalNormType
)
where
import "base" Data.Bits ( (.|.) )
import "base" Data.Int
data CmpType
= Cmp_Eq
| Cmp_Gt
| Cmp_Ge
| Cmp_Lt
| Cmp_Le
| Cmp_Ne
deriving (Show, Eq)
c'CMP_EQ = 0
c'CMP_EQ :: (Num a) => a
c'CMP_GT = 1
c'CMP_GT :: (Num a) => a
c'CMP_GE = 2
c'CMP_GE :: (Num a) => a
c'CMP_LT = 3
c'CMP_LT :: (Num a) => a
c'CMP_LE = 4
c'CMP_LE :: (Num a) => a
c'CMP_NE = 5
c'CMP_NE :: (Num a) => a
marshalCmpType :: CmpType -> Int32
marshalCmpType cmpOp =
case cmpOp of
Cmp_Eq -> c'CMP_EQ
Cmp_Gt -> c'CMP_GT
Cmp_Ge -> c'CMP_GE
Cmp_Lt -> c'CMP_LT
Cmp_Le -> c'CMP_LE
Cmp_Ne -> c'CMP_NE
data NormType
= Norm_Inf
| Norm_L1
| Norm_L2
| Norm_L2SQR
| Norm_Hamming
| Norm_Hamming2
| Norm_MinMax
deriving (Show, Eq)
data NormAbsRel
= NormRelative
| NormAbsolute
deriving (Show, Eq)
c'NORM_INF = 1
c'NORM_INF :: (Num a) => a
c'NORM_L1 = 2
c'NORM_L1 :: (Num a) => a
c'NORM_L2 = 4
c'NORM_L2 :: (Num a) => a
c'NORM_L2SQR = 5
c'NORM_L2SQR :: (Num a) => a
c'NORM_HAMMING = 6
c'NORM_HAMMING :: (Num a) => a
c'NORM_HAMMING2 = 7
c'NORM_HAMMING2 :: (Num a) => a
c'NORM_MINMAX = 32
c'NORM_MINMAX :: (Num a) => a
c'NORM_RELATIVE = 8
c'NORM_RELATIVE :: (Num a) => a
marshalNormType :: NormAbsRel -> NormType -> Int32
marshalNormType absRel normType =
case absRel of
NormRelative -> c'normType .|. c'NORM_RELATIVE
NormAbsolute -> c'normType
where
c'normType = case normType of
Norm_Inf -> c'NORM_INF
Norm_L1 -> c'NORM_L1
Norm_L2 -> c'NORM_L2
Norm_L2SQR -> c'NORM_L2SQR
Norm_Hamming -> c'NORM_HAMMING
Norm_Hamming2 -> c'NORM_HAMMING2
Norm_MinMax -> c'NORM_MINMAX