Identifying positioning method and apparatus, computer device and storage medium
By identifying reference marker units in the target image and obtaining their corresponding reference coordinate system, the corrected position of the marker to be identified is determined. This solves the problems of inaccurate scanning results and low efficiency caused by inaccurate region selection in traditional methods, and achieves efficient and accurate marker recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUKE INTELLIGENT TECH (SHANGHAI) CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-06-05
AI Technical Summary
In traditional barcode scanning methods, the area manually selected by the user does not match the actual location of the barcode, resulting in inaccurate scanning results and low efficiency.
By acquiring the target image, identifying reference marker units to determine the target marker units, and obtaining their corresponding reference coordinate system, the corrected position of the marker to be identified is determined based on the position information, thereby achieving accurate identification and positioning.
It improves the accuracy and efficiency of identification, avoiding the problems of inaccurate scanning results or low scanning efficiency caused by inaccurate area selection in traditional methods.
Smart Images

Figure CN122156566A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for identifying and locating objects. Background Technology
[0002] With the development of computer vision, identification code technology has gradually emerged. This technology allows data or applications to be embedded in storage space corresponding to identification codes. Users can obtain the corresponding data or applications by scanning and recognizing the identification codes. This technology typically requires manual adjustment of the scanning device's position to ensure accurate alignment with the identifier for effective scanning and data extraction. In traditional methods, users can manually click on the identifier area while scanning for faster recognition. However, this manually selected area may not perfectly match the actual location of the identification code, leading to inaccurate scanning results and affecting recognition efficiency. Summary of the Invention
[0003] Therefore, it is necessary to provide an identification and positioning method, apparatus, computer equipment, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0004] Firstly, this application provides a method for identifying and locating an identifier. The method includes:
[0005] Acquire a target image; wherein the target image includes the region where the identifier to be identified is located; the identifier to be identified includes multiple identifier units;
[0006] Based on the reference identification unit, the reference identification unit is identified in the region to obtain a target identification unit that matches the reference identification unit;
[0007] Obtain the reference coordinate system corresponding to the target identification unit;
[0008] Based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system, the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification to be identified is located in the reference coordinate system are determined.
[0009] Based on the pose information, the third position is mapped to the target image to determine the corrected position of the region where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
[0010] In one embodiment, the step of identifying the reference identifier unit in the region based on the reference identifier unit to obtain a target identifier unit matching the reference identifier unit includes:
[0011] Based on the reference identification unit, the reference identification unit is identified in the region to obtain candidate identification units that match the reference identification unit;
[0012] Obtain the candidate coordinate system corresponding to each candidate identifier unit;
[0013] Based on the fourth position of each candidate identifier unit in the target image and the fifth position of each candidate identifier unit in the corresponding candidate coordinate system, the sixth position of each candidate coordinate system in the region where the identifier to be identified is located is determined.
[0014] Based on each of the fifth positions and the corresponding sixth positions, the distance between the region where the identifier to be identified is located and each of the candidate identifier units in each candidate coordinate system is determined, and the target identifier unit is determined based on the distance.
[0015] In one embodiment, determining the pose information of the target identifier unit in the reference coordinate system, and the third position of the region where the identifier to be identified is located in the reference coordinate system, based on the first position of the target identifier unit in the target image and the second position of the target identifier unit in the reference coordinate system, includes:
[0016] Obtain the planar coordinates of the corner point of the target identification unit in the planar coordinate system corresponding to the target image;
[0017] Based on the planar coordinates and the spatial coordinates of the corner points of the target identifier unit in the reference coordinate system, the pose information of the target identifier unit in the reference coordinate system and the third position of the region where the identifier to be identified is located in the reference coordinate system are determined.
[0018] In one embodiment, acquiring the target image includes:
[0019] Acquire an initial image; wherein the initial image includes the region where the identifier to be identified is located;
[0020] The initial image is corrected using a preset distortion strategy, and the resolution data of the initial image is adjusted to obtain the target image;
[0021] Based on the difference between the initial image and the target image, and the region where the identifier to be identified is located in the initial image, the region where the identifier to be identified is located is identified from the target image.
[0022] In one embodiment, the method further includes:
[0023] Based on the location of the region containing the identifier to be identified in the target image and the correction location, the distance between the region location and the correction location is determined;
[0024] If the distance is greater than a preset threshold, an early warning signal is generated.
[0025] In one embodiment, the target image includes a video frame, and the method includes:
[0026] Obtain the pose information of the starting frame of the target video, the target position corresponding to the starting frame, and the corresponding target identifier;
[0027] Based on the pose information of each video frame of the target video and the pose information of the starting frame, the pose change of the target identifier in each video frame is determined.
[0028] Based on the pose change and the target position corresponding to the starting frame, the target position of the identifier to be identified in each video frame is determined.
[0029] Secondly, this application also provides an identification and positioning device. The device includes:
[0030] An image acquisition module is used to acquire a target image; wherein the target image includes the area where the identifier to be identified is located; the identifier to be identified includes multiple identifier units;
[0031] The identifier recognition module is used to identify the reference identifier unit in the region based on the reference identifier unit, and obtain a target identifier unit that matches the reference identifier unit;
[0032] The coordinate system acquisition module is used to acquire the reference coordinate system corresponding to the target identification unit;
[0033] The position determination module is used to determine the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification unit is located in the reference coordinate system based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system.
[0034] The position determination module is further configured to map the third position to the target image based on the pose information, and determine the corrected position of the area where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
[0035] In one embodiment, the identifier recognition module includes:
[0036] The candidate identifier determination submodule is used to identify the reference identifier unit in the region based on the reference identifier unit, and obtain the candidate identifier unit that matches the reference identifier unit;
[0037] The coordinate system determination submodule is used to obtain the candidate coordinate system corresponding to each candidate identifier unit;
[0038] The sixth position determination submodule is used to determine the sixth position of each of the candidate coordinate systems in the region where the identifier to be identified is located, based on the fourth position of each candidate identifier unit in the target image and the fifth position of the candidate identifier unit in the corresponding candidate coordinate system.
[0039] The identification unit determination submodule is used to determine the distance between the area where the identification to be identified is located in each candidate coordinate system and each candidate identification unit based on each fifth position and the corresponding sixth position, and to determine the target identification unit based on the distance.
[0040] In one embodiment, the location determination module includes:
[0041] The coordinate determination submodule is used to obtain the planar coordinates of the corner point of the target identification unit in the planar coordinate system corresponding to the target image;
[0042] The position determination submodule is used to determine the pose information of the target identifier unit in the reference coordinate system and the third position of the area where the identifier to be identified is located in the reference coordinate system based on the planar coordinates and the spatial coordinates of the corner point of the target identifier unit in the reference coordinate system.
[0043] In one embodiment, the image acquisition module includes:
[0044] An image acquisition submodule is used to acquire an initial image; wherein, the initial image includes the region where the identifier to be identified is located;
[0045] The image correction submodule is used to correct the initial image using a preset distortion strategy and adjust the resolution data of the initial image to obtain the target image.
[0046] The image identification submodule is used to identify the region where the identification to be identified is located from the target image based on the difference between the initial image and the target image, and the region where the identification to be identified is located in the initial image.
[0047] In one embodiment, the device further includes:
[0048] The spacing acquisition module is used to determine the spacing between the region location and the correction position based on the region location and the correction position of the identifier to be identified in the target image.
[0049] The spacing warning module is used to generate a warning signal when the spacing is greater than a preset threshold.
[0050] In one embodiment, the target image includes a video frame, and the apparatus further includes:
[0051] The data acquisition module is used to acquire the starting frame of the target video, the target position corresponding to the starting frame, and the pose information of the corresponding target identifier;
[0052] The pose acquisition module is used to determine the pose change of the target identifier in each video frame based on the pose information of each video frame of the target video and the pose information of the starting frame.
[0053] The position determination module is used to determine the target position of the identifier to be identified in each video frame based on the pose change and the target position corresponding to the starting frame.
[0054] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the identification and location method as described in any of the embodiments of this disclosure.
[0055] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the identification and location method as described in any one of the embodiments of this disclosure.
[0056] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the identification and location method as described in any of the embodiments of this disclosure.
[0057] The aforementioned identification and positioning method, apparatus, computer equipment, storage medium, and computer program products acquire a target image, identify reference identification units within the target image to obtain the target identification unit, then acquire the reference coordinate system corresponding to the target identification unit. Based on the position information of the target identification unit in the target image and the reference coordinate system, the pose information of the target identification unit and the position of the area where the identification unit is located in the reference coordinate system are determined. Finally, the position of the area where the identification unit is located is mapped back to the target image to obtain the corrected position, thus achieving accurate identification and positioning of the identification unit. It can accurately extract the pose information of the target identification unit and compare it with the reference coordinate system, thereby achieving efficient and accurate positioning. This method avoids the problem of inaccurate scanning results or slow scanning efficiency caused by the inconsistency between the selected area and the actual identification code position in traditional methods, improving the accuracy and efficiency of identification recognition. Attached Figure Description
[0058] Figure 1 This is a flowchart illustrating the identification and positioning method in one embodiment;
[0059] Figure 2This is a schematic diagram of the process for confirming the target identification unit in one embodiment;
[0060] Figure 3 This is a flowchart illustrating the process of confirming the third position in one embodiment;
[0061] Figure 4 This is a schematic diagram of the target image acquisition process in one embodiment;
[0062] Figure 5 This is a schematic diagram of the process for generating a warning signal in one embodiment;
[0063] Figure 6 This is a flowchart illustrating the process of confirming the location of a video target in one embodiment;
[0064] Figure 7 This is a flowchart illustrating the implementation of the identification and positioning method in one embodiment;
[0065] Figure 8 This is a structural block diagram of the identification and positioning device in one embodiment;
[0066] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0068] In one embodiment, such as Figure 1 As shown, a method for identifying and locating an object is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0069] Step S100: Obtain the target image; wherein the target image includes the area where the identifier to be identified is located; the identifier to be identified includes multiple identifier units.
[0070] In one exemplary embodiment, the target image may include a photograph, video frame, etc.; the identifier to be identified may include data or applications stored in the identifier to be identified by scanning and identifying the identifier; the identifier to be identified may include a barcode, QR code, etc. The area where the identifier to be identified is located may include a region containing the identifier, which can be obtained by annotating the target image, that is, the area where the identifier to be identified is located can be annotated in the target image.
[0071] In one exemplary embodiment, the target image may be a video frame, which may also include real-time video; the determination of the area where the identifier to be identified is located may include the user selecting an area or the user selecting a point, and setting an area with that point as the center point, which is the area where the identifier to be identified is located; for example, the area to be identified may be a QR code, and when the user clicks on the QR code, a point is generated, and a square area or a circular area is generated with that point as the center point, which is the area where the identifier to be identified is located.
[0072] In one exemplary embodiment, the identification unit may include dividing the identifier to be identified into multiple sub-identifiers, which can be combined to form the identifier to be identified. For example, the identifier to be identified may be a 12*12 QR code; the sub-identifiers may be 4*4 sub-QR codes, meaning the 12*12 QR code can be divided into 9 sub-QR codes, i.e., 9 identification units. In another exemplary embodiment, the multiple identification units may also include overlapping content between different identification units. For example, in a 12*12 QR code, the first sub-identifier has an x-coordinate of 0-3 and a y-coordinate of 0-3; while the second sub-identifier has an x-coordinate of 1-4 and a y-coordinate of 0-3, etc.
[0073] Step S200: Based on the reference identification unit, identify the reference identification unit in the region to obtain a target identification unit that matches the reference identification unit.
[0074] In one exemplary embodiment, the reference identifier unit may include a preset identifier unit established based on the identifier to be identified. The reference identifier unit allows for the identification of target identifier units matching the reference identifier unit from the area containing the identifier to be identified. For example, when the identifier to be identified is a QR code, the reference identifier unit can be set as a 3x3 grid, where the grid contains a combination of two colors; for example, black and white. That is, the grid color is either black or white. By establishing multiple such reference identifier units, the corresponding target identifier unit can be identified from the area containing the identifier to be identified. In practical use, the reference identifier unit may include the entire set or only some identifier units with features. The entire set may include all possible occurrences of the identifier unit. For example, if the identifier unit is a 3x3 grid, then it is necessary to consider all possible identifier units that could appear in the 3x3 grid filled with two colors, i.e., the entire set.
[0075] In one exemplary embodiment, when identifying the reference identifier unit, multiple candidate identifier units matching the reference identifier unit can be identified, and one of the candidate identifier units can be selected as the target identifier unit for subsequent use such as positioning. Specifically, when the identifier to be identified is a QR code, the reference identifier unit can be an ArUco identifier, etc.
[0076] In one exemplary embodiment, the ArUco detection library provided by OpenCV can be used to identify reference identification units (ArUco identifiers) from the target image, extract the corresponding identifier IDs, and provide a data basis for candidate determination of reference coordinate systems, etc.
[0077] Step S300: Obtain the reference coordinate system corresponding to the target identification unit.
[0078] In one exemplary embodiment, the reference coordinate system may include a three-dimensional coordinate system, etc.; each reference identifier unit may have a corresponding reference coordinate system, and obtaining the reference coordinate system corresponding to the target identifier unit may include obtaining the reference coordinate system of the corresponding reference identifier unit. For example, when the identifier to be identified is a QR code, the reference identifier unit may be an ArUco identifier, etc. It is understood that each ArUco identifier will correspond to a three-dimensional coordinate system, which may be calculated based on the geometric features of the identifier and the camera's viewpoint, etc.
[0079] Step S400: Based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system, determine the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification to be identified is located in the reference coordinate system.
[0080] In one exemplary embodiment, the first position may include the first coordinates of the target identification unit in the planar coordinate system corresponding to the target image; the second position may include the second coordinates of the target identification unit in the reference coordinate system. The pose information of the target identification unit in the reference coordinate system can be obtained through the first and second coordinates, and specifically, the PnP algorithm can be used for confirmation.
[0081] In one exemplary embodiment, when mapping the area where the identifier to be identified is located to a reference coordinate system, multiple points corresponding to two-dimensional coordinates can be obtained, and a point mapped to the same plane as the target identifier unit in the reference coordinate system can be selected as the third position, etc.
[0082] Step S500: Based on the pose information, the third position is mapped to the target image to determine the corrected position of the region where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
[0083] In one exemplary embodiment, the three-dimensional coordinates can be mapped onto the target image based on the pose information of the target identification unit in the target coordinate system and the three-dimensional coordinates (third position) of the area where the identification to be identified is located in the target coordinate system, thereby obtaining the two-dimensional coordinates of the area where the identification to be identified is located in the planar coordinate system of the target image, and the two-dimensional coordinates are determined as the correction position, etc.
[0084] In the aforementioned marker localization method, a target image is acquired, and reference marker units are identified within the target image to obtain the target marker units. Then, the reference coordinate system corresponding to the target marker units is obtained. Based on the position information of the target marker units in the target image and the reference coordinate system, the pose information of the target marker units and the position of the region containing the marker to be identified in the reference coordinate system are determined. Finally, the position of the region containing the marker to be identified is mapped back to the target image to obtain the corrected position, thus achieving accurate identification and localization of the marker to be identified. This method can accurately extract the pose information of the target marker units and compare it with the reference coordinate system, thereby achieving efficient and accurate localization. This approach avoids the problem of inaccurate scanning results or slow scanning efficiency caused by inconsistencies between the selected area and the actual marker position in traditional methods, improving the accuracy and efficiency of marker recognition.
[0085] In one embodiment, such as Figure 2 As shown, the step of identifying the reference identifier unit in the region based on the reference identifier unit to obtain a target identifier unit matching the reference identifier unit includes:
[0086] Step S201: Identify the reference identifier unit in the region according to the reference identifier unit, and obtain a candidate identifier unit that matches the reference identifier unit.
[0087] Step S202: Obtain the candidate coordinate system corresponding to each candidate identifier unit.
[0088] Step S203: Based on the fourth position of each candidate identifier unit in the target image and the fifth position of each candidate identifier unit in the corresponding candidate coordinate system, determine the sixth position of the region where the identifier to be identified is located in each candidate coordinate system.
[0089] Step S204: Based on each of the fifth positions and the corresponding sixth positions, determine the distance between the area where the identifier to be identified is located in each candidate coordinate system and each of the candidate identifier units, and determine the target identifier unit based on the distance.
[0090] In an exemplary embodiment, the identification reference unit in the region may include candidate identifier units that match multiple reference identifier units, i.e., there are multiple candidate identifier units. Obtaining the candidate coordinate system corresponding to each candidate identifier unit means that each reference identifier unit has a corresponding coordinate system (three-dimensional coordinate system), and obtaining the candidate coordinate system means obtaining the coordinate system corresponding to the reference identifier unit that matches the candidate identifier unit. The fourth position of the candidate identifier unit in the target image may include the two-dimensional coordinates of the candidate identifier unit in the corresponding planar coordinate system of the target image, and the fifth position of the candidate identifier unit in the corresponding candidate coordinate system may include the three-dimensional coordinates of the candidate identifier unit in the corresponding candidate coordinate system. Based on the obtained two-dimensional and three-dimensional coordinates, the mapping relationship between the planar coordinate system of the target image and the candidate coordinate system can be obtained. Using the mapping relationship, the two-dimensional coordinates of the region where the identifier to be identified is located are mapped to each candidate coordinate system to obtain the three-dimensional coordinates of the region where the identifier to be identified is located in each candidate coordinate system, i.e., the sixth position. It is understood that a two-dimensional point mapped to a three-dimensional coordinate system is a ray. Here, a point on the same plane as the candidate identifier unit can be selected as the target point, and the three-dimensional coordinates of the target point are the sixth position, etc. Based on the fifth position of each candidate identifier unit and the sixth position of the identifier to be identified, the distance between each candidate identifier unit and the identifier to be identified is determined. Specifically, the distance from the center point of each candidate identifier unit to the center point of the area where the identifier to be identified is located can be selected, and the candidate identifier unit with the closest distance can be selected as the target identifier unit. In another exemplary embodiment, a target identifier unit can be randomly selected from the candidate identifier units for subsequent positioning.
[0091] In one exemplary embodiment, the distance between the region where the identifier to be identified is located and each candidate identifier unit in each candidate coordinate system may include calculating the Euclidean distance between the region where the identifier to be identified is located and the candidate identifier unit.
[0092] In this embodiment, by identifying multiple candidate identifier units in the region and determining their corresponding candidate coordinate systems, and further mapping the region where the identifier to be identified is located to each candidate coordinate system based on the position information of the candidate identifier units in the target image and the candidate coordinate systems, the target identifier unit is determined by calculating the distance between the identifier to be identified and the candidate identifier units. This allows for the precise selection of the most suitable target identifier unit, improving the accuracy of target identifier unit identification. This refined processing ensures the accuracy and reliability of subsequent positioning steps, thereby improving the performance of the entire identifier positioning method.
[0093] In one embodiment, such as Figure 3As shown, determining the pose information of the target identifier unit in the reference coordinate system and the third position of the region where the identifier to be identified is located in the reference coordinate system, based on the first position of the target identifier unit in the target image and the second position of the target identifier unit in the reference coordinate system, includes:
[0094] Step S401: Obtain the planar coordinates of the corner point of the target identification unit in the planar coordinate system corresponding to the target image.
[0095] Step S402: Based on the planar coordinates and the spatial coordinates of the corner point of the target identifier unit in the reference coordinate system, determine the pose information of the target identifier unit in the reference coordinate system, and the third position of the area where the identifier to be identified is located in the reference coordinate system.
[0096] In one exemplary embodiment, the planar coordinates and spatial coordinates of the corner points of the target identification unit can be used to determine the pose information of the target identification unit. It is understood that the corner points are key points of the shape and contain a lot of positional information. Therefore, the approximate shape of the image can be determined by the corner points, and the pose information can be determined based on the planar coordinates and spatial coordinates.
[0097] In one exemplary embodiment, the pose information of the target identifier unit in the reference coordinate system can be calculated using the PnP algorithm based on the planar coordinates and spatial coordinates of the corner points of the target identifier unit. The PnP algorithm is a method for solving camera pose based on the mapping relationship between n three-dimensional spatial points and two-dimensional planar points, where n is greater than or equal to 3. In this embodiment, the pose information of the target identifier unit in the reference coordinate system, including rotation matrices and translation vectors, can be calculated using the planar coordinates of the four corner points of the target identifier unit in the target image and their spatial coordinates in the reference coordinate system. Simultaneously, based on the pose information of the target identifier unit and its coordinates in the reference coordinate system, the third position of the area containing the identifier to be identified in the reference coordinate system can be determined, i.e., the three-dimensional coordinates of the area containing the identifier to be identified in the reference coordinate system. Specifically, the two-dimensional coordinates of the area containing the identifier to be identified can be mapped to the reference coordinate system to obtain the three-dimensional coordinates of the area containing the identifier to be identified in the reference coordinate system. In this way, the pose information of the target identifier unit in the reference coordinate system and the position of the area containing the identifier to be identified in the reference coordinate system can be accurately determined, providing an accurate data foundation for subsequent positioning steps.
[0098] In this embodiment, the pose information of the target identifier unit in the reference coordinate system is accurately calculated by utilizing the planar and spatial coordinates of its corner points. This step not only ensures the accuracy of the calculation but also provides a solid foundation for subsequent positioning steps. Simultaneously, based on the pose information of the target identifier unit and its coordinates in the reference coordinate system, we can accurately map the area where the identifier to be identified is located onto the reference coordinate system, obtaining its precise position in three-dimensional space. This precise positioning method greatly improves the accuracy and efficiency of identifier recognition, making the entire identifier positioning process more reliable and efficient.
[0099] In one embodiment, such as Figure 4 As shown, acquiring the target image includes:
[0100] Step S101: Obtain an initial image; wherein the initial image includes the area where the identifier to be identified is located.
[0101] Step S102: Using a preset distortion strategy, the initial image is corrected, and the resolution data of the initial image is adjusted to obtain the target image.
[0102] Step S103: Based on the difference between the initial image and the target image, and the region where the identifier to be identified is located in the initial image, the region where the identifier to be identified is located is identified from the target image.
[0103] In one exemplary embodiment, the memory matrix and related parameters can be recalculated based on the camera's intrinsic parameter matrix and distortion coefficients, and based on the resolution of the initial image, to match the resolution change. Then, the new intrinsic parameter matrix and distortion coefficients can be combined to perform resolution adjustment and distortion correction operations on the input image data, thereby obtaining the target image, etc. Specifically, the camera's intrinsic parameter matrix and distortion coefficient matrix can be obtained in advance, and these two parameters can be used to perform distortion correction on the input initial image to eliminate nonlinear distortions caused by the optical lens, etc.
[0104] In one exemplary embodiment, after distortion correction and resolution adjustment of the initial image, the corresponding region of the identifier to be identified can be determined from the target image based on the region of the identifier to be identified in the initial image, and then labeled to obtain the target image, etc.
[0105] In one exemplary embodiment, the distortion strategy may include radial distortion correction and tangential distortion correction. Radial distortion is typically caused by the lens shape, making straight lines in the image appear curved; while tangential distortion is caused by imperfect parallelism between the lens and the image sensor. By using pre-acquired camera intrinsic parameter matrices and distortion coefficient matrices, precise distortion correction can be performed on the initial image, resulting in a more accurate target image. Regarding resolution adjustment, the resolution of the initial image can be appropriately enlarged or reduced according to actual needs to adapt to different application scenarios. Simultaneously, to ensure image quality after distortion correction and resolution adjustment, interpolation algorithms can be used to smooth the image, avoiding jagged edges or blurring. After obtaining the target image, based on the differences between the initial and target images, and the region where the identifier to be identified is located in the initial image, the region can be accurately identified from the target image. This process can be implemented using an image matching algorithm, comparing the region of the identifier to be identified in the initial image with the target image, and finding the most similar region as the target region where the identifier is located. To improve the accuracy and efficiency of recognition, advanced image matching algorithms such as feature point matching and template matching can be used.
[0106] In this embodiment, an initial image is acquired, and a preset distortion strategy is used to correct and adjust the resolution of the initial image to obtain the target image. This process effectively eliminates distortion in the image and improves image clarity. Simultaneously, based on the differences between the initial and target images, and the region where the identifier to be identified is located in the initial image, the region where the identifier is located can be accurately identified from the target image. This method not only improves the accuracy of identifier localization but also enhances the system's adaptability and robustness.
[0107] In one embodiment, such as Figure 5 As shown, the method further includes:
[0108] Step S601: Determine the distance between the region location and the correction position based on the region location and correction position of the identifier to be identified in the target image.
[0109] Step S602: If the spacing is greater than a preset threshold, a warning signal is generated.
[0110] In one exemplary embodiment, the distance between the location of the identifier to be identified in the target image and the corrected location information can be calculated. This distance can be used to measure the degree of deviation between the current location of the identifier to be identified and the corrected location. In another exemplary embodiment, the preset threshold can be set according to the needs of the actual application scenario to determine whether the current location of the identifier to be identified deviates too far from the corrected location. When the distance is greater than the preset threshold, it indicates a large deviation between the current location of the identifier to be identified and the corrected location, which may indicate inaccurate positioning or misidentification. In this case, a warning signal can be generated. The warning signal can be presented in various forms such as sound, light, and text, so that operators can promptly detect and handle the problem. By adding this step, the accuracy and reliability of identifier positioning can be further improved, ensuring the normal operation of the system.
[0111] In one exemplary embodiment, the location of the region containing the identifier to be identified in the target image may include the location of the initial region where the identifier to be identified is marked in the target image; the corrected location information may include the repositioned and corrected location, etc. When the deviation between the two locations is too large, it can be considered that the corrected location may have errors or mistakes, and therefore a warning signal can be generated. In one exemplary embodiment, the warning signal may include re-determining the corrected location, etc.
[0112] In one exemplary embodiment, the warning signal can also trigger a re-execution of the marker positioning process to ensure accurate identification and positioning of the marker to be identified. Specifically, upon receiving a warning signal, the system can automatically or manually trigger a re-execution of the entire marker positioning process, including steps such as re-acquiring the target image, re-identifying the reference marker unit and the target marker unit, re-determining the pose information, and correcting the position, to correct any possible errors or mistakes. In this way, the accuracy and reliability of marker positioning can be further improved, ensuring the stability and precision of the system. Furthermore, the method may also include recording historical information of the warning signal for subsequent analysis and improvement of system performance.
[0113] In one exemplary embodiment, the target image may be a real-time video frame, so that when a warning signal is generated, the area or correction position of the marker to be identified in the target image can be identified; or the area and correction position of the marker to be identified may be identified simultaneously.
[0114] In this embodiment, by using the location of the identifier to be identified in the target image and the corrected location, not only is accurate identification and positioning of the identifier achieved, but a location verification step is also added. When the distance between the identified location and the corrected location exceeds a preset threshold, the system can automatically generate an early warning signal. This function greatly improves the accuracy and reliability of identifier positioning, thereby ensuring the stability and precision of the entire identifier positioning process.
[0115] In one embodiment, such as Figure 6 As shown, the target image includes video frames, and the method includes:
[0116] Step S611: Obtain the pose information of the starting frame of the target video, the target position corresponding to the starting frame, and the corresponding target identifier.
[0117] Step S612: Based on the pose information of each video frame of the target video and the pose information of the starting frame, determine the pose change of the target identifier in each video frame.
[0118] Step S613: Determine the target position of the identifier to be identified in each video frame based on the pose change and the target position corresponding to the starting frame.
[0119] In one exemplary embodiment, the target position of the identifier to be identified in each video frame can be deduced based on the pose information and target position of the target identifier in the starting frame, as well as the changes in pose information in subsequent video frames. This process can be achieved by tracking and analyzing the pose information of the target identifier, thereby obtaining the precise position of the identifier to be identified in each video frame. In this way, the identifier to be identified can be identified and located in real time in the video stream, providing data support for subsequent dynamic positioning and tracking. In another exemplary embodiment, the pose of the target identifier in each video frame can be tracked using methods such as optical flow and feature point matching, thereby obtaining continuous pose change information. At the same time, in order to ensure the accuracy and stability of pose tracking, a filtering algorithm can be used to smooth the pose information to avoid abrupt pose changes caused by noise or interference. After obtaining the pose change information in each video frame, the target position of the identifier to be identified in each video frame can be deduced by combining it with the target position in the starting frame.
[0120] In one exemplary embodiment, the video may include pre-stored video files or real-time captured video. Video frames can be continuously read, and identifier detection and pose estimation can be performed in real time. For each frame processed, the identifier's pose information can be extracted. Combining the identifier's initial pose information and current pose, the two-dimensional projection point of the corrected position for the current frame can be calculated, thereby achieving real-time video localization and target detection.
[0121] In this embodiment, by acquiring the starting frame of the target video and its corresponding target position and target identifier pose information, an initial reference baseline can be established. Subsequently, based on the pose information of each video frame of the target video and the pose information of the starting frame, the changes in pose of the target identifier can be dynamically tracked. This step is crucial for understanding how the target identifier moves or changes in the video. By combining the pose change information and the target position of the starting frame, the target position of the identifier to be identified in each video frame can be accurately calculated. This method is applicable not only to pre-stored video files but also to real-time captured videos, providing an effective solution for identifier localization in dynamic scenes. Furthermore, by continuously reading video frames and performing real-time identifier detection and pose estimation, continuous localization and target detection of the video can be achieved, providing possibilities for further dynamic analysis and applications. This real-time processing and dynamic tracking capability greatly enhances the flexibility and practicality of the identifier localization method, enabling it to demonstrate powerful performance in various application scenarios.
[0122] In one exemplary embodiment, the identifier location method may be as follows: Figure 7 The illustrated implementation specifically includes:
[0123] Step S901: Read the camera calibration parameters and perform distortion correction; load the camera intrinsic parameter matrix and distortion coefficient matrix from the pre-stored calibration parameter file. These two parameters are used to correct the distortion of the input image, eliminating nonlinear distortion caused by the optical lens, thereby providing accurate image input for subsequent QR code pose estimation and target area localization.
[0124] Step S902: Detect ArUco identifiers. Using the ArUco detection library provided by OpenCV, identify ArUco identifiers from the input video stream or image frames, and extract their corner coordinates and unique identifier ID. If detection fails, terminate the current detection step. The detection results include the corner position information of the ArUco identifier and its unique ID, which are used for subsequent pose estimation and spatial localization.
[0125] Step S903: The user interactively selects a region of interest; in the video or detection result display of the current frame, the user selects a set of two-dimensional points within the region of interest using mouse operations. These user-selected points will serve as important reference data for subsequent three-dimensional spatial point calculation and localization tasks.
[0126] Step S904: Initialize the 3D target region and calculate the Euclidean distance; based on the detected ArUco identifier corner points and the user-selected 2D point set, use the PnP algorithm to calculate the ArUco identifier pose and the actual position of these points relative to the ArUco identifier in 3D space. Calculate the Euclidean distance of these 3D points relative to the origin of the ArUco identifier for proximity analysis of the target region in subsequent localization tasks.
[0127] In one exemplary embodiment, when using multiple ArUco identifiers to locate the same region of interest, the distance from the location point of the region of interest to the origin of the ArUco identifier is calculated mainly because the error of the ArUco identifier recognition causes the location point to have a larger error as it is further away from the origin. Therefore, the identifier with the closest distance is selected for location. The proximity analysis of the target region is mainly based on the distance from the location point of the target region to each identifier in the initial solution, and the identifiers detected in the current frame are compared and the closest identifier is selected for location.
[0128] Step S905: Real-time video frame reading and pose detection; ArUco identifier detection and pose estimation are performed in real time by continuously reading video frames. For each frame processed, the detector extracts the corner position information of the ArUco identifier and calculates the pose of the identifier in the current frame using the corner points. Combining the initial pose information with the current pose, the two-dimensional projection points of the region of interest in the current frame are calculated, thereby achieving real-time localization and target detection.
[0129] In one exemplary embodiment, the pose information (i.e., position and orientation in the camera coordinate system) of the ArUco identifier in each frame can be obtained. Using the camera intrinsic parameter matrix (focal length, principal point, etc.) and extrinsic parameter matrix (camera position and orientation), the three-dimensional spatial points can be transformed into a two-dimensional image plane. The obtained two-dimensional points are then the location points of the region of interest in the current frame.
[0130] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0131] Based on the same inventive concept, this application also provides an identifier positioning device for implementing the identifier positioning method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more identifier positioning device embodiments provided below can be found in the limitations of the identifier positioning method described above, and will not be repeated here.
[0132] In one embodiment, such as Figure 8 As shown, a marker positioning device 100 is provided, including: an image acquisition module 101, a marker recognition module 102, a coordinate system acquisition module 103, and a position determination module 104, wherein:
[0133] An image acquisition module is used to acquire a target image; wherein the target image includes the area where the identifier to be identified is located; the identifier to be identified includes multiple identifier units;
[0134] The identifier recognition module is used to identify the reference identifier unit in the region based on the reference identifier unit, and obtain a target identifier unit that matches the reference identifier unit;
[0135] The coordinate system acquisition module is used to acquire the reference coordinate system corresponding to the target identification unit;
[0136] The position determination module is used to determine the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification unit is located in the reference coordinate system based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system.
[0137] The position determination module is further configured to map the third position to the target image based on the pose information, and determine the corrected position of the area where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
[0138] In one embodiment, the identifier recognition module includes:
[0139] The candidate identifier determination submodule is used to identify the reference identifier unit in the region based on the reference identifier unit, and obtain the candidate identifier unit that matches the reference identifier unit;
[0140] The coordinate system determination submodule is used to obtain the candidate coordinate system corresponding to each candidate identifier unit;
[0141] The sixth position determination submodule is used to determine the sixth position of each of the candidate coordinate systems in the region where the identifier to be identified is located, based on the fourth position of each candidate identifier unit in the target image and the fifth position of the candidate identifier unit in the corresponding candidate coordinate system.
[0142] The identification unit determination submodule is used to determine the distance between the area where the identification to be identified is located in each candidate coordinate system and each candidate identification unit based on each fifth position and the corresponding sixth position, and to determine the target identification unit based on the distance.
[0143] In one embodiment, the location determination module includes:
[0144] The coordinate determination submodule is used to obtain the planar coordinates of the corner point of the target identification unit in the planar coordinate system corresponding to the target image;
[0145] The position determination submodule is used to determine the pose information of the target identifier unit in the reference coordinate system and the third position of the area where the identifier to be identified is located in the reference coordinate system based on the planar coordinates and the spatial coordinates of the corner point of the target identifier unit in the reference coordinate system.
[0146] In one embodiment, the image acquisition module includes:
[0147] An image acquisition submodule is used to acquire an initial image; wherein, the initial image includes the region where the identifier to be identified is located;
[0148] The image correction submodule is used to correct the initial image using a preset distortion strategy and adjust the resolution data of the initial image to obtain the target image.
[0149] The image identification submodule is used to identify the region where the identification to be identified is located from the target image based on the difference between the initial image and the target image, and the region where the identification to be identified is located in the initial image.
[0150] In one embodiment, the device further includes:
[0151] The spacing acquisition module is used to determine the spacing between the region location and the correction position based on the region location and the correction position of the identifier to be identified in the target image.
[0152] The spacing warning module is used to generate a warning signal when the spacing is greater than a preset threshold.
[0153] In one embodiment, the target image includes a video frame, and the apparatus further includes:
[0154] The data acquisition module is used to acquire the starting frame of the target video, the target position corresponding to the starting frame, and the pose information of the corresponding target identifier;
[0155] The pose acquisition module is used to determine the pose change of the target identifier in each video frame based on the pose information of each video frame of the target video and the pose information of the starting frame.
[0156] The position determination module is used to determine the target position of the identifier to be identified in each video frame based on the pose change and the target position corresponding to the starting frame.
[0157] Each module in the aforementioned positioning device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0158] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements an identification and positioning method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0159] Those skilled in the art will understand that Figure 9The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0160] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0161] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0163] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for identifying and locating objects, characterized in that, The method includes: Acquire a target image; wherein the target image includes the region where the identifier to be identified is located; the identifier to be identified includes multiple identifier units; Based on the reference identification unit, the reference identification unit is identified in the region to obtain a target identification unit that matches the reference identification unit; Obtain the reference coordinate system corresponding to the target identification unit; Based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system, the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification to be identified is located in the reference coordinate system are determined. Based on the pose information, the third position is mapped to the target image to determine the corrected position of the region where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
2. The method according to claim 1, characterized in that, The step of identifying the reference identifier unit in the region based on the reference identifier unit, and obtaining the target identifier unit that matches the reference identifier unit, includes: Based on the reference identification unit, the reference identification unit is identified in the region to obtain candidate identification units that match the reference identification unit; Obtain the candidate coordinate system corresponding to each candidate identifier unit; Based on the fourth position of each candidate identifier unit in the target image and the fifth position of each candidate identifier unit in the corresponding candidate coordinate system, the sixth position of each candidate coordinate system in the region where the identifier to be identified is located is determined. Based on each of the fifth positions and the corresponding sixth positions, the distance between the region where the identifier to be identified is located and each of the candidate identifier units in each candidate coordinate system is determined, and the target identifier unit is determined based on the distance.
3. The method according to claim 1, characterized in that, The step of determining the pose information of the target identifier unit in the reference coordinate system and the third position of the region where the identifier to be identified is located in the reference coordinate system based on the first position of the target identifier unit in the target image and the second position of the target identifier unit in the reference coordinate system includes: Obtain the planar coordinates of the corner point of the target identification unit in the planar coordinate system corresponding to the target image; Based on the planar coordinates and the spatial coordinates of the corner points of the target identifier unit in the reference coordinate system, the pose information of the target identifier unit in the reference coordinate system and the third position of the region where the identifier to be identified is located in the reference coordinate system are determined.
4. The method according to claim 1, characterized in that, The acquisition of the target image includes: Acquire an initial image; wherein the initial image includes the region where the identifier to be identified is located; The initial image is corrected using a preset distortion strategy, and the resolution data of the initial image is adjusted to obtain the target image; Based on the difference between the initial image and the target image, and the region where the identifier to be identified is located in the initial image, the region where the identifier to be identified is located is identified from the target image.
5. The method according to claim 1, characterized in that, The method further includes: Based on the location of the region containing the identifier to be identified in the target image and the correction location, the distance between the region location and the correction location is determined; If the distance is greater than a preset threshold, an early warning signal is generated.
6. The method according to any one of claims 1-5, characterized in that, The target image includes video frames, and the method includes: Obtain the pose information of the starting frame of the target video, the target position corresponding to the starting frame, and the corresponding target identifier; Based on the pose information of each video frame of the target video and the pose information of the starting frame, the pose change of the target identifier in each video frame is determined. Based on the pose change and the target position corresponding to the starting frame, the target position of the identifier to be identified in each video frame is determined.
7. A positioning device, characterized in that, The device includes: An image acquisition module is used to acquire a target image; wherein the target image includes the area where the identifier to be identified is located; the identifier to be identified includes multiple identifier units; The identifier recognition module is used to identify the reference identifier unit in the region based on the reference identifier unit, and obtain a target identifier unit that matches the reference identifier unit; The coordinate system acquisition module is used to acquire the reference coordinate system corresponding to the target identification unit; The position determination module is used to determine the pose information of the target identification unit in the reference coordinate system and the third position of the area where the identification unit is located in the reference coordinate system based on the first position of the target identification unit in the target image and the second position of the target identification unit in the reference coordinate system. The position determination module is further configured to map the third position to the target image based on the pose information, and determine the corrected position of the area where the identifier to be identified is located in the target image; the corrected position is used to identify the identifier to be identified.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.