never executed always true always false
1 {-# language CPP #-}
2
3 #ifndef ENABLE_INTERNAL_DOCUMENTATION
4 {-# OPTIONS_HADDOCK hide #-}
5 #endif
6
7 module OpenCV.Internal.ImgProc.MiscImgTransform where
8
9 import "base" Data.Bits
10 import "base" Data.Int
11 import "base" Foreign.C.Types
12 import "linear" Linear.V2 ( V2(..) )
13 import "this" OpenCV.Core.Types.Rect
14
15 --------------------------------------------------------------------------------
16
17 #include <bindings.dsl.h>
18 #include "opencv2/core.hpp"
19 #include "opencv2/imgproc.hpp"
20
21 #include "namespace.hpp"
22
23 --------------------------------------------------------------------------------
24
25 data ThreshType
26 = Thresh_Binary !Double
27 | Thresh_BinaryInv !Double
28 | Thresh_Truncate
29 | Thresh_ToZero
30 | Thresh_ToZeroInv
31 deriving (Show, Eq)
32
33 #num THRESH_BINARY
34 #num THRESH_BINARY_INV
35 #num THRESH_TRUNC
36 #num THRESH_TOZERO
37 #num THRESH_TOZERO_INV
38
39 marshalThreshType :: ThreshType -> (Int32, CDouble)
40 marshalThreshType = \case
41 Thresh_Binary maxVal -> (c'THRESH_BINARY , realToFrac maxVal)
42 Thresh_BinaryInv maxVal -> (c'THRESH_BINARY_INV, realToFrac maxVal)
43 Thresh_Truncate -> (c'THRESH_TRUNC , 0)
44 Thresh_ToZero -> (c'THRESH_TOZERO , 0)
45 Thresh_ToZeroInv -> (c'THRESH_TOZERO_INV, 0)
46
47 data ThreshValue
48 = ThreshVal_Abs !Double
49 | ThreshVal_Otsu
50 | ThreshVal_Triangle
51 deriving (Show, Eq)
52
53 #num THRESH_OTSU
54 #num THRESH_TRIANGLE
55
56 marshalThreshValue :: ThreshValue -> (Int32, CDouble)
57 marshalThreshValue = \case
58 ThreshVal_Abs val -> (0 , realToFrac val)
59 ThreshVal_Otsu -> (c'THRESH_OTSU , 0)
60 ThreshVal_Triangle -> (c'THRESH_TRIANGLE, 0)
61
62 #num FLOODFILL_FIXED_RANGE
63 #num FLOODFILL_MASK_ONLY
64
65 --------------------------------------------------------------------------------
66
67 data GrabCutOperationMode
68 = GrabCut_InitWithRect (Rect Int32)
69 -- ^ Initialize the state and the mask using the provided rectangle. After that, run iterCount iterations of the algorithm.
70 -- The rectangle represents a ROI containing a segmented object. The pixels outside of the ROI are marked as “obvious background”.
71 | GrabCut_InitWithMask
72 -- ^ Initialize the state using the provided mask.
73 | GrabCut_InitWithRectAndMask (Rect Int32)
74 -- ^ Combination of 'GCInitWithRect' and 'GCInitWithMask'. All the pixels outside of the ROI are automatically initialized with GC_BGD.
75 | GrabCut_Eval
76 -- ^ Just resume the algorithm.
77 deriving (Show)
78
79 #num GC_INIT_WITH_RECT
80 #num GC_INIT_WITH_MASK
81 #num GC_EVAL
82
83 marshalGrabCutOperationMode :: GrabCutOperationMode -> Int32
84 marshalGrabCutOperationMode = \case
85 GrabCut_InitWithRect _ -> c'GC_INIT_WITH_RECT
86 GrabCut_InitWithMask -> c'GC_INIT_WITH_MASK
87 GrabCut_InitWithRectAndMask _ -> c'GC_INIT_WITH_RECT .|. c'GC_INIT_WITH_MASK
88 GrabCut_Eval -> c'GC_EVAL
89
90 marshalGrabCutOperationModeRect :: GrabCutOperationMode -> Rect Int32
91 marshalGrabCutOperationModeRect = \case
92 GrabCut_InitWithRect r -> r
93 GrabCut_InitWithMask -> emptyRect
94 GrabCut_InitWithRectAndMask r -> r
95 GrabCut_Eval -> emptyRect
96 where
97 emptyRect = toRect (HRect { hRectTopLeft = V2 0 0, hRectSize = V2 0 0 })
98
99 --------------------------------------------------------------------------------
100
101 #num COLOR_BGR2BGRA
102 #num COLOR_RGB2RGBA
103 #num COLOR_BGRA2BGR
104 #num COLOR_RGBA2RGB
105 #num COLOR_BGR2RGBA
106 #num COLOR_RGB2BGRA
107 #num COLOR_RGBA2BGR
108 #num COLOR_BGRA2RGB
109 #num COLOR_BGR2RGB
110 #num COLOR_RGB2BGR
111 #num COLOR_BGRA2RGBA
112 #num COLOR_RGBA2BGRA
113 #num COLOR_BGR2GRAY
114 #num COLOR_RGB2GRAY
115 #num COLOR_GRAY2BGR
116 #num COLOR_GRAY2RGB
117 #num COLOR_GRAY2BGRA
118 #num COLOR_GRAY2RGBA
119 #num COLOR_BGRA2GRAY
120 #num COLOR_RGBA2GRAY
121 #num COLOR_BGR2BGR565
122 #num COLOR_RGB2BGR565
123 #num COLOR_BGR5652BGR
124 #num COLOR_BGR5652RGB
125 #num COLOR_BGRA2BGR565
126 #num COLOR_RGBA2BGR565
127 #num COLOR_BGR5652BGRA
128 #num COLOR_BGR5652RGBA
129 #num COLOR_GRAY2BGR565
130 #num COLOR_BGR5652GRAY
131 #num COLOR_BGR2BGR555
132 #num COLOR_RGB2BGR555
133 #num COLOR_BGR5552BGR
134 #num COLOR_BGR5552RGB
135 #num COLOR_BGRA2BGR555
136 #num COLOR_RGBA2BGR555
137 #num COLOR_BGR5552BGRA
138 #num COLOR_BGR5552RGBA
139 #num COLOR_GRAY2BGR555
140 #num COLOR_BGR5552GRAY
141 #num COLOR_BGR2XYZ
142 #num COLOR_RGB2XYZ
143 #num COLOR_XYZ2BGR
144 #num COLOR_XYZ2RGB
145 #num COLOR_BGR2YCrCb
146 #num COLOR_RGB2YCrCb
147 #num COLOR_YCrCb2BGR
148 #num COLOR_YCrCb2RGB
149 #num COLOR_BGR2HSV
150 #num COLOR_RGB2HSV
151 #num COLOR_BGR2Lab
152 #num COLOR_RGB2Lab
153 #num COLOR_BGR2Luv
154 #num COLOR_RGB2Luv
155 #num COLOR_BGR2HLS
156 #num COLOR_RGB2HLS
157 #num COLOR_HSV2BGR
158 #num COLOR_HSV2RGB
159 #num COLOR_Lab2BGR
160 #num COLOR_Lab2RGB
161 #num COLOR_Luv2BGR
162 #num COLOR_Luv2RGB
163 #num COLOR_HLS2BGR
164 #num COLOR_HLS2RGB
165 #num COLOR_BGR2HSV_FULL
166 #num COLOR_RGB2HSV_FULL
167 #num COLOR_BGR2HLS_FULL
168 #num COLOR_RGB2HLS_FULL
169 #num COLOR_HSV2BGR_FULL
170 #num COLOR_HSV2RGB_FULL
171 #num COLOR_HLS2BGR_FULL
172 #num COLOR_HLS2RGB_FULL
173 #num COLOR_LBGR2Lab
174 #num COLOR_LRGB2Lab
175 #num COLOR_LBGR2Luv
176 #num COLOR_LRGB2Luv
177 #num COLOR_Lab2LBGR
178 #num COLOR_Lab2LRGB
179 #num COLOR_Luv2LBGR
180 #num COLOR_Luv2LRGB
181 #num COLOR_BGR2YUV
182 #num COLOR_RGB2YUV
183 #num COLOR_YUV2BGR
184 #num COLOR_YUV2RGB
185 #num COLOR_YUV2RGB_NV12
186 #num COLOR_YUV2BGR_NV12
187 #num COLOR_YUV2RGB_NV21
188 #num COLOR_YUV2BGR_NV21
189 #num COLOR_YUV420sp2RGB
190 #num COLOR_YUV420sp2BGR
191 #num COLOR_YUV2RGBA_NV12
192 #num COLOR_YUV2BGRA_NV12
193 #num COLOR_YUV2RGBA_NV21
194 #num COLOR_YUV2BGRA_NV21
195 #num COLOR_YUV420sp2RGBA
196 #num COLOR_YUV420sp2BGRA
197 #num COLOR_YUV2RGB_YV12
198 #num COLOR_YUV2BGR_YV12
199 #num COLOR_YUV2RGB_IYUV
200 #num COLOR_YUV2BGR_IYUV
201 #num COLOR_YUV2RGB_I420
202 #num COLOR_YUV2BGR_I420
203 #num COLOR_YUV420p2RGB
204 #num COLOR_YUV420p2BGR
205 #num COLOR_YUV2RGBA_YV12
206 #num COLOR_YUV2BGRA_YV12
207 #num COLOR_YUV2RGBA_IYUV
208 #num COLOR_YUV2BGRA_IYUV
209 #num COLOR_YUV2RGBA_I420
210 #num COLOR_YUV2BGRA_I420
211 #num COLOR_YUV420p2RGBA
212 #num COLOR_YUV420p2BGRA
213 #num COLOR_YUV2GRAY_420
214 #num COLOR_YUV2GRAY_NV21
215 #num COLOR_YUV2GRAY_NV12
216 #num COLOR_YUV2GRAY_YV12
217 #num COLOR_YUV2GRAY_IYUV
218 #num COLOR_YUV2GRAY_I420
219 #num COLOR_YUV420sp2GRAY
220 #num COLOR_YUV420p2GRAY
221 #num COLOR_YUV2RGB_UYVY
222 #num COLOR_YUV2BGR_UYVY
223 -- #num COLOR_YUV2RGB_VYUY
224 -- #num COLOR_YUV2BGR_VYUY
225 #num COLOR_YUV2RGB_Y422
226 #num COLOR_YUV2BGR_Y422
227 #num COLOR_YUV2RGB_UYNV
228 #num COLOR_YUV2BGR_UYNV
229 #num COLOR_YUV2RGBA_UYVY
230 #num COLOR_YUV2BGRA_UYVY
231 -- #num COLOR_YUV2RGBA_VYUY
232 -- #num COLOR_YUV2BGRA_VYUY
233 #num COLOR_YUV2RGBA_Y422
234 #num COLOR_YUV2BGRA_Y422
235 #num COLOR_YUV2RGBA_UYNV
236 #num COLOR_YUV2BGRA_UYNV
237 #num COLOR_YUV2RGB_YUY2
238 #num COLOR_YUV2BGR_YUY2
239 #num COLOR_YUV2RGB_YVYU
240 #num COLOR_YUV2BGR_YVYU
241 #num COLOR_YUV2RGB_YUYV
242 #num COLOR_YUV2BGR_YUYV
243 #num COLOR_YUV2RGB_YUNV
244 #num COLOR_YUV2BGR_YUNV
245 #num COLOR_YUV2RGBA_YUY2
246 #num COLOR_YUV2BGRA_YUY2
247 #num COLOR_YUV2RGBA_YVYU
248 #num COLOR_YUV2BGRA_YVYU
249 #num COLOR_YUV2RGBA_YUYV
250 #num COLOR_YUV2BGRA_YUYV
251 #num COLOR_YUV2RGBA_YUNV
252 #num COLOR_YUV2BGRA_YUNV
253 #num COLOR_YUV2GRAY_UYVY
254 #num COLOR_YUV2GRAY_YUY2
255 -- #num CV_YUV2GRAY_VYUY
256 #num COLOR_YUV2GRAY_Y422
257 #num COLOR_YUV2GRAY_UYNV
258 #num COLOR_YUV2GRAY_YVYU
259 #num COLOR_YUV2GRAY_YUYV
260 #num COLOR_YUV2GRAY_YUNV
261 #num COLOR_RGBA2mRGBA
262 #num COLOR_mRGBA2RGBA
263 #num COLOR_RGB2YUV_I420
264 #num COLOR_BGR2YUV_I420
265 #num COLOR_RGB2YUV_IYUV
266 #num COLOR_BGR2YUV_IYUV
267 #num COLOR_RGBA2YUV_I420
268 #num COLOR_BGRA2YUV_I420
269 #num COLOR_RGBA2YUV_IYUV
270 #num COLOR_BGRA2YUV_IYUV
271 #num COLOR_RGB2YUV_YV12
272 #num COLOR_BGR2YUV_YV12
273 #num COLOR_RGBA2YUV_YV12
274 #num COLOR_BGRA2YUV_YV12
275 #num COLOR_BayerBG2BGR
276 #num COLOR_BayerGB2BGR
277 #num COLOR_BayerRG2BGR
278 #num COLOR_BayerGR2BGR
279 #num COLOR_BayerBG2RGB
280 #num COLOR_BayerGB2RGB
281 #num COLOR_BayerRG2RGB
282 #num COLOR_BayerGR2RGB
283 #num COLOR_BayerBG2GRAY
284 #num COLOR_BayerGB2GRAY
285 #num COLOR_BayerRG2GRAY
286 #num COLOR_BayerGR2GRAY
287 #num COLOR_BayerBG2BGR_VNG
288 #num COLOR_BayerGB2BGR_VNG
289 #num COLOR_BayerRG2BGR_VNG
290 #num COLOR_BayerGR2BGR_VNG
291 #num COLOR_BayerBG2RGB_VNG
292 #num COLOR_BayerGB2RGB_VNG
293 #num COLOR_BayerRG2RGB_VNG
294 #num COLOR_BayerGR2RGB_VNG
295 #num COLOR_BayerBG2BGR_EA
296 #num COLOR_BayerGB2BGR_EA
297 #num COLOR_BayerRG2BGR_EA
298 #num COLOR_BayerGR2BGR_EA
299 #num COLOR_BayerBG2RGB_EA
300 #num COLOR_BayerGB2RGB_EA
301 #num COLOR_BayerRG2RGB_EA
302 #num COLOR_BayerGR2RGB_EA
303