4.2.2. Hand–Eye Coordination Algorithm
Text Recognition Module: The PaddlePaddle framework, integrated with ROS and Python 3.6.9, is utilized, and the PaddleOCR text recognition system is installed. Building upon the OCR capabilities, the overall grasping logic is developed. The design workflow of this module is illustrated in
Figure 9.
OpenCV and PaddlePaddle are widely used libraries for visual algorithms, with PP-OCR being an OCR (Optical Character Recognition) toolkit developed on the PaddlePaddle deep learning framework [
18]. PP-OCR primarily consists of three components: DB-based text detection, detection-frame correction, and CRNN text recognition. PaddleOCR is chosen as the core algorithm for visual detection due to its efficient text detection and recognition capabilities, fast processing speed while maintaining high accuracy, and its simple, user-friendly APIs with multilingual support.
The image-processing workflow is illustrated in
Figure 10. Once the robot reaches the target parcel location, the camera mounted on the end of the robotic arm dynamically captures each frame of image data, extracting the current frame for processing. The image is first preprocessed using the OpenCV library [
19], followed by the application of a pre-trained text-detection model to locate text regions within the image. A deep learning–based recognition model then performs text recognition. Simultaneously, the center coordinates of the detected text bounding box are extracted and used as input parameters for the robotic arm’s pose adjustment via coordinate-system transformation.
For text-region localization, information filtering is a crucial step. During this process, object color characteristics are leveraged for positioning; specifically, areas likely to contain parcel boxes are extracted from the HSV image based on a predefined blue color range. Concurrently, the median filtering algorithm from OpenCV is applied, which replaces each pixel value with the median of its neighboring pixels to effectively reduce noise in the image.
Figure 11 illustrates the theoretical concept of the median filtering algorithm [
20].
In mail recognition and localization, mask-based processing is employed to binarize the blue-color region, isolating only the blue portions of the image. This approach reduces the computational load for subsequent processing steps while enhancing the efficiency and accuracy of target object extraction. By effectively removing image noise and preserving the edge information of the target, these methods minimize interference and improve both the precision and reliability of object recognition.
Coordinate Transformation Module:
In the designed system, the hand–eye coordination follows an “Eye-to-Hand” configuration, where the camera is fixed to the end-effector of the robotic arm. Consequently, visual processing involves transforming coordinates between the camera coordinate system and the robotic arm coordinate system. Utilizing the pinhole camera imaging model, image data is acquired and processed accordingly. According to the pinhole camera model [
21], the camera, with known focal length and distortion parameters, locates the target by converting extracted pixel coordinates into camera coordinates. The camera’s intrinsic parameter matrix K is defined as follows:
where f
x and f
y represent the camera’s focal lengths in the x- and y-directions, respectively, that is, the distances from the camera’s optical center to the imaging plane. These values are expressed in pixel units within the intrinsic matrix and determine both the camera’s field of view and the size of the captured image. The parameters c
x and c
y denote the coordinates of the principal point, which correspond to the projection of the optical axis onto the image plane, indicating the origin of the image coordinate system within the image.
Accordingly, given the image coordinate point (u, v) corresponding to the detected target object, the camera coordinate point (x, Y) can be computed as
To transform the camera-coordinate point into the robotic arm coordinate system, yielding (Arm_x,Arm_y,Arm_z), the fixed offsets between the camera and the robotic arm (offset_x,offset_y,offset_z) and the object’s depth Z relative to the camera must be considered.
Based on these factors, a comprehensive hand–eye coordination algorithm was developed. By leveraging the spatial relationships among the parcel, the camera, and the robotic arm, along with the conversion ratio between pixel dimensions and real-world distances, the algorithm converts camera coordinates into robotic arm pose information, enabling precise arm movement to grasp the parcel accurately.
Principle of Hand–Eye Coordination Parameter Tuning:
Based on actual testing conditions, the observation position of the robotic arm (arm _x,arm _y,arm _z) is first determined.
Next, based on the pixel offsets and from the camera’s center coordinate to the target coordinate, and the scaling ratio between actual physical size and pixel units, the real-world distances from the target to the image center, denoted as and are calculated.
Finally, using the observation height, the actual distance between the target and the camera, the fixed offset between the camera and the robotic arm, and the grasping parameters (grab _x,grab _y) are calculated and transmitted to the robotic arm. These parameters represent the target pose to which the arm should adjust after the camera has recognized the parcel in real time, enabling accurate extraction of textual information at the correct position.
If the parcel’s text information cannot be recognized, a four-point region is defined around the current pose, prompting the robotic arm to adjust its position and attempt recognition again.
4.2.3. SMITE Video Image Segmentation Algorithm
1. Key-Region Segmentation for Target Images:
When the robotic arm adjusts its pose, complex motions and variations in the target within the camera’s field of view, such as occlusion or changes in orientation, can cause the bounding box around key object parts to be lost. This often results in failure to recognize critical information printed on the parcel.
To address this challenge, we innovatively adopt the SMITE model proposed by DeepMind for image segmentation [
22]. Architecturally, the SMITE model employs a diffusion-based segmentation approach that processes video frames sequentially, achieving efficient video segmentation. Additionally, it incorporates a temporal-attention mechanism to maintain label consistency across frames, effectively reducing flicker and noise in the segmentation results. The core principle of diffusion models involves a forward-diffusion process followed by a reverse-denoising process. In the forward diffusion stage, applied to a single image frame (equivalent to each frame in video segmentation), the process can be described as follows:
Let
denote the image data at time
,
represent the original image (the initial frame state),
be a predefined noise scheduling parameter controlling the rate at which noise is added, and
represent standard Gaussian noise. The forward diffusion process can then be expressed as
By iteratively applying this formulation (with starting from the initial step), the image becomes progressively “corrupted” by noise.
In the reverse denoising process, the model learns a conditional probability distribution
to restore the image. This distribution is typically modeled as Gaussian, with mean
and variance
determined by the model parameter
. During training, the model optimizes these parameters by minimizing the negative log-likelihood, aiming to make the predicted denoised image as close as possible to the true noise-free image. During inference, the model progressively removes noise from a corrupted image to generate the segmented output (
Figure 12). Additionally, the SMITE model introduces a novel tracking-based voting mechanism that enhances segmentation stability and accuracy by tracking pixel positions within the attention maps. This mechanism effectively addresses the bounding-box loss problem, ensuring reliable segmentation accuracy across a wide range of challenging conditions.
2. Temporal-Attention Mechanism-Related Formula Derivation:
Suppose the video sequence contains frames, and the -th frame produces a feature vector after feature extraction, where represents the feature dimension.
3. Compute attention scores:
To capture inter-frame correlations, the attention score matrix
is computed, where each element
represents the attention score of frame
with respect to frame
. A dot-product attention mechanism can be used, for example:
where
is a function measuring the similarity between feature vectors.
4. Obtain weighted features:
By performing a weighted summation of the features from all frames using the attention scores, a temporally contextualized feature vector is obtained for segmentation, expressed as
In this way, the resulting feature vector incorporates information from other frames, helping to ensure label consistency across the entire sequence.
5. Tracking-and-Voting Mechanism-Related Formula Derivation:
Suppose that in the attention map, the position of pixel in frame is denoted as , and its corresponding feature vector is .
6. Position similarity computation:
The position similarity between pixels in adjacent frames is computed, for example, using a Gaussian kernel to measure positional variation. Let
be the scale parameter controlling position similarity. Then, the position similarity
(representing the similarity between pixel
in frame
and pixel
in frame
) can be expressed as
7. Feature similarity computation:
Feature similarity
is computed simultaneously, for example, using cosine similarity. Let
and
denote the feature vectors corresponding to two pixels, then
Voting weight computation: The voting weight
is obtained by combining position similarity and feature similarity, expressed as
Final voting score: For pixel
in frame
, the final voting score
is obtained by summing the voting weights from all corresponding pixels
in frame
, expressed as
Based on this voting score, the segmentation label of the pixel can be determined. For example, given a threshold , if , the pixel is classified as part of the target object; otherwise, it is labeled as background.
8. Algorithm Advantages:
Compared to other video segmentation algorithms such as Baseline-I and Grounded SAM 2, the SMITE model can accurately predict and segment objects in video frames using only one or a few reference images. This significantly reduces reliance on large amounts of annotated data, thereby enhancing the flexibility and efficiency of segmentation tasks. Furthermore, through its tracking and temporal voting mechanisms, SMITE ensures temporal consistency of segmentation results throughout the entire video sequence. Even under challenging conditions, such as variations in object appearance, changes in illumination, or shifts in viewpoint, the model maintains stable and precise segmentation, greatly improving the temporal continuity and reliability of the results (
Figure 13).
9. Deployment of the SMITE Algorithm:
Environment Preparation: Due to the substantial computational load of the SMITE model, the use of an NVIDIA GPU is recommended. The GPU should provide sufficient memory; processing high-resolution video typically requires at least 8 GB of VRAM or more. As the hardware on the logistics vehicle is insufficient for training and inference, cloud-based training is chosen for the SMITE model. A suitable deep learning framework, such as PyTorch or TensorFlow, should be selected according to the model implementation, with the corresponding versions installed. Additionally, NVIDIA CUDA and cuDNN libraries must be installed. Other essential libraries for data processing and visualization, including NumPy and OpenCV-Python, are also required. Pretrained SMITE model weights should be obtained from the official code repository linked in the corresponding research publication. Video data for segmentation must be collected and preprocessed by adjusting parameters such as resolution and frame rate to meet the model’s input specifications. Reference images should be prepared as per the model’s requirements, serving to guide the segmentation of objects appearing in the video frames.
Video Processing and Segmentation: Video frames are read sequentially using OpenCV-Python. Each frame undergoes preprocessing, such as normalization and resizing, to align with the model’s input requirements. The preprocessed frames are then passed through the SMITE model for segmentation inference, which outputs a segmentation mask for each frame. Finally, post-processing operations, including noise removal and hole filling, are applied to these masks to enhance the overall quality and accuracy of the segmentation results.