@@ -33,6 +33,7 @@ def __init__(self, args):
3333 self .multi = args .multi
3434 self .saveDetections = args .save_detections
3535 self .saveAll = args .save_all
36+ self .arucoBased = args .aruco_based
3637
3738 def getQRModeString (self ):
3839 msg1 = "multi " if self .multi else ""
@@ -104,7 +105,12 @@ def DetectQRFrmImage(self, inputfile):
104105 return
105106 print ('Run {:s} on image [{:d}x{:d}]' .format (
106107 self .getQRModeString (), inputimg .shape [1 ], inputimg .shape [0 ]))
107- qrCode = cv .QRCodeDetector ()
108+
109+ if self .arucoBased :
110+ qrCode = cv .QRCodeDetectorAruco ()
111+ else :
112+ qrCode = cv .QRCodeDetector ()
113+
108114 count = 10
109115 timer = cv .TickMeter ()
110116 for _ in range (count ):
@@ -152,7 +158,10 @@ def DetectQRFrmCamera(self):
152158 print ("Press ' ' (space) to save result into images" )
153159 print ("Press 'ESC' to exit" )
154160
155- qrcode = cv .QRCodeDetector ()
161+ if self .arucoBased :
162+ qrcode = cv .QRCodeDetectorAruco ()
163+ else :
164+ qrcode = cv .QRCodeDetector ()
156165
157166 while True :
158167 ret , frame = cap .read ()
@@ -204,6 +213,10 @@ def main():
204213 help = "input image path (for example, 'opencv_extra/testdata/cv/qrcode/multiple/*_qrcodes.png)" ,
205214 default = "" ,
206215 metavar = "" )
216+ parser .add_argument (
217+ '--aruco_based' ,
218+ help = "use aruco-based detector" ,
219+ action = 'store_true' )
207220 parser .add_argument (
208221 '-d' ,
209222 '--detect' ,
0 commit comments