Identification code selection method, device and electronic device
By collecting images in electronic devices and obtaining the size information of the identification code, and automatically selecting the target identification code, the problem of difficulty for users to manually select in multiple identification code scenarios is solved, and the efficiency and convenience of scanning code operations are improved.
Patent Information
- Application Number
- CN202111043730.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-09-07
AI Technical Summary
In the case where multiple image identification codes exist in the scanned image, the user needs to manually select one, which leads to inconvenient operation.
By collecting images, the size information of multiple identification codes is obtained, and the target identification code is automatically selected based on these information.
It realizes reducing user operation steps in multiple identification code scenarios, improving code scanning efficiency, and supporting one-handed operation of electronic devices.
Smart Images

Figure CN113780019B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to an identification code selection method, an identification code selection device and an electronic device. Background Art
[0002] Scanning image recognition codes have been widely used in various scenarios. Currently, in the application scenario of scanning image recognition codes, there may be a situation where multiple image recognition codes exist in the scanned image, and the user needs to manually select one of the multiple image recognition codes according to actual needs, which causes inconvenience to the user operation. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, device and electronic device for selecting an identification code, so as to solve the problem that a user needs to manually select one of multiple image identification codes, causing inconvenience to the user operation.
[0004] In a first aspect, an embodiment of the present application provides an identification code selection method, the method comprising: acquiring a first image; when the first image contains multiple identification codes, obtaining size information of each of the multiple identification codes; and selecting a target identification code from the multiple identification codes based on the size information of each of the multiple identification codes.
[0005] In a second aspect, an embodiment of the present application provides an identification code selection device, which includes: an acquisition unit, used to acquire a first image, and an acquisition unit, used to acquire size information of each of the multiple identification codes when the first image contains multiple identification codes; and a selection unit, used to select a target identification code from the multiple identification codes based on the size information of each of the multiple identification codes.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method of the first aspect.
[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the method of the first aspect.
[0009] In an embodiment of the present application, when an electronic device scans an identification code, the camera of the electronic device is called to capture an image. In some scenarios, multiple different identification codes are posted in parallel on the same plane, and the camera will capture images with multiple different identification codes. The user can set the angle at which the camera captures the image by controlling the posture of the electronic device when capturing images. When the camera captures images at different angles, the size information of the identification code in the image is also different. By identifying and analyzing the size information, the user's intention to scan the identification code can be determined, and the target identification code from the multiple identification codes can be selected. By obtaining the size information of multiple identification codes in the image, multiple identification codes in the image can be automatically selected, without the user manually selecting the target identification code from the multiple identification codes. In a scanning scenario where multiple identification codes exist, the user's scanning operation steps are reduced. Since the user does not need to click on the identification code and the identification code is automatically selected, it is convenient for the user to operate the electronic device with one hand, thereby improving the efficiency of the scanning operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 One of the flow charts of the identification code selection method according to an embodiment of the present application is shown;
[0011] Figure 2 One of the schematic diagrams of a preview interface of an electronic device according to an embodiment of the present application is shown;
[0012] Figure 3 A second schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown;
[0013] Figure 4 A second flow chart of the identification code selection method according to an embodiment of the present application is shown;
[0014] Figure 5 A third schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown;
[0015] Figure 6 The third flowchart of the identification code selection method according to the embodiment of the present application is shown;
[0016] Figure 7 A fourth schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown;
[0017] Figure 8 A structural block diagram of an identification code selection device according to an embodiment of the present application is shown;
[0018] Fig. 9 A structural block diagram of an electronic device according to an embodiment of the present application is shown;
[0019] Fig.10A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0022] The following is combined with Figures 1 to 10 , the identification code selection method, identification code selection device and electronic device provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0023] The present application embodiment provides a method for selecting an identification code. Figure 1 FIG. 1 shows one of the flow charts of the identification code selection method according to an embodiment of the present application. Figure 1 As shown, the identification code selection method includes:
[0024] Step 102, collecting a first image;
[0025] Step 104, when the first image includes multiple identification codes, obtain size information of each of the multiple identification codes;
[0026] Step 106 , selecting a target identification code from the plurality of identification codes according to the size information of each identification code from the plurality of identification codes.
[0027] The identification code selection method provided in the embodiment of the present application is applied to an electronic device, wherein a camera is provided in the electronic device, and the camera is in an on state. A first image is recorded by the camera, and when it is detected that the first image contains multiple identification codes, multiple identification codes are selected according to size information of each of the multiple identification codes.
[0028] When scanning the identification code through an electronic device, the camera of the electronic device is called to capture the first image. In some scenarios, multiple different identification codes are posted in parallel on the same plane, and the camera will capture the first image with multiple different identification codes. The user can set the angle at which the camera captures the first image by controlling the posture of the electronic device when capturing the first image. When the camera captures the first image at different angles, the size information of the identification code in the first image is also different. By identifying and analyzing the size information, it is possible to determine the user's intention to scan the identification code and select the target identification code from multiple identification codes.
[0029] It is worth noting that before acquiring the first image, the user can set filtering conditions for the size information, for example, selecting filtering conditions such as minimum area, maximum area, minimum perimeter or maximum perimeter.
[0030] Specifically, the identification code includes a QR code, a barcode, etc. And the screening condition is set to the identification code with the largest area as the target identification code. When the camera captures the first image, the first image is displayed in the preview interface on the screen. Before the first image is captured by the camera of the electronic device, or during the process of capturing the first image, the user adjusts the relative position and relative angle between the camera and the identification code, and the preview interface shows that the area of the target identification code in the first image is larger. After the electronic device captures the first image including multiple identification codes, the electronic device processes and analyzes the first image, determines the area of each identification code in the first image, and selects the identification code with the largest area as the target identification code. The target identification code is marked with a graphic mark in the first image of the preview interface to prompt the user of the selection result of the target identification code.
[0031] The embodiment of the present application can automatically select multiple identification codes in the image by acquiring the size information of multiple identification codes in the image, without the need for the user to manually select a target identification code from the multiple identification codes, thereby reducing the number of operation steps for the user to scan the code in a scanning scenario where multiple identification codes exist. Since the user does not need to click on the identification code, the identification code is automatically selected, which facilitates the user to operate the electronic device with one hand, thereby improving the efficiency of the scanning operation.
[0032] In some embodiments of the present application, the step of obtaining the size information of each identification code in the plurality of identification codes specifically includes:
[0033] The area of each identification code is obtained, and the area corresponding to each identification code is used as the size information of the corresponding identification code.
[0034] In the embodiment of the present application, after the first image is captured by the camera, the first image captured by the camera is processed by the first image detection algorithm, and the positions of multiple identification codes in the first image can be identified, and the area of each identification code is detected, and the area is used as the size information of the target identification code. The target identification code among the multiple identification codes is selected according to the area of each identification code in the first image.
[0035] It can be understood that by detecting the number of pixels corresponding to each identification code in the first image, the area of each identification code can be determined according to the number of pixels of each identification code.
[0036] Specifically, multiple identification codes are posted on the same plane. During the first image acquisition process, by adjusting the relative angle between the camera and the plane on which the identification codes are posted, the area of the identification codes in the acquired first image can be quickly adjusted, thereby improving the efficiency of selecting a target identification code from multiple identification codes, and the user only needs to adjust the angle of the camera when acquiring the first image to quickly select the target identification code, further simplifying the user's operation steps.
[0037] Figure 2 One of the schematic diagrams of the preview interface of the electronic device according to the embodiment of the present application is shown, such as Figure 2 As shown, a code scanning operation is performed by a mobile phone, the camera of the mobile phone is called to capture a first image, and the first image 200 is displayed on the preview interface of the screen. The first image includes identification code 1 and identification code 2. By adjusting the relative angle between the mobile phone camera and the plane on which the identification code is posted, the area of identification code 1 and identification code 2 in the first image can be adjusted.
[0038] Identification code 1 and identification code 2 are distributed on the left and right sides of the first image. When the camera is tilted to the left, the area of identification code 1 on the left side of the first image increases, and the area of identification code 2 on the right side of the first image decreases. When the camera is tilted to the right, the area of identification code 1 on the left side of the first image decreases, and the area of identification code 2 on the right side of the first image increases.
[0039] It is worth noting that when the user adjusts the angle between the camera and the plane on which the identification codes are posted, the adjustment needs to be made according to the positional relationship between the multiple identification codes.
[0040] If multiple identification codes are distributed vertically, adjust the camera to make an up-down tilt adjustment. If multiple identification codes are distributed horizontally, adjust the camera to make an up-down tilt adjustment. If the identification codes are distributed in an array, move the camera toward or away from the target identification code.
[0041] In some embodiments, the step of selecting a target identification code from the plurality of identification codes according to the size information of each identification code from the plurality of identification codes specifically includes:
[0042] An identification code with the largest area among multiple identification codes is selected, and the identification code with the largest area is used as the target identification code.
[0043] In the embodiment of the present application, when the first image contains multiple identification codes, the identification code with the largest area among the multiple identification codes is selected as the target identification code. After selecting the identification code, the electronic device needs to read the information stored in the identification code. The larger the area of the identification code in the first image, the clearer the identification code is. Using the identification code with the largest area in the first image as the target identification code can effectively improve the success rate of the electronic device in recognizing the target identification code.
[0044] It is understandable that by comparing the numerical values of the areas of each identification code, the target identification code with the largest area is obtained. Specifically, the number of pixels corresponding to each identification code can be compared, and the identification code with the largest number of pixels is used as the target identification code.
[0045] In some embodiments, after the step of selecting a target identification code from a plurality of identification codes, the method further includes:
[0046] The identification code prompt information is displayed in the preview image, wherein the display position of the identification code prompt information corresponds to the display position of the target identification code.
[0047] In the embodiment of the present application, after determining the target identification code among the multiple identification codes, the corresponding identification code prompt information is displayed on the preview interface of the screen, and the display position of the identification code prompt information corresponds to the display position of the target identification code. For example, the identification code prompt information is displayed overlaid on the target identification code, or the identification code prompt information is displayed on the upper side of the target identification code, etc.
[0048] The identification code information may be a preview image logo or a text logo.
[0049] In the embodiment of the present application, after determining the target identification code in the preview image, the identification code prompt information is displayed at the position corresponding to the target identification code in the preview interface of the electronic device screen, which can play a role in prompting the identification code. It is convenient for the user to judge whether the target identification code obtained by automatic identification is the identification code that meets the requirements by viewing the preview interface.
[0050] In a specific embodiment, identification code 1 and identification code 2 posted on the same plane correspond to different jump links respectively. When the user confirms that identification code 1 needs to be scanned, the angle of the camera relative to the posting plane is adjusted to make the area of identification code 1 larger in the preview image. At this time, the electronic device recognizes that identification code 1 is the target identification code, and displays the identification code prompt information in the area corresponding to the position of identification code 1 in the preview interface of the screen. The user can understand through the identification code prompt information that the electronic device has completed the automatic selection of the target identification code, and can quickly confirm whether the recognition is accurate based on the identification code prompt information.
[0051] Figure 3 A second schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown. Figure 3 As shown, the identification code prompt information is a graphic mark 304 , the target identification code 302 is located on the left side of the preview image 300 , and the graphic mark 304 covers and displays the middle position of the target identification code 302 , thereby serving as a prompt for the target identification code 302 .
[0052] It is understandable that, when the graphic logo is used as the identification code prompt information, the color of the graphic logo is set to a color different from the color of the identification code. For example, if the identification code is determined to be green by the first image detection algorithm, the graphic logo is set to red. Differentiating the color of the identification code prompt information from the color of the identification code can improve the recognition of the target identification code and facilitate the user to determine whether the target identification code meets the user's wishes.
[0053] In some embodiments, Figure 4 FIG. 2 shows a second flow chart of the identification code selection method according to an embodiment of the present application. Figure 4 As shown, the identification code selection method includes:
[0054] Step 402, acquiring a first image;
[0055] Step 404, when the first image includes multiple identification codes, obtain size information of each of the multiple identification codes;
[0056] Step 406, acquiring a second image;
[0057] The identification code included in the second image is the same as the identification code included in the first image.
[0058] Step 408: Determine the target identification code according to the size information of each identification code in the first image and the second image.
[0059] Among them, the target identification code is the identification code with the largest size change rate compared to the same identification code in the first image among the multiple identification codes in the second image. In an embodiment of the present application, when scanning the code through an electronic device, the camera captures the first image and displays the first image through the preview interface of the screen. After obtaining the size information of each identification code in the first image, the second image is captured, and the size information of each identification code in the second image is obtained. According to the size information of the identification code in the first image and the size information of the identification code in the second image, the target identification code among the multiple identification codes is selected. Specifically, according to the size information of the identification codes in the first image and the second image, the size change rate of the same identification code in the first image and the second image can be determined, and the identification code with the largest size change rate is selected as the target identification code.
[0060] For example, a user uses a mobile phone camera to capture a first image with multiple QR codes, and the mobile phone automatically identifies the area of each QR code in the first image. The user adjusts the camera angle of the mobile phone to capture multiple QR codes and captures a second image, which also includes multiple QR codes. The QR codes in the first image and the second image are the same in number and position distribution, and the mobile phone automatically identifies the area of multiple QR codes in the second image. The area of each QR code in the first image is compared with the area of each corresponding QR code in the second image, and the QR code with the largest area change among the multiple QR codes is selected as the target QR code.
[0061] In an embodiment of the present application, after capturing a first image containing multiple identification codes, the user can adjust the shooting angle of the electronic device for capturing images again to obtain a second image, and use the rate of change of the identification code in the second image compared to the identification code in the first image as a selection condition for the target identification code, thereby making the selected target identification code more in line with the user's selection intention and improving the accuracy of recognition.
[0062] In some embodiments, after the step of selecting a target identification code from a plurality of identification codes, the method further includes:
[0063] When a second input for selecting an identification code is received within a preset time period, a target identification code from among the plurality of identification codes is reselected in response to the second input.
[0064] In the embodiment of the present application, after determining the target identification code among the multiple identification codes, the timing is started. If the second input is not received within the preset time after the timing starts, it is determined that the target identification code meets the user's wishes. If the second input is received within the preset time after the timing starts, it is determined that the user needs to update the target identification code, and the target identification code is reselected according to the selection instruction in the second input, and the target identification code is updated.
[0065] Before starting the timing, the target identification code is marked by the identification code prompt information, so that the user can view the automatically identified target identification code. If the user needs to change the target identification code among the multiple identification codes, the user inputs a second input into the electronic device to update the target identification code.
[0066] In the embodiment of the present application, after the electronic device automatically identifies the target identification code among the multiple identification codes, the user can reselect the target identification code among the multiple identification codes as desired, thereby avoiding misidentification of the target identification code. Furthermore, if the user needs to reselect the target identification code, the target identification code can be automatically locked if no operation is performed within a preset time period, without the user's additional confirmation operation, thereby reducing the user's operation steps and improving the user experience.
[0067] The preset duration ranges from 1 second to 10 seconds.
[0068] It is understandable that the second input may be selected as a drag operation, a click instruction, or other operations on the target identification code.
[0069] Figure 5 A third schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown, Figure 5 As shown, in the preview interface of image 500 , target identification code 502 is the identification code located on the left side of image 500 , and the user can switch target identification code 502 to the identification code on the right side of image 500 by clicking on the identification code on the right side of image 500 .
[0070] It can be understood that the image 500 can be the first image or the second image.
[0071] In some embodiments, Figure 6 FIG. 2 shows a second flow chart of the identification code selection method according to an embodiment of the present application. Figure 6 As shown, the step of updating the target identification code specifically includes:
[0072] Step 602, obtaining direction information in the second input and location information of the target identification code in the preview image;
[0073] The direction information is the direction information of the movement of the electronic device acquired by the gravity sensor.
[0074] Step 604: Select a first identification code adjacent to the target identification code according to the position information and direction information corresponding to the target identification code, and update the target identification code to the first identification code.
[0075] The electronic device is provided with a gravity sensor, through which the user's swinging operation of the electronic device can be collected. Within a preset time after determining the target identification code, the electronic device recognizes the user's second input through the gravity sensor. The gravity sensor can detect the direction information of the electronic device's movement, and the moving direction of the electronic device can be determined according to the direction information, and the first identification code on the path of the moving direction and adjacent to the target identification code is used as the target identification code.
[0076] It can be understood that after the electronic device selects the target identification code according to the size information of the identification code, the electronic device displays a preview image through the display screen, and the preview image can be selected as the first image or the second image.
[0077] In some embodiments, after the electronic device captures a first image and identifies size information of multiple identification codes in the first image, a target identification code from the multiple identification codes is selected directly based on the areas of the multiple identification codes. At this time, the display screen of the electronic device uses the first image as a preview image, and a first mark is displayed in the preview image. The first mark is used to mark the target identification code from the multiple identification codes in the first image.
[0078] In some other embodiments, after the electronic device captures the first image and identifies the first size information of multiple identification codes in the first image, it captures the second image again, identifies the second size information of multiple identification codes in the second image, and determines the size change rate of the identification codes in the first image and the second image based on the first size information and the second size information. At this time, the display screen of the electronic device uses the second image as a preview image, and a second mark is displayed in the preview image, and the second mark is used to mark the target identification code of the multiple identification codes in the second image.
[0079] In the embodiment of the present application, the second input is the user's movement operation on the electronic device, and the electronic device can collect the user's movement operation on the electronic device through the gravity sensor. In the case of a user's misoperation or the automatically selected target identification code not being consistent with the user's wishes, the user swings the electronic device in the target direction within a preset time, and the gravity sensor updates the target identification code based on the collected direction information. The user does not need to click on the target identification code to switch and update the target identification code among multiple identification codes, which meets the user's demand for one-handed operation of the electronic device.
[0080] It is worth noting that in the process of updating the target identification code, the target identification code before the update is used as the path starting point, and the direction information obtained by the detection is used as the switching direction. In the case of multiple identification code arrays, when a swing is detected, the identification code in the switching direction and adjacent to the original target identification code is changed to the target identification code.
[0081] Figure 7A fourth schematic diagram of a preview interface of an electronic device according to an embodiment of the present application is shown. Figure 7 As shown, a preview image 700 is displayed in the preview interface of the mobile phone, and the preview image 700 includes identification codes 1, 2, 3, and 4 distributed in an array, wherein identification code 4 is a target identification code 702. The gravity sensor detects that the user swings the mobile phone to the left. Then, the target identification code 702 is switched from identification code 4 located on the right side of the preview image 700 to identification code 3 located on the left side of the preview image 700.
[0082] In some embodiments, after the target identification code is selected, identification information in the target identification code is read and displayed.
[0083] If the second input sent by the user is not received within a preset time after the target identification code is determined among the multiple identification codes, the identification information in the target identification code is directly read. If the second input is received within the preset time, the target identification code is updated and the identification information in the updated target identification code is read.
[0084] In the embodiment of the present application, after the target identification code is determined among multiple identification codes, the identification information in the target identification code is automatically read without manual operation by the user, thereby further simplifying the operation steps of the user.
[0085] In some embodiments of the present application, an identification code selection device 800 is provided. Figure 8 FIG. 8 is a block diagram showing a structure of an identification code selection device 800 according to an embodiment of the present application. Figure 8 As shown, the identification code selection device 800 includes:
[0086] The acquisition unit 802 is used to acquire a first image;
[0087] An acquiring unit 804 is configured to acquire size information of each of the multiple identification codes when the acquired first image contains multiple identification codes;
[0088] The selection unit 806 is configured to select a target identification code from among the multiple identification codes according to the size information of each identification code from among the multiple identification codes.
[0089] In an embodiment of the present application, when an identification code is scanned by an electronic device, the camera of the electronic device is called to capture a first image. In some scenarios, multiple different identification codes are posted in parallel on the same plane, and the camera will capture a first image with multiple different identification codes. The user can set the angle at which the camera captures the first image by controlling the posture of the electronic device when capturing the first image. When the camera captures the first image at different angles, the size information of the identification code in the first image is also different. By identifying and analyzing the size information, it is possible to determine the user's intention to scan the identification code and select a target identification code from multiple identification codes.
[0090] It is worth noting that before acquiring the first image, the user can set filtering conditions for the size information, for example, selecting filtering conditions such as minimum area, maximum area, minimum perimeter or maximum perimeter.
[0091] Specifically, the identification code includes a QR code, a barcode, etc. And the screening condition is set to the identification code with the largest area as the target identification code. When the camera captures the first image, the first image is displayed in the preview interface on the screen. Before the first image is captured by the camera of the electronic device, or during the process of capturing the first image, the user adjusts the relative position and relative angle between the camera and the identification code, and the preview interface displays that the target identification code in the first image has a larger area. After the electronic device captures the first image including multiple identification codes, the electronic device processes and analyzes the first image, determines the area of each identification code in the first image, and selects the identification code with the largest area as the target identification code. The target identification code is marked with a graphic mark in the first image of the preview interface to prompt the user of the selection result of the target identification code.
[0092] The embodiment of the present application obtains the size information of multiple identification codes in the first image and automatically selects multiple identification codes in the first image, without the need for the user to manually select a target identification code from the multiple identification codes. In a scanning scenario where multiple identification codes exist, the operation steps of the user scanning the code are reduced. Since the user does not need to click on the identification code and the identification code is automatically selected, it is convenient for the user to operate the electronic device with one hand, thereby improving the efficiency of the scanning operation.
[0093] Furthermore, the acquisition unit 804 is further configured to: acquire the area of each identification code, and use the area corresponding to each identification code as corresponding size information.
[0094] In the embodiment of the present application, after the first image is captured by the camera, the first image captured by the camera is processed by the first image detection algorithm, and the positions of multiple identification codes in the first image can be identified, and the area of each identification code is detected, and the area is used as the size information of the target identification code. The target identification code among the multiple identification codes is selected according to the area of each identification code in the first image.
[0095] It can be understood that by detecting the number of pixels corresponding to each identification code in the first image, the area of each identification code can be determined according to the number of pixels of each identification code.
[0096] Specifically, multiple identification codes are posted on the same plane. During the first image acquisition process, by adjusting the relative angle between the camera and the plane on which the identification codes are posted, the area of the identification codes in the acquired first image can be quickly adjusted, thereby improving the efficiency of selecting a target identification code from multiple identification codes, and the user only needs to adjust the angle of the camera when acquiring the first image to quickly select the target identification code, further simplifying the user's operation steps.
[0097] Further, the acquisition unit 802 is further configured to: acquire a second image, wherein the identification code included in the second image is the same as the identification code included in the first image;
[0098] The selection unit 806 is further configured to: determine the target identification code according to the size information of each identification code in the first image and the second image;
[0099] The target identification code is an identification code with the largest size change rate compared to the same identification code in the first image among the multiple identification codes in the second image.
[0100] In an embodiment of the present application, after capturing a first image containing multiple identification codes, the user can adjust the shooting angle of the electronic device for capturing images again to obtain a second image, and use the rate of change of the identification code in the second image compared to the identification code in the first image as a selection condition for the target identification code, thereby making the selected target identification code more in line with the user's selection intention and improving the accuracy of recognition.
[0101] Furthermore, the selection unit 806 is further configured to: select an identification code with the largest area among the multiple identification codes, and use the identification code with the largest area as the target identification code.
[0102] In the embodiment of the present application, when an image contains multiple identification codes, the identification code with the largest area among the multiple identification codes is selected as the target identification code. After selecting the identification code, the electronic device needs to read the information stored in the identification code. The larger the area of the identification code in the image, the clearer the identification code is. Using the identification code with the largest area in the image as the target identification code can effectively improve the success rate of the electronic device in recognizing the target identification code.
[0103] It is understandable that by comparing the numerical values of the areas of each identification code, the target identification code with the largest area is obtained. Specifically, the number of pixels corresponding to each identification code can be compared, and the identification code with the largest number of pixels is used as the target identification code.
[0104] Furthermore, the identification code selection device 800 further includes:
[0105] The prompt unit is used to display the identification code prompt information in the preview image.
[0106] The display position of the identification code prompt information corresponds to the display position of the target identification code.
[0107] In the embodiment of the present application, after determining the target identification code in the preview image, the identification code prompt information is displayed at the position corresponding to the target identification code in the preview interface of the electronic device screen, which can play a role in prompting the identification code. It is convenient for the user to judge whether the target identification code obtained by automatic identification is the identification code that meets the requirements by viewing the preview interface.
[0108] Furthermore, the identification code selection device 800 further includes:
[0109] The updating unit is configured to update the target identification code in response to the second input when a second input for selecting the identification code is received within a preset time period.
[0110] In the embodiment of the present application, after the electronic device automatically identifies the target identification code among the multiple identification codes, the user can reselect the target identification code among the multiple identification codes as desired, thereby avoiding misidentification of the target identification code. Furthermore, if the user needs to reselect the target identification code, the target identification code can be automatically locked if no operation is performed within a preset time period, without the user's additional confirmation operation, thereby reducing the user's operation steps and improving the user experience.
[0111] Furthermore, the updating unit is also used to: obtain direction information in the second input and position information of the target identification code in the preview image; select a first identification code adjacent to the target identification code according to the position information and direction information corresponding to the target identification code, and update the target identification code to the first identification code.
[0112] The direction information is the direction information of the movement of the electronic device acquired by the gravity sensor.
[0113] In the embodiment of the present application, the second input is the user's movement operation on the electronic device, and the electronic device can collect the user's movement operation on the electronic device through the gravity sensor. In the case of a user's misoperation or the automatically selected target identification code not being consistent with the user's wishes, the user swings the electronic device in the target direction within a preset time, and the gravity sensor updates the target identification code based on the collected direction information. The user does not need to click on the target identification code to switch and update the target identification code among multiple identification codes, which meets the user's demand for one-handed operation of the electronic device.
[0114] Furthermore, the identification code selection device 800 further includes:
[0115] The reading unit is used to read the identification information in the target identification code and display the identification information.
[0116] If the second input sent by the user is not received within a preset time after the target identification code is determined among the multiple identification codes, the identification information in the target identification code is directly read. If the second input is received within the preset time, the target identification code is updated and the identification information in the updated target identification code is read.
[0117] In the embodiment of the present application, after the target identification code is determined among multiple identification codes, the identification information in the target identification code is automatically read without manual operation by the user, thereby further simplifying the operation steps of the user.
[0118] The identification code selection device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0119] The identification code selection device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0120] The identification code selection device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0121] Optionally, the embodiment of the present application further provides an electronic device 900, Fig. 9 A structural block diagram of an electronic device according to an embodiment of the present application is shown. Fig. 9 As shown, it includes a processor 910, a memory 909, and a program or instruction stored in the memory 909 and executable on the processor 910. When the program or instruction is executed by the processor 910, each process of the embodiment of the above-mentioned identification code selection method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0122] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0123] Fig.10 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0124] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network unit 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0125] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0126] The input unit 1004 is used to collect the first image;
[0127] The processor 1010 is configured to obtain size information of each of the multiple identification codes when the first image includes multiple identification codes; and select a target identification code from the multiple identification codes according to the size information of each of the multiple identification codes.
[0128] The embodiment of the present application obtains the size information of multiple identification codes in the first image and automatically selects multiple identification codes in the first image, without the need for the user to manually select a target identification code from the multiple identification codes. In a scanning scenario where multiple identification codes exist, the operation steps of the user scanning the code are reduced. Since the user does not need to click on the identification code and the identification code is automatically selected, it is convenient for the user to operate the electronic device with one hand, thereby improving the efficiency of the scanning operation.
[0129] Optionally, the processor 1010 is further configured to obtain the area of each identification code in the first image, and use the area corresponding to each identification code as corresponding size information.
[0130] In the embodiment of the present application, after the first image is captured by the camera, the first image captured by the camera is processed by the first image detection algorithm, and the positions of multiple identification codes in the first image can be identified, and the area of each identification code in the first image is calculated, and the area is used as the size information of the target identification code. The target identification code among the multiple identification codes is selected according to the area of each identification code in the first image.
[0131] Optionally, the input unit 1004 is further used to capture a second image;
[0132] The processor 1010 is further configured to determine a target identification code according to size information of each identification code in the first image and the second image.
[0133] The target identification code is an identification code with the largest size change rate compared to the same identification code in the first image among the multiple identification codes in the second image.
[0134] In an embodiment of the present application, after capturing a first image containing multiple identification codes, the user can adjust the shooting angle of the electronic device for capturing images again to obtain a second image, and use the rate of change of the identification code in the second image compared to the identification code in the first image as a selection condition for the target identification code, thereby making the selected target identification code more in line with the user's selection intention and improving the accuracy of recognition.
[0135] Optionally, the processor 1010 is further configured to select an identification code with the largest area among the multiple identification codes, and use the identification code with the largest area as the target identification code.
[0136] In the embodiment of the present application, when the first image contains multiple identification codes, the identification code with the largest area among the multiple identification codes is selected as the target identification code. After selecting the identification code, the electronic device needs to read the information stored in the identification code. The larger the area of the identification code in the first image, the clearer the identification code is. Using the identification code with the largest area in the first image as the target identification code can effectively improve the success rate of the electronic device in recognizing the target identification code.
[0137] Optionally, the processor 1010 is further configured to display the identification code prompt information in the first image, wherein the display position of the identification code prompt information corresponds to the display position of the target identification code.
[0138] In the embodiment of the present application, after determining the target identification code in the first image, in the preview interface of the electronic device screen, the identification code prompt information is displayed at the position corresponding to the target identification code, which can play a role in prompting the identification code. It is convenient for the user to judge whether the target identification code obtained by automatic identification is the identification code that meets the requirements by viewing the preview interface.
[0139] Optionally, the processor 1010 is further configured to update the first image in response to a first input for adjusting a shooting angle.
[0140] In the embodiment of the present application, after the first image containing multiple identification codes is captured, the user can adjust the shooting angle of the electronic device to capture the first image again. The user adjusts the shooting angle of the first image according to the user's wishes and updates the first image to avoid the area of the identification code in the first image captured initially being inconsistent with the user's wishes. The target identification code obtained by identifying and analyzing the updated first image is more in line with the user's selection intention, thereby improving the accuracy of identification.
[0141] Optionally, the processor 1010 is further configured to reselect a target identification code from the plurality of identification codes in response to a second input when a second input for selecting an identification code is received within a preset time period.
[0142] In the embodiment of the present application, after the electronic device automatically identifies the target identification code among the multiple identification codes, the user can reselect the target identification code among the multiple identification codes as desired, thereby avoiding misidentification of the target identification code. Furthermore, if the user needs to reselect the target identification code, the target identification code can be automatically locked if no operation is performed within a preset time period, without the user's additional confirmation operation, thereby reducing the user's operation steps and improving the user experience.
[0143] Optionally, the processor 1010 is further configured to obtain direction information in the second input and position information of the target identification code in the preview image; select a first identification code adjacent to the target identification code according to the position information and direction information corresponding to the target identification code, and update the target identification code to the first identification code. The direction information is the direction information of the electronic device movement obtained by the gravity sensor.
[0144] In the embodiment of the present application, the second input is the user's movement operation on the electronic device, and the electronic device can collect the user's movement operation on the electronic device through the gravity sensor. In the case of a user's misoperation or the automatically selected target identification code not being consistent with the user's wishes, the user swings the electronic device in the target direction within a preset time, and the gravity sensor updates the target identification code based on the collected direction information. The user does not need to click on the target identification code to switch and update the target identification code among multiple identification codes, which meets the user's demand for one-handed operation of the electronic device.
[0145] Optionally, the processor 1010 is further configured to read identification information in the target identification code and display the identification information.
[0146] If the second input sent by the user is not received within a preset time after the target identification code is determined among the multiple identification codes, the identification information in the target identification code is directly read. If the second input is received within the preset time, the target identification code is updated and the identification information in the updated target identification code is read.
[0147] In the embodiment of the present application, after the target identification code is determined among multiple identification codes, the identification information in the target identification code is automatically read without manual operation by the user, thereby further simplifying the operation steps of the user.
[0148] It should be understood that in the embodiments of the present application, Fig.10As shown, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch control unit. Other input devices 10072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.
[0149] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned identification code selection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0150] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0151] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned identification code selection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0152] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0153] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0155] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for selecting an identification code, characterized in that: include: acquiring a first image; When the first image includes a plurality of identification codes, obtaining size information of each of the plurality of identification codes; Selecting a target identification code from among the plurality of identification codes according to size information of each of the identification codes; In the case where the first image includes a plurality of identification codes, after obtaining the size information of each of the plurality of identification codes, the method further includes: Capturing a second image, wherein the identification code included in the second image is the same as the identification code included in the first image; The step of selecting a target identification code from among the plurality of identification codes according to the size information of each identification code from among the plurality of identification codes comprises: Determine, according to the size information of each identification code in the first image and the second image, a size change rate of the same identification code in the first image and the second image, and determine the target identification code according to the size change rate; The target identification code is an identification code with the largest size change rate compared to the same identification code in the first image among the multiple identification codes in the second image.
2. The identification code selection method according to claim 1, characterized in that: The step of obtaining the size information of each identification code in the multiple identification codes specifically includes: The area of each identification code is obtained, and the area corresponding to each identification code is used as the size information of the corresponding identification code.
3. The identification code selection method according to claim 1 or 2, characterized in that: After the step of selecting a target identification code from the plurality of identification codes, the method further includes: In the case where a second input for selecting an identification code is received within a preset time period, a target identification code from among the plurality of identification codes is reselected in response to the second input.
4. The identification code selection method according to claim 3, characterized in that: The step of reselecting a target identification code from the plurality of identification codes in response to the second input specifically comprises: Acquire direction information in the second input and position information of the target identification code in the preview image, wherein the direction information is direction information of movement of the electronic device acquired by a gravity sensor; According to the position information and the direction information corresponding to the target identification code, a first identification code adjacent to the target identification code is selected, and the target identification code is updated to the first identification code.
5. An identification code selection device, characterized in that: include: A collection unit, used for collecting a first image; an acquiring unit, configured to acquire size information of each of the plurality of identification codes when the first image includes a plurality of identification codes; A selection unit, configured to select a target identification code from among the plurality of identification codes according to size information of each of the identification codes; The acquisition unit is further used to acquire a second image, wherein the identification code included in the second image is the same as the identification code included in the first image; The selection unit is further configured to determine a size change rate of the same identification code in the first image and the second image according to size information of each identification code in the first image and the second image, and determine the target identification code according to the size change rate; The target identification code is an identification code with the largest size change rate compared to the same identification code in the first image among the multiple identification codes in the second image.
6. The identification code selection device according to claim 5, characterized in that: The acquisition unit is further used to acquire the area of each of the identification codes, and use the area corresponding to each of the identification codes as the size information of the corresponding identification code.
7. The identification code selection device according to claim 5 or 6, characterized in that: Also includes: The updating unit is configured to, when receiving a second input for selecting an identification code within a preset time period, reselect a target identification code from among the plurality of identification codes in response to the second input.
8. The identification code selection device according to claim 7, characterized in that: The acquiring unit is further used to acquire direction information in the second input and position information of the target identification code in the preview image, wherein the direction information is direction information of movement of the electronic device acquired by the gravity sensor; The updating unit is specifically configured to select a first identification code adjacent to the target identification code according to the position information and the direction information corresponding to the target identification code, and update the target identification code to the first identification code.
9. An electronic device, characterized in that: The invention comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the identification code selection method as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Multi-bar code identification method and related equipment
CN113051950A