Adaptive angle adjusting method and system for code scanning camera and electronic equipment
By real-time detection of environmental parameters and dynamically optimizing adjustment strategies, the problem of low angle adjustment efficiency and insufficient accuracy of scanning cameras when environmental changes is changed is solved, and higher adaptability and efficiency are achieved.
Patent Information
- Application Number
- CN202510272139.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-10
AI Technical Summary
When the environmental parameters of existing code scanning cameras change dynamically, the angle adjustment efficiency is low and the accuracy is insufficient, making it difficult to adapt to complex and changeable actual scenarios.
By detecting the environmental parameters of the scanning code area in real time, an angle adjustment strategy is generated, and the multi-dimensional gimbal is driven to perform angle compensation actions, and image quality evaluation is performed based on the scanning code camera data, and the adjustment strategy is optimized to achieve adaptive angle adjustment.
It improves the accuracy and response speed of camera angle adjustment, and improves the adaptability and efficiency of the code scanning system.
Smart Images

Figure CN119788969A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of camera technology, and in particular to a method, system and electronic device for adaptively adjusting the angle of a barcode scanning camera. Background Art
[0002] With the rapid development of the Internet of Things and smart devices, code scanning technology, as an important means of information interaction, has been widely used in retail, logistics, medical care, manufacturing and other fields. However, in practical applications, the performance of code scanning cameras is often significantly affected by environmental factors, such as changes in lighting conditions, uncertainty in the distance and angle of the target object, etc. These factors may lead to code scanning failure or low recognition efficiency, which in turn affects user experience and overall system performance. Traditional code scanning cameras usually use fixed angles or manual adjustment methods, which are difficult to adapt to complex and changeable actual scenes, especially in dynamic environments. They cannot respond to changes in environmental parameters in real time, resulting in reduced code scanning accuracy and efficiency. In addition, the existing angle adjustment methods mostly rely on the data of a single sensor, lack the ability to comprehensively analyze and dynamically optimize environmental parameters, and are difficult to achieve accurate angle compensation and efficient code scanning operations. Therefore, there is an urgent need for a code scanning camera angle adaptive adjustment method that can detect environmental parameters in real time, dynamically generate angle adjustment strategies, and automatically optimize the adjustment effect, so as to improve the adaptability, accuracy and response speed of the code scanning system. Summary of the invention
[0003] The present application provides a method, system and electronic device for adaptively adjusting the angle of a barcode scanning camera, which are used to solve the technical problems of low efficiency and insufficient accuracy of camera angle adjustment caused by dynamic changes in environmental parameters.
[0004] In a first aspect of the present application, a method for adaptively adjusting the angle of a barcode scanning camera is provided, the method comprising: Perform real-time detection on the environmental parameters of the area to be scanned to obtain a dynamic parameter set; perform deviation analysis based on the dynamic parameter set and the preset code scanning reference parameters to generate an angle adjustment strategy; drive the multi-dimensional gimbal to perform angle compensation actions according to the angle adjustment strategy to generate code scanning camera image data; perform image quality evaluation based on the code scanning camera image data to generate an evaluation result, optimize the angle adjustment strategy of the camera according to the evaluation result, and determine the angle adaptive adjustment strategy.
[0005] A second aspect of the present application provides a system for adaptively adjusting the angle of a barcode scanning camera, the system comprising: Real-time detection unit: performs real-time detection on the environmental parameters of the area to be scanned, and obtains a dynamic parameter set; deviation analysis unit: performs deviation analysis based on the dynamic parameter set and the preset scanning reference parameters, and generates an angle adjustment strategy; angle compensation unit: drives the multi-dimensional gimbal to perform angle compensation action according to the angle adjustment strategy, and generates scanning camera image data; strategy optimization unit: performs image quality evaluation based on the scanning camera image data, generates evaluation results, optimizes the angle adjustment strategy of the camera according to the evaluation results, and determines the angle adaptive adjustment strategy.
[0006] The third aspect of the present application provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; wherein the processor is used to execute the method for adaptively adjusting the angle of a code scanning camera provided in the present application.
[0007] One or more technical solutions provided in this application have at least the following technical effects or advantages: The present application performs real-time detection of environmental parameters of the area to be scanned, and obtains a dynamic parameter set; performs deviation analysis based on the dynamic parameter set and preset code scanning reference parameters to generate an angle adjustment strategy; drives the multi-dimensional pan-tilt head to perform angle compensation actions according to the angle adjustment strategy to generate code scanning camera image data; performs image quality assessment based on the code scanning camera image data to generate an assessment result, optimizes the angle adjustment strategy of the camera according to the assessment result, and determines an angle adaptive adjustment strategy. The present invention solves the technical problems of low efficiency and insufficient precision of camera angle adjustment due to dynamic changes in environmental parameters, and achieves the technical effect of improving the accuracy and response speed of camera angle adjustment by real-time detection of environmental parameters and dynamic optimization of adjustment strategies. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0009] Figure 1 A schematic flow chart of a method for adaptively adjusting the angle of a barcode scanning camera provided in an embodiment of the present application.
[0010] Figure 2 A schematic diagram of the structure of a system for adaptively adjusting the angle of a barcode scanning camera provided in an embodiment of the present application.
[0011] Figure 3 This is a schematic diagram of the structure of an exemplary electronic device of the present application.
[0012] Explanation of the accompanying drawings: real-time detection unit 11, deviation analysis unit 12, angle compensation unit 13, strategy optimization unit 14, processor 21, memory 22, input device 23, output device 24. DETAILED DESCRIPTION
[0013] The present application provides a method, system and electronic device for adaptively adjusting the angle of a code scanning camera, aiming to solve the technical problem of low efficiency and insufficient precision of camera angle adjustment due to dynamic changes in environmental parameters. By real-time detection of environmental parameters and dynamic optimization of the adjustment strategy, the technical effect of improving the accuracy and response speed of camera angle adjustment is achieved.
[0014] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0015] It should be noted that any variations of the terms "include" and "have" are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or modules that are not explicitly listed or inherent to these processes, methods, products or devices.
[0016] Embodiment 1, as Figure 1 As shown, the present application provides a method for adaptively adjusting the angle of a barcode scanning camera, the method comprising: The environmental parameters of the area to be scanned are detected in real time to obtain a set of dynamic parameters.
[0017] In the embodiment of the present application, during the code scanning process, real-time detection of the environmental parameters of the code scanning area is a key step to ensure that the camera can accurately capture the target information. This process uses multiple sensors to work together to obtain a dynamic parameter set, mainly including three core parameters: target distance, camera inclination and light intensity. First, through the TOF (Time of Flight) sensor array, the three-dimensional distance distribution between the surface of the target object and the camera can be measured in real time to obtain the target distance, thereby providing data support for subsequent focus adjustment. Secondly, the gyroscope sensor is used to collect the pitch and yaw angle data of the camera to determine the camera inclination, which is used to analyze the deviation between the current posture of the camera and the standard vertical angle. Finally, the scanning area is sampled in multiple areas through the ambient light sensor array to determine the light intensity and identify the changes in lighting conditions, especially the distribution of shadow areas. The acquisition of these dynamic parameter sets provides a comprehensive and real-time data basis for the subsequent deviation analysis and the generation of angle adjustment strategies, ensuring that the camera can quickly and accurately adjust the angle according to environmental changes, and improve the success rate and efficiency of code scanning.
[0018] Furthermore, in the method provided in the embodiment of the application, the environmental parameters of the area to be scanned are detected in real time to obtain a dynamic parameter set, and the method includes: The three-dimensional distance distribution from the target object surface to the camera is obtained through the TOF sensor array, and the average target distance is calculated; the pitch angle data and yaw angle data of the camera are collected in real time using the gyroscope sensor to construct a camera tilt matrix; the ambient light sensor array is activated for multi-area sampling to generate a light intensity distribution map; the average target distance, the camera tilt matrix, and the light intensity distribution map are integrated to obtain the dynamic parameter set.
[0019] In an embodiment of the present application, in the process of adaptively adjusting the angle of the scanning camera, the acquisition of the dynamic parameter set is a comprehensive process of multi-sensor collaborative work. First, the surface of the target object is scanned in three dimensions by the TOF sensor array to obtain the three-dimensional distance distribution data from the surface of the target object to the camera, and then the mean of these distance distribution data is calculated to obtain the average target distance, providing an accurate distance reference for subsequent focus adjustment. Subsequently, the gyroscope sensor is used to collect the pitch and yaw angle data of the camera in real time, and the camera inclination matrix is constructed through these data to analyze the deviation between the current posture of the camera and the standard vertical angle. At the same time, the ambient light sensor array is activated to perform multi-area sampling of the scanning area to generate a light intensity distribution map, which not only contains the light intensity data of each area, but also pays special attention to the illumination ratio between the center area and the edge area to identify the distribution of uneven lighting or shadow areas. Finally, the calculated average target distance, camera inclination matrix and light intensity distribution map are integrated to form a complete dynamic parameter set. This collection provides comprehensive and real-time data support for subsequent deviation analysis, angle adjustment strategy generation, and dynamic adjustment of fill light, ensuring that the camera can quickly and accurately complete angle adaptive adjustment according to environmental changes, thereby improving the success rate and efficiency of code scanning.
[0020] Deviation analysis is performed based on the dynamic parameter set and the preset code scanning reference parameters to generate an angle adjustment strategy.
[0021] In an embodiment of the present application, based on the dynamic parameter set obtained by real-time detection, it will be compared and analyzed with the preset scanning benchmark parameters to identify the deviation between the current environment and the ideal scanning conditions, and generate a corresponding angle adjustment strategy. First, the difference between the target distance and the preset focus distance will be analyzed to determine whether the focus position of the camera needs to be adjusted to ensure clear imaging of the target object. Secondly, by comparing the camera tilt matrix with the standard vertical angle, the pitch and yaw angle deviations of the camera are calculated, and the angle direction and amplitude that need to be adjusted are determined so that the camera can be aimed at the target area. Finally, the light intensity distribution map will be combined to identify uneven lighting or shadow areas in the scanning area, generate fill light dynamic adjustment instructions, and optimize lighting conditions. Based on these deviation analysis results, a multi-dimensional angle adjustment strategy will be comprehensively generated, including specific actions such as focus distance adjustment, camera angle compensation, and lighting optimization, to provide precise guidance for the subsequent execution of compensation actions, thereby improving the accuracy and efficiency of scanning.
[0022] Furthermore, in the method provided in the embodiment of the application, a deviation analysis is performed based on the dynamic parameter set and the preset code scanning reference parameter to generate an angle adjustment strategy, and the method includes: Retrieve a historical scanning parameter set of the scanning camera, and construct preset scanning benchmark parameters based on the historical scanning parameter set, wherein the preset scanning benchmark parameters include a preset optimal focus distance and a standard vertical angle; calculate the difference between the average target distance and the preset optimal focus distance to generate an axial displacement compensation amount; analyze the camera tilt matrix and the standard vertical angle to determine a compensation angle data set of the multi-dimensional gimbal, wherein the compensation angle data set includes pitch compensation angle data and yaw compensation angle data; identify the proportion of shadow areas based on the light intensity distribution diagram, and generate a fill light dynamic adjustment instruction; perform angle adjustment analysis on the axial displacement compensation amount, the pitch compensation angle data, and the yaw compensation angle data according to the fill light dynamic adjustment instruction to generate the angle adjustment strategy.
[0023] In an embodiment of the present application, the historical scanning parameter set of the scanning camera is retrieved from the operation log, including the historical focus distance and historical angle data, and then the historical focus distance and historical angle data in the historical scanning parameter set are respectively calculated by mean and standard deviation to obtain the mean and standard deviation of the historical focus distance, and the mean and standard deviation of the historical angle data. Subsequently, the focus distance cleaning threshold [μ-kσ,μ+kσ] is set using the mean and variance of the historical focus distance, where μ is the mean; σ is the standard deviation; k is a constant, usually 2 or 3, which is used to control the strictness of the cleaning. After obtaining the focus distance cleaning threshold, this cleaning threshold is used to judge the historical focus distance, remove data points that are not within this range, and then perform mean calculation on the cleaned historical focus distance to obtain the preset optimal focus distance; for the historical angle data, the same operation is performed to obtain the standard vertical angle. After that, the difference between the average target distance and the preset optimal focus distance is calculated to generate the axial displacement compensation amount; the standard vertical angle is used as the standard vertical direction, and the direction vector of the camera's current direction is extracted from the camera tilt matrix. If the standard vertical angle is (0,0,1), it represents the Z axis of the world coordinate system. At this time, the data in the third column of the camera tilt matrix is used as the current direction vector of the camera. The yaw compensation angle data is obtained by performing an arcsine calculation on the x-axis component of the current direction vector. The formula The pitch compensation angle data is calculated, where: is the pitch compensation angle data, is the y-axis component of the current direction vector, The calculated yaw compensation angle data and pitch compensation angle data are stored in a data set to form a compensation angle data set. Then, the light intensity distribution map is analyzed to identify the coordinate data of the shadow area, understand the proportion of the shadow area, and then dynamically adjust the brightness and angle of the fill light according to the coordinate data of the shadow area to generate a fill light dynamic adjustment instruction. Finally, the axial displacement compensation amount, pitch compensation angle data and yaw compensation angle data are combined with the fill light dynamic adjustment instruction to form a comprehensive adjustment strategy, namely the angle adjustment strategy, including axial displacement adjustment (adjusting the position of the camera according to the axial displacement compensation amount), pitch angle adjustment (adjusting the pitch angle of the camera according to the pitch compensation angle data), yaw angle adjustment (adjusting the yaw angle of the camera according to the yaw compensation angle data), fill light adjustment (adjusting the brightness and angle of the fill light according to the fill light dynamic adjustment instruction). This angle adjustment strategy will be sent to the multi-dimensional gimbal to adjust the position, angle and fill light parameters of the camera in real time to ensure that the camera can accurately aim at the target area and optimize the scanning effect.
[0024] Furthermore, in the method provided in the embodiment of the application, the shadow area ratio is identified based on the light intensity distribution diagram, and a fill light dynamic adjustment instruction is generated, and the method includes: Shadow recognition is performed according to the light intensity distribution diagram to determine the shadow area, the shadow area is traversed to mark points, and the coordinate data of the shadow area is obtained; the adjustable-focus LED array is controlled to generate a directional fill light beam according to the coordinate data of the shadow area; the directional fill light beam is used to deploy a ring-shaped auxiliary light source at the edge of the code scanning area to generate the fill light dynamic adjustment instruction.
[0025] In the embodiment of the present application, shadow recognition is performed on the light intensity distribution diagram according to the light intensity threshold, and the area below the threshold in the light intensity distribution diagram is marked as a shadow area, wherein the light intensity threshold can be dynamically adjusted according to the average intensity of the ambient light. Subsequently, each shadow area is traversed pixel by pixel, the coordinates of each pixel are recorded, and then the contour extraction algorithm (such as the findContours function of OpenCV) is used to obtain the coordinates of the boundary points of the shadow area, and the coordinate data of the shadow area is obtained by storing the pixel point coordinates and the boundary point coordinates inside the shadow area. After that, according to the position of the shadow area, an LED unit that can cover the area is selected from the LED array, and then the direction vector from the LED to the center point of the shadow area is calculated, and the focusing angle of the LED is adjusted so that the light beam is accurately pointed to the target area, and then the focusing range of the LED is adjusted according to the size of the shadow area to ensure that the light beam covers the entire shadow area, and then the brightness of the LED is adjusted according to the difference between the light intensity of the shadow area and the surrounding environment, so that the fill light effect matches the ambient light, and then the selected LED unit is controlled to generate a directional fill light beam according to the adjusted direction, focusing range and brightness. Then, evenly deploy the ring auxiliary light source at the edge of the code scanning area to ensure that the light source covers the entire code scanning area, and then set the initial brightness, color temperature and beam angle of the ring auxiliary light source to make it consistent with the directional fill light beam. Among them, the ring auxiliary light source uses PWM (pulse width modulation) technology to dynamically adjust the color temperature of the light source to match the spectral distribution of the background ambient light to avoid visual discomfort or lighting incoordination caused by color temperature differences. Finally, combine the parameter settings of the ring auxiliary light source with the parameters of the directional fill light beam of the LED array to generate a fill light dynamic adjustment instruction to achieve precise fill light.
[0026] According to the angle adjustment strategy, the multi-dimensional pan-tilt platform is driven to perform angle compensation action to generate code scanning camera image data.
[0027] In an embodiment of the present application, according to the generated angle adjustment strategy, the multi-dimensional pan-tilt will be driven to perform a series of angle compensation actions to accurately adjust the posture and lighting conditions of the camera, thereby generating high-quality code scanning camera image data. First, the multi-dimensional pan-tilt will synchronously adjust the pitch angle and yaw angle of the camera according to the analysis results of the camera tilt deviation, so that it maintains the best alignment angle with the target area, ensuring that the code scanning area is located within the central field of view of the camera. At the same time, the focus position of the camera will be dynamically adjusted in combination with the deviation of the target distance to ensure clear imaging of the target object. In addition, in order to optimize the lighting conditions, the light source parameters of the fill light module, such as the brightness, angle and illumination range of the light source, will be synchronously adjusted to eliminate the influence of the shadow area on the code scanning effect. Through the collaborative work of the multi-dimensional pan-tilt and the fill light module, it can respond to environmental changes in real time, accurately perform angle compensation actions, and finally generate clear and stable code scanning camera image data, providing high-quality input for subsequent code scanning recognition.
[0028] Furthermore, in the method provided in the embodiment of the application, the shadow area ratio is identified based on the light intensity distribution diagram, and a fill light dynamic adjustment instruction is generated, and the method includes: The axial displacement compensation amount is converted into a pulse drive signal of a Z-axis stepper motor; the camera is controlled to move along the guide rail to the target focus position through the pulse drive signal, and the focus compensation data is determined; the pitch compensation angle and the yaw compensation angle are converted into a servo rotation control instruction of the multi-dimensional gimbal using a PID control algorithm; the angle compensation data of the camera is determined through the servo rotation control instruction, and the code scanning camera is started to scan and shoot according to the focus compensation data and the angle compensation data, so as to generate the code scanning camera image data.
[0029] In the embodiment of the present application, the basic parameters of the Z-axis stepper motor are obtained, including the step angle (the angle of rotation per step) and the lead screw (the distance the lead screw drives the camera to move for each rotation of the motor), and the lead screw is ratioed to the number of steps per revolution to obtain the displacement per step, where the number of steps per revolution is the ratio of 360° to the step angle. The axial displacement compensation amount is then ratioed to the displacement per step to obtain the number of pulses. According to the calculated number of pulses, a corresponding pulse drive signal is generated to control the rotation of the stepper motor. Each pulse signal corresponds to one step of rotation of the stepper motor, thereby achieving precise movement of the camera along the Z axis to the target focus position. Subsequently, the PID control algorithm is used to convert the pitch compensation angle and the yaw compensation angle into the servo rotation control instructions of the multi-dimensional gimbal. Specifically, the angle compensation amount is directly used as the input error of the PID controller, and the control output is calculated: ; ;in, , , are the proportional, integral, and differential coefficients of the PID controller, and is the current angle compensation, and is the integral of the angle compensation, used to eliminate steady-state errors. and is the differential of the angle compensation, which is used to predict the error change trend. , Converted into the rotation control command of the servo, the servo is usually controlled by pulse width modulation (PWM) signal, and the pulse width of the control signal is proportional to the rotation angle of the servo, that is, ,in, Refers to the output of the PID controller, which represents the control amount calculated based on the current error (angle compensation amount). Then, through the steering gear rotation control instruction, the multi-dimensional gimbal is driven to adjust the pitch angle and yaw angle of the camera so that it maintains the best alignment angle with the target area, thereby determining the angle compensation data and ensuring the accuracy of the camera posture. Finally, combined with the focus compensation data and angle compensation data, the code scanning camera is started to scan and shoot. On the basis of precise focus and angle compensation, the camera captures the image of the target area and generates high-quality code scanning camera image data. Through the above steps, precise control of the camera position and posture is achieved, ensuring that the code scanning process is efficient and accurate, and generating code scanning camera image data that meets the requirements.
[0030] An image quality assessment is performed based on the scanned code camera image data to generate an assessment result, and the angle adjustment strategy of the camera is optimized according to the assessment result to determine an angle adaptive adjustment strategy.
[0031] In the embodiment of the present application, based on the scanned code camera image data, an image quality assessment will be performed to determine whether the current image meets the requirements of scanned code recognition. The assessment process will analyze key indicators such as image clarity and contrast, and generate an assessment result through the convolution analysis of the convolutional neural network model. If the assessment result does not reach the threshold, it means that the current image quality is not enough to support efficient code scanning. At this time, it will enter the iterative optimization process. Specifically, the angle adjustment strategy will be optimized based on the historical adjustment records. For example, the pitch angle, yaw angle and focus distance of the camera will be further adjusted to improve the image quality. This process will be iterated until the generated scanned code camera image data meets the requirements of scanned code recognition. Finally, an angle adaptive adjustment strategy will be determined, which can dynamically adjust the camera parameters according to real-time environmental changes to ensure that high-quality imaging data can be obtained under various complex conditions, thereby improving the accuracy and stability of code scanning.
[0032] Furthermore, in the method provided in the embodiment of the application, image quality evaluation is performed based on the scanned image data to generate an evaluation result, and the angle adjustment strategy of the camera is optimized according to the evaluation result to determine the angle adaptive adjustment strategy. The method includes: Based on the scanned code camera image data, the clarity index, contrast index and distortion coefficient of the imaging data are extracted to construct a quality assessment vector; the quality assessment vector is synchronized to a pre-trained convolutional neural network model for convolution analysis to generate the assessment result, which includes a comprehensive assessment value; based on the comparison between the comprehensive assessment value and the expected assessment value, it is determined whether the comprehensive assessment value is less than the expected assessment value; when the comprehensive assessment value is less than the expected assessment value, a parameter optimization path is generated based on the historical adjustment record; according to the parameter optimization path, the compensation coefficient of the angle adjustment strategy of the camera is updated to determine the angle adaptive adjustment strategy.
[0033] In an embodiment of the present application, after obtaining the scanned code camera image data, the clarity index, contrast index and distortion coefficient of the imaging data are extracted therefrom, wherein the clarity index is obtained by calculating the gradient amplitude of the image; the contrast index is obtained by calculating the grayscale distribution variance of the image; and the distortion coefficient is obtained by detecting whether the straight line in the image is curved. The quality assessment vector is obtained by combining the clarity, contrast and distortion coefficient. Subsequently, the pre-built convolutional neural network model is activated, and the quality assessment vector is input into the convolutional neural network model. The convolutional neural network model extracts and analyzes the input vector through the convolution layer, the pooling layer and the fully connected layer to generate a comprehensive evaluation result. This evaluation result is a comprehensive evaluation value obtained by weighting the resolution score and the probability of identification. Afterwards, the comprehensive evaluation value is compared with the preset expected evaluation value. If the comprehensive evaluation value is less than the expected evaluation value, it means that the current image quality does not meet expectations and parameter optimization is required. At this time, the similarity between the quality evaluation vector of the historical scene and the current quality evaluation vector is calculated by cosine similarity, and the records whose similarity meets the similarity threshold and their corresponding adjustment parameters are extracted, such as the camera angle compensation coefficient. , , . Then, the adjustment parameters in similar historical records are weighted averaged to generate new camera angle compensation coefficients, and these coefficients are used as parameter optimization paths. Finally, according to the parameter optimization path, the compensation coefficients of the camera angle adjustment strategy are updated, that is, the proportional, integral, and differential coefficients in the PID controller are updated. This process is repeated until the comprehensive evaluation value reaches or exceeds the expected evaluation value, thereby generating a new angle adaptive adjustment strategy for subsequent camera posture adjustment.
[0034] For the convolutional neural network model, a convolutional neural network (CNN) is used to build an initial model structure, including input layer, convolution layer, pooling layer, fully connected layer and output layer. The weights of the CNN model are initialized using random numbers and other methods, and the training set (including historical quality assessment vectors, historical resolution scores, and historical identifiable probabilities) is input into the initialized CNN model for forward propagation. The model is passed layer by layer through the input layer, convolution layer, pooling layer, fully connected layer, output layer, etc., and the prediction results including resolution scores and identifiable probabilities are calculated. Subsequently, the mean square error (MSE) loss function is used to calculate the loss value between the prediction result and the historical data, and the gradient of the loss to the weight of each layer is calculated layer by layer through back propagation. The Adam optimizer is then used to optimize the model parameters and adjust the weights to minimize the value of the loss function. The above process is repeated until the maximum number of iterations is reached. After the training is completed, the model performance is tested using the validation set to evaluate the accuracy of the model in the resolution score and identifiable probability prediction tasks. If the accuracy meets the expected accuracy, the current CNN model is output as the final convolutional neural network model. Otherwise, the learning rate, number of training batches and other hyperparameters are adjusted to further improve the prediction effect of the model. After the training is completed, the fusion weights determined based on business needs and expert decisions are built into the output layer to fuse the predicted resolution score and identifiable probability to determine the comprehensive evaluation value.
[0035] Furthermore, in the method provided in the embodiment of the application, the clarity index, contrast index and distortion coefficient of the imaging data are extracted based on the scanned code camera image data to construct a quality assessment vector, and the method includes: The code scanning camera image data is divided into N×N pixel blocks to generate an image block matrix; the improved Sobel gradient operator is used to calculate the horizontal and vertical gradient amplitudes of the image block matrix to generate a local clarity index; the grayscale histogram of the image block matrix is extracted, the grayscale variance ratio of the central area and the edge area of the grayscale histogram is calculated to generate a contrast index; the preset reference mark points in the code scanning camera image data are identified, and the preset reference mark points are matched with the standard template to obtain the spatial coordinate offset; the code scanning camera image data is divided into M×M detection grids, and the radial distortion coefficient of the feature point distribution in each grid is calculated; the local clarity index of each pixel block in the image block matrix is aggregated to generate a clarity index; the radial distortion coefficient is weightedly fused with the coordinate offset to generate a distortion coefficient; the clarity index, the contrast index, and the distortion coefficient form the quality assessment vector.
[0036] In the embodiment of the present application, after obtaining the scanned code camera image data, the scanned code camera image data will be divided into pixel blocks of size N×N. For example, for a 640×480 image, if N=32, it is divided into 20×15 pixel blocks, thereby obtaining an image block matrix, in which each element is an N×N pixel block. For the clarity index, the improved Sobel operator is used to calculate the horizontal gradient of each pixel block. and vertical gradient , that is, the traditional Sobel operator is multiplied by the Gaussian weight, where the Gaussian weight is determined according to the needs of the specific task, for example, the weight of the central pixel is enhanced to reduce the influence of noise, and then the gradient amplitude of each pixel is calculated based on the horizontal gradient and the vertical gradient, and the number of pixels whose gradient amplitude exceeds the preset gradient threshold in each pixel block is counted in the total number of pixels to obtain the local clarity index, and then the local clarity index of all pixel blocks in the image block matrix is aggregated, that is, the clarity index is obtained by the mean calculation method. For the contrast index, the grayscale histogram is extracted for each pixel block, the number of pixels at each grayscale level is counted, and the grayscale histogram is divided into the central area (such as grayscale [64,192]) and the edge area (such as grayscale [0,63] and [193,255]), and then the grayscale variance of the central area and the grayscale variance of the edge area are calculated, and the grayscale variance of the central area is calculated by ratio calculation to obtain the contrast index. For the distortion coefficient, the preset reference mark points (such as the positioning mark of the QR code) are identified in the scanned camera image data, and the identified reference mark points are matched with the standard template, and the spatial coordinate offset is calculated by difference. Subsequently, the scanned camera image data is divided into M×M detection grids, and feature points (such as corner points or edge points) are detected in each grid. The radial distortion coefficient of the feature points in each grid is calculated by the radial distortion coefficient calculation formula. The radial distortion coefficient is as follows: ; where k is the radial distortion coefficient, is the distance from the feature point to the center of the image, is the average distance, and n is the number of feature points. Then, through the formula The distortion coefficient is calculated as follows: is the distortion coefficient, , is the weight coefficient, and is the spatial coordinate offset. Finally, the clarity index, contrast index and distortion coefficient are spliced to obtain a quality evaluation vector. Through the above steps, the scanned camera image data can be divided into pixel blocks, the local clarity index, contrast index and distortion coefficient can be calculated, and finally a quality evaluation vector can be generated. This method can comprehensively evaluate the quality of the image and provide data support for the subsequent optimization of the camera adjustment strategy.
[0037] Furthermore, in the method provided in the embodiment of the application, the angle adjustment strategy of the camera is optimized according to the evaluation result, and after the angle adaptive adjustment strategy is determined, the method includes: Establish a database associating the scanning success rate with the adjustment parameters, record the parameter combination and recognition results of each adjustment process, and obtain historical adjustment combination data; analyze the historical adjustment combination data through a reinforcement learning algorithm, and dynamically optimize the matching rules of the multi-dimensional gimbal control parameters and the fill light parameters; when a new scanning target is detected, call the matching rules to initialize the angle adaptive adjustment strategy.
[0038] In the embodiment of the present application, during each adjustment process, the multi-dimensional gimbal control parameters (such as pitch angle, yaw angle, focal length, etc.) and fill light parameters (such as fill light intensity, fill light angle, etc.) are recorded, and the scan code recognition result (success or failure) after each adjustment is recorded, and then the parameter combination and recognition result of each adjustment are stored in the associated database to form historical adjustment combination data. Subsequently, a reinforcement learning model is constructed, and commonly used algorithms include Q-learning or deep Q network (DQN), which can dynamically optimize the matching rules of multi-dimensional gimbal control parameters and fill light parameters by learning the rules in historical data. In the design of the model, the state is defined as the current multi-dimensional gimbal control parameters (such as pitch angle, yaw angle, focal length, etc.) and fill light parameters (such as fill light intensity, fill light angle, etc.), and the action is the adjustment operation of these parameters, for example, increasing or decreasing the value of a parameter. The reward is set based on the scanning result. If the scanning is successful, a reward of +1 is given, and if it fails, a reward of -1 is given. This reward mechanism can guide the model to optimize in the direction of improving the scanning success rate. During the training process, the state, action and reward are extracted from the historical adjustment combination data and input into the reinforcement learning model as training samples. The model gradually optimizes its strategy through continuous trial and error and learning, and finds the parameter adjustment rules that can maximize the reward. This process is dynamic. With the accumulation of more historical data, the model can continuously update and improve its matching rules. Finally, the trained model will generate a set of optimized matching rules, which can guide the subsequent adjustment process and help quickly find the optimal parameter combination when facing different scanning targets. In this way, the reinforcement learning algorithm can not only effectively utilize historical data, but also continuously optimize parameter matching rules in a dynamic environment, thereby improving the overall performance and efficiency of the code scanning system. When a new code scanning target is detected, the characteristics of the target (such as size, shape, reflectivity, etc.) are extracted, and then the optimized matching rules are called according to the characteristics of the target to initialize the multi-dimensional gimbal control parameters and fill light parameters. The matching rules are used to directly initialize the near-optimal parameter combination, reduce the number of iterations of adaptive adjustment, and improve the adjustment efficiency. In summary, by establishing an associative database of the scanning success rate and the adjustment parameters, combining the reinforcement learning algorithm to analyze historical data, dynamically optimizing the matching rules, and calling the matching rules to initialize the adjustment strategy when a new code scanning target is detected, the number of iterations of adaptive adjustment can be significantly shortened, and the scanning efficiency and success rate can be improved.
[0039] In the embodiments of the present application, in summary, the embodiments of the present application have at least the following technical effects: The present application performs real-time detection of environmental parameters of the area to be scanned, and obtains a dynamic parameter set; performs deviation analysis based on the dynamic parameter set and preset code scanning reference parameters to generate an angle adjustment strategy; drives the multi-dimensional pan-tilt head to perform angle compensation actions according to the angle adjustment strategy to generate code scanning camera image data; performs image quality assessment based on the code scanning camera image data to generate an assessment result, optimizes the angle adjustment strategy of the camera according to the assessment result, and determines an angle adaptive adjustment strategy. The present invention solves the technical problems of low efficiency and insufficient precision of camera angle adjustment due to dynamic changes in environmental parameters, and achieves the technical effect of improving the accuracy and response speed of camera angle adjustment by real-time detection of environmental parameters and dynamic optimization of adjustment strategies.
[0040] Embodiment 2 is based on the same inventive concept as the method for adaptively adjusting the angle of a barcode scanning camera in the above embodiment. Figure 2 As shown, the present application provides a system for adaptively adjusting the angle of a barcode scanning camera, and the system and method embodiments in the present application are based on the same inventive concept. The system includes: Real-time detection unit 11: performs real-time detection on the environmental parameters of the area to be scanned, and obtains a dynamic parameter set; deviation analysis unit 12: performs deviation analysis based on the dynamic parameter set and the preset code scanning reference parameters, and generates an angle adjustment strategy; angle compensation unit 13: drives the multi-dimensional gimbal to perform angle compensation action according to the angle adjustment strategy, and generates code scanning camera image data; strategy optimization unit 14: performs image quality evaluation based on the code scanning camera image data, generates evaluation results, optimizes the angle adjustment strategy of the camera according to the evaluation results, and determines the angle adaptive adjustment strategy.
[0041] Furthermore, the system is also used to implement the following functions: The three-dimensional distance distribution from the target object surface to the camera is obtained through the TOF sensor array, and the average target distance is calculated; the pitch angle data and yaw angle data of the camera are collected in real time using the gyroscope sensor to construct a camera tilt matrix; the ambient light sensor array is activated for multi-area sampling to generate a light intensity distribution map; the average target distance, the camera tilt matrix, and the light intensity distribution map are integrated to obtain the dynamic parameter set.
[0042] Furthermore, the system is also used to implement the following functions: Retrieve a historical scanning parameter set of the scanning camera, and construct preset scanning benchmark parameters based on the historical scanning parameter set, wherein the preset scanning benchmark parameters include a preset optimal focus distance and a standard vertical angle; calculate the difference between the average target distance and the preset optimal focus distance to generate an axial displacement compensation amount; analyze the camera tilt matrix and the standard vertical angle to determine a compensation angle data set of the multi-dimensional gimbal, wherein the compensation angle data set includes pitch compensation angle data and yaw compensation angle data; identify the proportion of shadow areas based on the light intensity distribution diagram, and generate a fill light dynamic adjustment instruction; perform angle adjustment analysis on the axial displacement compensation amount, the pitch compensation angle data, and the yaw compensation angle data according to the fill light dynamic adjustment instruction to generate the angle adjustment strategy.
[0043] Furthermore, the system is also used to implement the following functions: The axial displacement compensation amount is converted into a pulse drive signal of a Z-axis stepper motor; the camera is controlled to move along the guide rail to the target focus position through the pulse drive signal, and the focus compensation data is determined; the pitch compensation angle and the yaw compensation angle are converted into a servo rotation control instruction of the multi-dimensional gimbal using a PID control algorithm; the angle compensation data of the camera is determined through the servo rotation control instruction, and the code scanning camera is started to scan and shoot according to the focus compensation data and the angle compensation data, so as to generate the code scanning camera image data.
[0044] Furthermore, the system is also used to implement the following functions: Shadow recognition is performed according to the light intensity distribution diagram to determine the shadow area, the shadow area is traversed to mark points, and the coordinate data of the shadow area is obtained; the adjustable-focus LED array is controlled to generate a directional fill light beam according to the coordinate data of the shadow area; the directional fill light beam is used to deploy a ring-shaped auxiliary light source at the edge of the code scanning area to generate the fill light dynamic adjustment instruction.
[0045] Furthermore, the system is also used to implement the following functions: Based on the scanned code camera image data, the clarity index, contrast index and distortion coefficient of the imaging data are extracted to construct a quality assessment vector; the quality assessment vector is synchronized to a pre-trained convolutional neural network model for convolution analysis to generate the assessment result, which includes a comprehensive assessment value; based on the comparison between the comprehensive assessment value and the expected assessment value, it is determined whether the comprehensive assessment value is less than the expected assessment value; when the comprehensive assessment value is less than the expected assessment value, a parameter optimization path is generated based on the historical adjustment record; according to the parameter optimization path, the compensation coefficient of the angle adjustment strategy of the camera is updated to determine the angle adaptive adjustment strategy.
[0046] Furthermore, the system is also used to implement the following functions: The code scanning camera image data is divided into N×N pixel blocks to generate an image block matrix; the improved Sobel gradient operator is used to calculate the horizontal and vertical gradient amplitudes of the image block matrix to generate a local clarity index; the grayscale histogram of the image block matrix is extracted, the grayscale variance ratio of the central area and the edge area of the grayscale histogram is calculated to generate a contrast index; the preset reference mark points in the code scanning camera image data are identified, and the preset reference mark points are matched with the standard template to obtain the spatial coordinate offset; the code scanning camera image data is divided into M×M detection grids, and the radial distortion coefficient of the feature point distribution in each grid is calculated; the local clarity index of each pixel block in the image block matrix is aggregated to generate a clarity index; the radial distortion coefficient is weightedly fused with the coordinate offset to generate a distortion coefficient; the clarity index, the contrast index, and the distortion coefficient form the quality assessment vector.
[0047] Furthermore, the system is also used to implement the following functions: Establish a database associating the scanning success rate with the adjustment parameters, record the parameter combination and recognition results of each adjustment process, and obtain historical adjustment combination data; analyze the historical adjustment combination data through a reinforcement learning algorithm, and dynamically optimize the matching rules of the multi-dimensional gimbal control parameters and the fill light parameters; when a new scanning target is detected, call the matching rules to initialize the angle adaptive adjustment strategy.
[0048] Embodiment 3, based on the same inventive concept as the method for adaptively adjusting the angle of a barcode scanning camera in the above embodiment, this embodiment provides an electronic device, Figure 3 The schematic diagram of the structure of the electronic device provided in the third embodiment of the present invention shows a block diagram of an exemplary electronic device suitable for implementing the implementation mode of the present invention. Figure 3 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention. Figure 3 As shown, the electronic device includes a processor 21, a memory 22, an input device 23 and an output device 24; the number of processors 21 in the electronic device can be one or more. Figure 3 Taking a processor 21 as an example, the processor 21, memory 22, input device 23 and output device 24 in the electronic device can be connected through a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0049] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. And the above-mentioned specific embodiments of this specification are described. The processes depicted in the accompanying drawings do not necessarily require the specific order and continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0050] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
[0051] This specification and drawings are merely exemplary illustrations of the present application and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, a person skilled in the art may make various modifications and variations to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present application and its equivalents, the present application intends to include these modifications and variations.
Claims
1. A method for adaptively adjusting the angle of a barcode scanning camera, characterized in that: The method comprises: Perform real-time detection of environmental parameters of the area to be scanned and obtain a dynamic parameter set; Perform deviation analysis based on the dynamic parameter set and the preset code scanning reference parameters to generate an angle adjustment strategy; According to the angle adjustment strategy, the multi-dimensional gimbal is driven to perform angle compensation action to generate scanned code camera image data; An image quality assessment is performed based on the scanned code camera image data to generate an assessment result, and the angle adjustment strategy of the camera is optimized according to the assessment result to determine an angle adaptive adjustment strategy.
2. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 1, characterized in that: The environmental parameters of the area to be scanned are detected in real time to obtain a dynamic parameter set. The method includes: The three-dimensional distance distribution from the target object surface to the camera is obtained through the TOF sensor array, and the average target distance is calculated; Use the gyroscope sensor to collect the camera's pitch angle data and yaw angle data in real time and build the camera tilt matrix; Activate the ambient light sensor array to perform multi-area sampling and generate a light intensity distribution map; The average target distance, the camera tilt matrix, and the light intensity distribution map are integrated to obtain the dynamic parameter set.
3. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 2, characterized in that: Based on the deviation analysis between the dynamic parameter set and the preset code scanning reference parameter, an angle adjustment strategy is generated, and the method includes: Retrieve a historical scanning parameter set of the scanning camera, and construct preset scanning benchmark parameters according to the historical scanning parameter set, wherein the preset scanning benchmark parameters include a preset optimal focus distance and a standard vertical angle; Calculate the difference between the average target distance and the preset optimal focus distance to generate an axial displacement compensation amount; Analyze the camera tilt angle matrix and the standard vertical angle to determine a compensation angle data set of the multi-dimensional gimbal, wherein the compensation angle data set includes pitch compensation angle data and yaw compensation angle data; Identify the shadow area ratio based on the light intensity distribution diagram, and generate a fill light dynamic adjustment instruction; According to the fill light dynamic adjustment instruction, the axial displacement compensation amount, the pitch compensation angle data, and the yaw compensation angle data are subjected to angle adjustment analysis to generate the angle adjustment strategy.
4. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 3, characterized in that: According to the angle adjustment strategy, the multi-dimensional gimbal is driven to perform angle compensation action to generate scanned code camera image data, and the method includes: Converting the axial displacement compensation amount into a pulse drive signal of the Z-axis stepper motor; The pulse driving signal is used to control the camera to move along the guide rail to the target focus position, and determine the focus compensation data; The pitch compensation angle and the yaw compensation angle are converted into a steering gear rotation control instruction of the multi-dimensional gimbal by using a PID control algorithm; The angle compensation data of the camera is determined by the steering gear rotation control instruction, and the code scanning camera is started to scan and take pictures according to the focus compensation data and the angle compensation data to generate the code scanning picture data.
5. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 3, characterized in that: Identifying the shadow area ratio based on the light intensity distribution diagram and generating a fill light dynamic adjustment instruction, the method includes: Perform shadow recognition according to the light intensity distribution map, determine the shadow area, traverse the shadow area to mark points, and obtain coordinate data of the shadow area; Controlling the focus-adjustable LED array to generate a directional fill light beam according to the shadow area coordinate data; The directional fill light beam is used to deploy a ring-shaped auxiliary light source at the edge of the code scanning area to generate the fill light dynamic adjustment instruction.
6. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 1, characterized in that: Performing image quality evaluation based on the scanned code camera image data, generating an evaluation result, optimizing the angle adjustment strategy of the camera according to the evaluation result, and determining an angle adaptive adjustment strategy, the method includes: Extracting the clarity index, contrast index and distortion coefficient of the imaging data based on the scanned code camera image data, and constructing a quality assessment vector; Synchronizing the quality assessment vector to a pre-trained convolutional neural network model for convolutional analysis to generate the assessment result, which includes a comprehensive assessment value; Based on the comparison between the comprehensive evaluation value and the expected evaluation value, determining whether the comprehensive evaluation value is less than the expected evaluation value; When the comprehensive evaluation value is less than the expected evaluation value, generating a parameter optimization path based on historical adjustment records; The compensation coefficient of the angle adjustment strategy of the camera is updated according to the parameter optimization path to determine the angle adaptive adjustment strategy.
7. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 6, characterized in that: Extracting the clarity index, contrast index and distortion coefficient of the imaging data based on the scanned code camera image data, and constructing a quality assessment vector, the method includes: Divide the scanned image data into N×N pixel blocks to generate an image block matrix; The improved Sobel gradient operator is used to calculate the horizontal and vertical gradient amplitudes of the image block matrix to generate a local clarity index; Extracting the grayscale histogram of the image block matrix, calculating the grayscale variance ratio between the central area and the edge area of the grayscale histogram, and generating a contrast index; Identify preset reference mark points in the scanned camera image data, and match the preset reference mark points with a standard template to obtain a spatial coordinate offset; Divide the scanned code camera image data into M×M detection grids, and calculate the radial distortion coefficient of the feature point distribution in each grid; Aggregating the local clarity index of each pixel block in the image block matrix to generate a clarity index; Performing weighted fusion of the radial distortion coefficient and the coordinate offset to generate a distortion coefficient; The clarity index, the contrast index, and the distortion coefficient are combined into the quality assessment vector.
8. The method for adaptively adjusting the angle of a barcode scanning camera according to claim 1, characterized in that: After optimizing the angle adjustment strategy of the camera according to the evaluation result and determining the angle adaptive adjustment strategy, the method includes: Establish a database associating the scanning success rate with the adjustment parameters, record the parameter combination and recognition results of each adjustment process, and obtain historical adjustment combination data; The historical adjustment combination data is analyzed by a reinforcement learning algorithm to dynamically optimize the matching rules between the multi-dimensional gimbal control parameters and the fill light parameters; When a new type of scanning target is detected, the matching rule is called to initialize the angle adaptive adjustment strategy.
9. A camera angle adaptive adjustment system for scanning barcodes, characterized in that: The system is used to execute the method for adaptively adjusting the angle of a barcode scanning camera according to any one of claims 1 to 8, and the system includes: Real-time detection unit: performs real-time detection of environmental parameters of the area to be scanned and obtains a set of dynamic parameters; Deviation analysis unit: performs deviation analysis based on the dynamic parameter set and the preset code scanning reference parameter to generate an angle adjustment strategy; Angle compensation unit: drives the multi-dimensional gimbal to perform angle compensation actions according to the angle adjustment strategy, and generates scanned image data; Strategy optimization unit: perform image quality evaluation based on the scanned code camera image data, generate evaluation results, optimize the angle adjustment strategy of the camera according to the evaluation results, and determine the angle adaptive adjustment strategy.
10. An electronic device, characterized in that: The electronic device comprises: a processor; and a memory for storing instructions executable by the processor; wherein the processor is used to execute the method for adaptively adjusting the angle of a barcode scanning camera as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Two-dimensional code scanning method and device
CN107358135A
Code scanning adaptive system based on self-service code scanner
CN118917336A
Intelligent holder integrated photography tripod system and precise control method thereof
CN119042480A
Camera adaptive adjustment method and system, and storage medium
CN119545164A
Code scanning method, electronic device, and storage medium
WO2024179064A1
Cited By
Automatic adjusting method and system for cotton grading detection light supplementing device
CN120417155A
Automatic adjustment device for coverage range in distributed multi-camera environment
CN120639944A
An automatic coverage adjustment device in a distributed multi-camera environment
CN120639944B
Scenic spot tourist non-inductive snapshot and intelligent optimization system based on multi-modal perception
CN121037677A