@@ -17,6 +17,7 @@ module OpenCV.Extra.ArUco
17
17
-- * ChArUco markers
18
18
, ChArUcoBoard
19
19
, createChArUcoBoard
20
+ , drawChArUcoBoard
20
21
21
22
-- ** Detecting markers
22
23
, interpolateChArUcoMarkers
@@ -48,6 +49,7 @@ import "this" OpenCV.Extra.Internal.C.Inline ( openCvExtraCtx )
48
49
import "this" OpenCV.Extra.Internal.C.Types
49
50
import "opencv" OpenCV.Internal
50
51
import "opencv" OpenCV.Internal.C.Types
52
+ import "opencv" OpenCV.Internal.Core.Types.Mat
51
53
import "base" System.IO.Unsafe
52
54
import qualified "vector" Data.Vector.Storable as SV
53
55
@@ -485,6 +487,23 @@ getPredefinedDictionary name =
485
487
case name of
486
488
DICT_7X7_1000 -> [C. pure | int { DICT_7X7_1000 } |]
487
489
490
+
491
+ {-| Draw a ChArUco board, ready to be printed and used for calibration/marke
492
+ detection.
493
+ -}
494
+ drawChArUcoBoard :: ChArUcoBoard -> Mat ('S '[h , w ]) ('S 1 ) depth
495
+ drawChArUcoBoard charucoBoard = unsafePerformIO $ do
496
+ dst <- newEmptyMat
497
+ withPtr charucoBoard $ \ c'board ->
498
+ withPtr dst $ \ dstPtr ->
499
+ [C. block | void {
500
+ Mat & board = * $(Mat * dstPtr);
501
+ Ptr<CharucoBoard> & charucoBoard = *$(Ptr_CharucoBoard * c'board);
502
+ charucoBoard->draw(cv::Size(500, 500), board);
503
+ }|]
504
+ pure (unsafeCoerceMat dst)
505
+
506
+
488
507
--------------------------------------------------------------------------------
489
508
withPtrs
490
509
:: WithPtr a
0 commit comments