How to locate an object on a screenshot using Python, OpenCV & PyAutoGUI

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 38

  • @storyks
    @storyks 2 года назад +4

    thanks for the knowledge You teach very easy to understand.

  • @robr9313
    @robr9313 2 года назад +6

    Thank you, solved all my issues.

  • @naveenvarmaa
    @naveenvarmaa 3 года назад +6

    Very Informative

  • @W-meme
    @W-meme 3 года назад +1

    How to use x and y separately in locate on screen. EDIT: Got it you explained in the video. Thanks a lot.

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  3 года назад

      Cool) Feel free to inspect my chess programming channel if you're interested:
      ruclips.net/channel/UCB9-prLkPwgvlKKqDgXhsMQ

    • @W-meme
      @W-meme 3 года назад

      @@monkey_see_monkey_do please help error cannot unpack non iterable numpy.int64 object

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  3 года назад

      @@W-meme are you running my code? Or how are you getting this error? This tutorial is intended to follow step by step in order to come up with the pattern recognition so if you just grab the code and try to run it then it shouldn't work because of relying on the EXACT screenshot. In your environment you probably have it slightly different hence it's not working. It's only a guess though. So you just try to follow step by step and if the error occurs descibe it in MORE details because without having an idea of what exactly you're doing it's hard to figure out what's going wrong.

    • @W-meme
      @W-meme 3 года назад

      @@monkey_see_monkey_do thanks for replying, I'm assigning variables the values of these points because I'm cropping from multiple locateonscreen bpundaries. Somehow running for loop and using locateonscreen as array works. Assigning x and y bound.left and bound.right .

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  3 года назад

      @@W-meme I would've sptitted image into parts and then processed it part by part. You just try to locate object on one image first and when it works go for next image.

  • @python360
    @python360 3 года назад +4

    This is fantastic man. This is a great evolution from web scraping.
    I had to work out how to extract text from a video, but getting an image from a video is very cool. This could have many ML implementations as well?

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  3 года назад +1

      Yup, sure and extracting text should be easy as well if it's not a handwriting. I believe that potentially it can be done using template matching from built-in opencv functions)

  • @pranayasinangwidhi9840
    @pranayasinangwidhi9840 Год назад +1

    Can you help me? I made pretty much the same thing. Mine screenshot the detected image (or rather take a full screenshot and then cut the detected part) I used confidence 0.65 and it works well. But everytime there is a slight difference to the detected object, it either doesn't detect or doesn't detect well. I am trying to use AI for the detection. but I don't know how. Can you help me?

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  Год назад +1

      I'd love to but I don't know how because just adjusting confidence was fairly enough for my needs.

  • @am-kl2lg
    @am-kl2lg 2 года назад

    Hi, did you tryed useing this software on a different monitor with another screen scale? I'm haveing some problems when i switch from laptop monitor to external monitor

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  2 года назад +1

      It needs to be initialized on every new monitor because it relies on the absolute coordinates.

  • @EscoladoDiaaDia
    @EscoladoDiaaDia 2 года назад

    Excellent video! I would like to know how you can click on a specific pawn and move it. How to differentiate it from others? Thank you very much

  • @errorgradov8050
    @errorgradov8050 Год назад

    Bro i got problem ,when i try to print the width of object it says "'Point' object doesn't have attribute 'width'" could you please help me?

  • @nahuelastor7522
    @nahuelastor7522 Год назад

    I have that problem. When I install OpenCV python stop working in all my proyects. So I have to uninstall python, delete the folders and re-install python

  • @МактумАль-Норсафи
    @МактумАль-Норсафи 2 года назад

    It's fine, thanks!

  • @MrSanman28
    @MrSanman28 2 года назад

    Can the found objects be kept and remove everything else?

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  2 года назад

      Yes

    • @MrSanman28
      @MrSanman28 2 года назад

      @@monkey_see_monkey_do do you have a video on how to?

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  2 года назад

      @@MrSanman28 no, you can use the code to draw red rectangle to capture the desired part of the image to store it, then remove the initial picture, or even don't - just write the desired part into file.

  • @theboss4ever99
    @theboss4ever99 3 года назад +2

    This is a really nice implementation, Kindly help me extract the images of chess puzzles from pdf and then turn them into chess fen and then chess diagram.

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  3 года назад +1

      Glad it helps. I have a chess programming dedicated channel: ruclips.net/channel/UCB9-prLkPwgvlKKqDgXhsMQ maybe you'll get interested.

    • @theboss4ever99
      @theboss4ever99 3 года назад

      @@monkey_see_monkey_do.. I have seen few of them, I want 2 know the specific which I mentioned above. If u relate any video would that It will be really great help for me.

  • @mrsnappy9977
    @mrsnappy9977 2 года назад

    i am trying to do the same thing but not from a ss but from a file and using cv2.imread instead of pyautogui.screenshot does not seem to work.Can anyone help me?

    • @monkey_see_monkey_do
      @monkey_see_monkey_do  2 года назад

      Check out image encoding. When you do screenshot you need additional conversions, with file read open v already opens a file in a preferred representation.

    • @mrsnappy9977
      @mrsnappy9977 2 года назад

      @@monkey_see_monkey_do Ok i will check that out. Thanks!

    • @MrWafflero
      @MrWafflero 2 года назад

      do you have an update ? im having the same issue

    • @gambarimas
      @gambarimas 2 года назад

      I think you can find a way in this video ruclips.net/video/vXqKniVe6P8/видео.html

  • @poornimavemula67
    @poornimavemula67 2 года назад

    Can u send me the code for finding missing objects in an image

  • @ОЛЕГМАНГАЛ-н7ф
    @ОЛЕГМАНГАЛ-н7ф Год назад

    обнял