Client Development Guide
Prerequisites
Install gRPC and Protocol Buffers
Ensure gRPC and the Protocol Buffers (
protoc) compiler are installed correctly in your development environment. Follow the official documentation for installation and version compatibility.Generate client code
Use the MipMap
.protofile Proto file download and generate client code for your target language withprotoc. See the gRPC official documentation or in-project instructions for commands and options.Prepare the task configuration JSON file
The real-time reconstruction service requires a task configuration JSON file at initialization. Ensure the file is complete, the path is correct, and the server can access it.
Path access
Ensure image paths in the client configuration are local or network paths directly accessible by the server. Inaccessible paths will cause task failures.
Standard real-time reconstruction workflow
- Start the server (
realtime_service)
Start the server and keep it listening. Specify the port with -port_number, for example:
realtime_service -port_number 50051Multiple server instances can run concurrently on different ports.
- Start the client and connect
Start the client, specify the server port, and establish a gRPC connection. Call interfaces in this order:
Initialize— Initialize the real-time reconstruction taskAddFrame— Add image frames one at a timeEndTask— End the current real-time task
- Task management and repeated runs
The server process can run continuously and handle multiple tasks. The client exits after each EndTask call. To start a new task, launch the client again, connect to the server, and repeat the workflow above.
Client program realtime_client
The realtime_client program is provided for callers who are unfamiliar with gRPC and have a simple integration pattern. No custom client code is required—start realtime_client and the server executable.
Steps:
(1) Add image_dir and the target scaled image size to the initialization JSON. Ensure the directory is valid.
| Field | Type | Description |
|---|---|---|
image_dir | string | Image folder path (UTF-8 encoding) |
target_max_size | int | Longest-edge pixel count after frame scaling. Real-time tasks should scale frames; larger values improve quality but increase per-frame latency. When 0, scale images externally and pass the scaled image metadata string (see below). |
(2) Start realtime_service from the console. The optional argument is the port number; different ports represent different services. Default port: 50051.
realtime_service -port_number 50051(3) Start realtime_client from the console with the same optional port argument.
realtime_client -port_number 50051After the client starts, the console prompts for the path to the parameter JSON file. Enter the JSON file path (without quotes). The server then runs real-time reconstruction and prints logs.
(4) Poll 2D and 3D real-time outputs on a schedule and refresh rendering.
(5) After the real-time task starts, the client waits for the end command. When you type end, the server stops adding frames and ends the current real-time task.
Miaosuan edition development guide
The Miaosuan edition SDK has special requirements:
- Set the
realtime_servicetask_typeparameter to2D:
./realtime_service --port_number 50051(optional) --task_type 2DThe
license_idfield must be9202.AddFrameimage_meta_datamust be a valid value—the caller must scale images and supply metadata for the scaled images. Use theextract_image_infoutility:
./extract_image_info --src_image_path path_to_src_image --dst_image_path path_to_dst_image --info_json path_to_extracted_image_meta_data --max_side_width target_pixels_of_longest_side_of_dst_iamge- The following JSON parameters have no effect during server initialization:
do_realtime_3d_map,target_max_size,mesh_3d_save_type,rt_mesh_reso_scale_to_gsd,save_dom_tiff,coordinate_descriptor_2D.