Basic and important implementation points

 

YC image usage


Available resolution list for app

The list of YC image resolutions available to the app varies depending on the camera firmware settings.

ref: https://dev-partner-en.i-pro.com/space/TPFAQEN/1172766748/Available+YC+image+resolution+by+ADAM_CamPref_Get()

Support upside-down image

When using the image rotation and upside-down settings of the CV2x camera, the YC images the app can get are not automatically flipped, and the app has to implement the flipping process.

In addition, for some CV2x cameras (box type, dome type), regardless of the upside-down setting, the YC images that the app can get are inverted by default due to the orientation of the image sensor. Please refer to the following page to implement the inversion process after getting the YC images.

https://dev-partner-en.i-pro.com/space/TPFAQEN/967836262/Installation+direction+of+the+camera+and+retrieved+YC+image

 

This is implemented in the sample applications web_template_app, yuv_dnn_app, yuv_pose_ap, yuv_ssd_app, yuv_yolo_app, yuv_yolov5_app, and yuv_yolov8_app included in SDK v2.01 or later.

360-degree fisheye camera

Depending on the image capture mode configuration, app can use the desired images such as fisheye images or de-warped images in the app.

https://dev-partner-en.i-pro.com/space/TPFAQEN/1301708940/Use+360-degree+fisheye+camera+with+the+AdamApp+app

Multi-directional camera

For multi-directional cameras, when installing the app, select the camera number (No. 1 to No. 4) to install the app on. When using ADAM_DevYcVideo_Create, the YC images got by the app will automatically be those from that camera number. When using ADAM_DevRawVideo_Create, it is possible to specify the image from a specific camera number or automatically, depending on the argument.

 

If you want to display video from a camera number on the web UI of the app, for example, please use Adam_GetSensorChannel to get the camera number where the app is installed, and then use the CGI.

(ex. /cgi-bin/mjpeg?ch=2, /cgi-bin/mjpeg?ch=3, /cgi-bin/mjpeg?ch=4)

This is implemented in the sample applications web_template_app.

 

The frame rate of the YC image for multi-directional camera is limited.

 2M / 4M : max. 15 fps

 5M / 6M / 4K : max. 7.5 fps

 

Example of AI processing sequence


image-20240530-062539.png

 

Perform AI processing when camera firmware event is triggered

Instead of performing image analysis on all YC images, you can use ADAM_DevInputAlarm_Create to have the app receive VMD or terminal alarm events detected by the camera and then process them for a fixed period of time (this is implemented in the sample app web_template_app), or you can use ADAM_DevPtzPresetPositionState_Create to receive the trigger that PTZ camera moves to a preset position.

ADAM_DevInputAlarm_Create is not supported for python.

 

Sending data to external devices


When event is generated in the app, app can use the SDK to trigger alarm on camera firmware, or the app can communicate directly with external devices.

ADAM_Alarm_Notify

The following camera firmware functions can be triggered.

ex.

 

*This SDK is implemented in the sample applications alarm_sample_app and web_template_app.

ADAM_MetaDataStream_SetRaw

Data can be sent as RTSP metadata channel. Software that utilizes this data needs to be developed by our partners.

 

Also, by using a specified data format, it can be integrated with i-PRO Active Guard and various VMS automatically.

https://dev-partner-en.i-pro.com/space/TPFAQEN/1051271527/i-PRO+Active+Guard+integration+guide

 

*This SDK is implemented in the sample applications meta_stream_app and web_template_app.

ADAM_AdditionalInfo_Set

Data can be added to the RTP extension header for H.264, H.265, and audio transmission. In case of JPEG, COM segment is used. It is neccessary for partner to develop client software.

 

*This SDK is implemented in the sample application additional_info_sample_app.

 

Other protocol

 

Partners can freely implement protocols. The sample app mqtt_sample implements MQTT.

 

Run camera firmware API (CGI) from app


It is possible to run CGI from the application to the HTTP port of the camera firmware as local communication. Since user authentication is required, the camera's user name and password must be implemented as application configuration. The camera's HTTP port number setting, which is required for local communication, can be got by ADAM_GetHttpInfo.


CGI documentation: https://i-pro.com/products_and_solutions/en/surveillance/learning-and-support/device-integration/i-pro-camera
About CGI details, please contact us from the support page of each region.https://i-pro.com/products_and_solutions/en/surveillance/contact-us

 

Utilize camera’s internal RAM and ROM


Available resources depending on the camera model.

ref. https://dev-partner-en.i-pro.com/space/TPFAQEN/701433474/Installation+conditions+for+applications

Storing data to ROM (flash memory)

