Detect People with Raspberry Pi and MATLAB Online
Learn how to use your Raspberry Pi™ with MATLAB Online™ to detect upright people. Remotely access your Raspberry Pi from anywhere that has an Internet connection. Connect to your Raspberry Pi camera module and use the peopleDetectorACF
and the detect()
method to return bounding boxes and scores for the people detected in the live video.
Download the code used in this video.
Published: 22 Jul 2019
In this demo, I will show you how to detect people from a Pi camera using a Raspberry Pi™ and MATLAB Online™.
If you haven’t set up your Raspberry Pi in MATLAB Online, please refer to the documentation to learn how.
Use the command raspilist to see the online Raspberry Pis. You need to connect to your board using the function raspi(). You can either specify a Raspberry Pi or use the default which connects to the most recent board.
Here, I’m using a Raspberry Pi camera Module V2, which is connected to the Pi using the ribbon cable. Connect to it by using the function cameraboard(). Here, I’m using the resolution 640 by 480.
Next, you can load the people detector. This detector was trained using a person data set. It detects upright people using aggregate channel features.
Here you can use a for loop to repeatedly take images using the snapshot() function, and use the detect() function to find the people in the image and store the results as bounding boxes and scores.
Now, you can insert these results into the image using insertObjectAnnotation() and then use imshow() to display the image to the screen.
Click Run and a figure on the right will show up.
As you can see, as people walk into frame, they are highlighted by the yellow bounding boxes along with a score at the top of the box.
We’ve successfully detected people from the Raspberry Pi camera using MATLAB Online.
For more information, please visit the documentation at mathworks.com.
Up Next:
Related Videos:
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)