Bonkeyzz / opencv_poketwofinder

Helper to identify Pokétwo spawns with OpenCV.
3 stars 2 forks source link

edit: very inefficient/wrong identifications #2

Open Pranjal-SB opened 11 months ago

Pranjal-SB commented 11 months ago
Traceback (most recent call last):
  File "stuf/matcher.py", line 1, in <module>
    import cv2
  File "stuf/.pythonlibs/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "stuf/.pythonlibs/lib/python3.10/site-packages/cv2/__init__.py", line 111, in bootstrap
    load_first_config(['config.py'], True)
  File "stuf/.pythonlibs/lib/python3.10/site-packages/cv2/__init__.py", line 109, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.
Pranjal-SB commented 11 months ago

when i do python3 matcher.py i get that error

Pranjal-SB commented 11 months ago

i researched a bit and found out that this error mostly comes only in replit which i am using 😅 lol but still if you could help i would be glad

Pranjal-SB commented 11 months ago

i tried running on my pc and after a long load of all the templates i could find i got this different error

[*] Loaded "./templates/Wartortle.png"!
[*] Loaded "./templates/Watchog.png"!
[*] Loaded "./templates/Wattrel.png"!
[*] Loaded "./templates/Weavile.png"!
[*] Loaded "./templates/Weedle.png"!
[*] Loaded "./templates/Weepinbell.png"!
[*] Loaded "./templates/Weezing.png"!
[*] Loaded "./templates/Whimsicott.png"!
[*] Loaded "./templates/Whirlipede.png"!
[*] Loaded "./templates/Whiscash.png"!
[*] Loaded "./templates/Whismur.png"!
[*] Loaded "./templates/Wigglytuff.png"!
[*] Loaded "./templates/Wiglett.png"!
[*] Loaded "./templates/Wimpod.png"!
[*] Loaded "./templates/Wingull.png"!
[*] Loaded "./templates/Wishiwashi.png"!
[*] Loaded "./templates/Wo-Chien.png"!
[*] Loaded "./templates/Wobbuffet.png"!
[*] Loaded "./templates/Woobat.png"!
[*] Loaded "./templates/Wooloo.png"!
[*] Loaded "./templates/Wooper.png"!
[*] Loaded "./templates/Wormadam.png"!
[*] Loaded "./templates/Wugtrio.png"!
[*] Loaded "./templates/Wurmple.png"!
[*] Loaded "./templates/Wynaut.png"!
[*] Loaded "./templates/Wyrdeer.png"!
[*] Loaded "./templates/Xatu.png"!
[*] Loaded "./templates/Xerneas.png"!
[*] Loaded "./templates/Xurkitree.png"!
[*] Loaded "./templates/Yamask.png"!
[*] Loaded "./templates/Yamper.png"!
[*] Loaded "./templates/Yanma.png"!
[*] Loaded "./templates/Yanmega.png"!
[*] Loaded "./templates/Yungoos.png"!
[*] Loaded "./templates/Yveltal.png"!
[*] Loaded "./templates/Zacian.png"!
[*] Loaded "./templates/Zamazenta.png"!
[*] Loaded "./templates/Zangoose.png"!
[*] Loaded "./templates/Zapdos.png"!
[*] Loaded "./templates/Zarude.png"!
[*] Loaded "./templates/Zebstrika.png"!
[*] Loaded "./templates/Zekrom.png"!
[*] Loaded "./templates/Zeraora.png"!
[*] Loaded "./templates/Zigzagoon.png"!
[*] Loaded "./templates/Zoroark.png"!
[*] Loaded "./templates/Zorua.png"!
[*] Loaded "./templates/Zubat.png"!
[*] Loaded "./templates/Zweilous.png"!
[*] Loaded "./templates/Zygarde.png"!
[*] Testing source: ./test_poketwo_spawns/poketwo_deino.png
Traceback (most recent call last):
  File "C:\Users\psbha\Documents\Stuff\opencv_poketwofinder-master\matcher.py", line 99, in <module>
    main()
  File "C:\Users\psbha\Documents\Stuff\opencv_poketwofinder-master\matcher.py", line 92, in main
    match_canditates.append({"name": str(template), "template": template.template, "result": check_matching(poketwo_spawn.template, template.template)})
                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\psbha\Documents\Stuff\opencv_poketwofinder-master\matcher.py", line 55, in check_matching
    kp1, kp2, matches = match_images(src, templ_flipped, False)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\psbha\Documents\Stuff\opencv_poketwofinder-master\matcher.py", line 12, in match_images
    matches = bf.match(des1, des2)
              ^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\batch_distance.cpp:275: error: (-215:Assertion failed) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function 'cv::batchDistance'
Pranjal-SB commented 11 months ago

checked google maybe its because i gave 1000 templates or smh maybe

Pranjal-SB commented 11 months ago

oh it was because of flabebe template it has those specia e s in her name so it didnt load correctly

Pranjal-SB commented 11 months ago

image bruh i have the exact deino image but this

Pranjal-SB commented 11 months ago
//......loads
[*] Testing source: ./test_poketwo_spawns/poketwo_deino.png
[*] Potential Match: 'Iron moth' with score: 139
Pranjal-SB commented 11 months ago

maybe most probably was becoz of the background

Pranjal-SB commented 11 months ago

image

new issue not right at all fr

Pranjal-SB commented 11 months ago

if there is any way to remove the bg before scan it may work better

Bonkeyzz commented 11 months ago

Hello!

image bruh i have the exact deino image but this

image

new issue not right at all fr

This python script currently does not have any instructions to follow when trying to match a source image containing a pokemon that it does not have a template for & it may output inaccurate results even with pre-existing templates, I was aware of that issue already and plan on fixing it at some point.

if there is any way to remove the bg before scan it may work better

I am not so sure if i will implement such feature, though its a maybe.

Thank you for the feedback!