This topic explains how to use the Device-side C SDK to implement vision capabilities, such as video calls and visual question answering.
1. Before you begin
1.1. Prerequisites
- This topic builds on "Implement chat capabilities with the Device-side C SDK". Before continuing, ensure that you have read the topic and prepared the required environment.
- This guide assumes you have already integrated the SDK and that the voice interaction workflow is running correctly.
- This guide reuses some pseudocode and interaction flows from Implement chat capabilities with the Device-side C SDK.
1.2. Configure and enable the vision module
-
In the Model Studio console, create a multimodal application.
After the application is created, the application card displays the application ID (which starts with
mm_) and the license usage status. If the license status is "Not Purchased", click Purchase to buy a license. Click Configure App to open the application configuration page. -
Click
Configure Appto enable the agent forVideo Call,Visual Question Answering,Photo Translation, and/orInstant Video Call. You can find this option in the Model Studio Applications list, under the Agent section on the Skill tab.
2. Develop the on-device vision module
The vision module features include visual question answering, video call, photo translation, and instant video call.
When not in a video call or an instant video call, any question similar to "What is in front of me?" triggers VQA.
When not in a video call or an instant video call, any question with a translation intent, such as "Translate the road sign in front of me," triggers photo translation.
When you are in a video call or an instant video call, the respective service handles all image Q&A logic.
2.1. SDK directory and file structure
After decompressing the SDK package, the relevant files and directories are structured as follows:
For information about how to obtain the SDK package, see Device-side C SDK.
c_visual.h header file and link the libc_visual.a static library.
2.2. c_visual initialization
Sample code:
c_visual_config only saves the configuration and registers command callbacks; it does not allocate the image buffer. The PSRAM image buffer is allocated automatically by the SDK when it receives the cloud vision-start command, or you can call c_visual_malloc to pre-allocate it before a session. Before allocation completes, APIs such as c_visual_task_handle and c_visual_image_get_buffer return UTIL_ERR_NO_INIT or NULL. In addition, c_visual_config must be called before c_mmi_init; otherwise it returns an error.