Real-time Object Detection - OpenCV Object Detection in Games #5

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

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

  • @unrivalledsuperhottie4716
    @unrivalledsuperhottie4716 3 года назад +32

    I have been developing Python programs for a year, and have studied this subject for many many years before. I just wish every single tutorial on difficult topics were as good as this series is. Absolutely amazing. All the important details are here and important parts explained, I never had this much of an easy time following a coding series.

  • @Alexander_Meyer
    @Alexander_Meyer 4 года назад +35

    Looking sharp with the new hair my man!

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +8

      Thanks! Pretty stoked that my haircut placed opened back up last week.

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

      Awesome Video. Please how can i increase FPS ? Im running at 1.5fps. all functions works but fps its low. help please

  • @Гусьэкономит
    @Гусьэкономит Год назад +7

    It has been two years already, where is the continuation? Why did you abandon your channel? You explain better than all my teachers! You're the best! It has been 2 years already, perhaps you have improved object detection, bot performance, and their movement between points, or maybe there's something else interesting to see!

    • @北极-q4j
      @北极-q4j 3 месяца назад +1

      i feel the same man

  • @dieweltentdecker5878
    @dieweltentdecker5878 4 года назад +21

    Yeah, finally a new video. I've been waiting for this video for 2 weeks. When are new videos coming?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +14

      Glad you look forward to these! I've got a big work project due at the end of the month, so it'll probably be another two weeks before the next one unfortunately.

  • @johngalt5602
    @johngalt5602 3 года назад +3

    Your videos are better than any paid service. This is great!

  • @scoringdigitsson.5194
    @scoringdigitsson.5194 4 года назад +18

    Your contents are top notch. You deserve more subs!

  • @thezichko3476
    @thezichko3476 4 года назад +6

    Hey, I'd like to thank you very much. I've been wanting to learn to code for a while but have felt so small compared to how powerful programming can be. I'm extremely thankful for your videos. I'm now taking what I've been learning from you and other talented people to help me with my robotic/AI ideas I've been dreaming of for a long time now. Who knew it took learning code by playing games would be one of the best ways for me to learn but it helped a ton. Thank you! I still get annoyed with the code still but I take a break and a few hours or the next day I've figured it out.

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

      Taking breaks is an important part of coding, for sure. Glad my videos have been helpful for you!

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

      @@LearnCodeByGaming hello bro would you give me a hand? A thousand thanks

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

      @@LearnCodeByGaming Hello bro! Awesome video. I'm learning a lot from it. Whell, i'm trying to crop the screesnhot to read just re LifeValue with pyteserract. But when i try, i cannot cut the image properyly
      cDC.BitBlt((0, 0), (self.w, self.h), dcObj, (self.cropped_x, self.cropped_y), win32con.SRCCOPY)
      When i change this, nothing changes. Please help 😁🙏

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

      I already have a code that works, from the another project which saved the screenshot in HD or SSD. but too slow. Then when i try in this Real-Time the FPS goes from 4 to 0.70. I will try to do some Multiprocessing to this slow function run alone

  • @Lasnikers
    @Lasnikers 4 года назад +6

    I love the tutorials and I am just watching and not even coding along (I only program in Java)

  • @user-br6vh5ix9u
    @user-br6vh5ix9u 4 года назад +2

    I created a farming bot for an mmo that clears a stage of bad guys, and at the end runs around to look for a relic and go to it to leave the mission. I used 3 needle images at different distances, but it is extremely hard for the bot to find since the relic has fire coming out of it and the level is on a fiery magma rock surface. Im really excited for the next video, because this has really been the final frontier for my bot that I can't seem to get through as well as id like. Thank you for the great content.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      That sounds awesome! I think I've got some ideas in the next couple videos that will help you.

  • @sensbo
    @sensbo 4 года назад +1

    I stopped already coding 10 years ago and doing other things. I started playing a game some month ago which consumes a lot of time and look for opportunities for automate it... and agian think about to start coding with the new tools, like py. Its a loop which will never ends... thank you for sharing that tutorial.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Games are supposed to be fun, I hate when they add grinds. But then automating the grinds can become more fun than the game itself. Thanks for watching!

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

    you're one of my favorite programmers on youtube! thanks for the video and nice hair!

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

    Wow this video is worth watching. I can't believe that a lecture with this quality is just uploaded on RUclips for free!

  • @TypicallyThomas
    @TypicallyThomas Год назад +2

    I nearly cried when you said the solution for the black screen issue is to just default to a full screen capture. The specific game I'm trying this with won't work with that method, and it also has the black screen bug, so I guess I just can't do my project. This video series is like the 20th resource I found for this and looked the most promising. If this is the only solution you have, I guess I'm on a fool's errand here

  • @kelvinmandlik6633
    @kelvinmandlik6633 4 года назад +1

    Finally dude i have been waiting for this so long
    I have watched the video entirely but don't stop this series please.
    Waiting for next one,
    by the way, nice video

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

    You're an EXCELLENT teacher. Thank you!

  • @eduardopetecof4927
    @eduardopetecof4927 4 года назад +4

    Very nice series, I'm really enjoying it and learning at lot too. Thanks for putting all the effort into these videos. I'm strugling a bit to adapt the WindowCapture code to my Ubuntu OS, but hopefully I will get there. I can feel Deep Learning coming and I can't wait to see it :)

  • @Ab-cj6gl
    @Ab-cj6gl 3 года назад

    man this channel is fooking amazing
    extremely underrated

  • @Furrierity
    @Furrierity 4 года назад +12

    tyy benn mateee!

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

    This is great stuff, commenting so youtube algorithms show it to more people :)

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

    I learned more on Python from you than in our actual university. lmao
    I'm 3 years late but thank you for making this series.

  • @thanhhaphan5183
    @thanhhaphan5183 4 года назад +1

    Cant wait to watch the video. Thanks Ben!

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

    Yes it's here!!!!!!!! Thanks Ben

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Yes, finally here! Thanks for watching Joe

    • @s1ack3r07
      @s1ack3r07 4 года назад

      @@LearnCodeByGaming Setup an interesting function to help randomize click locations for targets found with the opencv techniques you've gone over. Hoping this will help with potential detection for services I may or may not be using this technology with ;)

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      @@s1ack3r07 Awesome!

    • @emiliomota2459
      @emiliomota2459 4 года назад

      @@s1ack3r07 you could use pyautogui click relative position function, and use the random library withing a range to click it.

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

    Please come back, we miss you

  • @Nish-d1y
    @Nish-d1y 10 месяцев назад

    You are awesome "Ben", thanks for amazing learning session!

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

    you should definitely try machine learning with yolov5 for object detection. this is much more powerful than template matching and can address some of the issues you mentioned at the end. also would make for a great vid! solid video already, well deserved sub!

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

    If you're having trouble viewing your vision window because it's too large, you can resize your screenshot just before calling imshow by using
    screenshot = cv.resize(screenshot, (new_width, new_height))

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

    As usual, amazing content!

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

    Man, you are amazing, as a beginner I learned a lot.

  • @cetusipy9484
    @cetusipy9484 2 года назад +10

    Careful around 7 minutes when he's first testing the live capture of the new image, in the previous tutorials he used PNG and made note of it as important. In this one he's switched to JPG, and CV2 will error if you use PNG as it's expecting the images in certain formats.

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

      i do have the exact problem now, but i dont understand where i have to change something, because at that point there is nowhere any mention of filetype

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

      @@locutusvonborg2k3 Don't change anything, just make sure your needle image is in JPG format

    • @spikips9375
      @spikips9375 Год назад +2

      took me 5 hours to figure this one out

  • @Zeeye
    @Zeeye 4 года назад +1

    Great video, can't wait for the next

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

    quick tip: use Windows+Shift+S to grab cropped screen regions directly without the need to fiddle with ms paint afterwards

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

    I have been following line by line. This is great!

  • @Zeeye
    @Zeeye 4 года назад +4

    Yes!

  • @maksiplus
    @maksiplus 4 года назад

    Its cool, man
    Please don't stop) waiting for new videos
    I'm writing on java , but your videos helping me to understand how it works

  • @fabiorodrigo3638
    @fabiorodrigo3638 3 года назад +16

    Still getting a black screen. The script certanly finds the window, but its all black. Anyone else with the same problem?

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

      yeah i do too

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

      I have the same problem

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

      You can’t minimize the window you’re capturing. Could that be the issue?

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

      @@Brakerjw That's not my issue in any case. Even just maximised and in focus, it's not working

    • @abdelkaderguellati5164
      @abdelkaderguellati5164 11 месяцев назад

      Anyone fond the solution to this problem

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

    Yesssss!!!

  • @ahmadalsheikhali4424
    @ahmadalsheikhali4424 4 года назад +1

    OMG, really amazing way to learn python
    thanks a lot

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

    This channel is incredibly useful, thanks a bunch bro

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

    THANKS for this AWESOME tutorial!!!!

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

    I really like the way you teach, nice video series!

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

    What I usually do with vision algorithms is wrap the code with try catch blocks and listen for 'keyboard exceptions' or something like that for me to be able to have that "press q to close" functionality instead of sleeping for 1ms with the cv.waitKey() function because that can be hurting your fps. Might be a good thing to try out to improve the performance.

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

      Interesting idea here. Wondering if you could provide a code snippet for this concept. Thanks

  • @afterglow1390
    @afterglow1390 4 года назад +1

    Great work Ben !

  • @KentuckyFriedClips
    @KentuckyFriedClips 11 месяцев назад

    Dude you’re amazing!

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

    Yaaay! Thanks thanks!!

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

    yessssssssss, dudeeee

  • @OFadigas
    @OFadigas 4 года назад +1

    NICE!!!! I was looking forward to this!!! When the next video will go up? :D

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Thanks for keeping tabs on the channel! Will probably be two weeks before the next one is up. Got a big client project due at the end of this month that I need to focus on first.

    • @OFadigas
      @OFadigas 4 года назад

      @@LearnCodeByGaming No problem, I will be here when it comes

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

    Videos are 10/10 great content.

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

    Another great video Ben...

  • @romeoaringo6370
    @romeoaringo6370 4 года назад +4

    yolov3 object detection tutorial would be great

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Yeah it would be! That's definitely on my list of video ideas. Thanks for letting me know what you want to see.

  • @SumitYadav-ik2df
    @SumitYadav-ik2df 4 года назад +1

    Oh finally we're getting close to the end 😂. Yeah so I really want to make an gathering ai. So as your video has helped me alot since the game I was trying to make an bot is albion online and you're working on it. Sooo if it's ever possible can you make a video where the code identifies the nodes ( which it already does ) and then makes our character move towards it on its own and collect it. All on itself because that's what I wanted to do. And so far I'm also stuck on this place because I don't know coding alot so your video is helping me a lot ....that's why if you can teach how to make the character move towards the identified item that would be helpful because I want to make a lot of ai that do the gathering on their own and staring with albion ...I'll have a great start as it has a lot of problems soo it's a good place to start and you're good at explaining the" why, what and how" of it.....so I'm really looking forward to the movement part of the series

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

      Yeah that's where I plan on ending this series, with the automated collection working. I think it'll be three more videos total.

    • @SumitYadav-ik2df
      @SumitYadav-ik2df 4 года назад

      @@LearnCodeByGaming yeah I saw that . You told that somewhere ...I forgot where I saw that. But I'm following you for this series 😄

  • @saint-jiub
    @saint-jiub 4 года назад +6

    I found one (possible) bug that may throw people off when using this version of the code. Please let me know if I'm misunderstanding, or if there is a better way of input validation for matchTemplate.
    Here is the scenario,
    In vision.py, under the .find() method, line 29
    If you start the script using a needle img you know won't work and matchTemplate CANNOT locate the needle image in our haystack window, it will throw an error and stop the script with "(-215:Assertion failed) (depth == CV8U || depth == CV_32F) && type == _templ.type() && img_dism()

    • @orion7317
      @orion7317 4 года назад +1

      I also found this an issue unfortunately. In my case, it also presents an error even when searching for an image that should be in the feed. I am not as familiar with OpenCV, but it might have something to do with dropping the alpha channel and making the image C_CONTIGUOUS because if you comment these 2 lines out: # img = img[..., :3], # img = np.ascontiguousarray(img) in the windowcapture.py file, the program will run. Doing this however, I am now experiencing a new issue which I haven't had time to look into yet where it fails draw rectangles around an object the system logs as detected.

    • @Daniel-nv9fl
      @Daniel-nv9fl 3 года назад +1

      @@orion7317 also having this issue and don't really understand how to get past this and I'm also sure the issue has to do with the changes done to the img in the windowcapture class. Please let me know if you guys came up with a more functional workaround please!

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

      I deleted img = img[...,:3] and img = np.ascontiguousarray(img) from window capture class and now it somewhat works, the fps is down from 30 to 5, but no window pops up

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

      @@jugarucristi1 so its pointless

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

      @@Daniel-nv9fl Great its also work for me, thank you! I notice when my needle image is PNG I need comment or delete line with img = img[...,:3] and img = np.ascontiguousarray(img) in windowcapture.py. But if I have image in JPEG format I don't need to delete or comment it.
      @Alekaditez Ben in video also has FPS drop when start program so it's part of journey :)

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

    Thanks man. Really helpful

  • @Daniel-nv9fl
    @Daniel-nv9fl 3 года назад +1

    Can't get my Find click positions right. I'm getting back an error:
    result = cv.matchTemplate(haystack_img, needle_img, cv.TM_CCOEFF_NORMED)
    cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-h4wtvo23\opencv\modules\imgproc\src\templmatch.cpp:1163: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims()

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

    You are a legend.

  • @emiliomota2459
    @emiliomota2459 4 года назад +1

    you also could do what i did in a game, just modify a image file of the thing you search in the game, like a mod, and the n recognize that. Also, you could use a lot of templates for searching in a for loop, and when one templates matches, then use that template only until the algorithm doesnt recognize the template anymore because of changes in day, night, etc, this way you could keep your performace but also make the code adaptable to the situations, thanks for the tutorials, you rock man.
    what do you think of those sugestions ?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      Yeah those are really good ideas!

    • @emiliomota2459
      @emiliomota2459 4 года назад +1

      @@LearnCodeByGaming thanks man, keep the good work, i am a big fan.

    • @hiscockanthony97
      @hiscockanthony97 4 года назад

      What would the for loop look like? I have a pretty good script down but I’m tying to understand an efficient way to cycle through multiple needle images or templates or something

    • @emiliomota2459
      @emiliomota2459 4 года назад

      @@hiscockanthony97 it is hard to explain in words XD, but you could make a for loop that runs trough a list of your needle images and make a recognition, if the recognition is done with one image, break the for loop, return the image you need in a variable manner. and enter an outer while loop where you use the image that generated a match for image recognition till you cant find the image again, then you do the for loop again, it could be done inside a function

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

    Thank you dude

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

    bro you do an amazing work, trank you!!

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

    YOUR CODE IS GENIOUS

  • @hmoreno3508
    @hmoreno3508 4 года назад +1

    Awesome videos! Is Video #6 coming soon? Would like to learn how to click random points within the object and learn how to create steps. such as,
    Step 1.Find Wood
    Step 2.Click Wood
    Step 3.Gather wood
    Step 4. sleep for 10 minutes
    Start all over again.

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

    excellent content, congratulations

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

    Great videos! Do you plan to use this with machine learning?

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

      Thanks! I'm not going to get to machine learning in this series, but I definitely want to do a lot of machine learning content on my channel.

  • @КириллИванов-ы9с4ъ
    @КириллИванов-ы9с4ъ 4 года назад

    Dude you are genious!

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

    When I run the code instead of one window a lot of windows open up. How can I fix this?

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

    Hey again Ben, needless to mention this series is just epic! Thanks!
    I have a few questions.
    1. For simplicity, let's say u want to detect one of your 2D icons from that top right menu bar (for example that mail icon). After you took a screenshot of that icon and implemented this into your code, you are now successfully detecting the icon. Now, if I have a different monitor with different resolution (thus size matters) and I'm trying to run the same code with the same icon screenshot, it wouldn't work, right? So my question is, how can take a picture of an object and make sure it will be detected among all screen resolutions?
    Maybe there's a way to convert the sampled image (the mail icon) and the surface image (the game screen frame) to some sort of a "binary pattern" that doesn't rely on pixel color so that they will be treated equally and the size won't matter?
    2. How do you use a png image (transparent background, and non-'squared') as your target object to detect?
    Thanks!

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Hey Shay. For #1, I can't find anything OpenCV has built-in for that kind of multi-scale template matching, so you'd need to do it yourself. Basically you'd make a loop that resizes your needle image, looks for that using match template, and then continues that process until your image is found. That might be faster if you first convert the images to black and white (so the binary pattern like you suggest) using something like canny edge detection.
      For #2, my understanding is that OpenCV can load transparent png files no problem with imread(), as long as you provide the IMREAD_UNCHANGED flag. But imshow() and matchTemplate() will give you some trouble. Match template has an optional mask argument, and I think you'd need to provide that along with your needle image in order to correctly ignore those pixels that aren't of interest.

    • @ShayRubachOfficial
      @ShayRubachOfficial 4 года назад +1

      @@LearnCodeByGaming I've already found a possible solution to (1) that indeed involves scaling the image up/down. Working on it a the moment. Thanks a lot man!!

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

      @@ShayRubachOfficial Hi. Did you find a way to use a png image as the target?

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

      @@s0ld1er16 oh that was so long ago I couldn't even remember :/ sorry

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

      @@ShayRubachOfficial what about first question? :D

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

    I got a black screen again

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

    I have had an issue with Chrome giving a black screen when captured. If you disable Hardware Acceleration, the capture of Chrome as a window works fine.

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

    Thank you sensei.

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

    This series is great! I have followed along and learnt a lot, but I have ended up stuck! I am getting an error even if I copy and paste your code, for a opencv assertion around "(-215:Assertion failed) (depth == CV_8U || depth == CV_32F)...."
    I am struggling to fix this so bad!

    • @PanicNvm
      @PanicNvm 3 года назад +5

      Funnily I just figured it out! it was an issue inside of the __init__ for the cv.imread. I fixed it by removing the "cv.IMREAD_UNCHANGED"

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

      @@PanicNvm What did you change it too? I'm having the same issue

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

      @@matthew4030 I just removed it 🙂

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

      @@PanicNvm Perfect thanks so much! I'm working again!

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

      @@PanicNvm do u mean inside the vision __init__ im struggling pretty hard with this too

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

    Awesome!

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

    Solution to this error "error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims()

    • @RedditNovelties
      @RedditNovelties 2 года назад +2

      Thank you!! I was about to have a mental breakdown trying to figure out what the issue was LOL

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

    Nice
    Ur my inspiration

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

    I have a black Result Screen what I make false?

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

      did you fix this issue, i got black screen too.

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

    Great tutorial series! I have a question...What if I wanted to capture from a my Avermedia Capture Card instead of game window?

  • @frankcasanova2132
    @frankcasanova2132 4 года назад

    GREAT!

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

    very nice explanation
    Can you explain how to send commands via adb?

  • @tacticalcatboy
    @tacticalcatboy 9 месяцев назад

    window capture is not working for me, i think its because the window name is too long? is there a way i can make it find the process instead?

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

    Would the image detection method be effective for detecting in-game text? Specifically, the goal is to locate an item named [DARK ARMOUR], which has a 1/100 chance of appearing on the screen when clicking. To achieve this, it is necessary to click rapidly to cycle through all ARMOUR types until [DARK ARMOUR] appears on the screen. The question remains, however, as to the speed at which clicks must be made in order to not miss this specific type.
    I hope I was clear to what I wanted

  • @MichalAaa
    @MichalAaa 5 месяцев назад

    Hi! I did everything just as in the tutorial, but when capturing the Google Chrome window I still have only black screen. Any tips how to fix it?

  • @cedricjonckers752
    @cedricjonckers752 4 года назад

    Dear Ben, amazing video! I had one quick question about the beginning (part 1) of this series: the results don't show the whole picture, but only the top left area of the original (I saw this is the same for you in this video). My screen is 1920x1080 And I search an image around pixel(1900,1000), however, this part of the picture is not in the result (and therefore also not in the max_loc and max_value). Have you got any clue how to solve this? Huge thankyou in advance, kind regards. You're doing amazing!

  • @alexkowalczyk8618
    @alexkowalczyk8618 4 года назад

    Good stuff

  • @sgteamx
    @sgteamx 4 года назад +1

    One if the issues i've faced jus to share is that when importing pyautogui in main.py, it changes to 100% dpi when the windows system is at 125% dpi.
    Will need to change your system to 100% dpi if not matches screen just has the actual screen on top left.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      Yeah that's good to note. I think Windows defaults to 125% for some reason and that has caused problems for many people.

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

    amazing thank u

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

    Is it possible to feed the program a file of "needles" (multiple images) without an impact to frame-rate?
    Thanks for the video!

    • @Lefinno
      @Lefinno 4 года назад

      I had the same problem, but one possible solution(which I used) is that if you know the area the match will show up(for example gui), try limiting the search area to be smaller and to the general vicinity of the occurance. This is due to the fact that match template is essentially opencv matching pixel for pixel to check for an exact match(to my understanding, maybe wrong). so if the pixel count of your 'haystack' is smaller, the less it impacts the framerate(the faster it searches through the image). An alternative solution other than limiting the size of the 'haystack' is to reduce the resolution of both the 'haystack' and the 'needle', putting them under the exact transformation(or the matching won't work) or just extract your needle from the already processed 'haystack', this solution is less accurate, if the resolution is too low, the exact set of the pixel will have a higher chance to occur therefore picking up false positives. Either way, the goal is to reduce the total pixel count and dimension for opencv to process through to reduce the processing time. Hope that solves your probelm~

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

    @Learn Code By Gaming Can we draw these rectangles as an overlay on the actual game screen instead of inside the python window?

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

      Interesting idea...so you can just watch what the bot is thinking as it works...

  • @OToep
    @OToep 2 месяца назад

    When Vision appears, I get a black screen. How can I fix this please!

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

    So with the fix at the beginning of this video, I'm able to make my program work. But the issue being that if I want it to work effectively, as in the screen is still usable while its doing its thing, I need to be able to capture that window specifically. So my question is, understanding that this has aged, has there been a development in finding a solution to do just that?
    My bot currently searches my game to determine when a match queue has popped and then accepts it for them. So not worrying about covering the screen would be a boon.

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

    I changed the image as well as the window where it is supposed to look for it but it gives me errors I don't even know.

  • @hiscockanthony97
    @hiscockanthony97 4 года назад

    How could I check a specific pixel color? Do I need to use coords from the game window or the window capture window. How would I do that? Also amazing video! was thinking
    prayer_loc = prayer_orb.find(screenshot,.8,'points')
    new_cord = (prayer_loc[0][0],prayer_loc[0][1])
    new_x,new_y = wincap.get_screen_position(new_cord)
    if np.any(screenshot[new_x+12, new_y] == 0):
    prayer()

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

    Hey after all the coding I get this error:
    cv2.error: OpenCV(4.5.3) C:\Users
    unneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\imgproc\src\templmatch.cpp:1164: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims()

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

    hi , it worke once for me, now i have just black creen ny ideas ?, sometims it show statc img from other window

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

    I've been trying to implement this with RuneLite and I've run into some.. interesting issues. Initially, it captured perfectly. Then when I shifted some files around it broke and was capturing a black screen. I wasn't concerned because I read the pinned comment on the previous video. Now however, the capture is artifacting as if there was a GPU driver failure. It's very bizarre and I'm not quite sure how to fix it.

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

    Hey Ben, came back here to ask another question :)
    1. Lets say my screen is 1920x1080. Now, if I only want to capture and process 100x100 pixel of the center of my screen - will performance (time to capture and process - essentially FPS) will be faster/higher?
    2. Regarding the same subject - how exactly do I only capture a certain part of the screen (lets stick with the example of that 100x100 in the middle of my screen)? I've noticed I can play with the self.w and self.h (and the offsets) of the WindowCapture class but I always have a black screen leftovers and the FPS seems to be low/slow.
    love your vids!
    Thanks!

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

      If you're trying to make an aimbot you want to be capturing your entire screen. Other than that I'm not sure.

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

      @@alekaditez3830 not necessarily an aimbot, but a snap-to-target in a certain radius of it (on the screen). So not the "usual" aimbot you were thinking of but tnx :)

  • @tinatipton3291
    @tinatipton3291 2 года назад +2

    I'm uncertain if I'm just not understanding this correctly but for the lines that specify the needle_img_path and haystack_image, etc, am I supposed to be substituting say haystack for screenshot, if so where is that specified, because as far as I can tell it isn't specified in main or in get_screenshot in windowcapture? As well, do I need to change the needle_img to whatever my template is? For instance in the self.needle_img = cv.imread(needle_img_path) should it be self.needle_img = cv.imread('template.png', cv.IMREAD_UNCHANGED). If anyone knows the answer to this it would be greatly appreciated thanks.

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

      Nevermind, I got it solved, I came upon the issue of it struggling with the match template feature but I solved it by taking cv.IMREAD_UNCHANGED out of the cv.imread part.

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

      @@tinatipton3291Thank you so much I had the
      cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\templmatch.cpp:1164: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims()

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

      @@h4m719 it fixed? I need help it

  • @user-db9hn8kf5d
    @user-db9hn8kf5d 4 года назад

    Hey I have a question. My code detects the objects then I have it set up to click on the object. However it starts spam clicking because it keeps continuing through the while loop.
    Ideally I’d like to be able to run a sleep function after I click and detect again for another needle after a few seconds, but when I try that the screen capture window crashes.

  • @u13e12
    @u13e12 4 года назад +1

    I am trying to combine this with pyautogui to click on the object that vision detects. I am finding if I just use the cordinates that vision returns, the mouse moves to a point above what I want to click. I just did some subtraction to adjust for this but I can't figure out why this adjustment is necessary.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Someone else had this problem and it turned out they had their zoom level set to 125% somewhere in the Windows settings. You might look into that.

  • @RainDevs
    @RainDevs 4 года назад +1

    I've got something I would love to have you try. Its a problem I've been working towards solving with opencv image recognition. Can you think of a way to ignore transparent pictures of an image? I'm trying to find a near stationary object but the background around the object and moving and changing. Any suggestions for this issue would be fantastic. I can get it to recognize sometimes if I check multiple images but often its too slow and misses the object before it disappears.

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

      Hey so I just noticed that matchTemplate() has an optional mask parameter. I think if you provide that mask to ignore the parts of your needle image that should be transparent, that should give you the results you're looking for. If you try this out let me know how it goes!

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

    I would like to count how many times player click on "buy" button. But once "buy" button is hold, count is double up, triple up and so on. It is possible to manipulate somehow so that it is counted once, or i should implement any "on click" event? regards

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

    Any chance you can help with this? I am getting this error after changing the Window name and changing the image used to check the screen shot with.
    error: (-215:Assertion failed)
    points = vision_limestone.find(screenshot, 0.5, 'rectangles')
    result = cv.matchTemplate(haystack_img, self.needle_img, self.method)

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

    genius

  • @outstanding1403
    @outstanding1403 4 года назад +4

    Please go train a model and search for it in Albion

    • @dieweltentdecker5878
      @dieweltentdecker5878 4 года назад +1

      Ganja Kurier Good Idea the last Tutorial is 3 Years old.

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

      I want to cover a few other techniques first, but I may get to machine learning on this project down the line. Thanks for watching!

    • @outstanding1403
      @outstanding1403 4 года назад +1

      @@LearnCodeByGaming I hope so because your videos are the bset

    • @Ehxx
      @Ehxx 4 года назад

      I have a weight trained for chickens in rs, its 300mb or so though and seems pretty slow to load, some people have made weights down to 30mb that work somehow. Opencv is probably your best bet for now, not to mention getting a tensorflow version, cuda, etc to all work together is a nightmare.

    • @hiscockanthony97
      @hiscockanthony97 4 года назад

      EX E would you be able to answer a couple questions I have about opencv? I’m trying to do a similar thing as a first starter project but feel like I’m missing something. If ya can add me on discord: ToeAsiago#4748