 , tileImages
 
 -- * Conversions
+, convertTo
 , rgbToGray
 , rgbToGray8
 , grayToRGB




convert8UTo :: CInt -> CInt -> BareImage -> BareImage
convert8UTo code channels img = unsafePerformIO $ creatingBareImage $ do
    res <- {#call wrapCreateImage8U#} w h channels
    withBareImage img $ \cimg ->
        {#call cvCvtColor#} (castPtr cimg) (castPtr res) code
    return res
 where
    (fromIntegral -> w,fromIntegral -> h) = getSize img

convertTo :: CInt -> CInt -> BareImage -> BareImage
convertTo code channels img = unsafePerformIO $ creatingBareImage $ do
    res <- {#call wrapCreateImage32F#} w h channels
    withBareImage img $ \cimg ->
        {#call cvCvtColor#} (castPtr cimg) (castPtr res) code
    return res
 where
    (fromIntegral -> w,fromIntegral -> h) = getSize img

data BGR

data LAB
data YUV
data RGBA
data LAB_Channel = LAB_L | LAB_A | LAB_B deriving (Eq,Ord,Enum)
data YUV_Channel = YUV_Y | YUV_U | YUV_V deriving (Eq,Ord,Enum)

-- | Type family for expressing which channels a colorspace contains. This needs to be fixed wrt. the BGR color space.
type family ChannelOf a :: *
type instance ChannelOf RGB_Channel = RGB
type instance ChannelOf LAB_Channel = LAB
type instance ChannelOf YUV_Channel = YUV

-- Bit Depths
type D8  = Word8
