Target identification method and device, electronic equipment and storage medium
By performing binary processing of the image to be identified in the laptop case and analyzing the target recognition information, the target candidate area is determined, and the problem of misidentification caused by small QR code area is solved, and higher recognition accuracy and production efficiency are achieved.
Patent Information
- Application Number
- CN202411464822.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-03-18
AI Technical Summary
During the production process of laptop computers, the QR code area is relatively small, which leads to misidentification problems and affects production efficiency.
By acquiring the image to be identified, performing binarization processing, obtaining the target identification information of the reference image, determining the target candidate area, and performing target identification based on the area.
It improves the accuracy of target identification of electronic devices, reduces misidentification problems, and improves production efficiency.
Smart Images

Figure CN119648982A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition, and in particular to a target recognition method, device, electronic device and storage medium. Background Art
[0002] The QR code on the laptop shell is the laptop's ID card, which contains the laptop's product information. During the production process of the laptop, the QR code image of the laptop needs to be parsed and identified to confirm whether the QR code information of the laptop is consistent with the actual information. Since the QR code area is relatively small compared to the entire computer shell area, there is a certain probability of misidentification, which greatly affects production efficiency. Therefore, how to accurately identify the QR code of the laptop shell has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present application provides a target recognition method, device, electronic device and storage medium to at least solve the above technical problems existing in the prior art.
[0004] According to a first aspect of the present application, a target recognition method is provided, the method comprising:
[0005] Acquire an image to be identified for the electronic device;
[0006] Binarizing the image to be identified to obtain a binary image;
[0007] Acquiring target recognition information for a reference image of an electronic device;
[0008] Determining a target candidate region based on the binary image and the target recognition information;
[0009] Based on the target candidate area, target recognition is performed on the electronic device.
[0010] In one possible implementation manner, the target recognition information of the reference image includes target area recognition information and target aspect ratio recognition information; and determining the target candidate area based on the binarized image and the target recognition information includes:
[0011] Determine the minimum bounding rectangle of a closed connected region in the binary image;
[0012] When the area of the minimum circumscribed rectangle of the closed connected region satisfies the first preset condition for the target area identification information, and the aspect ratio of the minimum circumscribed rectangle of the closed connected region satisfies the second preset condition for the target aspect ratio identification information, the closed connected region is taken as a target candidate region.
[0013] In one possible implementation, after determining the target candidate area, the method further includes:
[0014] Determine a region rectangular frame of the target candidate region;
[0015] The step of performing target recognition on the electronic device based on the target candidate area includes:
[0016] Perform an AND operation on the target candidate region and the image to be identified to obtain a grayscale candidate region;
[0017] Determine the target recognition area in the image to be recognized based on the area rectangular frame and the grayscale candidate area;
[0018] Based on the target recognition area, target recognition is performed on the electronic device.
[0019] In one possible implementation, the target identification of the electronic device based on the target identification area includes:
[0020] Get the tilt angle of the minimum bounding rectangle of the target candidate area;
[0021] Based on the tilt angle of the minimum circumscribed rectangle, the target recognition area is corrected to obtain a corrected target recognition area;
[0022] Based on the corrected target recognition area, target recognition is performed on the electronic device.
[0023] In one possible implementation manner, the performing target recognition on the electronic device based on the corrected target recognition area includes:
[0024] Obtaining a sharpness evaluation value of the corrected target recognition area;
[0025] When the clarity evaluation value is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device with respect to the corrected target recognition area.
[0026] In one possible implementation, it further includes:
[0027] When the clarity evaluation value is less than or equal to a preset clarity evaluation threshold, performing sharpening and enhancement processing on the corrected target recognition area to obtain an enhanced recognition area;
[0028] Obtaining a clarity evaluation value of the enhanced recognition area;
[0029] When the clarity evaluation value of the enhanced recognition area is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device for the enhanced recognition area.
[0030] In one possible implementation, it further includes:
[0031] When the definition evaluation value of the enhanced recognition area is less than or equal to a preset definition evaluation value, performing at least one sharpening enhancement process on the enhanced recognition area to obtain a secondary enhanced recognition area;
[0032] When the clarity evaluation value of the secondary enhanced recognition area is greater than a preset clarity evaluation threshold, or the number of sharpening enhancement processes exceeds a preset number threshold, target recognition is performed on the electronic device for the secondary enhanced recognition area.
[0033] According to a second aspect of the present application, a target recognition device is provided, the device comprising:
[0034] A first acquisition unit, used to acquire an image to be recognized for the electronic device;
[0035] A second acquisition unit is used to perform binarization processing on the image to be identified to obtain a binarized image;
[0036] A third acquisition unit, used to acquire target recognition information of a reference image for the electronic device;
[0037] A first determining unit, configured to determine a target candidate region based on the binary image and the target recognition information;
[0038] The recognition unit is used to perform target recognition on the electronic device based on the target candidate area.
[0039] According to a third aspect of the present application, an electronic device is provided, including:
[0040] at least one processor; and
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present application.
[0043] According to a fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method described in the present application.
[0044] In the present application, an image to be identified for an electronic device is obtained; the image to be identified is binarized to obtain a binarized image; target identification information of a reference image for the electronic device is obtained; a target candidate area is determined based on the binarized image and the target identification information; and target identification is performed on the electronic device based on the target candidate area. The accuracy of target identification of the electronic device can be improved.
[0045] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become readily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, wherein:
[0047] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0048] Figure 1 A schematic diagram of the implementation process of the target recognition method according to an embodiment of the present application is shown;
[0049] Figure 2 A schematic diagram of the application of the target recognition method according to an embodiment of the present application is shown;
[0050] Figure 3 A schematic diagram of the structure of the target recognition device according to an embodiment of the present application is shown;
[0051] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0052] In order to make the purpose, features, and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0053] The present application embodiment provides a target recognition method, such as Figure 1 As shown, the method includes:
[0054] S101: Acquire an image to be recognized of an electronic device.
[0055] In this step, the electronic device is a laptop computer. It is understood that each laptop computer has a QR code attached to its D shell, and the production information and model information of the laptop computer are stored in the QR code on its D shell. The image to be identified is an image obtained by photographing the D shell of the laptop computer, and the image includes a QR code representing the laptop computer ID card.
[0056] S102: Binarization is performed on the image to be recognized to obtain a binary image.
[0057] In this step, combine Figure 2 As shown, since the electronic device needs to be subjected to target recognition, i.e., QR code recognition, in order to make the QR code area more prominent in the image to be recognized, the embodiment of the present application takes into account the characteristics of the QR code with a white background and black code, and performs binarization processing on the image to be recognized, so that there are only black and white colors in the image to be recognized, which can make the QR code area in the image to be recognized more prominent and improve the accuracy of target recognition of the electronic device.
[0058] S103: Acquire target recognition information of a reference image of the electronic device.
[0059] In this step, the electronic device has a standard reference image, and the information of the QR code area in the reference image is used as the standard comparison information. The target identification information is the relevant information of the standard QR code area in the reference image, including the target area identification information (the standard area of the QR code area) and the target aspect ratio identification information (the standard aspect ratio of the QR code area), which can provide a data basis for more accurately locating the QR code area in the image to be identified.
[0060] S104: Determine a target candidate region based on the binary image and the target recognition information.
[0061] In this step, the target candidate area is a suspected QR code area or a QR code area whose accuracy does not reach a preset level. Based on the obtained binary image and target recognition information, the target candidate area can be determined, and then the electronic device can be identified. The specific determination process of the target candidate area can be found in the detailed description of the relevant parts below, which will not be repeated.
[0062] S105: Performing target recognition on the electronic device based on the target candidate area.
[0063] In this step, based on the target candidate area, the electronic device can be identified, that is, the QR code is recognized, so as to ensure efficient and accurate QR code verification of the electronic device before it leaves the factory and avoid the problem that the QR code production information of the electronic device is inconsistent with the actual production information.
[0064] In the scheme shown in steps S101 to S105, an image to be identified for an electronic device is obtained; the image to be identified is binarized to obtain a binarized image; target identification information of a reference image for the electronic device is obtained; a target candidate area is determined based on the binarized image and the target identification information; and target identification is performed on the electronic device based on the target candidate area. The accuracy of target identification of the electronic device can be improved.
[0065] In an optional solution, the target recognition information of the reference image includes target area recognition information and target aspect ratio recognition information; and determining the target candidate area based on the binarized image and the target recognition information includes:
[0066] Determine the minimum bounding rectangle of a closed connected region in the binary image;
[0067] When the area of the minimum circumscribed rectangle of the closed connected region satisfies the first preset condition for the target area identification information, and the aspect ratio of the minimum circumscribed rectangle of the closed connected region satisfies the second preset condition for the target aspect ratio identification information, the closed connected region is taken as a target candidate region.
[0068] In the present application, the findContours function is used to find the minimum bounding rectangle of all closed connected areas in the binary image. The area and aspect ratio of the minimum bounding rectangle of each closed connected area are compared with the target area identification information and the target aspect ratio identification information, respectively. In practical applications, considering that the imaging effect may not be as accurate as desired due to various external factors during shooting, a first preset condition and a second preset condition are set for the target area identification information and the target aspect ratio identification information, respectively, during the comparison. The first preset condition is a preset satisfaction range for the target area identification information, and the second preset condition is a preset satisfaction range for the target aspect ratio identification information. Combined with Figure 2 As shown, when the minimum circumscribed rectangle of a closed connected area satisfies both the first preset condition and the second preset condition, the closed connected area is considered to be a two-dimensional code area, and is used as a target candidate area for target recognition of the electronic device. The two-dimensional code area can be preliminarily determined in the binary image, which facilitates accurate target recognition of the electronic device.
[0069] In an optional solution, after determining the target candidate area, the method further includes:
[0070] Determine a region rectangular frame of the target candidate region;
[0071] The step of performing target recognition on the electronic device based on the target candidate area includes:
[0072] Perform an AND operation on the target candidate region and the image to be identified to obtain a grayscale candidate region;
[0073] Determine the target recognition area in the image to be recognized based on the area rectangular frame and the grayscale candidate area;
[0074] Based on the target recognition area, target recognition is performed on the electronic device.
[0075] In this application, it is considered that the imaging of electronic devices may be affected by light (backlight or reflection), etc., which may cause the QR code area (target candidate area) to be missing a corner or a piece of area, etc. The target candidate area's regional rectangular frame is a rectangular frame that includes the missing corners or areas of the target candidate area, which can ensure that the regional rectangular frame includes all areas of the target candidate area itself, facilitating accurate recognition of the QR code. Figure 2 As shown, the binary target candidate area is ANDed with the original image to be identified, so that the grayscale candidate area of the QR code can be highlighted, and the grayscale candidate area is cropped from the image to be identified according to the area rectangular frame to obtain a target identification area with high accuracy, and the electronic device is identified based on the target identification area. The process of obtaining the target identification area is shown in formula (1) to formula (2):
[0076] A=B|C Formula (1)
[0077] D=A(E).clone() formula (2)
[0078] Wherein, A is the grayscale candidate area. B is the target candidate area. C is the image to be identified. B|C represents an AND operation between the target candidate area and the image to be identified. D is the target identification area. E is the area rectangular frame. clone() is a copy function, which is used to crop the target identification area in the embodiment of the present application. A(E).clone() represents cropping the grayscale candidate area with the area rectangular frame as the border.
[0079] In an optional solution, the performing target identification on the electronic device based on the target identification area includes:
[0080] Get the tilt angle of the minimum bounding rectangle of the target candidate area;
[0081] Based on the tilt angle of the minimum circumscribed rectangle, the target recognition area is corrected to obtain a corrected target recognition area;
[0082] Based on the corrected target recognition area, target recognition is performed on the electronic device.
[0083] In this application, as mentioned above, when imaging an electronic device, it may be affected by lighting (backlight or reflection), etc., which may cause the QR code area (target candidate area) to be missing a corner or a region, etc. Unlike the region rectangle frame of the target candidate area, the minimum bounding rectangle of the target candidate area may not include the missing corner or region of the target candidate area. Therefore, the shape of the minimum bounding rectangle is not a regular rectangle, and it has a certain tilt angle. In order to further ensure the accuracy of subsequent target recognition, combined with Figure 2As shown, in the embodiment of the present application, the target recognition area is rotated and corrected based on the tilt angle of the minimum circumscribed rectangle to obtain a corrected target recognition area.
[0084] In an optional solution, the performing target recognition on the electronic device based on the corrected target recognition area includes:
[0085] Obtaining a sharpness evaluation value of the corrected target recognition area;
[0086] When the clarity evaluation value is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device with respect to the corrected target recognition area.
[0087] In this application, the clarity evaluation value of the corrected target recognition area is calculated by formula (3):
[0088] S=∑ x ∑ y ((f(x+1,y)-f(x,y)) 2 +(f(x,y+1)-f(x,y)) 2 ) Formula (3)
[0089] Where x is the horizontal coordinate of the pixel in the corrected target recognition area. y is the vertical coordinate of the pixel in the corrected target recognition area. f(x,y) is the pixel value of the pixel with coordinates (x,y) in the corrected target recognition area. f(x+1,y) is the pixel value of the adjacent pixel in the x direction of the pixel with coordinates (x,y) in the corrected target recognition area. f(x,y+1) is the pixel value of the adjacent pixel in the y direction of the pixel with coordinates (x,y) in the corrected target recognition area. S is the clarity evaluation value.
[0090] Combination Figure 2 As shown, the clarity evaluation value of the corrected target recognition area is compared with a preset clarity evaluation threshold, wherein the preset clarity evaluation threshold is calculated by formula (4):
[0091] T=R×factor Formula (4)
[0092] Wherein, T is the preset definition evaluation threshold. R is the definition evaluation value of the QR code area in the reference image, which can be calculated by the above formula (3). factor is the adjustment factor, which ranges from [0, 1] and is usually taken as 0.8.
[0093] When the clarity evaluation value is greater than the preset clarity evaluation threshold, target recognition is performed directly on the corrected target recognition area. Compared with the solution in the related art that first performs rotation correction on the image including the QR code area and then directly performs positioning and recognition based on the template information, the related art will perform interpolation calculation on the entire image during the rotation correction process, resulting in distortion and blurring of the QR code area image, and the recognition effect after positioning is also poor. However, the embodiment of the present application also calculates the clarity evaluation value after rotation correction to determine whether the conditions for accurate recognition have been met at this time, which greatly ensures the accuracy of target recognition.
[0094] In an optional solution, it also includes:
[0095] When the clarity evaluation value is less than or equal to a preset clarity evaluation threshold, performing sharpening and enhancement processing on the corrected target recognition area to obtain an enhanced recognition area;
[0096] Obtaining a clarity evaluation value of the enhanced recognition area;
[0097] When the clarity evaluation value of the enhanced recognition area is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device for the enhanced recognition area.
[0098] In this application, combined Figure 2 As shown, when the clarity evaluation value is less than or equal to the preset clarity evaluation threshold, the following steps are used to perform sharpening and enhancement processing on the corrected target recognition area:
[0099] 1) Perform Gaussian filtering on the corrected target recognition area to obtain a filtered image. Gaussian filtering can effectively remove low-frequency energy and retain the high-frequency part of the image (i.e., the edge part), making the image edge clearer;
[0100] 2) Subtract the image processed by Gaussian filtering from the corrected target recognition area to obtain a residual image;
[0101] 3) Multiply the residual image by the sharpening factor to obtain an enhanced residual image;
[0102] 4) Superimposing the enhanced residual image with the image processed by Gaussian filtering to obtain a sharpened image, that is, enhancing the identification area.
[0103] Among them, the enhanced recognition area can be calculated by formula (5) and formula (6):
[0104]
[0105] Where, Q1(x,y) is the enhanced recognition area. Q(x,y) is the corrected target recognition area. G(x,y) is the Gaussian filter formula. (x,y) is the coordinates of the pixel point in the corrected target recognition area. is the sharpening factor. The larger the value, the more obvious the image enhancement effect. The value range is usually [0, 1]. σ is the standard deviation of the pixel values of the pixels in the corrected target recognition area. exp is an exponential function with the natural constant e as the base.
[0106] Combination Figure 2 As shown, after obtaining the enhanced recognition area, the iteration continues, and the clarity evaluation value of the enhanced recognition area is obtained by the above formula (3). When the clarity evaluation value of the enhanced recognition area is greater than the preset clarity evaluation threshold, the target recognition is directly performed on the enhanced recognition area.
[0107] In an optional solution, it also includes:
[0108] When the definition evaluation value of the enhanced recognition area is less than or equal to a preset definition evaluation value, performing at least one sharpening enhancement process on the enhanced recognition area to obtain a secondary enhanced recognition area;
[0109] When the clarity evaluation value of the secondary enhanced recognition area is greater than a preset clarity evaluation threshold, or the number of sharpening enhancement processes exceeds a preset number threshold, target recognition is performed on the electronic device for the secondary enhanced recognition area.
[0110] In this application, combined Figure 2 As shown, when the definition evaluation value of the enhanced recognition area is less than or equal to the preset definition evaluation value, the enhanced recognition area is subjected to a second or multiple sharpening enhancement process to obtain a secondary enhanced recognition area. The secondary enhanced recognition area is obtained by formula (7):
[0111]
[0112] Among them, Q n (x, y) is the secondary enhancement identification area. n is the number of times the sharpening enhancement process is currently performed. n-1 is the number of times the sharpening enhancement process is performed before the current one. n-1 (x, y) is the area obtained by the previous sharpening enhancement process. For example, when n = 2, Q n-1 (x,y) is the enhanced recognition area.
[0113] After obtaining the secondary enhanced recognition area, the clarity evaluation value of the secondary enhanced recognition area is obtained by the aforementioned formula (3). When the clarity evaluation value of the secondary enhanced recognition area is greater than the preset clarity evaluation threshold, the target recognition is directly performed on the secondary enhanced recognition area. Alternatively, when the clarity evaluation value after multiple sharpening and enhancement processes is still less than or equal to the preset clarity evaluation threshold, but the number of sharpening and enhancement processes has exceeded the preset number threshold (generally set to 10 times), the target recognition is also directly performed on the secondary enhanced recognition area. This can reduce the problem of misidentification of targets in the production process of electronic equipment, achieve high-precision recognition of targets, and improve production efficiency.
[0114] The present application also provides a target recognition device, such as Figure 3 As shown, the device comprises:
[0115] A first acquisition unit 301 is used to acquire an image to be recognized for an electronic device;
[0116] The second acquisition unit 302 is used to perform binarization processing on the image to be identified to obtain a binarized image;
[0117] The third acquisition unit 303 is used to acquire target recognition information of the reference image of the electronic device;
[0118] A first determining unit 304 is used to determine a target candidate region based on the binary image and the target recognition information;
[0119] The identification unit 305 is used to perform target identification on the electronic device based on the target candidate area.
[0120] In an optional scheme, the target recognition information of the reference image includes target area recognition information and target aspect ratio recognition information; the first determination unit 304 is used to determine the minimum bounding rectangle of the closed connected area in the binary image; when the area of the minimum bounding rectangle of the closed connected area meets the first preset condition for the target area recognition information, and the aspect ratio of the minimum bounding rectangle of the closed connected area meets the second preset condition for the target aspect ratio recognition information, the closed connected area is used as a target candidate area.
[0121] In an optional solution, the device further includes:
[0122] A second determining unit, used to determine a region rectangular frame of the target candidate region;
[0123] The recognition unit 305 is used to perform an AND operation on the target candidate area and the image to be recognized to obtain a grayscale candidate area; determine the target recognition area in the image to be recognized based on the area rectangular frame and the grayscale candidate area; and perform target recognition on the electronic device based on the target recognition area.
[0124] In an optional solution, the recognition unit 305 is used to obtain the inclination angle of the minimum circumscribed rectangle of the target candidate area; based on the inclination angle of the minimum circumscribed rectangle, the target recognition area is corrected to obtain a corrected target recognition area; based on the corrected target recognition area, the electronic device is subjected to target recognition.
[0125] In an optional solution, the recognition unit 305 is used to obtain a clarity evaluation value of the corrected target recognition area; when the clarity evaluation value is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device for the corrected target recognition area.
[0126] In an optional solution, the recognition unit 305 is used to perform sharpening and enhancement processing on the corrected target recognition area to obtain an enhanced recognition area when the clarity evaluation value is less than or equal to a preset clarity evaluation threshold; obtain the clarity evaluation value of the enhanced recognition area; and when the clarity evaluation value of the enhanced recognition area is greater than the preset clarity evaluation threshold, perform target recognition on the electronic device for the enhanced recognition area.
[0127] In an optional solution, the identification unit 305 is used to perform at least one sharpening enhancement process on the enhanced identification area to obtain a secondary enhanced identification area when the clarity evaluation value of the enhanced identification area is less than or equal to a preset clarity evaluation value; when the clarity evaluation value of the secondary enhanced identification area is greater than a preset clarity evaluation threshold, or the number of sharpening enhancement processes exceeds a preset number threshold, target identification of the electronic device is performed for the secondary enhanced identification area.
[0128] It should be noted that the target identification device of the embodiment of the present application solves the problem in a principle similar to that of the aforementioned target identification method. Therefore, the implementation process, implementation principle and beneficial effects of the target identification device can all be referred to the description of the implementation process, implementation principle and beneficial effects of the aforementioned method, and the repeated parts will not be repeated.
[0129] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0130] Figure 4A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0131] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0132] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0133] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as the target recognition method. For example, in some embodiments, the target recognition method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the target recognition method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the target recognition method in any other appropriate manner (e.g., by means of firmware).
[0134] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0135] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0136] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0138] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0139] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0140] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0141] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0142] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A target recognition method, characterized in that: The method comprises: Acquire an image to be identified for the electronic device; Binarizing the image to be identified to obtain a binary image; Acquiring target recognition information for a reference image of an electronic device; Determining a target candidate region based on the binary image and the target recognition information; Based on the target candidate area, target recognition is performed on the electronic device.
2. The method according to claim 1, characterized in that The target recognition information of the reference image includes target area recognition information and target aspect ratio recognition information; and determining the target candidate area based on the binarized image and the target recognition information includes: Determine the minimum bounding rectangle of a closed connected region in the binary image; When the area of the minimum circumscribed rectangle of the closed connected region meets the first preset condition for the target area identification information, and the aspect ratio of the minimum circumscribed rectangle of the closed connected region meets the second preset condition for the target aspect ratio identification information, the closed connected region is taken as a target candidate region.
3. The method according to claim 1 or 2, characterized in that: After determining the target candidate area, the method further includes: Determine a region rectangular frame of the target candidate region; The step of performing target recognition on the electronic device based on the target candidate area includes: Perform an AND operation on the target candidate region and the image to be identified to obtain a grayscale candidate region; Determine the target recognition area in the image to be recognized based on the area rectangular frame and the grayscale candidate area; Based on the target recognition area, target recognition is performed on the electronic device.
4. The method according to claim 3, characterized in that The target identification of the electronic device based on the target identification area includes: Get the tilt angle of the minimum bounding rectangle of the target candidate area; Based on the tilt angle of the minimum circumscribed rectangle, the target recognition area is corrected to obtain a corrected target recognition area; Based on the corrected target recognition area, target recognition is performed on the electronic device.
5. The method according to claim 4, characterized in that The performing target recognition on the electronic device based on the corrected target recognition area includes: Obtaining a sharpness evaluation value of the corrected target recognition area; When the clarity evaluation value is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device with respect to the corrected target recognition area.
6. The method according to claim 5, characterized in that Also includes: When the clarity evaluation value is less than or equal to a preset clarity evaluation threshold, performing sharpening and enhancement processing on the corrected target recognition area to obtain an enhanced recognition area; Obtaining a clarity evaluation value of the enhanced recognition area; When the clarity evaluation value of the enhanced recognition area is greater than a preset clarity evaluation threshold, target recognition is performed on the electronic device for the enhanced recognition area.
7. The method according to claim 6, characterized in that Also includes: When the definition evaluation value of the enhanced recognition area is less than or equal to a preset definition evaluation value, performing at least one sharpening enhancement process on the enhanced recognition area to obtain a secondary enhanced recognition area; When the clarity evaluation value of the secondary enhanced recognition area is greater than a preset clarity evaluation threshold, or the number of sharpening enhancement processes exceeds a preset number threshold, target recognition is performed on the electronic device for the secondary enhanced recognition area.
8. A target recognition device, characterized in that: The device comprises: A first acquisition unit, used to acquire an image to be recognized for the electronic device; A second acquisition unit is used to perform binarization processing on the image to be identified to obtain a binarized image; A third acquisition unit, used to acquire target recognition information of a reference image for the electronic device; A first determining unit, configured to determine a target candidate region based on the binary image and the target recognition information; The recognition unit is used to perform target recognition on the electronic device based on the target candidate area.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-7.