ADAM_GetAppDataDirPath provides the directory to store data into flash memory inside the camera. The data will be kept even if the camera is turned off and on.

 

Because there is a limit to the number of times that a flash memory can be written to, if you want to save data detected from video, you need to send it to an SD card or external device and save it there.

When temporarily storing into RAM is enough, ADAM_GetAppTmpDirPath provides the direcltory on RAM, and you can use it as long as it does not exceed the RAM limit.

 

Resource Monitor tool in SDK 2.01 or later allows you to check the status of access to flash memory. Please check during development to see if there is any unnecessary access.

ref: https://dev-partner-en.i-pro.com/space/TPFAQEN/1039828049/Resource+Monitor

 

If the used ROM size exceeds the limit, camera's firmware will stop the app. In this case, “Illegal termination (ROM capacity limit (actual capacity))” will be displayed in the camera's web browser control log.

 

Storing data to RAM

It is possible to temporarily store data in the directory got by ADAM_GetAppTmpDirPath.

In this case, please make sure not to exceed the upper limit.

If the used RAM size exceeds the limit, camera's firmware will stop the app. In this case, “Illegal termination (RAM capacity limit)” will be displayed in the camera's web browser control log.

 

How to get resource information

 

During development, you can check it using the Resource Monitor tool included in the SDK.

If you want to get it within the app, you can do so in one of the following ways.

  1. Adam WebAPI getAppResourceInfo

  2. /proc/[pid]/status, /proc/[pid]/statm

  3. ADAM_GetRomRamSize *Supported in SDK v2.01 or later

 

Utilize SD memory card


To access SD memory card from the app, set [On] for [Basic] - [SD memory card] - [Ext. software mode] on camera's web.

ADAM_GetSdCardPath provides the directory.

With external library SQLite, you can also create a database on the SD memory card. This is implemented in the sample app sqlite_app.

 

When [FAT] is used for [SD Memory Card File System Format] setting, the recording function to the SD memory card by the camera firmware also works, but this cannot be guaranteed.

When [ext] is used, the recording function to the SD memory card by the camera firmware does not work.

 

There is a limit to the number of times you can write to an SD memory card. For details, please refer to the manufacturer's information.

WEB UI implementation


You can freely implement WEB UI in your app and display it from the camera's WEB browser (e.g. displaying MJPEG and detection bounding box, changing app settings, etc.).

WEB UI is also implemented in various sample apps, and web_template_app includes functions that are generally required for apps.

If license activation is required for the app, this must be implemented by the partner. SDK provides camera's MAC address and serial number.

 

Use of multiple AI models and multiple apps


It is possible to include multiple AI models in one app.

If you want to divide the app into multiple apps and communicate between them, please refer to the sample apps iac_server_sample_app and iac_client_sample_app.

 

Keep-alive monitoring


The camera firmware will try communicating to app's main thread at intervals of about 20 seconds. Please do not perform waiting processes or time-consuming processes in the main thread.

If the app does not respond for two consecutive times, it is judged that the app status is abnormal and the firmware will stop the app automatically. If the app is still within its scheduled operation period, it will automatically start again.

 

In addition, when the external device send AdamCGI (WEB API) to camera and the application does not return a response to the firmware, the application will stop and restart in the same way.

For example, even if the application checks the received parameters and determines that client request is not correct, app must implement a response to the firmware using ADAM_ServerResponse_Send or ADAM_ServerResponse_SendAsIs.

 

If you want to add another thread in your app to the keep-alive monitoring list, use ADAM_KeepAlive_Add.

CV2x and CV52 camera app compatibility and how to distinguish SoC


Camera apps for SoCs with Cv2x and CV52 are not compatible. If you have already developed a Cv2x camera app and would like to develop a CV52 camera app, you will need to convert the AI ​​model (https://dev-partner-en.i-pro.com/space/TPFAQEN/1186890263/How+to+create+an+AI+model+for+ambaCV5X) and change the build options (https://dev-partner-en.i-pro.com/space/TPFAQEN/1158545409/SDK+installation+(v1.80+or+later)).

 

In the source code, following define can be used. Either one will be enabled depending on the build options.

#ifdef ADAM_TARGET_PF_ipro_ambaCV2X_linux

#ifdef ADAM_TARGET_PF_ipro_ambaCV5X_linux

 

This is implemented in the sample applications web_template_app, yuv_dnn_app, yuv_pose_ap, yuv_ssd_app, yuv_yolo_app, yuv_yolov5_app, and yuv_yolov8_app included in SDK v2.01 or later.

 

In addition, it is also possible to get SoC information using the SDK ADAM_GetSocType, which was added in firmware versions compatible with SDK 2.01 and later.