Dimensional Analysis is one of the most important tools used by practicing engineers and scientists, and allows you to convert from any set of units to any other set of units. It provides an a methodical method that takes the guess work out of conversions. This video takes you through the method step-by-step with several examples. The homework should be done before watching the next video.
AI on the Jetson Nano LESSON 40: Training Facial Recognition Models in OpenCV
In this lesson we learn to make training our AI Facial Recognition system simpler and more automated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import face_recognition import cv2 import os print(cv2.__version__) Encodings=[] Names=[] j=0 image_dir='/home/pjm/Desktop/pyPro/faceRecognizer/demoImages/known' for root, dirs, files in os.walk(image_dir): print(files) for file in files: path=os.path.join(root,file) print(path) name=os.path.splitext(file)[0] print(name) person=face_recognition.load_image_file(path) encoding=face_recognition.face_encodings(person)[0] Encodings.append(encoding) Names.append(name) print(Names) font=cv2.FONT_HERSHEY_SIMPLEX image_dir='/home/pjm/Desktop/pyPro/faceRecognizer/demoImages/unknown' for root,dirs, files in os.walk(image_dir): for file in files: print(root) print(file) testImagePath=os.path.join(root,file) testImage=face_recognition.load_image_file(testImagePath) facePositions=face_recognition.face_locations(testImage) allEncodings=face_recognition.face_encodings(testImage,facePositions) testImage=cv2.cvtColor(testImage,cv2.COLOR_RGB2BGR) for (top,right,bottom,left),face_encoding in zip(facePositions,allEncodings): name='Unknown Person' matches=face_recognition.compare_faces(Encodings,face_encoding) if True in matches: first_match_index=matches.index(True) name=Names[first_match_index] cv2.rectangle(testImage,(left,top),(right,bottom),(0,0,255),2) cv2.putText(testImage,name,(left,top-6),font,.75,(0,255,255),2) cv2.imshow('Picture', testImage) cv2.moveWindow('Picture',0,0) if cv2.waitKey(0)==ord('q'): cv2.destroyAllWindows() |
REVIEW of the New NVIDIA Jetson Xavier NX Single Board Super Computer
Guys I am really excited about the new NVIDIA Jetson Xavier NX supercomputer on a board. I have put this bad boy through his paces for the last couple of weeks, and above is my video review. Really love this new board, and you can pick yours up HERE.
Arduino Tutorial 61: Improving Precision of Your Distance Measurements

In this lesson we strive to improve the precision of our distance measurements using an average of a large number of measurements. This builds on the work we did in the last few lessons.
We are building this with parts from our Elegoo Kit , and our actual build is using an Arduino Nano, which allows the project to be built on a single breadboard. You can get the neat jumper wires HERE.
This video takes you through the process step-by-step.
The code developed in this video is included below for your convenience.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #include <LiquidCrystal.h> int rs=7; int en=8; int d4=9; int d5=10; int d6=11; int d7=12; int buttonPin=A0; int buttonVal; int numMeas=100; float avMeas; int j; float bucket=0; LiquidCrystal lcd(rs,en,d4,d5,d6,d7); int trigPin=2; int echoPin=3; int pingTravelTime; float pingTravelDistance; float distanceToTarget; int dt=5000; void setup() { // put your setup code here, to run once: lcd.begin(16,2); pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); pinMode(buttonPin,INPUT); digitalWrite(buttonPin,HIGH); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: lcd.setCursor(0,0); lcd.print("Place the Target"); lcd.setCursor(0,1); lcd.print("Press to Measure"); buttonVal=digitalRead(buttonPin); while (buttonVal==1){ buttonVal=digitalRead(buttonPin); } lcd.setCursor(0,0); lcd.clear(); lcd.print("Measureing . . ."); for (j=1;j<=numMeas;j=j+1){ digitalWrite(trigPin,LOW); delayMicroseconds(10); digitalWrite(trigPin,HIGH); delayMicroseconds(10); digitalWrite(trigPin,LOW); pingTravelTime=pulseIn(echoPin,HIGH); delay(25); pingTravelDistance=(pingTravelTime*765.*5280.*12)/(3600.*1000000); distanceToTarget=pingTravelDistance/2; bucket=bucket+distanceToTarget; } avMeas=bucket/numMeas; Serial.print("Av. Dist. to Target is: "); Serial.print(avMeas); Serial.println(" in."); lcd.clear(); lcd.setCursor(0,0); lcd.print("Target Distance"); lcd.setCursor(0,1); lcd.print(distanceToTarget); lcd.print(" Inches"); delay(dt); } |
Arduino Tutorial 60: Add a Go Button to your Distance Sensor

In this lesson we add a “GO” button to our portable distance measurement system. Note that from the work done in Lesson 59, we are only left with digital pin 13. The problem is that pin 13 is connected to the on-board diode, so trying to use pin 13 as a button pin will not work.
Never fear we can use one of the analog in pins. To use an analog in pin as the button pin, in the void setup, you need to declare the pin as an INPUT, and then digitalWrite the pin to HIGH. This will connect it to 5V through a pullup resistor. Now you just have to do a digital read to that pin. When button is untouched, you will read a “1”, and when you press the button, you will read a “0”.
We are building this with parts from our Elegoo Kit , so if you get this kit, you will be using the same hardware we are using.
A challenge with this project is to keep the build neat and compact, which is much easier if you use an Arduino Nano, which allows the project to be built on a single breadboard. The build neatness is also facilitated by using small straight jumper wires, which you can get HERE.
This video takes you through the explanation step-by-step:
This is the code used in this project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <LiquidCrystal.h> int rs=7; int en=8; int d4=9; int d5=10; int d6=11; int d7=12; int buttonPin=A0; int buttonVal; LiquidCrystal lcd(rs,en,d4,d5,d6,d7); int trigPin=2; int echoPin=3; int pingTravelTime; float pingTravelDistance; float distanceToTarget; int dt=5000; void setup() { // put your setup code here, to run once: lcd.begin(16,2); pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); pinMode(buttonPin,INPUT); digitalWrite(buttonPin,HIGH); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: lcd.setCursor(0,0); lcd.print("Place the Target"); lcd.setCursor(0,1); lcd.print("Press to Measure"); buttonVal=digitalRead(buttonPin); while (buttonVal==1){ buttonVal=digitalRead(buttonPin); } digitalWrite(trigPin,LOW); delayMicroseconds(10); digitalWrite(trigPin,HIGH); delayMicroseconds(10); digitalWrite(trigPin,LOW); pingTravelTime=pulseIn(echoPin,HIGH); delay(25); pingTravelDistance=(pingTravelTime*765.*5280.*12)/(3600.*1000000); distanceToTarget=pingTravelDistance/2; Serial.print("Distance to Target is: "); Serial.print(distanceToTarget); Serial.println(" in."); lcd.clear(); lcd.setCursor(0,0); lcd.print("Target Distance"); lcd.setCursor(0,1); lcd.print(distanceToTarget); lcd.print(" Inches"); delay(dt); } |