Closed vlatkoB closed 10 years ago
@vlatkoB Does my branch / pull request fix your problem? https://github.com/aleator/CV/pull/45
I took pxqr:master #46, I suppose. I assumed it is the newest with all fixes merged. However, I just tried yours (https://github.com/TomMD/CV) and got the following errors:
CV/Transforms.chs:108:32: Could not deduce (RealFrac s0) arising from a use of âfloorâ from the context (CreateImage (Image c D32)) bound by the type signature for scaleToSize :: CreateImage (Image c D32) => Interpolation -> Bool -> (Int, Int) -> Image c D32 -> Image c D32 at CV/Transforms.chs:(96,16)-(97,68) The type variable âs0â is ambiguous Relevant bindings include ratio :: s0 (bound at CV/Transforms.chs:110:14) Note: there are several potential instances: instance RealFrac Double -- Defined in âGHC.Floatâ instance RealFrac Float -- Defined in âGHC.Floatâ instance Integral a => RealFrac (GHC.Real.Ratio a) -- Defined in âGHC.Realâ ...plus two others In the expression: floor In the expression: floor $ fromIntegral ow * ratio In the expression: (floor $ fromIntegral ow * ratio, floor $ fromIntegral oh * ratio)
CV/Transforms.chs:110:23: Could not deduce (Ord s0) arising from a use of âmaxâ from the context (CreateImage (Image c D32)) bound by the type signature for scaleToSize :: CreateImage (Image c D32) => Interpolation -> Bool -> (Int, Int) -> Image c D32 -> Image c D32 at CV/Transforms.chs:(96,16)-(97,68) The type variable âs0â is ambiguous Relevant bindings include ratio :: s0 (bound at CV/Transforms.chs:110:14) Note: there are several potential instances: instance Ord LAB_Channel -- Defined in âCV.Imageâ instance Ord RGB_Channel -- Defined in âCV.Imageâ instance Ord CV.Image.YUV_Channel -- Defined in âCV.Imageâ ...plus 139 others In the expression: max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh) In an equation for âratioâ: ratio = max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh) In an equation for âscaleToSizeâ: scaleToSize tpe retainRatio (w, h) img = unsafePerformIO $ do { target <- create (w', h'); withGenImage img $ \ i -> withGenImage target $ ...; return target } where (ow, oh) = getSize img (w', h') = if retainRatio then (floor $ fromIntegral ow * ratio, floor $ fromIntegral oh * ratio) else (w, h) ratio = max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh)
CV/Transforms.chs:110:28: Could not deduce (Num s0) arising from a use of âfromIntegralâ from the context (CreateImage (Image c D32)) bound by the type signature for scaleToSize :: CreateImage (Image c D32) => Interpolation -> Bool -> (Int, Int) -> Image c D32 -> Image c D32 at CV/Transforms.chs:(96,16)-(97,68) The type variable âs0â is ambiguous Relevant bindings include ratio :: s0 (bound at CV/Transforms.chs:110:14) Note: there are several potential instances: instance Num a => Num (Utils.Point.Pt a) -- Defined in âUtils.Pointâ instance Num Double -- Defined in âGHC.Floatâ instance Num Float -- Defined in âGHC.Floatâ ...plus 46 others In the first argument of â(/)â, namely âfromIntegral wâ In the first argument of âmaxâ, namely â(fromIntegral w / fromIntegral ow)â In the expression: max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh)
CV/Transforms.chs:110:42: Could not deduce (Fractional s0) arising from a use of â/â from the context (CreateImage (Image c D32)) bound by the type signature for scaleToSize :: CreateImage (Image c D32) => Interpolation -> Bool -> (Int, Int) -> Image c D32 -> Image c D32 at CV/Transforms.chs:(96,16)-(97,68) The type variable âs0â is ambiguous Relevant bindings include ratio :: s0 (bound at CV/Transforms.chs:110:14) Note: there are several potential instances: instance Fractional Double -- Defined in âGHC.Floatâ instance Fractional Float -- Defined in âGHC.Floatâ instance Integral a => Fractional (GHC.Real.Ratio a) -- Defined in âGHC.Realâ ...plus four others In the first argument of âmaxâ, namely â(fromIntegral w / fromIntegral ow)â In the expression: max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh) In an equation for âratioâ: ratio = max (fromIntegral w / fromIntegral ow) (fromIntegral h / fromIntegral oh)
CV/Transforms.chs:342:9: Couldn't match expected type âIO a0â with actual type âCInt -> IO ()â Probable cause: âcvDistTransformâ is applied to too few arguments In the expression: cvDistTransform c_source c_result (fromIntegral . fromEnum $ dtype) (fromIntegral . fromEnum $ maskSize) nullPtr nullPtr In the second argument of â($)â, namely â\ c_result -> cvDistTransform c_source c_result (fromIntegral . fromEnum $ dtype) (fromIntegral . fromEnum $ maskSize) nullPtr nullPtrâ
Bump...
@vlatkoB Are you building for OpenCV 2.3? I know my fork doesn't build with 2.3 - only 2.4 by using cabal install -fopencv24
. I would bet aleator's master branch is in a similar state.
@TomMD Made it. It seems that last conditional clause in Transformers.chs, on line 347-349 `#ifdef OpenCV24 (fromIntegral . fromEnum $ CCOMP)
should be written with space after the # (_ is space)
`#_ifdef OpenCV24 (fromIntegral . fromEnum $ CCOMP)
otherwise compiler doesn't see it (?)
No, it should behave identically either way - if it does't then your C pre-processor is badly broken. I've pushed a patch to my repo that removes the CPP and just assumed CV 2.4, if you are inclined to give that a try then let me know how things go.
@TomMD Just tried it. Compiles without problems. :-) Any idea how to check/fix "badly broken C pre-processor"?
I have no good idea what could have gone wrong with the CPP - that is an issue I've never ran across, very odd one too.
@TomMD Thnaks a lot for help. Any idea when your patch(es) would get applied, to cv 4.0.0?
@vlatkoB I don't expect my patches to ever be applied. I am getting the feeling @aleator is busy and perhaps abandoning this repository.
Seems quite a few changes in this release, some functions (mapContours) and types missing/changed.
Hello,
My system: GHC 7.8.3, Cabal 1.20.0.2, Ubuntu 12.04, tried both OpenCV 2.3.1 and 2.4.5
When compiling the master branch, I'm getting these errors:
CV/Matrix.hs:145:83: Could not deduce (Enum s0) arising from a use of âfromEnumâ from the context (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) bound by the type signature for invert :: (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) => Matrix a -> Matrix a at CV/Matrix.hs:141:11-88 The type variable âs0â is ambiguous Note: there are several potential instances: instance Enum RGB_Channel -- Defined at CV/Image.chs:159:56 instance Enum LAB_Channel -- Defined at CV/Image.chs:165:59 instance Enum ImageDepth -- Defined at CV/Image.chs:965:10 ...plus 72 others In the second argument of â(.)â, namely âfromEnumâ In the expression: fromIntegral . fromEnum In the third argument of âc'cvInvertâ, namely â(fromIntegral . fromEnum $ c'CV_LU)â
CV/Matrix.hs:145:94: Could not deduce (Num s0) arising from a use of âc'CV_LUâ from the context (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) bound by the type signature for invert :: (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) => Matrix a -> Matrix a at CV/Matrix.hs:141:11-88 The type variable âs0â is ambiguous Note: there are several potential instances: instance Num a => Num (Utils.Point.Pt a) -- Defined at Utils/Point.hs:8:10 instance Num Double -- Defined in âGHC.Floatâ instance Num Float -- Defined in âGHC.Floatâ ...plus 64 others In the second argument of â($)â, namely âc'CV_LUâ In the third argument of âc'cvInvertâ, namely â(fromIntegral . fromEnum $ c'CV_LU)â In the expression: c'cvInvert c_m c_c (fromIntegral . fromEnum $ c'CV_LU)