Bug on a panoramic photograph program?

Hello, i’m still working on the Laurent Berger book, at the ponoramic exemple:
all the code is here

there is a bug , a boolean error at line 302 :

PS C:\Users\me> & "C:/Program Files/Python39/python.exe" c:/Users/me/Programmation/livreTraitementImageOCVpython/opencv/opencv2/py_panoramique/panorama.py
Toutes les cams [(<VideoCapture 0000016020780530>, 0), (<VideoCapture 0000016020780590>, 1), (<VideoCapture 0000016020780570>, 
2)]
webcam 1&2 : [(<VideoCapture 0000016020780590>, 1), (<VideoCapture 0000016020780570>, 2)]
Appariement :  Best
Transformation :  homography
Couture :  no
Surface :  plane
Exposition :  2
Ajustement :  ray
Appariement :  Best
Transformation :  homography
Couture :  no
Surface :  cylindrical
Exposition :  2
Ajustement :  ray
Traceback (most recent call last):
  File "c:\Users\me\Programmation\livreTraitementImageOCVpython\opencv\opencv2\py_panoramique\panorama.py", line 602, in <module>
    param_ecran, pano_cameras = gestion_cmd_clavier(
  File "c:\Users\me\Programmation\livreTraitementImageOCVpython\opencv\opencv2\py_panoramique\panorama.py", line 558, in gestion_cmd_clavier
    init_panorama(liste_images, nouveau_pano)
  File "c:\Users\me\Programmation\livreTraitementImageOCVpython\opencv\opencv2\py_panoramique\panorama.py", line 302, in init_panorama
    algo_apparier = cv.detail_AffineBestOf2NearestMatcher(
TypeError: Argument 'try_use_gpu' is not convertable to bool

thanks for your help.

1 Like

i have not tried, but looking at the docs, this:

probably should be :

        algo_apparier = cv.detail_AffineBestOf2NearestMatcher(
            False, # not affine
            pano.try_cuda,
            pano.seuil_appariement)
1 Like

The code is running great now,i was thinking it was more difficult to debug it.
Thanks Berak.

1 Like

maybe you can try to make a pr at the book’s github repo, so others can profit too

1 Like

Yes it’s good idea.The best book i read for programing was reread before publication.

1 Like

/cc @laurent.berger

I’m sorry that’s not the best book :grinning:
I’m sure that’s you can find a better example for same purpose elsewhere :

Thanks @berak

It is not my favorite book, but I want an opencv4 version in c++ in French