AI on the Edge LESSON 23: Creating Regions of Interest (ROI) in OpenCV with Slicing
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:
https://www.patreon.com/PaulMcWhorter
Are you guys ready to learn AI? Will you be one of those that Thrives, or one that does not Survive? AI will be the biggest opportunity of the next hundred years, but at the same time many will be destroyed by it. You have already learned how to use openCV on the Raspberry Pi 5 to create live videos by grabbing and displaying frames. In this lesson we will become more comfortable managing multiple video windows in openCV. In the future we will often have multiple windows open on our screen, and we need to be able to keep these organized. In todays lesson we will learn how to begin to consider the picture or video frame we are gathering from the camera as a data structure. We will show that it is a data array. We have rows, and columns, and the intersection of a Row and Column is a pixel. For openCV, the pixel is given in B,G,R, or Blue Green Red format. A pixel would be a tuple like [0,255,0]. That would represent the color pure green. We also introduce you to the concept of a ROI or Region of Interest where we just look at parts of the frame. We will develop a program that splits the main frame into 4 quadrants, each a region of interest. We also show how to neatly stack or tile the video windows.
If you feel you need more background and familiarity with Python, I have a whole python class on this channel here:
https://www.youtube.com/playlist?list=PLGs0VKk2DiYzguDvh5xk2XoX9V1VKP5Hv.
In this class you will need the following hardware:
AI Fusion Lab Kit, available here:
You will also need a pi 5. Get one with as much memory as you can afford, but most pi 5’s should work for the class. This is a link.
https://amzn.to/40Gek5n
You will need a heat sink and fan:
https://amzn.to/3PpaEmv
You will need a 25 watt power supply:
https://amzn.to/4c6i1YC
Micro HDMI Cable
https://amzn.to/4lPQz4V
Just about any SD card you have lying around should work, I use a 128GB card. These cards seem to be really expensive right now, so I suggest you try and find one lying around. Smaller cards should work as well. Just find something that will work for now, and stock up when prices are lower.
Any USB mouse and keyboard will work. If you want a wireless one for the pi, look at this one:
https://amzn.to/4d71jte
Guys try as best you can to use things you already have. Hopefully you have keyboard, mouse, sd card and cables and such. The links are in case you do not have the items already.
Here is the link to the special Raspberry Pi Bookworm OS that already has all the AI libraries, modules, dependencies, and device drivers needed in this class. When you flash this operating system, don’t mess with it. Everything works, so do not do an update or upgrade-all. This OS is just for this class. If you want to do other things, flash a different card. This is a link to the OS:
https://sunfounder.github.io/download/ai-fusion-lab-kit/index.html
You will also need to install the Raspberry Pi OS imager for flashing the operating system. You can get it here:
https://www.raspberrypi.com/software/
These are the assembly instructions I mention the video for the Fusion AI Lab Kit
https://docs.sunfounder.com/projects/ai-lab-kit/en/latest/quick_start/assemble_power_hat.html
[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.]
#raspberrypi
#AI
#opencv
source
