Skip to content

Commit 8ec379d

Browse files
committed
Drop opencv4 Cabal flag since it's now the only choice
1 parent 4bc974b commit 8ec379d

File tree

14 files changed

+2
-142
lines changed

14 files changed

+2
-142
lines changed

opencv-extra/opencv-extra.cabal

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ source-repository head
3838
location: git://github.com/LumiGuide/haskell-opencv.git
3939
subdir: opencv-extra
4040

41-
flag opencv4
42-
description: Use OpenCV >= 4.0.0
43-
default: True
44-
manual: True
45-
4641
flag enable-nonfree
4742
description: Builds modules that only work if the system OpenCV was built with the OPENCV_ENABLE_NONFREE option (most OpenCV installations lack this by default).
4843
default: False
@@ -80,10 +75,7 @@ library
8075

8176
ghc-options: -Wall -fwarn-incomplete-patterns -funbox-strict-fields
8277

83-
if flag(opencv4)
84-
pkgconfig-depends: opencv4 >= 4.0.0
85-
else
86-
pkgconfig-depends: opencv >= 3.0.0
78+
pkgconfig-depends: opencv4 >= 4.0.0
8779

8880
if flag(internal-documentation)
8981
cpp-options: -DENABLE_INTERNAL_DOCUMENTATION

opencv/opencv.cabal

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ source-repository head
4343
location: git://github.com/LumiGuide/haskell-opencv.git
4444
subdir: opencv
4545

46-
flag opencv4
47-
description: Use OpenCV >= 4.0.0
48-
default: True
49-
manual: True
50-
5146
flag internal-documentation
5247
description: Enables documentation generation for internal modules.
5348
default: False
@@ -80,13 +75,7 @@ library
8075

8176
ghc-options: -Wall -fwarn-incomplete-patterns -funbox-strict-fields
8277

83-
if flag(opencv4)
84-
cpp-options: -DOPENCV4
85-
ghc-options: -optc-DOPENCV4
86-
pkgconfig-depends: opencv4 >= 4.0.0
87-
else
88-
pkgconfig-depends: opencv >= 3.0.0
89-
build-depends: base64-bytestring >= 1.0.0.1
78+
pkgconfig-depends: opencv4 >= 4.0.0
9079

9180
if flag(internal-documentation)
9281
cpp-options: -DENABLE_INTERNAL_DOCUMENTATION

