Code
Note: Modify the WiFi name and password.
#include "WiFi.h"
#include "StreamIO.h"
#include "VideoStream.h"
#include "RTSP.h"
#include "NNGestureDetection.h"
#include "VideoStreamOverlay.h"
#define CHANNEL 0
#define CHANNELNN 3
#define NNWIDTH 192
#define NNHEIGHT 192
VideoSetting config(VIDEO_FHD, 30, VIDEO_H264, 0);
VideoSetting configNN(NNWIDTH, NNHEIGHT, 10, VIDEO_RGB, 0);
NNGestureDetection gesturedetect;
RTSP rtsp;
StreamIO videoStreamer(1, 1);
StreamIO videoStreamerRGBGD(1, 1);
char ssid[] = "xxx";
char pass[] = "xxx";
int status = WL_IDLE_STATUS;
IPAddress ip;
int rtsp_portnum;
void setup() {
Serial.begin(115200);
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(2000);
}
ip = WiFi.localIP();
config.setBitrate(2 * 1024 * 1024);
Camera.configVideoChannel(CHANNEL, config);
Camera.configVideoChannel(CHANNELNN, configNN);
Camera.videoInit();
rtsp.configVideo(config);
rtsp.begin();
rtsp_portnum = rtsp.getPort();
gesturedetect.configVideo(configNN);
gesturedetect.modelSelect(GESTURE_DETECTION, NA_MODEL, NA_MODEL, NA_MODEL, NA_MODEL, NA_MODEL, DEFAULT_PALMDETECT, DEFAULT_HANDLANDMARK);
gesturedetect.begin();
videoStreamer.registerInput(Camera.getStream(CHANNEL));
videoStreamer.registerOutput(rtsp);
if (videoStreamer.begin() != 0) {
Serial.println("StreamIO link start failed");
}
Camera.channelBegin(CHANNEL);
videoStreamerRGBGD.registerInput(Camera.getStream(CHANNELNN));
videoStreamerRGBGD.setStackSize();
videoStreamerRGBGD.setTaskPriority();
videoStreamerRGBGD.registerOutput(gesturedetect);
if (videoStreamerRGBGD.begin() != 0) {
Serial.println("StreamIO link start failed");
}
Camera.channelBegin(CHANNELNN);
OSD.configVideo(CHANNEL, config);
OSD.configTextSize(CHANNEL, 16, 32);
OSD.begin();
gesturedetect.drawHandRegion();
}
void loop() {
// Do nothing
}
Upload
1. Hold down the BOOT button and press the EN button to enter download mode.
2. Select the corresponding serial port and click Download. Wait for a successful upload prompt.
3. Reset by pressing EN again to run the program.
Configuration
After uploading, open the serial monitor. Once WiFi connection is detected, the camera’s IP address will be displayed.
Enter rtsp://192.168.1.104:554 in VLC software to achieve RTSP streaming.
Code
For details, refer to: Neural Nework – Face Recognition – Realtek IoT/Wi-Fi MCU Solutions
#include "StreamIO.h"
#include "VideoStream.h"
#include "RTSP.h"
#include "NNFaceDetectionRecognition.h"
#include "VideoStreamOverlay.h"
#define CHANNEL 0
#define CHANNELNN 3
#define NNWIDTH 576
#define NNHEIGHT 320
VideoSetting config(VIDEO_FHD, 30, VIDEO_H264, 0);
VideoSetting configNN(NNWIDTH, NNHEIGHT, 10, VIDEO_RGB, 0);
NNFaceDetectionRecognition...
Read more »