LIVE Shop Talk 50: Are You Interested in an Artificial Intelligence for Everyone Series?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is paul mcquarter from toptechboy.com and we're here today with episode number 50 in our live shop talk so we are live live live and are you guys ready to rumble okay man where you guys from let's see uh we've got uh peter from los angeles we've got uh lol kid from australia code cage from east of uh from atlanta georgia uh we've got uh let's see where else uh eel from israel okay and i am broadcasting from the jungles of africa what i'm going to need you guys to do is pour yourself a nice strong cup of iced coffee that is straight up black coffee poured over ice no sugar no sweeteners none need it okay and i need you to get ready to learn some cool new stuff what we're going to be doing today is we're going to be talking a little bit about artificial intelligence all right and so i want to see if you guys have any interest in learning artificial intelligence also i want to give a wave to you guys who are helping me out over at patreon it is your support and your encouragement that keeps this great content coming if you guys are not helping out yet think about hopping on over to my patreon account and hooking a brother up so i want to give you guys a way but enough of this shameless self-promotion let's jump in and let's talk about what we're going to talk about today we are going to talk about artificial intelligence whoa look at that it's the virtual me i think i better switch back to the real me okay i am going to switch back to the real me here and let's just see if i can get back over there and i will come over here and like this and voila it's your old friend paul mcquarter in his well-known orange shirt okay what i did was i just was giving you a little preview of some of the cool stuff that we can do with artificial intelligence and just wrote some simple little programs there that i thought you guys might be interested in okay how many of you guys out there are working with me on my python lessons we went through i think 20 lessons on python getting all the way up to doing some pretty advanced things like classes and methods and threading and so forth and then last wednesday we actually jumped in and started working on how to do 3d graphics and animations in visual pythons and are you guys following along with me on on that are you guys interested in the python stuff i want to kind of see if my audience is actually interested in python okay we've got renko okay philippe says he likes it uh charles hello ian v python is interesting oh good good charles hello from australia he all says he likes it code cage is following it uh magnus likes uh thinks the visual python is pretty cool okay because guys i don't want to just be in there just doing kind of drive by shooting on on my lessons where i show you this or i show you this and my audience are just random people that are tuning in to get a little quick view of how to do a specific thing i want to kind of have my lessons build on themselves and i want to have some synergy between the lessons and so what we did is we spent some time learning python and now we're learning visual python where we can do graphics and we can do animations and all that is going to fold back into our arduino lessons where we'll be connecting the computer up to arduino and arduino will be talking to v python and then v python is going to come alive as the animations and the graphics are going to be controlled by environmental data that's coming from the arduino so all that stuff that you learned in arduino that's going to be sent to python and then that's going to animate uh 3d animations and graphics using visual python so you see the stuff we're learning in visual python is going to build on the stuff that we learned in python and then that's going to tie into the stuff that we did in arduino and now what i think would be interesting is to fold into that some artificial intelligence using python and so then we could have the arduino we could have the python and we could have artificial intelligence all working together now i did do a series i did do a series on artificial intelligence for the jetson nano a couple of things there one is you had to buy the jetson nano board and a lot of people just kind of didn't do that so not everyone followed that so what i would like this series to do that i'm thinking about i'm trying to kind of bounce this off of you i'm kind of thinking about doing a class that i would call a series that i would call artificial intelligence for everyone and it would be designed to run on a windows pc and run under python so you don't have to go out and buy a new board and it would naturally fold into the stuff that we're already doing with visual python it would be a new series but it would complement what we're doing with visual python and i kind of thought that that would be neat and then since we're already going to be talking as part of this going to be talking to the arduino you could have the arduino sort of feeding data to a python system that is running artificial intelligence and so i will be asking you and i will be looking over at the chat box whether you think that it would be interesting to have a series called artificial intelligence for everyone based on python and uh based on python and designed to run on a windows pc so give me some feedback okay deng dong said he really uh liked the jets and nano okay i've already done that series and some people got a lot out of it i think but i'm looking for maybe doing something on windows hey cap welcome uh okay hey cap you're from south africa how are things going over there i hear that it's kind of rather tense times in south africa right now hope you guys are saying stay staying safe okay raul says yes philippe says it sounds good that's good uh okay magnus likes it charles hey it looks like we're getting some pretty good feedback code cage says interesting manuel says no windows i'm sorry man manuel i hate windows as much as the next guy but it's kind of like a windows world and we're just living in it and so at some point we kind of got to do things in windows because that's what everyone else is doing if it were me i would just i would just move to linux man i love linux there's a couple of things that hold me from not just erasing my windows operating system one is like these live streams i do using wirecast and wirecast does not have a linux version i know that there's open broadcast software and it works pretty good but it just doesn't have the things some of the things that wirecast does and so wirecast is keeping me on windows right now okay but yeah i kind of hate windows as well okay looks like we are getting some pretty good feedback on that some pretty good feedback okay uh will raspberry pi 4 work with your tutorials okay if if you wanted to work on the raspberry pi 4 what you could do is you could go over to my jets and nano lessons and those are sort of linux lessons and you could probably make it pretty far on a lot of those lessons on the raspberry pi 4 so that would probably work pretty well hey you know i showed you this little artificial intelligence program that i work sort of as an intro i can try to go back over to that let's see if i can fire that thing up again i do believe it was right here let's see if i can fire this thing up again and i think that i can come right here and then maybe see if i can get out of your way and so basically what you can see is is this is an artificial intelligence program that is looking at the data coming from my camera and it is doing facial recognition and then it's creating contours of my face based on the images that it is getting off of my webcam and it can also recognize my hand let's see if this would i'm trying to okay hey felipe man oh wow felipe really appreciate it you guys that are helping out with the super chats and the uh patreon and so forth really appreciate it uh you know i've got some i've had some real expenses getting my equipment over here there's some more equipment that i need to buy my internet is really expensive over here so you guys that are helping out really appreciate it because it in fact keeps me out of trouble with my wife for spending so much money putting these videos together so really uh really appreciate you guys for uh for helping out so anyway what you can see here is we are looking hey griffin bonner appreciate it much appreciated what you guys can see is that i can recognize a face and i can put face contours on and also recognize a hand you can see in real time i can go one two three four five and it is finding all the little joints in the hand and so i think that is pretty cool let's take a quick look at this code here i think you can see it and you can see that a lot of it is just very much our old friend uh python there's 58 lines of code to do that animation where i'm recognizing and mapping contours on the face and what you can see is that it's not really 58 lines of code because there's a lot of comments in there and a lot of blank spaces and so it's really not that hard just some other sort of quick demos of things that we can do with python and artificial intelligence let me see if i can launch this one and then let me make sure that you can see it okay what this is is this is just the raw image coming from the webcam and then let's see if i can find this one then what this one is is this is taking the frames from the webcam it is finding the face it is mapping the face then it's looking for the hands and it is finding the hands and it can in fact find both hands okay i can think about it a little bit i can ponder the situation okay and you can see that it is actually finding and mapping every joint in the hand and every finger and then down here you can see that we've got the wrist and so that is in fact let's look and see here that is in fact for that 58 lines of code and so this is something that i can teach you how to do a very distracting echo in my feed okay let's see what could be causing that echo okay i am not sure i am not sure what would be causing the echo i don't know if i have two microphones on or if it's uh okay two two echoes i got two microphones on thank you guys for telling me that did it go away now has it gone away let's take a second and see if we can figure that is just one okay okay it's fixed so guys i apologize one of my other windows had a second microphone going so there was a there was a bogey audio channel associated with one of those backgrounds so okay sorry about that sounds like we got it fixed i'm glad i saw that in the uh glad i saw that in the comments okay so what were we in fact talking about we were talking about 50 lines of code and we were talking about being able to do this being able to do this facial mapping and hand mapping using only 50 lines of code what is my microphone i am using the yeti blue microphone here and i've got to tell you guys i am just grieving and miserable i miss my silver microphone you remember all those lessons we did where i had the nice blue yeti gray silver microphone well i left that 12 000 miles away it is 12 000 miles away back in texas sitting on my desk and uh what i did was i didn't pack it because all i could bring was four suitcases and then i just ordered this one and then had it shipped over here and all audio wise they're the same but i just thought it was so cool having that kind of silver microphone that you could see there so i miss my silver microphone but i digress i digress okay so what we're talking about is we're talking about some cool stuff that we can do using the most excellent python and 50 lines of code and then here we go okay hopefully you're not getting that annoying audio again but then you can see you cannot see that i you know what i need i need someone in the control room that's what i really need i need someone in the control room let me make sure this doesn't have audio okay i think that's sorry okay and then i will get out of your way okay so you can see that i can map every joint on every finger i can map the wrist and then i can map a facial contour using 40 lines of code now why would this be interesting well this would be interesting that i have access to all of this data but i also have access to the individual points and so i could monitor the position of my fingertip and i could monitor the position of my eye as i'm just sitting here working throughout the day i could take the distance between the fingertip and the eye and then i could give an audible warning if you were fixing to rub your eye you know in these days of the dreaded virus you're not supposed to touch your face well you could just have a little workstation uh webcam that is you're working if it looked like you were going to rub your face before you got up there it would give you a beep to warn you not to do that because really i think one of the number one ways you get the dreaded virus is by touching your eye i think that uh the pathway to viruses into your body a lot of times it's through the eye and a lot of times we sit and we rub our eyes and you touch something you get something on your finger and you rub your eyes so you could make a little thing that sat there and warns you gave you a beep if you were going to look like inadvertently touch your eye and so okay let's quit out of this program let's see what else we have here let's look at example number three i just wrote some quick programs this afternoon to show you some stuff that you can do without too much trouble could you do sign language to the camera and have it figure out what you're saying big boggy face yeah you really could do that okay now what you can see that i've done here is i've actually mapped the contour back onto my face and then you can kind of see the wire frame of the hands and again i have individual access to each one of these uh data points and so you end up with an array and that array each one has an each one of those little red dots and each green dot on my face has an x and y value and so like you know where your eye is you know where your nose is you actually have data points for your ear for your mouth and so you can do things like could you do sign language yes absolutely because you see from this like it works whichever direction your hand is in let's see if it'll do yeah even the upside down hand so you see you can kind of figure out in real time it also gives you an estimation of z and so it's not just a two dimensional image it gives you a z value and knows if you're coming towards or away from the camera and probably it knows like a typical distance between two points on your finger and as you're getting closer that distance is getting larger so it's perceiving that you're getting closer or further uh or further away and so you could go in and start analyzing this wireframe on the hand and you could have something that would actually read sign language and then you could imagine you could also have something that would generate sign language so one could imagine a little app that would be able to communicate with the hearing impaired for the phone and i would be surprised probably if someone hasn't already done that but i think this is just pretty cool here and then we will move on and i think i've got like another demo here that i put together and that would be the most excellent the most excellent example number four and what we'll do here is we will fire this one up oh okay and what this shows is you can besides the face contour you can come in and you can do a full body contour so as you see now i've got data points on my shoulders i've got data points on my elbows and then here let's see here you can see is the elbow and then the wrist and then you have like a little three point representing the hand and so the body pose comes up to the hand and then i'm also running the hand pose and i'm also running the face pose and let's see i'm wondering if i can turn the face pose off let's see i really shouldn't try to program in real time here because it usually leads to disaster but let's see if i can turn off that let's see if i can turn off that face pose face connections let's see if i comment that out and then uh let me comment this out and i'm gonna i'm trying to just i'm gonna comment out the hands too don't worry about all this stuff it makes a lot of sense when i actually explain it to you okay see now this is not the face contour that i'm showing you here this is the whole body contour and it has a couple of points for the face you see like your mouth the tip of your nose and the extent of your eye and so that tracks pretty good and then it has the whole body now i could back up and i could dance for you but i don't think you want to watch that yeah i'm not going to be busting a move for you i have no moves all right now i have this brain with this kind of unusually large portion for math and analytics and science but is that part of the brain seemed to be a little bit larger than normal it seemed to kind of crowd out the part of the brain normally dedicated to coordination and things like that balance and coordination so a lot of math not much balance and coordination so i will not be busting a move because i do not have a move for you but you can see that we could track the whole body and i don't think that i could scoot back far enough for you to see that it gives you your waist your knees your hips your ankles and your feet it gives you a whole body thing so you could really analyze some pretty uh you could analyze some pretty complex motion there okay so i think that is pretty cool yeah von that's exactly like reading your uh reading your body motion for robot control and so like even here you could imagine something something even simpler like if you just tracked the hand position like if you just sort of zoomed in on a finger and you sort of controlled like let's say that you controlled a couple of servos based on what you were doing with fingers okay and also if you think of this fingertip and this finger tip again that's an x y coordinate for that little red dot and an x y coordinate for that little red dot and so you could have something happen as those dots were coming together or moving apart like you could imagine drawing a box or drawing on the screen just by tracking those finger positions so as you start thinking it gets pretty exciting especially if we're passing this data down to arduino which might be then controlling stepper motors or might be controlling servos or something like that okay can i do this on my jetson nano i don't know if you can do it on your jetsam actually this exact thing jets and nano you can do pose on you can do face contours on the library i am using right now i have not actually installed there's a linux version of it but i've not installed it on the jetson series yet but i will be trying to uh trying to do that we can make a following drone okay that's an interesting idea what is the python library that is helping you it is called mediapipe and that is something that i will probably be including in my lessons because it does some pretty uh some pretty cool stuff and let's see here also you can do things besides just look at your face you can try to find and track things and so let's see okay you guys can see that let me see if i can scoot back here it's always a little bit scary to do these things in real time here but look at that this is my shoe and you see it's not only finding the shoe it's tracking in three dimensions not just the or position but the orientation of the shoe okay don't hate me because of my shoe okay don't hate me because of my shoe here's a different shoe let's see if it'll find this this one is a little bit harder for it to recognize i think maybe because it doesn't have a shoelace there it goes okay let's see if it recognizes the bottom of the shoe okay yeah it's kind of recognizing the bottom side okay so you see you can find things you can find things and you can identify things this uh you know there's these models out there that we'll find uh that will find and recognize different things and so that's pretty uh that's pretty cool so let's talk a little bit about this there's sort of different strategies that you can use and i've gotten different feedback from you guys but let me kind of tell you what the different strategies are that you can use in artificial intelligence one is to start from scratch and learn things like tensorflow and pi torch and torch vision and those are very basic artificial intelligence engines and then what you can do is you can train those and then if you start absolutely from scratch what you can do is maybe make something that would recognize digits and so like you would have handwritten digits 0 to 9 and a bunch of people could write them a bunch of different ways and you could create kind of from scratch an artificial intelligence system that could read the characters okay that's something that would be done starting from scratch and then you would learn the in ins and outs of something like tensorflow or pie torch or torch vision okay the good thing about that is you're learning really at a very very fundamental level the bad news is if you start there you're never probably going to get to the point of being able to do something like facial detection where you see there is a face or facial recognition where you know whose face it is because for those things what you need to do is you need to start with some pre-trained models and so as much as i like doing things from a fundamental level i think it's it's a lot more interesting if we kind of start at a higher level and use some of the existing pre-trained models i show you how to use those things and then we use them and then we communicate with the arduino and we interact between artificial intelligence and the virtual world which we'll be doing in visual python and the real world which we'll be connecting to through the arduino with sensors and actuators on the arduino so i think this idea of virtual world real world and artificial intelligence world all kind of working together i think that's pretty interesting and you know what we will never get there if we start at the very basic pie torch level so what i will be starting with is some of these pre-trained models that are already out there and i got to tell you some of these pre-trained models they train them on millions and millions of images and spent hundreds of thousands of hours on high-end computers doing the training and we would never be able to train something as well as these pre-trained models that exist out there now what we can do we can take one of those pre-trained models and we can retrain it on a data set that we're interested in like i took one of the pre-trained models and i retrained it to recognize single board computers and that was one of my jets nano lessons where you could put any single board computer in front of the camera and it would tell you which one it was i did not do that from scratch i started with a pre-trained model and i retrained it okay so that is sort of what i am thinking because i just think that if we start with the core pie torch we're never gonna get to anything that is all that really neat and cool and maybe someday i would do a more fundamental lesson but that is not what i am thinking about right now okay guys i've got the disappearing glass here today tell me what you think about this mr nimbus thank you so much i really appreciate you guys with the super chats again i've had a lot of expenses here on the channel and so the help you're giving me is very much appreciated okay cap electronics says he and his family are okay he and his family are in south africa and they're crazy things right now and we're actually uh warned they would come to our area but luckily we'll we're safe okay cap we'll have you in our prayers for safety because i know things are things are always a little dicey in africa but it seems like somewhat unstable right now in south africa so hope things will come calm down there okay please upload the codes for using your programs man muhammad i don't upload my codes because i want to teach you how to code you know you can't go through life just copying and pasting i'll teach you how to do this but i don't want you to copy my code i want you to learn how to code okay i'm not hopefully muhammad i'm not sounding harsh i didn't mean to be harsh on you but just understand i teach you how to code and that's why i don't post my code okay gary welcome to a live session great to have you opal one of our regulars always good to have you opal and then uh muhammad is currently learning arduino okay how can you make your own model okay that's kind of hard that's beyond the scope of what is easy to do and yet the models often have odd bases okay uh python is actually slow okay yeah and let me tell you for the things that i am showing you today if i just run these programs they run really really fast okay the problem is i am running wirecast and wirecast is insanely graphics intensive i have like 25 shots that are set up in my wirecast studio and so that is really sucking all the life out of my man joakim urbina thank you so much really really appreciate it i'll tell you guys are most generous today really really really much appreciated keeps this great content coming so that is very much appreciated okay so the reason these demonstrations i'm showing you are a little bit choppy is my wirecast suit studio is sucking the life out of my graphics card to keep all these shots and this live streaming and all this sort of stuff going and so then my programs run a little bit choppy if i'm running these programs without trying to do a live stream on the same computer they run perfectly smoothly so i think we should be able to do some interesting things i think we should be able to do some interesting things just running on a windows machine with a reasonable processor okay uh i'm in richards bay was uh amongst okay uh okay we got several people from south africa here all right wow hope you guys uh hope you guys uh stay safe uh will this require a good computer mind slows down as soon as i do anything complicated even pi v python slows it down okay big boggy it will take a little bit of a processor these things will run and they will work it's just a question of how many frames per second you can get if you have a computer that's slow you will be getting the same learning happening that anyone else will you just will be displaying your your program will be running at a lower frames per second than the guy with uh you know a faster processor okay so that will that will be what will happen you'll be able to run it but it might run with fewer frames per second on your uh on your machine okay so we've kind of run through the demos there what i want to do is i think a lot of times when people hear uh i think a lot of times when people hear artificial intelligence i think wow this is just crazy complicated so let me just kind of show you a little bit about what artificial into an artificial intelligence program would look like and so i'm going to create a simple little a simple little program here you guys cannot follow along this live stream at home because you don't have the libraries installed that i have but i just want to write a simple program just so you see this isn't as hard as you might think so i will just call this where am i over here i need to add a new program and i will call this a i demo dot p y dot p y like that all right and now let me see if i can come over here man i need someone in the control room you realize that i need someone in the control room okay so let me show you just kind of how you would do a simple little start to an artificial intelligence program so what i'm going to do is i'm going to be using opencv so i'm going to import cv2 and don't try to do this because you probably don't have opencv on your computer don't try to go install opencv because you're going to end up with a version different than what i'm using just be patient let me do the lessons and then you can follow along but then okay so what i've done is i've imported the library now what i need to do is i need to create a camera object so i'm going to call my camera object my cam and what it is going to be is it will be cv2 which is my opencv program and then what i will call it or what the command is video capture and then i want to capture it from port 0. and so what this will do is 99 times out of 100 this will go out and it will grab your webcam if you have more than one webcam the first one is going to be cam0 the second one cam one the third one cam three and so this little number here just controls which webcam you connect to so i'm gonna have my cam is cv2 video capture frame zero now you gotta think that webcam is is throwing frames at you and if it's throwing frames at you you better be ready to what you better be ready to catch those frames and there's going to be more than one frame coming at you so you need to do it in a loop so you need to say while true when is true true true is always true so this will be an infinite loop and then my command is going to return two variables i'm going to throw the first one away because it's not useful to me so it'll be underscore that's a throwaway variable and then it's the second variable that i want and i'm going to capture that array in a variable i'm going to call frame and then this is going to go to my object my cam and it's going to read my cam okay so it goes out to my cam which is my webcam it's going to grab a frame and it's going to put it in the variable called frame does that make sense it is going to put it in the variable called frame and then what am i going to do i am going to say cv2 i'm going to leave some blank lines there then i'm going to say see the 2 dot i am show so i want to show my image and what i want to do i want to put it in a window called my webcam that's just going to be the name of the window and then i am going to show what i am going to show frame like that okay and let me make sure you guys are seeing that yeah i think you can see that i think you can see that i need two more monitors i need two more monitors something terrible okay all right and that got in your way all right i think you can see what you need to see now okay so what do you do i'm in an infinite loop and i'm going to what grab a frame and show a frame grab a frame and show a frame now there's one little bookkeeping thing that i need to do there's one little bookkeeping thing i need to do i need a graceful way to exit the program because if you just raw just bluntly kill the program you might still have that webcam port tied up so what you want to do is you want to exit cleanly so what i'm going to say is if cv2 dot weight key so this is going to wait for a key press how long will it wait for a key press one millisecond so it gets here it pauses one millisecond just to see if you've pressed a key okay and then if that is equal to i'm going to quit on a q so i want to look for the ord the ordinance value of q okay so if this sees a q pressed then if this sees a q pressed what is it going to do it is going to break out of that while loop and then when it breaks out what i want to do is i want to my cam release and this way i can run the program again otherwise i could lock up the camera kill the program and the camera stays locked up so this is just a little clean way that you can kill uh kill your program and make sure that your window is still that your camera is available for the next go around so let's go ahead and just run this program it's what like eight nine lines of code oh and we got an error weight key ah you know what look at this uppercase k we use the old bumpy font here hopefully this will work now okay so hello there it is again it's a little choppy because of the resources i'm using for wirecast but you see in a couple of lines of code we grab a frame and show a frame i think just on its own that's pretty neat let's see if i can kill it with q yep q killed it and it released the camera all right now that's not all that exciting but i want you to see that you grab a frame and you show a frame and we're operating at 30 frames a second and you've got to think that your microprocessor is running it like gigahertz and so you've got a 30th of a second between reading a frame and showing a frame in computer years that's like the age of the universe it's like you have an infinite amount of time between reading the frame and showing the frame to do all kinds of mischief and it is this area between reading the frame and showing the frame that all your artificial intelligence happens so you can read the frame you can pass that frame to various artificial intelligence engines and processes and functions and then get a result back and then you can map that result back on your image and i think that is just pretty cool that is just pretty cool and you can see that we are well on our way to doing a little bit of artificial intelligence here okay so like what is something else you could do well just to show you can start manipulating things like one thing is i could change the resolution of the camera so i could say my cam and i could set it and then i want to set the horizontal which is the parameter 3 and i can set that to 1280 okay and then i can do a my cam.set and then 4 is the did i say that right 1280 is the horizontal and 4 is the vertical and that's going to be 720. and so here i'm going to change the resolution that i grabbed the frame at from the camera and there you see that i've got a bigger frame so you see i can control the resolution of the image that i grab from the webcam now i've got to use one of the supported ones you can't take a low resolution camera and magically generate a high resolution image but you can get the image size needed for your application another thing just showing you kind of the simple things you could do like i could do cv2 after i show the frame i could do a move when window and uh which window do i want to move i want to move my web webcam and where do i want to move it i want to move it to the corner it's which is 0 0 which is row 0 column 0 because it seems like when you do an i am show it kind of puts it in a random spot so you can move it up to the corner and let's see how that looks yeah like now you see we have it in the corner or we can move it wherever we want it in the screen like a lot of times we'll have a bunch of windows and then you can make them smaller and you can just sort of stack them up across your screen so that you can kind of see as you're doing the artificial intelligence see how things stack up you can also do like manipulation of the frame like what i could come in here is i could come in and i could say that gray is a new image and it's going to be cv2 dot convert color cvt color and then what do i want to convert i want to take frame and i want to do cv dot color underscore b g r for blue green red to gray and so i'm taking that frame and i'm changing it to a grayscale image okay i'm taking that frame and i'm changing it to a grayscale image and then let's go ahead and let's uh you know what i'm going to do i'm going to change this back to 640 by 480. now let's go let's why not let's go 320 by 240. you guys keep the ratios right don't do a crazy ratio it re it does this quickly but if you create a strange ratio then it slows it down because it tries to recompute that image every uh every frame which you don't want to do so now what we should do is we should just we will still have a color image but it should be small and up in the corner oh uh what did we do wrong here ah frame comma two parameters okay what is this eight why does it not like that this has got me somewhat perplexed gray is equal to cv2 dot cvt convert color frame cv2 oh oh yeah thank you guys saw that you know what it turned blue it turned purple so i thought that it recognized it okay so now let's try it boom okay you see there's the little version of me that's 620x480 okay i don't like that very much but somewhere i went back to 640 by 480 i just cannot take that so it would have been 640 by 360. and so this i'm going to make 180 i think and that should be a correct that should be a correct one okay i realize that it must be painful to watch me do this sometimes okay so this should be a nice little yeah okay that's what i wanted okay now we can come in and what we could also do is we could show that other that gray image that we made and so what we could do here is we could come in and we could say do a cv2 dot i am i i am show and this time i'm going to say me in gray for the window name and then i'm going to show gray all right now i'm going to need to move that out of the way so i'm going to do cv2 dot move window okay and then i'm going to go uh which one me in gray all right and then where do i want to move it well i think this is this is row column i think so i want to stay at row zero and then the column will put like let's say 350 so let's put it at 0 350. now what's confusing in opencv that if you're dealing with a matrix it's always row and then column row comma column but if you're dealing with math it is x comma y so about half the time you're going to guess this wrong because sometimes it won't throw comma column and sometimes it wants x comma y and so we'll just try this and see if it works and of course i guessed it wrong but you can't see it but let's fix that so i went row column and it wanted x y so let's go 350 comma zero so i'm sorry this would be x comma y i do believe yeah boom okay so you see i converted it okay i converted it and i'm showing it now also just one other little thing that that all of a sudden now what you got to see is there's nothing mysterious about this frame and there's nothing mysterious about this gray now i do need to do one little thing here i need to convert it back so when i go from color to gray it flattens the image so each pixel is not three data points for red green blue it is one data point which is gray so it flattened the array to only have one number at each row and column it has one number which is great so i want to convert it back to color now the color is lost but i just want to get the matrix back to you know a uh three numbers in that in each pixel and it'll make sense in a minute while i'm doing this since dot c v t color and then this time i'm going to work on gray and this time i'm going to do c v 2 dot and i'm going to do gray to bgr and that's the other kind of quirky thing about opencv it goes blue green red it goes blue green red normally you think of red green blue okay so this is still going to be a great scale image but there's going to be three data points for each pixel so let's go ahead and do this oh and what do we do grade two okay somebody tell me what i did wrong oh i forgot color all right you guys i'm sure we're yelling at me okay so now let's try it i think this one will work okay there it is so you see the gray image is still gray it's just in a color format but the numbers are the same in those three positions so it still stays great but let me show you why i did that okay so what i could do now is i could come in and what you got to see is there's nothing magical about gray or frame all it is is an array okay it's a matrix right it's an array if you've done arduino if you've done python you know about arrays it is a two-dimensional array where you have rows and you have columns it is just a data array well i can go in and just manipulate that data so let's say i could say gray and i could treat it now where i'm going to put an index in there okay and now of course i'm not sure let's see i think this is going to be row comma column and so i'm going to go from let's say 120 to 140. so i'm taking row 120 to row 140 and then i'm going to take column 85 that should be a comma i'm going to take column 85 to 1 15 i'm just kind of winging it here i should have tried these numbers before then so i'm taking in that gray i'm taking i'm taking row 120 to row 140 and remember there's 320 rows all right there's 320 columns okay 320 columns i'm going 120 140 and then 85 to 115. so i'm taking that data in those ranges and i'm going to say that that is equal to what the color one frame okay and then i want to use that same image because those two images are the same size and i'm sure i butchered these ranges because i'm getting rows and columns mixed up but let's do this and just see hopefully it's not completely off the screen okay there it is you see that little do you see that little box there what i did was i ran and i grabbed i stole that little piece over here i stole that little piece over here on the color one and i went and i put it on the gray one okay so you see how you can start manipulating you can start manipulating uh your image just treating it like a data array i'm just treating it like a data array and so let's see i think it would make sense if that was a little bit bigger and so the uh i went 120 to 140 and then i went 85 to 115. let's say i went 160 and then let's say i went 130 and so that's going to be much bigger and i've got to remember not to just kill the program i've got to remember to be good and quit out of it okay now let's take it this should be a bigger segment that i'm stealing and moving over did not like that at all 120 i didn't i got to do this both places copy paste all right let's see man it doesn't like this what did i do wrong 120 to 160 85 to 130. hey thank you mr nimbus boom man you guys are really really being very generous ah philippe all right i'm sorry felipe yes two brackets all right did a little sloppy copying and pacing all right there so you see there is a larger a larger little window okay a larger little color window now you could imagine you could make this a bouncing box that would move across the screen the part that was colored you could imagine that you could find the face and you could black the face out you could imagine you could find the face and borrow a different face and put you see there's all types of things you can do because what is gray gray is just a matrix it's a two-dimensional matrix with uh 320 rows no 300 i keep saying it you know what i need to do i need to put them in the right order and then i'll say it right okay there it has 180 rows and 320 columns 180 rows 320 columns and so if i wanted to look at an individual pixel in fact i could i could say print and i could print from the matrix gray i want to print from the matrix gray i want to print the pixel [Music] i could print an individual pixel and i could print the pixel let's say 120 okay and then the pixel 85 like that and this is just going to print three numbers it's going to be the three numbers that are at that position if i'm thinking about this right and i'm probably gonna i'm probably gonna mess up but let's see if this will work i always get these ideas on the fly to do things okay mr nimbus says that he was a litter picker met a man with the library reading pie books he told me about you learning from you i got into uni without the greats hey wow okay mr nimbus that is the kind of good news i like to hear i like to hear that people actually not only enjoy these lessons but are bettering themselves with these lessons that's a huge encouragement love to hear that okay so let's see if we can actually do this now and see what kind of crazy thing i did here okay so you see look at this and let me make sure that you can see this over here which yeah you can do you see how i am printing out an array of three numbers and what that is is you see how it's changing because the image is changing that is the r the g and the b value of 1 pixel in gray it is the pixel that is at row 120 and column 1 or column 85. now i'm going to try this because i think that if i make this like let's go in the gray region which would be like let's just say row five row five column five that's in the gray region we're still going to see three numbers okay but you see how they're the same because a gray image of r and g and b are the same you get gray and if it is a 255 255 255 you're going to get white if it's 0 0 0 you're going to get black and 100 100 100 is about halfway and you can see up here this would be about 5 5 that pixel there it's kind of halfway between black and white so it sort of makes sense why am i doing this i want you guys to see that there is nothing mysterious about an image an image you grab it from the camera and then it's just good old-fashioned data it's numbers you have a row index you have a column index so you have r comma c row comma column gives you a pixel that pixel has three numbers the red value the green value and the blue value but in the crazy world of open cv the first number is blue the second number is green and the third number is red b g r blue green red or in this case we set them all the same so it is great is this making sense how does machine vision different from compu computer vision machine vision cameras are much more expensive well i think a machine vision camera has some of the intelligence and image processing built in to where what we're doing with machine with you know computer vision you're just taking a cheap webcam and you're doing it in the computer somebody asked what webcam i have i'll give you some links later on so you guys if you want to do this you'll have the same camera i have one of the logitech webcams you can buy cheaper ones but the thing is because we want to go in and we want to send commands to the camera we want to work with it it's good to use one that we know will work with opencv okay uh sir please recon the laptop for good programming please find not sure what you're asking there mapari could be interesting for space application tracking celestial bodies and doppler effects yeah there is all types of things you see i like i like doing this just with camera images just like video images because you get so much data the data is so easy and it's so interesting to do but artificial intelligence is not just images you can get all types of data and do different types of cool things with it okay uh stacking images yeah you can stack images you could imagine that i could create like a mask around myself and then i could get rid of everything that isn't part of the mask and i could create the mask intelligently based on the image and then i could take the background and i could put a different background in and so there's all types of interesting things that you can do okay uh what do i think about resin 3d printers i don't think i like them very much because i don't just don't like all that chemical in my house just all that stinky chemical and then it's like you got to get the thing and it's all goopy and then you've got to like use acetone to clean it and it's just like i don't like chemicals that much so even the what do you call it the ones where you have the real like what is it uh i can't i cannot remember the name of the cable that you use to print with a normal 3d printer but even when you're using those normal 3d printers as you're melting that cord that becomes your object it puts off fumes and you can really smell those fumes in the room so i don't i don't even like having one of those things in my room because it's generating all those fumes and sometimes the prints take 12 hours 24 hours 36 hours so i don't want to sit and br breathe that that fume all the time so i would rather have the one with the normal cable to generate the what is that stuff called the filament filament the normal filament i would rather use one of those than a resin one but uh even that outgasses uh some some fumes off of that i'll tell you i have had probably four 3d printers and those things really really really broke my heart i started out with the makerbot and i like got two good prints out of it and then for the next three years it was constantly broken then i got a really really expensive like a five thousand dollar raised 3d printer and it would make beautiful prints when it was working but it's like either you don't stick to the build plate or you stick to the build plate so firmly that you can't get the thing off the build plate and you're constantly tweaking constantly tweaking i think probably the best one the best 3d printer i ever had was the prusa and it seemed to work kind of reliably but i might at some point give 3d printing another uh another tr another try okay philippe says he puts the printers in the garage because of the area i would i would put it in a place that i didn't live and sit there and and breathe it all the time uh philippe what type of 3d printer do you have maybe you could give us a little bit of a little bit of a guidance here on what you're doing but uh part of the problem was i was a high school teacher and i taught freshman sophomore junior seniors there was a lot of students in there and there were always students wanting to come in and play with the 3d printer well some guy would come in and he would print something and then like he would claws then get it all put back together then somebody else would come in and break it and leave it and so maybe i would enjoy 3d printers a little more if it was just me and a printer and me working with the printer and not me having to be the maintenance man for uh you know for 20 people breaking it and me fixing it and i'll be honest i finally just gave up on 3d printing in high school just because the students did not have the discipline that if they broke it to sit there and take the two days to fix it if it was working they had fun designing and printing but they didn't want to go in and uh and fix it so let's see felipe says he started with the 3d walks one okay i'm not familiar with that one but i will uh i will look at uh i will look it up okay so uh sunil is saying any plans for a studio tour let me get my studio uh set up i am in a uh kind of in an interim facility right now and when i get my real studio set up i'll i'll give you guys a tour it's gonna it's gonna be nice i got some good equipment over here i'll get it all put together and i will show you guys so i'm not uh really i've kind of got a bad taste in my mouth for uh for 3d printing but at some point i would like to go back and redo those fusion 360 lessons that i did and then maybe have it centered on 3d printing and maybe if i just had my own printer without 20 people using it maybe i could you know try one more time but like i say i've sort of kind of gotten burned a number of times on 3d printers there are so many types now five axis printers which rotate about the circularly so no need for supports that would be very exciting also the last version of the prusa kind of had a self-leveling base which did make the sticking down a little bit easier i do still find the clogging nozzles a very frustrating thing where you got to take it apart and it seemed like what i always felt like once one of those nozzles became clogged i could clean it and put it back together but it never seemed to kind of like really be completely clean and so clogged nozzles was one of the things that sort of made me end up not wanting to do 3d printing anymore okay guys i've done a lot of talking here you need to let me know is this something that you're going to be interested in if i did a set of lessons on artificial intelligence for everyone based on opencv and based on python would you guys want to do it and then if i did it should i do them in parallel with my uh visual python lessons and my arduino visual python lessons or should i do them sequentially like get through visual python get through arduino with visual python and then do artificial intelligence or should i have parallel threads going along okay you've got some people saying yes got some people saying yes felipe says very interested oh carbon fiber yeah i would uh uh yeah i i believe you're right that you can sort of burn that stuff in there okay yep interested got some people saying parallel uh absolutely sure love to learn absolutely okay it seems like we've got some seems like we have got some interest there maybe enough for me to do i'm still trying to look and see okay uh mapuri says sequentially uh parallel okay it seems like we're probably getting more people saying parallel it seems like we're probably seeing more people say parallel okay and i guess if you wanted sequential you could always do them sequentially if i offered them in parallel okay you could always uh do it in parallel cap says do it in parallel okay so that might be that might be reasonable let me check in and see on something here see where we are here looks like we are coming in at about approaching an hour and so i'll take a couple of a couple of more okay guys how was the let me ask you this i'm getting a warning i'm saying i'm getting a warning from youtube how was the stream i tried to stream at 1080p uh was it choppy and was i breaking up and was it getting glitchy or did it come through pretty smooth let me know whether i uh was trying to do too much i could drop back to 720p if my internet was not uh streaming okay redwick says no problems a couple of more guys give me stream was great stream was good uh okay it looks like it looks like i was able to sustain the 1080p at 30 frames per second to me there's no reason to try 60 frames per second at all there's no reason to try to do that so i'll try to do the 1080 at the 1080p at 30 frames per second because it is when you're trying to read the text it's a little bit sharper than the 720 so i will do that there were two pauses for about five about five minutes ago but everything else seemed good okay it seemed like a couple of people maybe got some some pauses but if it's good enough i will try to keep doing the 1080 and then if it turns out to be a problem at some point we'll drop back to 720. also i'm hoping once i'm not feeding you two microphones that the audio is okay this room has a tile floor and concrete walls and so i noticed when i re-listened to a couple of my first recordings there was a lot of echo so i've moved pillows and i moved cushions and i moved a lot of cloth in here to try to take the echo down so let me know how was the uh how was the uh audio on this was the audio okay or what are the suggestions you guys would have for me on the audio you know i want to maintain good production quality and i'm trying to sort of get i'm trying to get my my studio tuned in here uh audio okay audio is good yeah cap you know uh i've had to for certain things i've had to use a vpn and i've noticed for the last week using a vpn going through south africa it seems like you guys are having limited uh internet connection down there okay uh audio is fine audio fine okay guys i appreciate the feedback all right we've been at this a little bit over an hour i try to cut these things off at an hour really appreciate you guys tuning in remember it helps me with the algorithms if you give me a thumbs up and also leave me your suggestions in the comments down below because it's kind of hard for me to keep track of all the chats leave a comment down below if you're interested in me doing artificial intelligence for everyone leave me a comment should i do them sequentially or should i do them in parallel leave me ideas of what you would like me to do because it's a lot of work for me to make these video series and if i'm going to do them i want to make sure i'm doing something you guys are interested in so this is your chance to give me feedback i will listen i'll read every single comment okay guys really appreciate your encouragement appreciate the help appreciate the comments if you haven't subscribed subscribe to the channel i'm going to let you guys go this is paul mcquarter from toptechboy.com i will talk to you guys later
Info
Channel: Paul McWhorter
Views: 4,764
Rating: undefined out of 5
Keywords: Python, Vpython, Graphics, Simulations
Id: CMwd44pFnVs
Channel Id: undefined
Length: 67min 35sec (4055 seconds)
Published: Sat Jul 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.