AI for Everyone LESSON 7: Understanding Pictures and Images as Data Arrays
Вставка
- Опубліковано 16 сер 2021
- You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In these lessons we will be using a logitech webcam. If you use the identical camera that I have, you will be ensured to get the same results. I suggest your life will be easier if you use the same camera I am using, available from Amazon below:
amzn.to/3iwgIW0
In this video I show you how to understand images and pictures as simply two dimensional data arrays. I show the use of Numpy slice function to define different regions of interest (ROI).
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
#ArtificialIntelligence
#Python
#VisualStudioCode - Наука та технологія
Another great lesson sir, Thank You. You would have thought Newman would have had hard boiled eggs on his food offerings at Newman's Own.
Yet I think the actor in question was Steve McQueen
@@paulmcwhorter Strother Martin was the actor.
That's the Cool Hand Luke movie. Great lecture, great topic. Thank you Paul!
Glad you enjoyed it
I have found that to get the most out of your lessons is to always be one step ahead of you by preemptively practicing your examples. This way I get either a confirmation or an explanation when I was wrong.
Cool Hand Luke, Thank you Paul!
We have a winner! Something only an Old Timer who knows good movies would know. Really loved that movie.
@@paulmcwhorter And you do have the old timer here Paul, Thanks!!!!!
You taught me arduino 5 years ago. And here we are today. You are a great teacher.
Cool Hand Luke! Great lessons, thank you.
If you want to turn off those annoying tooltips, here are the steps:
While in VS Code: press F1 then type "settings" or "preferences" - then click "Preferences: Open User Settings" - or - ...
in the settings pane, type "hover" (no need to press "enter")
the settings pane should display the hover settings immediately.
Uncheck "Editor › Hover: Enabled" hover disable.
Yes on cool hand look, and excellent tip. Thanks.
Thank you for this great series, now things start to get clear thanks to you, i am a big fan of your way of teaching. ((an Egyptian fan))
Wow, thanks a lot. I have always dreamed of visiting Egypt, but have never managed it. Thanks!
@@paulmcwhorter you are most welcome ,just try to come you will really enjoy the place specially the (red sea) that is where i live, once more million thanks for your effort .
Thank You Mr. Paul McWhorter for everything you do. I'm currently binging your Arduino lessons and I cannot express how grateful I am for being so patient and incredible teacher!
Legendary completion...with parameters ... Huckleberry Style like Cool Hand Luke.
Steve McQueen was a real Huckleberry.
Though I have no idea about AI. And I know I can not understand a single word But I am trying to attend your class. Thanks for your great afford.
Thank you Mr. Paul! Your course is very useful for learning! Keep going! Thanks
Thanks! Really appreciate your help.
Good lesson today, on to home work!
Enjoy!
Thank You Mr. Paul McWhorter
"Cool hand Luke" 1967: and I win since I'm the only one doing this at this point!!
Hi Paul, I loved this tutorial! Thanks again!
Cool Hand Luke said "I am Legend!". It took me most of an afternoon to figure this problem out. I am still bugged by the white border at the top of the squares though. Thanks so much for all your most-excellent lessons, Paul.
Nice work!
I folded up like a cheap walmart lawn chair... :( I struggled with this for 8 hours and no amount of working stuff out on paper could help me figure out the correct parameters for the for loop. I was able to "hack" it out by simply defining the 32 red squares, but I was hoping to figure out how to do it with letting the computer do the work... alas, I never hit on the idea of using a "holding" color to alternate the generation of the squares. I will remember this lesson now that I have seen the solution, and I intend to practice rewriting the code for this without seeing the solution until I can do it by memory AND by comprehension. Thanks Paul for encouraging us to '...think like an engineer...' LOL - My days of watching silly cat videos are over!
I'm understanding this perfectly. Remember it well from previous lessons. What I find most complicated about it is, upon creating it, you ask for 2 rows, 2 columns. It gives you row 0, and row 1, column 0 and column 1. It's hard to wrap my brain around asking for 2 and doesn't give you 0,1 and 2 for 3 total.
Think of it this way. If you ask for two rows, it gives you exactly what you asked for . . . two rows.
I am Legend! It took me 2 hours after eating breakfast with a nice cup of tea. I make my own iced-tea in summer, I think that equals your ice coffee Paul. I'm happy about my result in this python program. If I knew that things like this would interest and inspire me so much years before... I probably wouldn't study archaeology as I did have, I would choose something like computer science instead. Thank you and best wishes from Belgium
And interesting, my real passion is archaeology. Especially the quirky things that dont make sense or fit with the mainstream narrative. Really wonder how they made those walls at Machu Picchu.
Cool Hand Luke. Thanks, Paul
You are correct.
Hi Paul Sir , I done your homework.Thanks for teaching us.
Great job!
Thanks for teaching me almost everything I know. You're the man, Paul!
Any time!
Hi Paul, 1st i have been drinking plain ice coffee and it is good...:) 2nd it is very hard to find much information on line-scan cameras as in x-raying tires with LDA... Linear Diode Array photo sensors.. they could be (200mm 7.87") in length and if you need the sensor to be longer just place several in series (400,800,1200). The LDA opens up a whole different world in camera or scanner setup. It is quite common to form the sensor in a physical C-shape, now place the tire in the C-camera with a Panoramic 270 degree X-ray tube beam pattern spread inside the tire. this allows the complete tire from small to earthmover sizes on different X-ray machines, to be viewed from bead to bead in only one tire revolution. Also, the camera gain is setup for the various sections of the tire. The thin sidewalls the sensor gain is set low, the thicker tread package the sensor gain is set higher thus giving a even brightness/contrast from b2b on the PC-monitor, each tire code is stored in a LookUpTable=LUT so when a barcode camera can identify the next tire to be x-rayed and applies that LUT to the C-camera. Also, this is a spin off off airport luggage scanner looking for guns and ice coffee, software package...:) thanks... this is a really long winded comment...
Another great lesson. I started off thinking BORING! another lesson on arrays but then you started using numpy to manipulate that array and that's just cool. Also, after googling It's not "What we have here" rather it's "What we've got here is failure to communicate" - Cool Hand Luke
"Resist Tyranny!"
I sir, am a legend.
What i did was check which row number we are iterating through and based on that determined the starting pattern (Start with black for even row num and red for odd red num). Once the starting pattern is selected, just alternate the pattern. I didn't alter the black parts of the checker board but instead focused on the slices which should be red. Also i did the for loop calcs outside the while loop coz what's the point in calculating the for loop again and again... Here's the code:
import cv2
import numpy as np
width, height = 600, 600
rows, cols= 8, 8
OneBlock=int(width/cols)
img=np.zeros([width, height, 3], dtype=np.uint8)
for i in range(rows):
for j in range(0,cols,2):
if(i%2):
img[i*OneBlock:(i+1)*(OneBlock)+1 , j*OneBlock:(j+1)*OneBlock+1] = (0,0,255)
else:
img[i*OneBlock:(i+1)*(OneBlock)+1 , (j+1)*OneBlock:(j+2)*OneBlock+1] = (0,0,255)
while True:
cv2.imshow("My Window", img)
if cv2.waitKey(1)&0xff==ord("q"):
break
Cool Hand Luke. Thanks for another thorough lesson Paul.
This is probably one of my favorite lessons so far. For a project, I am considering purchasing some 1Watt RBG LEDs. I might get some extra to play around with making my own display.
I am LEGEND, thank you so much Sir. Adeola from Nigeria
Very clean and clear lesson. I could understand everything that u explained Paul. Thanks mate :) .... looking forward to more of it
More to come!
Well i have no idea what's the movie name, but i have a comment on this lesson. It's true that the lesson was really long but i didn't even feel like it was long because it was so much fun. When we had the "how to lunch your webCam" lesson i thought that was the coolest lesson ever because we only did that using like 10 lines of code, i couldn't believe it, it's like pure magic!💓. Now i think this is even much cooler, I'm pretty sure if i opend the AI Textbooks it will have such a complicated explanation for this, you made it really fun and easy to understand, so thank you so much for this high quality content. We are really lucky to be learning from you.🔥
At first I folded like a cheap lawnchair from KMart. I got off on the wrong track, because I was still in the mindframe of making as many separate windows as possible. So of course I was trying to build a checkerboard with 64 windows. Doh!
So I watched your solution video, then I came back and wrote and debugged it on my own. Great exercise.
Now I'm a Legend (thanks to a lot of help!)
Cool Hand Luke!
Very clear. Thanks.
Glad it was helpful!
fun lesson - "Shakin' the tree Boss!! - Cool Hand Luke
He's Gone, get the dogs
Some pretty powerful stuff. Never got to this level, but you make it a lot easier to understand. Looking forward to the homework. One of my favorite movies 'Cool Hand Luke'. Have a good one Paul.
Thanks Opal. Those old movies were really great werent they. Today's movies lack the story line, the character development, and the epic actors. Would much rather go back and watch the old ones. Today's movies have no story, and are just all special effects.
@@paulmcwhorter Very true. Without the special effects and blood and guts, they do fall short.
Cool Hand Luke! Good video, I'm going to have to re-watch it, though, caught the premiere halfway through.
We have a winner! Good job, and great movie.
Thank you sir 😍
Cool Hand Luke and I are both LEGENDS, if not for the same reason.
LEGEND. I did love that movie by the way.
@@paulmcwhorter - I’m old enough that I watched the original showing of it.
Always great! :) Thanks Paul!
My pleasure!
I am FULLY LEGEND!!!! I did it finally. The quote is from Cool Hand Luke 1967.
I love the new White board!
Cool Hand Luke B) - keep up the good work PW - another awesome vid
Thank you again!
I´m LEGEND, also made it parametrised, so it is adaptive to input number. Really great lesson. Honestly don´t know that movie line :D :D
Glad you liked it!
A double feature perhaps? "Mano Fría Lucas". &"Ek is 'n legende"? :)
OK, I made it. I parameterized(?) it but cheated a little with an if statement in the second FOR loop. I do not know the movie but I checked wikipedia, sounds like a very interesting drama and I will watch it later this week.
Hi Paul. To be honest, this is not going as I planned regarding AI; however , this 'checkers' was the most engaging thing I have done in python so far. I worked it out on paper then applied it to the code and.... I am Legend. Cool Hand Luke. Thank you.
Hi Paul, great lesson, Cool Hand Luke ! Thank you very much. I am legend, only needed 19 lines of code and added a "color-modulation", so I am considering to print my own omnicolor wallpaper ...
Fantastic!
I AM A... lawn chair sadly :( another great lesson (as always)
Thanks so much for what you do Paul!
I want to say the movie quote is from Full Metal Jacket.
I am Legend. Completed it using 26 lines of code. 24 lines if I remove two variables that could be hard coded to np.zeros function. I think there is probably a more elegant solution but what I have works. I made variables for the start and stop positions of the rows and columns and put them into for loops with the appropriate math to change their values. Thanks for these lessons.
Like the way you think. It is a hard step for people to make to move from doing things brute force to allowing the computer to do the hard work by thinking through an elegant algorithm. Very nice work!
Hello mr.Paul.First,thanks a lot for this great lessons.Will we use this codes with arduino?And do you suggest to watch your 'Arduino with python ' series.
Thanks sir for the great explanation. cool hand Luke
(Honestly I had to search that line on google )
Glad I could help!
Great lesson, thanks, Boss. I am legend.
FYI you don't have to put 'dtype=np.uint8', 'np.uint8' will suffice.
Also frame[:]=1 does the same thing as frame[:,:]=1 and you can put frame[:]=(0,0,255) to turn everything red. I am a very lazy typist👹
Cool Hand Luke put me off hard boiled eggs for days!
Cool hand luke 🙂
"what we've got here is failure to communicate" - Cool Hand Luke
Paul is this the beginning of how AI like Dall-E 2 work? They break images into arrays like this.
Look forward to your presentations each week, excellent teaching style.
In your AI lesson 7 you start out (timestamp 2:02) by drawing several illustrations. Are you using a touch screen tablet and stylus? What hardware/software are you using? I would love to see an addition to your Online Teaching series illustrating this technique. You make it look so simple.
It is a apple ipad pro running sketchpad with the apple pen. Then the USB C goes to the hdmi converter, and then into the Blackmagic PCMI quad HDMI capture board. Then it is fed to wirecast as a background shot for the greenscreen. No one said it would be easy!
@@paulmcwhorter Paul, thank you for the update. Did not think you were using the Huion HS611 graphics tablet and Autodesk Sketchbook software which you talked about in a previous tutorial. Your presentations always look great which is probably due to your LARGE production crew behind the curtain. Where did you say you obtained your teaching degree? Stay safe.
Bob, I just could not get the precision I wanted out of the Huion tablet. For me to be precise, I have to see the image forming under the pencil, or in this case the stylus. The fact you are writing on a black tablet with a black stylus, and then the image is formed at a different place, on the computer screen, I just could not get the precise writing I wanted, and found it frustrating. The best solution I found was to use sketchup on an ipad. Now, as I use the pen on the tablet, the writing appears under the stylus, like normal writing. I wish there was a simpler solution. I do wish I had help in the control room. As I teach, I have to think about what I am saying, what I am about to say, what is happening with the program I am writing or trying to run, and what I need to do in the control room.
I do not have a teaching degree. I have a master in electrical engineering from stanford.
Thanks!
Wow, really appreciate it . . . thanks!
@@paulmcwhorter Thank you Paul, you are doing a great job.
cool hand luke
Excellent!
I am Legend!! awesome lesson
My main takeaway from this lesson? To resist tyranny. I will, Paul. I will.
I get intellisense for Numpy but not for CV2... anyone see this?
Cool hand luke
I am legend. Not a film buff so I will not win the competition. My homework was done in 50 lines but I bet you do it in a lot less. My array was 720,720,3
Cool Hand Luke
Great job.what did you study in university? Couse you study a lot of things.
um a legend
I know this is 2 years old but... I am Legend
LEGEND!
my window size do not decrease or increase but I have the same camera as yours
I don't know what movie that is from
I had to look "cool hand luke" to find answer.
Steve McQueen's The Great Escape!
Oops! Got my movies mixed up! The Great Escape was about a POW prison, I do believe, while Cool Hand Luke was about being jailed in a deep south prison. Totally different time frame and location.
Right actor wrong movie
@@codecage9333 correct
Should retitle the video numpy tip and tricks
Hi Paul,
Thanks for your lessons. You are the best teacher I have had in my short 62 years on this earth!
in your code lines
6 frame[:,:] = [0,0,255]
7 frame[:,0:125] = [0,255,0]
I am getting an error
Traceback (most recent call last):
File "c:/Users/User/PycharmProjects/Python/Opencv-5.py", line 14, in
frame[:,:]=[0,0,255]
ValueError: could not broadcast input array from shape (3) into shape (250,250)
Does round parenthesis make a difference? frame[:]=(0,0,255)
i don't know the movie but i've made it till the end :)))))))))))))))))))))
👍
🔥🔥🔥🔥
I am legend, also allows for variable window sizes, but I'm pretty sure there must be an easier way to do it than my solution. We shall see :)
I am Legend!!
❤❤❤
I am legend ... but not as legend as "Cool Hand Luke".😁
Excellent. One of the greatest movies ever, in my mind.
I try to search it in google using the word "Failure to communicate movie line" I got Cool Hand Luke I hope it is right ... I'm gonna re watch beacuse i'm late in the premiere :(
Cool Hand Luke (1967)
I am legend hopefully worthy of a double chest thump. I took your beat down from lesson 6 and stepped up to thinking like an engineer and did the math for this lesson. Got a beautiful red and black checkerboard. Thanks for the great lesson and making math great again. Even cool hand Luke wouldn't beat me down on this assignment.
Link to my homework.
ua-cam.com/video/ak2CIhgmpGY/v-deo.html
Tom
Cool Hand Luke movie
You got it, Boss.
movie is Cool Hand Luke
You are correct
Cool Hand Luke (1967) ; :)
Indeed
I AM LEGEND
I am legend
I am legend
Cool Hand Luke
LEGEND!
RESIST TYRANNY!
FREEDOM!
The Good, the Bad, the Ugly
Love those Spaghetti Westerns
A great movie, but unfortunately, not the one with the line. Loved G B & U but not the right answer for this question. Hint. . . movie had Steve McQueen.
Oops...wrong neurons firing in my noggin'
i'm right ?
I'm sorry Paul, but your MIC is too much BASS that it rumbles...
I think you'll find all the RUMBLE comes from the content 😄😁👆👌✌👍🖖
@@bigbogeyface-- is that like "Bringing the Thunder"?
@@georgefenrichjr.9636 I do believe so 👍 ⛈ ☔ 😌 💻
Cool Hand Luke!
Cool Hand Luke
I am legend
Cool Hand Luke
Cool Hand Luke
Classic!