Please enable JavaScript to view this site.

Waijung 2 User Guide

How do these blocks appear in a Simulink model?

camera_block_1

What can be configured?

camera_block_2
camera_block_2_1

Configuration Parameter

Selectable Option/Value

Description

Stream mode

Stream as IP camera (JPEG output)--Stream to target (RGB888 output)

Select whether the camera feed should be streamed to Matlab Simulink directly or pass-through ESP32 target.

Target Stream mode

do not stream--stream to HTTPserver--stream to simulink

Select whether the camera feed should be streamed in the target mode is selected.

Camera Module

AIMAGIN Camera--Custom Camera

Select the camera module.

Camera Pins

 

Enter the camera pin connections.

XCLK frequency (Hz)

 

Enter the clock frequency(locked)

LEDC TIMER

 

Enter the LEDC TIMER

LEDC CHANNEL

 

Enter the LEDC CHANNEL

Frame Size

QQVGA--QVGA--CIF--VGA--SVGA--XGA--SXGA--UXGA

Select the frame size of the camera feed.

JPEG quality

0 to 63

Enter the required quality of the image.

Number of frame buffers to be allocated

 

Enter the number of buffer frames to be allocated.

Sample time (sec)

-1 (inherited) or specify

Specify the sample time

Brightness

-2 to 2

Set image brightness (default-0)

Contrast

-2 to 2

Set image contrast (default-0)

Saturation

-2 to 2

Set image saturation (default-0)

Special effects

No Effect--Negative--Grayscale--Red Tint--Green Tint--Blue Tint--Sepia

Set a special effect (default-No Effect)

White balance

Check--Uncheck

Set white balance(default-Check)

AWB gain

Check--Uncheck

Set auto white balance(default-Check)

WB mode

Auto--Sunny--Cloudy--Office--Home

Set white balance mode(default-Auto)

Exposure ctrl

Check--Uncheck

Set exposure control(default-Check)

AEC2

Check--Uncheck

Set automatic exposure control(default-Uncheck)

AE level

-2 to 2

Set auto exposure level(default-0)

AEC value

0 to 1200

Set auto exposure control value(default-300)

Gain ctrl

Check--Uncheck

Set gain control(default-Check)

AGC gain

0 to 30

(default-0)

Gainceiling

0 to 6

(default-0)

bpc

Check--Uncheck

(default-Uncheck)

wpc

Check--Uncheck

(default-Check)

raw_gma

Check--Uncheck

(default-Check)

lenc

Check--Uncheck

Set lens correction(default-Check)

hmirror

Check--Uncheck

Set horizontal mirror(default-Uncheck)

vflip

Check--Uncheck

Set vertical flip(default-Uncheck)

dcw

Check--Uncheck

(default-Check)

colorbar

Check--Uncheck

(default-Uncheck)

 

INPUT/ OUTPUT Port

Port Name

Port Type

Date Type

Description

R

Vector

uint8

Red color output port for the camera image

G

Vector

uint8

Green color output port for the camera image

B

Vector

uint8

Blue color output port for the camera image

When to use these blocks?

This block can be used to stream the camera feed to,

To web browser

To Matlab Simulink.

To ESP32 target and process image.

How do these blocks work?

Mode: Stream as IP camera (JPEG output)

 In order to stream to Matlab Simulink, ‘esp32_camerablock_receiver’ and ‘esp32_host_setup’ blocks should be used in the model file at the target computer. If the user wants to view the camera image host computer also needs to have the computer vision toolbox, where "video view" block is available

Mode: Stream to target (RGB888 output)

 In this mode, the camera feed can be processed within the ESP32 itself by enabling output ports in the esp32_camerablock. Most computer vision toolbox functions are compatible with camera block.

 

Note: Currently this block is not supported for ESP32C3 target version due to library limitations(supported Socs). This block is tested with ESP32 target and working.

Demo

Stream mode Matlab and live view from Simulink

Demo file : esp32_camera_stream_demo.slx

camera_block_3

Demo file : host_pc_camera_receive.slx

camera_block_4

Description

This example will demonstrate how to use the camera block to stream a video from the target board and send data to the host PC. In addition to that, the WIFI blocks are used to set up the WiFi in AP mode. The data will be received using the IP Camera Receiver block and stream video can be viewed using the Video Viewer on simulink.

 

Additionally, users can view the streaming video through the web browser.

URL to capture still photos: http://[esp32 ip address]:80/capture

URL to live stream the camera feed: http://[esp32 target ip address]:81/stream

 

host_pc_camera_receive.slx demo file is not to upload to the target. Click the run button and open the RAW Image block to view the video. Make sure the stop time is set to inf.

Note: Host PC should have "computer vision toolbox" to have the video viewer block.

 

The SSID and the Password for accessing the target camera are as follows.

SSID: ESP32_CAM

Password: 00000000

Hardware Setup

1.1 x ESP32 module with camera

2.Host PC with Matlab simulink & WiFi

Stream mode Target

Demo file : esp32_camera_control_demo.slx

camera_block_5
camera_block_6
camera_block_7

Description

This demo shows one use case scenario for the "Stream to target (RGB888 output)" of the camera block. In this mode the video feed can be processed within the target ESP32 board itself. Also user is given the option to stream the processed image to Matlab Simulink. This demo shows how to process the video feed and transmit it. Again here we used computer vision toolbox to do the image processing.

To connect the WiFi with the target board use following IP, SSID and the Password

SSID: ESP32_CAM

Password: 00000000

 

Video result can be viewed as same as the previous example(web browser/host_pc_camera_receive.slx).

Hardware Setup

1.1 x ESP32 module with camera

2.Host PC with Matlab simulink & WiFi

What should be happening?

Once the demo is set up on the ESP32 camera module, connect to it with the given SSID and the Password using the client device via WiFi. Then live feed can be viewed using above mentioned methods. Here is an example of using host_pc_camera_receive.slx.

camera_block_8

 

Copyright 2023 Aimagin Co.,Ltd. Rev.869