That's not how CPUs/GPUs work :p The CPU cannot play GTA at ~10FPS, but can capture the desktop at 10FPS. The GPU is still being used to render the entire game at probably over 60FPS. Basically, 10FPS is how fast the GPU can copy over its framebuffer to the CPU/RAM and do some processing.
Danny Kong He wasnt talking abou igp on the proccesor, he was talking about the proccesor itself rendering the game EDIT: Which is kind of false, CPU is just displaying it on the CV
Bro, you are a God level programmer and I wish to be like you . Cool , humble Guy.... Really , Enjoyed your each and Every video.... You are freaking Awesome................................
Is edge detection the best way to find the road lanes? Wouldn't something that looks for large blocks of similar colour be more effective? I don't have any experience with neural networks, I'm just curious.
I wonder whether it would be useful to apply a wavelet transform after reading the image in order to represent it in a more efficient low-dimensional way. A wavelet transform could dramatically reduce the dimensionality of a representation of an image, which is why they are used in image compression. Maybe that would help with training the neural network more quickly or improving the speed on the AI.
To solve 8:23 this #largewindowissue add three lines before while loop from ctypes import windll us32=windll. user32 us32. SetProcessDPIAware() While True.........
How did you get gta 5 running? I would like to follow along with the tutorials. Also, thought you said candy edge detection, that would be a fun algorithm
i m getting this error .. Traceback (most recent call last): File "C:/Users/nsoni/Desktop/1.py", line 19, in process_screen = process_img(original_img) NameError: name 'original_img' is not defined >>>
I have a problem with PyAUtoGui, i am using windows python34 I did pip install pyautogui, everything was ok When I open cmd, write python, and doing import pyautogui everyting is ok, But when I am launching your scripts it gives me error: File "part-2-and-3-keyboard-input-and-basic-OpenCV.py", line 5, in import PyAutoGui ModuleNotFoundError: No module named 'PyAutoGui'
You don't NEED pyautogui. I am only using it because for some unknown reason it resizes my window proportionally and that's helpful for recording. You can just not import it.
hey thanks for the tutorial .I greatly enjoy your videos.Could you please do a special on using the Aruco module with opencv python or making your own bindings 'cause I think this might only be available in C++ and I kinda need ot for project (meaning all my work is based and I need it ready for next week ) you'd really help me out
pythonprogramming.net/loading-images-python-opencv-tutorial/, grab the appropriate wheel file for your setup from: www.lfd.uci.edu/~gohlke/pythonlibs/#opencv For example: opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl is opencv version 3.2, for python 3.6, and amd64 means your version of Python is 64bit.
Oh man, i really don't know how to program (just did a simple course) but this is so fascinating.. and so far it's "easy" to understand the basic behind it (let's find out if i can stick to that :D)
You can use code like this to draw the FPS on the image (to avoid the call to `print`): def draw_fps(image, frame_duration, position=(20, 20), font=cv2.FONT_HERSHEY_SIMPLEX, font_size=.5, text_color=(255, 255, 255)): text = 'FPS: {0:.2f}'.format(1 / frame_duration) cv2.putText(image, text, position, font, font_size, text_color) ... # Print FPS frame_duration = time.time() - last_time draw_fps(image, frame_duration) last_time = time.time()
Why does it take so much training data I wonder, I mean a human you're like "do this" once or twice and boom you've got a peasant washing plates for a living. Cool series learning a lot following. Also the human vs. computer question is rhetorical. edit: dumb question this isn't entirely on the fly right as you make the video? You've got another screen that you're looking at for reference, it seems like it, but regardless if Python is one of your primary languages then it makes sense to be so comfortable using it. I'm trying to follow the camelCase syntax where/when also the lack of semi-colons in Python is interesting.
Jacob David Cunningham if you ask a baby to wash plates he wouldn't even understand you. Our skill to learn simple tasks quick is result of years of training.
I don't know if when you say baby it's because of AI/Machine Learning's relatively early age or what... I obviously wasn't talking about babies if you can't understand English/language even that humans are visual you could show someone in another language by gesture how to do something but sure. As I mentioned my question isn't really a question.
The other thing is instinct. Isn't it cool how spiders know how to make a web without being taught how to weave one. I'm pretty sure they are not taught how to ie. a lone spider will figure out how to make a web. Also how deer can walk immediately when they're born versus humans that take possibly years.
I assume this is in response to my "the cpu is running GTA V." You're right, the CPU is just simply "displaying" the updating data, not actually doing any physics calcs...etc.
sentdex even I don't know,heck I'm just getting into programming but its just a hunch given the fact that it takes a fair bit of time to call the c routines then convert to Python code.So if there's any library or something which would enable people to use 2 totally different environments without the hassle of converting it to one form to another
Your tutorial is so clear.Thanks,I have learned a lot after watching your video.I want to ask for your permission to translate your video into Chinese and upload to some domestic websites of course I will put your channel link on..Because my country doesn't allow us to visit RUclips and not everyone is able to get a VPN.I'm waiting for your reply and it's ok if you don't want me to do this.
So I don't have windows, my laptop runs ubuntu, but if I had windows it would have run GTA 5. So, my main issue is whether the fact linux can't run games is going to be a factor?
you could do it for a different game that Linux can run if this one will not, I have no idea. There are many that run natively, and many more that will work well in wine.
There is a game on the N64 that has a cheat code that allows you to use a sort of black and white edge detection rendering algorithm like the one in this vid to play the game, honestly it is complete eye cancer because the blank areas are white instead of black :/ Also it lets in some texture on some surfaces so it's not really true edge detection but oh well I don't think that's what it's point was anyway
This series is gonna be the coolest yet.
yes
@@xtfeng5744 你也在呀
I don't know why I haven't across your channel yet. Your channel is the best thing. I have not seen something like this before.
I've been looking for a LinusTechTips of Software and i found new favourite channel. :D
Welcome good sir!
That's not how CPUs/GPUs work :p The CPU cannot play GTA at ~10FPS, but can capture the desktop at 10FPS. The GPU is still being used to render the entire game at probably over 60FPS. Basically, 10FPS is how fast the GPU can copy over its framebuffer to the CPU/RAM and do some processing.
Parad0x0217 I'm sure Python is adding some overhead to the process as well being an interpreted language and what not.
Complete sidebar when my nvidia drivers bricked without me realizing I still got 6-7 frames on my i5's integrated graphics
Danny Kong He wasnt talking abou igp on the proccesor, he was talking about the proccesor itself rendering the game
EDIT: Which is kind of false, CPU is just displaying it on the CV
@@jlewwis1995 also, python can run on one core only, so it's still quite impressive.
Bro, you are a God level programmer and I wish to be like you .
Cool , humble Guy....
Really , Enjoyed your each and Every video....
You are freaking Awesome................................
cv2.Canny automatically converts the passed-in image to grayscale (according to the documentation), so you're basically calling cv2.cvtColor twice ;)
Damn, you're right. Thanks for this correction.
if you ever going back to computer vision instead of neural network, try using mss instead of pillow for screen grab, it gives a lot better fps.
Amazing how much more performant it is! Thanks for sharing this.
You legitimately read my mind. I was looking for a good tutorial for this last night!
Is edge detection the best way to find the road lanes? Wouldn't something that looks for large blocks of similar colour be more effective? I don't have any experience with neural networks, I'm just curious.
that edge detection looked so cool
"you cant just throw neural networks at things" TRY ME! jokes aside this is what im doing now to learn :v
What is 0xFF doing?
oscarliang.com/what-s-the-use-of-and-0xff-in-programming-c-plus-p/
amazing stuff. Im like a caveman when it comes to programming! I use a raspberry pi when practicing
I wonder whether it would be useful to apply a wavelet transform after reading the image in order to represent it in a more efficient low-dimensional way. A wavelet transform could dramatically reduce the dimensionality of a representation of an image, which is why they are used in image compression. Maybe that would help with training the neural network more quickly or improving the speed on the AI.
To solve 8:23 this #largewindowissue add three lines before while loop
from ctypes import windll
us32=windll. user32
us32. SetProcessDPIAware()
While True.........
your fix at 8:30 is off screen, what was it you changed to fix the error?
It is possible to get the video feed from nvidia shadowplay? They save a temp file when recording
The threshold2 of 300 doesn't make sense cause there will never be a pixel with a value greater than 300, right? The max is 255.
How did you get gta 5 running? I would like to follow along with the tutorials. Also, thought you said candy edge detection, that would be a fun algorithm
AmCan Tech Videos Candy Edge Detection Saga ;)
Haha. I should work on that, just for the hell of it.
i m getting this error ..
Traceback (most recent call last):
File "C:/Users/nsoni/Desktop/1.py", line 19, in
process_screen = process_img(original_img)
NameError: name 'original_img' is not defined
>>>
the code is process_screen = process_img(screen)
the argument given to the process_img function should the screen we are capturing,
I have a problem with PyAUtoGui, i am using windows python34
I did pip install pyautogui, everything was ok
When I open cmd, write python, and doing import pyautogui everyting is ok,
But when I am launching your scripts it gives me error:
File "part-2-and-3-keyboard-input-and-basic-OpenCV.py", line 5, in
import PyAutoGui
ModuleNotFoundError: No module named 'PyAutoGui'
You don't NEED pyautogui. I am only using it because for some unknown reason it resizes my window proportionally and that's helpful for recording. You can just not import it.
Thanks
my windows refreshes so fast , it stays gray and goes into not responding
I wish you were my professor at college :(
One question man can we implement the YOLO object detection algorithm on this too ?
I dont think so, yolo is object detection, not object recognition AFAIK.
How do you decide the thresholds for Canny?
Fun fact: gta is free now so this is useful now
hey thanks for the tutorial .I greatly enjoy your videos.Could you please do a special on using the Aruco module with opencv python or making your own bindings 'cause I think this might only be available in C++ and I kinda need ot for project (meaning all my work is based and I need it ready for next week ) you'd really help me out
if just gray mode, how to recognize the traffic light?
Hey, do you know where I can get PIL for 3.4 onwards? I looked around but couldn't find a download for the right version.
I would use: www.lfd.uci.edu/~gohlke/pythonlibs/#pil
Thanks :D
6:04 that was an April fool's joke xD
Hey man, Lovin your work!!
ps where do i get cv2/openCV from?
pythonprogramming.net/loading-images-python-opencv-tutorial/, grab the appropriate wheel file for your setup from: www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
For example:
opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl is opencv version 3.2, for python 3.6, and amd64 means your version of Python is 64bit.
Thanks heaps dude!!! Keep up the great videos!
use pip
What @Ryan Bandler said. This worked for me just a few days ago (using Python on Win 10).
pip install opencv-python
Oh man, i really don't know how to program (just did a simple course) but this is so fascinating.. and so far it's "easy" to understand the basic behind it (let's find out if i can stick to that :D)
How are going with that?
Can I practice this on NFS rivals?
The question is will GTA run on a Jetson Nano 4G (B01)? :)
What do I do at at 8:11 you don't show it!!!!
cv2.imshow("window", new_screen)
it's late but: new_screen = process_img(screen) new_screen = process_img(original_image)
Video summary
We created blind gtav
You can use code like this to draw the FPS on the image (to avoid the call to `print`):
def draw_fps(image, frame_duration, position=(20, 20),
font=cv2.FONT_HERSHEY_SIMPLEX, font_size=.5, text_color=(255, 255, 255)):
text = 'FPS: {0:.2f}'.format(1 / frame_duration)
cv2.putText(image, text, position, font, font_size, text_color)
...
# Print FPS
frame_duration = time.time() - last_time
draw_fps(image, frame_duration)
last_time = time.time()
Getting the following error:
ModuleNotFoundError: No module named 'PIL'
whilst importing ImageGrab from PIL
please help :p
Use 'pip install pillow' in your terminal.
You get about 30% better performance if you move the cvtColor from imshow to the assignment of screen.
6:02
Uhh I'm pretty sure you're referring to NVIDIA's April Fools prank 😅
Why does it take so much training data I wonder, I mean a human you're like "do this" once or twice and boom you've got a peasant washing plates for a living. Cool series learning a lot following. Also the human vs. computer question is rhetorical.
edit: dumb question this isn't entirely on the fly right as you make the video? You've got another screen that you're looking at for reference, it seems like it, but regardless if Python is one of your primary languages then it makes sense to be so comfortable using it. I'm trying to follow the camelCase syntax where/when also the lack of semi-colons in Python is interesting.
Jacob David Cunningham if you ask a baby to wash plates he wouldn't even understand you. Our skill to learn simple tasks quick is result of years of training.
I don't know if when you say baby it's because of AI/Machine Learning's relatively early age or what... I obviously wasn't talking about babies if you can't understand English/language even that humans are visual you could show someone in another language by gesture how to do something but sure. As I mentioned my question isn't really a question.
The other thing is instinct. Isn't it cool how spiders know how to make a web without being taught how to weave one. I'm pretty sure they are not taught how to ie. a lone spider will figure out how to make a web. Also how deer can walk immediately when they're born versus humans that take possibly years.
YESSS SENTDEX I LOVE YOU
it says original_img not defined
change line to - new_screen = process_img(screen)
Did he fall for the nvidia ai stick thing?
how do u resize you gta screen so much?!
Change resolution in settings.
g4560 will it work hmmmm
wouldn't cv just be coping the image rather than rendering them like the gpu is?.
I assume this is in response to my "the cpu is running GTA V." You're right, the CPU is just simply "displaying" the updating data, not actually doing any physics calcs...etc.
is there a way where the image processing is done in c++ and the processed data is passed onto python??
It's my understanding the OpenCV is C++, and we're just simply using a Python wrapper with it when we import and use cv2. I could be wrong here.
sentdex even I don't know,heck I'm just getting into programming but its just a hunch given the fact that it takes a fair bit of time to call the c routines then convert to Python code.So if there's any library or something which would enable people to use 2 totally different environments without the hassle of converting it to one form to another
@sendex, Your'e correct opencv-python is just a python wrapper for openCV C++ library
Your tutorial is so clear.Thanks,I have learned a lot after watching your video.I want to ask for your permission to translate your video into Chinese and upload to some domestic websites of course I will put your channel link on..Because my country doesn't allow us to visit RUclips and not everyone is able to get a VPN.I'm waiting for your reply and it's ok if you don't want me to do this.
wow, que bacan sentdex!! eres lo maximo.. i want to make something similar with League of legends! =D
this will be so awesome :D
Many thanks
8:56 funny laugh bro lmao
if you have a linux computer, imagegrab won't work
Well he's playing GTA so obviously he's on windows.
Can I do this in linux?
if you can get GTA V running on linux, then yes. It's possible, but I've never bothered with doing that.
So I don't have windows, my laptop runs ubuntu, but if I had windows it would have run GTA 5. So, my main issue is whether the fact linux can't run games is going to be a factor?
you should install windows and thats it
Thanks.
you could do it for a different game that Linux can run if this one will not, I have no idea. There are many that run natively, and many more that will work well in wine.
I love converting to cray
Lovin it
this is the best
damn, it's a good idea.
There is a game on the N64 that has a cheat code that allows you to use a sort of black and white edge detection rendering algorithm like the one in this vid to play the game, honestly it is complete eye cancer because the blank areas are white instead of black :/ Also it lets in some texture on some surfaces so it's not really true edge detection but oh well I don't think that's what it's point was anyway
my ryzen 5 1400, 8gb ram 2666mhz and rx 550 runs like you the script (not the GTA V, of course, but the script runs like yours)
You are awsome
i am getting multiple windows
Using mss library I got 30 fps
your awsome XD
Had a better time once I hit mute. Entertaining content. Thanks for the inspiration.
:)
OpenCV isn't playing GTA though, is it? It's just taking screengrabs and displaying them back. Not that impressive on the CPU is it? :)