opencv/src/OpenCV/Features2d.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,7 @@ newOrb OrbParams{..} = fromPtr
197197
, $(int32_t orb_edgeThreshold)
198198
, $(int32_t orb_firstLevel)
199199
, $(int32_t c'WTA_K)
200-
#ifdef OPENCV4
201200
, cv::ORB::ScoreType($(int32_t c'scoreType))
202-
#else
203-
, $(int32_t c'scoreType)
204-
#endif
205201
, $(int32_t orb_patchSize)
206202
, $(int32_t orb_fastThreshold)
207203
);

opencv/src/OpenCV/ImgProc/FeatureDetection.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,7 @@ houghCircles dp minDist param1 param2 minRadius maxRadius src = unsafeWrapExcept
335335
cv::HoughCircles(
336336
*$(Mat * srcPtr),
337337
circles,
338-
#ifdef OPENCV4
339338
HOUGH_GRADIENT,
340-
#else
341-
CV_HOUGH_GRADIENT,
342-
#endif
343339
$(double c'dp),
344340
$(double c'minDist),
345341
$(double c'param1),

opencv/src/OpenCV/ImgProc/GeometricImgTransform.hsc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ C.context openCvCtx
9191

9292
C.include "opencv2/core.hpp"
9393
C.include "opencv2/imgproc.hpp"
94-
#ifdef OPENCV4
9594
C.include "opencv2/calib3d.hpp"
96-
#endif
9795
C.using "namespace cv"
9896

9997
#include <bindings.dsl.h>

opencv/src/OpenCV/ImgProc/ObjectDetection.hsc

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,33 +101,12 @@ data MatchTemplateNormalisation
101101
| MatchTemplateNormed -- ^ Use normalization.
102102
deriving (Show, Eq)
103103

104-
#ifdef OPENCV4
105104
#num TM_SQDIFF
106105
#num TM_SQDIFF_NORMED
107106
#num TM_CCORR
108107
#num TM_CCORR_NORMED
109108
#num TM_CCOEFF
110109
#num TM_CCOEFF_NORMED
111-
#else
112-
#num CV_TM_SQDIFF
113-
#num CV_TM_SQDIFF_NORMED
114-
#num CV_TM_CCORR
115-
#num CV_TM_CCORR_NORMED
116-
#num CV_TM_CCOEFF
117-
#num CV_TM_CCOEFF_NORMED
118-
c'TM_SQDIFF :: Num a => a
119-
c'TM_SQDIFF_NORMED :: Num a => a
120-
c'TM_CCORR :: Num a => a
121-
c'TM_CCORR_NORMED :: Num a => a
122-
c'TM_CCOEFF :: Num a => a
123-
c'TM_CCOEFF_NORMED :: Num a => a
124-
c'TM_SQDIFF = c'CV_TM_SQDIFF
125-
c'TM_SQDIFF_NORMED = c'CV_TM_SQDIFF_NORMED
126-
c'TM_CCORR = c'CV_TM_CCORR
127-
c'TM_CCORR_NORMED = c'CV_TM_CCORR_NORMED
128-
c'TM_CCOEFF = c'CV_TM_CCOEFF
129-
c'TM_CCOEFF_NORMED = c'CV_TM_CCOEFF_NORMED
130-
#endif
131110

132111
marshalMatchTemplateMethod :: MatchTemplateMethod -> Bool -> Int32
133112
marshalMatchTemplateMethod m n =

opencv/src/OpenCV/ImgProc/StructuralAnalysis.hsc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ import qualified "vector" Data.Vector.Storable as VS
5757

5858
#include <bindings.dsl.h>
5959
#include "opencv2/imgproc.hpp"
60-
#ifdef OPENCV4
6160
#include "namespace.hpp"
62-
#endif
6361

6462
C.context openCvCtx
6563

@@ -109,7 +107,6 @@ data ContourApproximationMethod
109107
| ContourApproximationTC89L1
110108
| ContourApproximationTC89KCOS
111109

112-
#ifdef OPENCV4
113110
#num RETR_EXTERNAL
114111
#num RETR_LIST
115112
#num RETR_CCOMP
@@ -118,32 +115,6 @@ data ContourApproximationMethod
118115
#num CHAIN_APPROX_SIMPLE
119116
#num CHAIN_APPROX_TC89_L1
120117
#num CHAIN_APPROX_TC89_KCOS
121-
#else
122-
#num CV_RETR_EXTERNAL
123-
#num CV_RETR_LIST
124-
#num CV_RETR_CCOMP
125-
#num CV_RETR_TREE
126-
#num CV_CHAIN_APPROX_NONE
127-
#num CV_CHAIN_APPROX_SIMPLE
128-
#num CV_CHAIN_APPROX_TC89_L1
129-
#num CV_CHAIN_APPROX_TC89_KCOS
130-
c'RETR_EXTERNAL :: Num a => a
131-
c'RETR_LIST :: Num a => a
132-
c'RETR_CCOMP :: Num a => a
133-
c'RETR_TREE :: Num a => a
134-
c'CHAIN_APPROX_NONE :: Num a => a
135-
c'CHAIN_APPROX_SIMPLE :: Num a => a
136-
c'CHAIN_APPROX_TC89_L1 :: Num a => a
137-
c'CHAIN_APPROX_TC89_KCOS :: Num a => a
138-
c'RETR_EXTERNAL = c'CV_RETR_EXTERNAL
139-
c'RETR_LIST = c'CV_RETR_LIST
140-
c'RETR_CCOMP = c'CV_RETR_CCOMP
141-
c'RETR_TREE = c'CV_RETR_TREE
142-
c'CHAIN_APPROX_NONE = c'CV_CHAIN_APPROX_NONE
143-
c'CHAIN_APPROX_SIMPLE = c'CV_CHAIN_APPROX_SIMPLE
144-
c'CHAIN_APPROX_TC89_L1 = c'CV_CHAIN_APPROX_TC89_L1
145-
c'CHAIN_APPROX_TC89_KCOS = c'CV_CHAIN_APPROX_TC89_KCOS
146-
#endif
147118

148119
marshalContourRetrievalMode :: ContourRetrievalMode -> Int32
149120
marshalContourRetrievalMode = \case

opencv/src/OpenCV/Internal/Calib3d/Constants.hsc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,10 @@ module OpenCV.Internal.Calib3d.Constants where
1212

1313
#include "namespace.hpp"
1414

15-
#ifdef OPENCV4
1615
#num FM_7POINT
1716
#num FM_8POINT
1817
#num FM_RANSAC
1918
#num FM_LMEDS
20-
#else
21-
#num CV_FM_7POINT
22-
#num CV_FM_8POINT
23-
#num CV_FM_RANSAC
24-
#num CV_FM_LMEDS
25-
c'FM_7POINT :: Num a => a
26-
c'FM_8POINT :: Num a => a
27-
c'FM_RANSAC :: Num a => a
28-
c'FM_LMEDS :: Num a => a
29-
c'FM_7POINT = c'CV_FM_7POINT
30-
c'FM_8POINT = c'CV_FM_8POINT
31-
c'FM_RANSAC = c'CV_FM_RANSAC
32-
c'FM_LMEDS = c'CV_FM_LMEDS
33-
#endif
3419

3520
#num LMEDS
3621
#num RANSAC

opencv/src/OpenCV/Internal/Core/Types/Mat/Depth.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ data Depth =
2828
| Depth_32S
2929
| Depth_32F
3030
| Depth_64F
31-
#ifndef OPENCV4
32-
| Depth_USRTYPE1
33-
#endif
3431
deriving (Bounded, Enum, Eq, Show)
3532

3633
--------------------------------------------------------------------------------

opencv/src/OpenCV/Internal/Core/Types/Mat/HMat.hs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import "base" Foreign.C.Types
2424
import "base" Foreign.Ptr ( Ptr )
2525
import "base" Foreign.Storable ( Storable(..), peekElemOff, pokeElemOff )
2626
import "base" System.IO.Unsafe ( unsafePerformIO )
27-
#ifndef OPENCV4
28-
import qualified "bytestring" Data.ByteString as B
29-
#endif
3027
import "linear" Linear.Vector ( zero )
3128
import "linear" Linear.V4 ( V4(..) )
3229
import "this" OpenCV.Core.Types
@@ -54,9 +51,6 @@ data HElems
5451
| HElems_32S !(VU.Vector Int32)
5552
| HElems_32F !(VU.Vector Float)
5653
| HElems_64F !(VU.Vector Double)
57-
#ifndef OPENCV4
58-
| HElems_USRTYPE1 !(V.Vector B.ByteString)
59-
#endif
6054
deriving (Show, Eq)
6155

6256
hElemsDepth :: HElems -> Depth
@@ -68,9 +62,6 @@ hElemsDepth = \case
6862
HElems_32S _v -> Depth_32S
6963
HElems_32F _v -> Depth_32F
7064
HElems_64F _v -> Depth_64F
71-
#ifndef OPENCV4
72-
HElems_USRTYPE1 _v -> Depth_USRTYPE1
73-
#endif
7465

7566
hElemsLength :: HElems -> Int
7667
hElemsLength = \case
@@ -81,9 +72,6 @@ hElemsLength = \case
8172
HElems_32S v -> VG.length v
8273
HElems_32F v -> VG.length v
8374
HElems_64F v -> VG.length v
84-
#ifndef OPENCV4
85-
HElems_USRTYPE1 v -> VG.length v
86-
#endif
8775

8876
class ToHElems a where
8977
toHElems :: VU.Vector a -> HElems
@@ -121,9 +109,6 @@ matToHMat mat = unsafePerformIO $ withMatData mat $ \step dataPtr -> do
121109
Depth_32S -> HElems_32S <$> copyToVec
122110
Depth_32F -> HElems_32F <$> copyToVec
123111
Depth_64F -> HElems_64F <$> copyToVec
124-
#ifndef OPENCV4
125-
Depth_USRTYPE1 -> HElems_USRTYPE1 <$> error "todo"
126-
#endif
127112
where
128113
copyToVec :: (Storable a, VU.Unbox a) => IO (VU.Vector a)
129114
copyToVec = do
@@ -159,9 +144,6 @@ hMatToMatIO (HMat shape channels elems) = do
159144
HElems_32S v -> copyFromVec v
160145
HElems_32F v -> copyFromVec v
161146
HElems_64F v -> copyFromVec v
162-
#ifndef OPENCV4
163-
HElems_USRTYPE1 _v -> error "todo"
164-
#endif
165147
where
166148
copyFromVec :: (Storable a, VU.Unbox a) => VU.Vector a -> IO ()
167149
copyFromVec v =

0 commit comments

Comments
 (0)