Category Archives: Python

Using an Arduino with Python LESSON 4: Visual Display of Measured Voltage in Visual Python

In this lesson we show how you can measure a voltage from a potentiometer using Arduino, and then pass that data to Visual Python over the serial port. Then we use visual python to create a 3D model that is animated by the live data.

On the Arduino side we use the following code to measure the voltage from the potentiometer:

Then on the python side we read and display the data with the following code:

Watch the video for a complete explanation of the code.

AI for Everyone LESSON 25: First Attempt at Using MediaPipe for Gesture Detection

In this lesson we describe what our approach will be to creating a gesture detection and recognition algorithm using mediaPipe. We will demonstrate the algorithm with some simple code demos. In future lessons we will further develop the algorithm.  The code below is the initial algorithm developed in this video. Enjoy!

 

Parsing Mediapipe Data for Face Mesh, Pose, and Hand Landmarks

We all love the incredibly powerful features of the Mediapipe AI library. But, lets face it, the data is very hard to interpret, and the returned data structures are complex, and poorly documented. The purpose of this lesson is to show you how to parse the complex data structures coming from Mediapipe, and to create simple, intuitive arrays for the landmark data. We create classes in python which do the parsing, and the classes are easy to work with. With these classes, you can use mediapipe simply, and get simple to understand data structures back. The video explains what we are doing and how we are doing it. For your convenience the resulting code is posted below.

 

Parsing Mediapipe Data for Pose Landmarks, Hand Landmarks and Face Bounding Box


 

In this lesson we show how to create python classes to parse the data coming from Mediapipe for hand Landmarks, Pose Landmarks and the bounding boxes for found faces. Creating these classes allows the difficult parsing to be done in the class, and then have a simple way to parse and use all the data.

 

Python 3D Graphics Tutorial 21: Understanding and Using Widgets in Vpython

In this video Lesson, we show how to interact with a Python model using widgets. We show how Vpython allows use of dropdown menus, radio buttons, check boxes and slider bars. These combine to give the user great control over an animated model. In past lessons we changed parameters by editing the program. By incorporating widgets we can allow non-programmers to effectively interact with a model.