#if __GLASGOW_HASKELL__ >= 800
#endif
module OpenCV.Extra.XPhoto
( dctDenoising
) where
import "base" Data.Int ( Int32 )
import "base" Data.Word ( Word8 )
import "base" Data.Maybe ( fromMaybe )
import qualified "inline-c" Language.C.Inline as C
import qualified "inline-c-cpp" Language.C.Inline.Cpp as C
import "opencv" OpenCV.Internal.C.Inline ( openCvCtx )
import "opencv" OpenCV.Internal.C.Types ( withPtr )
import "opencv" OpenCV.Internal.Exception
import "opencv" OpenCV.Internal.Core.Types.Mat
import "opencv" OpenCV.TypeLevel
C.context openCvCtx
C.include "opencv2/core.hpp"
C.include "opencv2/xphoto.hpp"
C.using "namespace cv"
dctDenoising
:: Double
-> Maybe Int32
-> Mat ('S [h, w]) ('S 3) ('S Word8)
-> CvExcept (Mat ('S [h, w]) ('S 3) ('S Word8))
dctDenoising sigma mPSize src =
unsafeWrapException $ do
dst <- newEmptyMat
handleCvException (pure $ unsafeCoerceMat dst) $
withPtr src $ \srcPtr ->
withPtr dst $ \dstPtr ->
[cvExcept|
cv::xphoto::dctDenoising( *$(Mat * srcPtr)
, *$(Mat * dstPtr)
, $(double c'sigma)
, $(int32_t c'pSize)
);
|]
where
c'sigma = realToFrac sigma
c'pSize = fromMaybe 16 mPSize