Image processing method and apparatus, and electronic device, computer-readable storage medium and computer program product
By detecting the state of a specific part and adjusting the focus parameters, the problem of unclear biometric image acquisition in the motion state is solved, and efficient and clear image acquisition is achieved.
Patent Information
- Application Number
- PCT/CN2025/077336
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-18
- Filing Date
- 2025-02-14
- Publication Date
- 2025-08-21
AI Technical Summary
When collecting biometric images of target objects, the prior art cannot dynamically adjust the focus parameters in the motion state of a specific part, resulting in low image quality and affecting recognition efficiency and accuracy.
By detecting the status of a specific part, the clarity is determined using edge detection technology, and the focus parameters are adjusted according to the clarity to acquire clear biometric images.
It realizes efficient acquisition of clear biometric images under the movement of specific parts, improves the clarity and efficiency of image acquisition, and avoids manual intervention.
Smart Images

Figure CN2025077336_21082025_PF_FP_ABST
Abstract
Description
Image processing method, device, electronic device, computer-readable storage medium, and computer program product
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on and claims the priority of Chinese patent application with application number 2024101836550 and application date of February 18, 2024. The content of this Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present invention relates to computer vision technology, and in particular to an image processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0004] Biometrics are widely used in identity authentication in various scenarios, such as electronic device login, financial services (electronic payment), and medical services. When performing identity authentication of the target object, the relevant technology needs to collect images including the biometrics of specific parts of the target object. However, during the collection process, the target object often cannot be guaranteed to be absolutely still, which results in low quality of the collected image, such as blurring, which affects the efficiency and accuracy of recognition. Summary of the Invention
[0005] The embodiments of the present application provide an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can efficiently capture clear images of specific parts of a target object including biological features.
[0006] The technical solution of the embodiment of the present application is implemented as follows:
[0007] An embodiment of the present application provides an image processing method, applied to an electronic device, the method comprising:
[0008] Acquire a first image including a specific portion of a target object, wherein the first image is acquired based on a first focus parameter, and the specific portion includes a biological feature of the target object;
[0009] detecting a state of the specific part when acquiring the first image;
[0010] In response to the state of the specific part being a moving state, performing edge detection on the specific part in the first image to obtain an edge region of the specific part;
[0011] detecting the clarity of the edge area;
[0012] The first focus parameter is adjusted based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including the specific part of the target object.
[0013] An embodiment of the present application provides an image processing device, the device comprising:
[0014] an acquisition module configured to acquire a first image including a specific portion of a target object, wherein the first image is acquired based on a first focus parameter, and the specific portion includes a biological feature of the target object;
[0015] a detection module configured to detect a state of the specific part when the first image is captured; in response to the state of the specific part being in motion, perform edge detection on the specific part in the first image to obtain an edge region of the specific part; and detect the clarity of the edge region;
[0016] An adjustment module is configured to adjust the first focus parameter based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including the specific part of the target object.
[0017] An embodiment of the present application provides an electronic device, comprising:
[0018] a memory for storing computer-executable instructions;
[0019] The processor is used to implement the image processing method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0020] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the image processing method provided in the embodiment of the present application when executed by a processor.
[0021] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the image processing method provided in the embodiment of the present application is implemented.
[0022] The embodiments of the present application have the following beneficial effects:
[0023] By detecting the state of a specific part in the first image, if the specific part is in motion when the first image is collected, the clarity of the specific part including the biometric feature is located by edge detection, and the first focus parameter used when the first image is adopted is adjusted according to the clarity to obtain the second focus parameter, so as to collect the second image with the second focus parameter. In this way, the focus parameter of the next collection can be adaptively adjusted in a timely manner according to the state of the specific part when the previous image was collected. The entire process does not require human intervention, ensuring that a clear image can be collected even when the specific part is in motion, thereby improving the clarity and efficiency of image collection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] FIG1 is a schematic structural diagram of an image processing system 100 provided in an embodiment of the present application;
[0025] FIG2 is a schematic diagram of the structure of a server 200 provided in an embodiment of the present application;
[0026] FIG3A is a schematic diagram of a first flow chart of an image processing method provided in an embodiment of the present application;
[0027] FIG3B is a schematic diagram of a second flow chart of the image processing method provided in an embodiment of the present application;
[0028] FIG3C is a schematic diagram of a third flow chart of the image processing method provided in an embodiment of the present application;
[0029] FIG3D is a schematic diagram of a fourth flow chart of the image processing method provided in an embodiment of the present application;
[0030] FIG3E is a schematic diagram of a fifth flow chart of the image processing method provided in an embodiment of the present application;
[0031] FIG3F is a sixth flow chart of the image processing method provided in an embodiment of the present application;
[0032] FIG3G is a seventh flow chart of the image processing method provided in an embodiment of the present application;
[0033] FIG3H is a schematic diagram of an eighth flow chart of the image processing method provided in an embodiment of the present application;
[0034] FIG3I is a ninth flow chart of the image processing method provided in an embodiment of the present application;
[0035] FIG3J is a schematic diagram of the tenth flow chart of the image processing method provided in an embodiment of the present application;
[0036] FIG3K is a schematic diagram of an eleventh flow chart of the image processing method provided in an embodiment of the present application;
[0037] FIG3L is a twelfth flow chart of the image processing method provided in an embodiment of the present application;
[0038] FIG3M is a schematic diagram of the thirteenth flow chart of the image processing method provided in an embodiment of the present application;
[0039] FIG3N is a schematic diagram of a fourteenth flow chart of the image processing method provided in an embodiment of the present application;
[0040] FIG3O is a schematic diagram of a fifteenth flow chart of the image processing method provided in an embodiment of the present application;
[0041] FIG4 is a schematic diagram of the structure of the AlexNet model provided in an embodiment of the present application;
[0042] FIG5 is a schematic diagram of the structure of a neural network model provided in an embodiment of the present application;
[0043] FIG6 is a schematic diagram showing the principle of a target recognition algorithm provided in an embodiment of the present application;
[0044] FIG7 is a schematic diagram of the positive gradient direction and the negative gradient direction of the current pixel point provided by an embodiment of the present application;
[0045] FIG8 is a diagram of the overall architecture of iris recognition provided by an embodiment of the present application;
[0046] FIG9 is a schematic diagram showing the principle of focusing parameter adjustment provided in an embodiment of the present application.
[0047] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of distinction between the advantages and disadvantages of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0049] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0050] In the following description, the terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first / second / third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0051] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0052] Unless otherwise specified, "at least one" mentioned below refers to one or more situations, and "a plurality of" may refer to two or more situations.
[0053] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0054] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0056] 1) A specific part refers to a designated part of a target object included in an image, wherein the part includes at least one of the following: palm, sole, pupil and face.
[0057] 2) Biometrics refer to the unique physiological characteristics of the human body, such as palm prints, irises, facial features and gait.
[0058] 3) Edge area refers to the curve formed by connecting multiple pixel points on the contour of a specific part.
[0059] 4) Focus parameters refer to the parameters used to adjust the position, shape, or other characteristics of the lens or image sensor in photography or image processing to ensure that the image can be presented clearly. Focus parameters generally include the following aspects:
[0060] Focus Distance: This refers to the distance from the lens to the subject. Focus distance determines whether the subject appears sharp in the image. If the focus distance is set correctly, the subject will appear sharp in the image; if it is set incorrectly, the subject may appear blurry.
[0061] Aperture: The aperture is the device in a lens that controls the amount of light entering, usually expressed as an f-number. The size of the aperture not only affects the amount of light entering, but also the depth of field. Depth of field refers to the range of sharpness from the foreground to the background in an image. A larger aperture (smaller f-number) reduces depth of field, blurring the background, while a smaller aperture (larger f-number) increases depth of field, making both the foreground and background sharper.
[0062] Focal Length: Focal length is the optical property of a lens that determines the angle of view and magnification of an image. A lens with a long focal length (such as a telephoto lens) has a narrower angle of view and a higher magnification, while a lens with a short focal length (such as a wide-angle lens) has a wider angle of view and a lower magnification.
[0063] Focus Mode: The focus mode determines how the camera adjusts the focus distance. Common focus modes include Manual Focus (MF), Auto Focus (AF), and Semi-Auto Focus. Auto Focus can be further categorized into One-Shot AF and Continuous AF.
[0064] Focus Area: The focus area is the area the camera selects to focus on during autofocus. Different focus area modes allow the camera to focus in different locations, such as center focus, multi-point focus, and face priority focus.
[0065] Fine-Tuning: In some advanced cameras, users can fine-tune the focus to correct the focus deviation between the lens and the camera to ensure image clarity.
[0066] 5) Membership, a concept in fuzzy set theory, represents the probability that a definition falls within a predefined reference definition set and is used to measure the strength of the association between the definition and the predefined reference definition set. Membership is a real number in the range [0, 1], where 0 indicates that the definition does not fall within the predefined reference definition set, and 1 indicates that the definition fully falls within the predefined reference definition set. Values between 0 and 1 indicate the degree to which the definition falls within the predefined reference definition set.
[0067] 6) Focus parameter step size refers to the maximum value of the focus parameter that the image sensor can adjust during a one-time image acquisition process.
[0068] 7) The adjustment coefficient refers to the weight of the focus parameter step size when adjusting the first focus parameter to obtain the second focus parameter. For example, the second focus parameter = the first focus parameter + the adjustment coefficient * the focus parameter step size. The adjustment coefficient is the weight of the focus parameter step size.
[0069] 8) Clarity membership, which represents the probability that the clarity belongs to a preset reference clarity set in the clarity dimension. For example, the preset reference clarity set has a value range of 0 to 100, where 0 represents blur and 100 represents clarity. When the clarity is 60, the clarity membership = 60 / 100 = 0.6.
[0070] 9) Fuzzy membership, which represents the probability that the clarity belongs to a preset reference clarity set in the fuzzy dimension. For example, the preset reference clarity set has a value range of 0 to 100, where 0 represents blur and 100 represents clarity. When the clarity is 60, the clarity membership = 1-60 / 100 = 0.4.
[0071] 10) Pre-registered images refer to image data pre-stored in an image database for comparison and verification. These images are captured or uploaded during the user (i.e., target object) registration process and typically include biometric features such as the user's face, fingerprint, iris, or photos of the user in specific scenarios. The primary purpose of pre-registered images is to serve as reference images during subsequent verification processes, used for comparison with newly captured second images to confirm the user's identity or match specific objects.
[0072] 11) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0073] 12) Human-computer interaction interface, which is used to provide an interface for human-computer interaction functions / an interface for displaying images.
[0074] For example, graphical user interface (GUI) display, such as augmented reality (AR) interface, virtual reality (VR) interface, voice user interface (VUI), interactive projection interface (using projection technology to display information on a plane), eye movement detection interface (interface controlled by detecting the user's line of sight), holographic interface (three-dimensional hologram formed by projecting images through holographic projection technology, so that stereoscopic images can be seen without wearing special glasses), multimodal interface (interface that combines multiple interaction methods, such as touch, vision, hearing, etc.), brain-machine interface (BMI) interface, etc.
[0075] The related art uses fixed focus parameters to acquire images, and even if the state of a specific part of a target object included in the image keeps changing, the same focus parameters are maintained for image acquisition.
[0076] Based on the above analysis, the applicant found that the image processing method of the related art cannot dynamically adjust the focus parameters to obtain a clear image when the state of a specific part is in motion. To address the above technical problems, the embodiment of the present application provides an image processing method that can efficiently capture clear images of specific parts including the biological features of the target object.
[0077] The embodiments of the present application provide an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can efficiently capture clear images of specific parts of a target object including biometric features. The following describes exemplary applications of the electronic device provided by the embodiments of the present application. The electronic device provided by the embodiments of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart TVs, and in-vehicle terminals, and can also be implemented as servers. The following describes exemplary applications when the electronic device is implemented as a server.
[0078] Refer to Figure 1, which is a structural diagram of the image processing system 100 provided in an embodiment of the present application. In order to support an image processing application, the terminal 400 is connected to the server 200 through the network 300. Data can be transmitted between the server 200 and the image database 500. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0079] Terminal 400 is configured to capture a first image and transmit it to server 200. Server 200 receives the first image, detects the first image, adjusts a first focus parameter corresponding to the first image, obtains a second focus parameter, and transmits the second focus parameter to terminal 400, so that terminal 400 captures a second image based on the second focus parameter and displays it on human-computer interaction interface 410. After capturing the second image, terminal 400 may transmit the second image to server 200, so that server 200 performs image recognition using vector database 500 to obtain a target image.
[0080] Taking the instant messaging scenario as an example, when the terminal 400 is making a video call with another terminal, the terminal 400 is used to capture a first image and send it to the server 200. The server 200 adjusts the focus parameters used for the captured first image to capture a second image.
[0081] Taking the electronic payment scenario as an example, when completing the payment by detecting a specific part of the target object, the terminal 400 is used to capture a first image including the specific part of the target object and send it to the server 200. The server 200 adjusts the focus parameters used for the captured first image, thereby capturing a second image including the specific part of the target object.
[0082] Taking the medical service scenario as an example, when performing specific part detection on a patient (target object), the terminal 400 is used to capture a first image including the specific part of the target object and send it to the server 200. The server 200 adjusts the focus parameters used for the captured first image, thereby capturing a second image including the specific part of the target object.
[0083] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0084] Referring to FIG. 2 , FIG. 2 is a schematic diagram of the structure of a server 200 provided in an embodiment of the present application. The server 200 shown in FIG. 2 includes: at least one processor 210, a memory 230, and at least one network interface 220. The various components in the server 200 are coupled together via a bus system 240. It will be understood that the bus system 240 is used to implement connection and communication between these components. In addition to including a data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in FIG. 2 , all of the various buses are labeled as the bus system 240.
[0085] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0086] The memory 230 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 230 may optionally include one or more storage devices that are physically remote from the processor 210.
[0087] The memory 230 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 230 described in the embodiments of the present application is intended to include any suitable type of memory.
[0088] In some embodiments, memory 230 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0089] Operating system 231, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0090] A network communication module 232 for reaching other electronic devices via one or more (wired or wireless) network interfaces 220 , exemplary network interfaces 220 including Bluetooth, Wi-Fi, and Universal Serial Bus (USB);
[0091] In some embodiments, the apparatus provided in the embodiments of the present application can be implemented using software. FIG2 shows an image processing apparatus 233 stored in memory 230. This apparatus 233 can be software in the form of a program or plug-in, and includes the following software modules: an acquisition module 2331, a detection module 2332, and an adjustment module 2333. These modules are logical and can be arbitrarily combined or further separated according to the functions implemented. The functions of each module will be described below.
[0092] In some embodiments, the terminal or server can implement the image processing method provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as a payment APP or an instant messaging APP; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0093] The image processing method provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the server provided in the embodiment of the present application.
[0094] Refer to Figure 3A, which is a first flow chart of the image processing method provided in an embodiment of the present application. The server is used as the main body and the steps shown in Figure 3A will be explained.
[0095] In step 101 , a first image including a specific portion of a target object is acquired, wherein the first image is acquired based on a first focus parameter, and the specific portion includes a biological feature of the target object.
[0096] In some embodiments, the first image is captured by an image sensor, wherein the image sensor may be built into the electronic device or externally connected to the electronic device. The specific part refers to the part of the biometric feature of the target object included in the image.
[0097] For example, the specific part can be any of the following: palm, sole, pupil, and face. When the specific part is the palm or sole, the biometric feature can be palm print; when the specific part is the pupil, the biometric feature can be iris; when the specific part is the face, the biometric feature can be facial features. In addition to the inherent physiological characteristics of the human body, biometric features also include behavioral characteristics, such as gait.
[0098] In step 102 , the state of a specific part when the first image is acquired is detected.
[0099] In some embodiments, the type of state of a specific part includes a static state and a motion state.
[0100] For example, taking the specific part as the pupil, assuming that the first image collected includes the pupil of the target object, when the user's eyes move left and right, the first image collected will appear blurred because the state of the pupil is in motion when the first image is collected; taking the specific part as the finger, assuming that the first image collected includes the finger of the target object, when the user swings the finger, the first image collected will appear blurred because the state of the finger is in motion when the first image is collected.
[0101] In some embodiments, when there are multiple first images and the multiple first images are continuous frame images, for example, assuming that the image sensor captures images at a frame rate of 30 frames per second, that is, it can capture 30 frames of images in one second, then the 30 frames of images captured in this second are called continuous frame images. In other words, continuous frame images are multiple images captured by the image sensor in a certain frame order and are continuous in the acquisition sequence. Referring to Figure 3B, Figure 3B is a second flow diagram of the image processing method provided in an embodiment of the present application. For the above-mentioned continuous frame image situation, step 102 of Figure 3A can be implemented by steps 1021A to 1023A of Figure 3B, which are described in detail below.
[0102] In step 1021A, grayscale values of pixels of a plurality of first images are obtained.
[0103] In some embodiments, for each pixel in each first image, the grayscale values of the three color channels corresponding to the pixel in the first image are obtained, and then the average of the grayscale values of the three color channels is calculated as the grayscale value of the pixel in the first image. A grayscale value is a numerical value representing the brightness of a pixel in an image. In digital image processing, a grayscale value is typically an integer between 0 and 255, where 0 represents black, 255 represents white, and intermediate values represent varying degrees of gray. This representation method is often used for grayscale conversion of black and white images or color images.
[0104] For example, taking the grayscale of 0-255 as an example, assuming that the grayscale values of the three color channels corresponding to any pixel in any first image are 110, 120 and 160 respectively, the grayscale value of the pixel is (110+120+160) / 3=130.
[0105] In step 1022A, the difference between the grayscale values of every two consecutive pixels of the first image is determined, and the absolute value of the difference is determined.
[0106] In some embodiments, the difference in grayscale values of pixels at the same position in any two consecutive first images is determined, and the absolute value of the difference is determined.
[0107] For example, the grayscale values of pixels at the same location in two consecutive first images are determined. For example, the multiple first images are, in the order of acquisition, first image A, first image B, and first image C. Any two consecutive first images are considered two consecutive first images. For example, first image A and first image B are two consecutive first images, and first image B and first image C are also two consecutive first images. Taking first image A and first image B as examples, if the grayscale values of the pixels located in the 3rd row and 5th column in first image A and first image B are 100 and 180, respectively, then the grayscale value difference is -80, and the absolute value of the difference is 80.
[0108] In step 1023A, in response to the absolute values corresponding to the pixels exceeding a preset ratio in the first image being greater than an absolute value threshold, it is determined that the specific part was in motion when the first image was acquired.
[0109] For example, the preset ratio is 50%, and the absolute value threshold is 50. If the absolute values corresponding to 80% of the pixels in the first image exceed 50, it can be determined that the specific part is in motion when the first image is collected.
[0110] For example, multiple image samples are obtained, and the image samples are manually labeled according to the status of specific parts in the image samples. For example, the label of the image sample in which the specific part is in motion is "motion state". The ratio between the image samples in each state and all the image samples is counted, and the mean or median value of the ratios corresponding to all states is taken as the preset ratio.
[0111] In some embodiments, as an alternative to steps 1021A through 1023A, an optical flow method may be used to detect the state of the specific portion when the first image was captured. Each pixel in the first image is assigned a velocity vector, and the image is dynamically analyzed based on the velocity vector characteristics of each pixel. When the specific portion is stationary, the optical flow vector varies continuously across the entire first image area. When the specific portion is in motion, there is relative motion between the specific portion and the background of the first image, and the velocity vector formed by the specific portion differs from the background velocity vector, thereby determining that the specific portion was in motion when the first image was captured.
[0112] For example, two consecutive first image frames are acquired, namely frame 1 and frame 2. The optical flow method is used to calculate the optical flow vector between frame 1 and frame 2. Assume that in frame 1, the average value of the velocity vector of the pixel points of the specific part is (0,0), indicating that the specific part is stationary; in frame 2, the specific part of the target object begins to move, and the average value of the velocity vector of the pixel points of the specific part is updated to (2,1), indicating that the specific part moves 2 pixels to the right and 1 pixel downward, indicating that the specific part is in motion.
[0113] The present embodiment uses optical flow to detect the state of a specific portion of a first image, enabling real-time calculation of motion information within an image sequence. This provides pixel-level motion information with high accuracy. The optical flow method is robust to changes in lighting and occlusion, and can operate stably in complex environments.
[0114] In some embodiments, when the number of first images is one, for example, when only the first image is captured by the image sensor (i.e., one first image is captured), the state of a specific part can be detected based on only one first image. Referring to FIG3C , FIG3C is a third flow chart of the image processing method provided in an embodiment of the present application. Step 102 of FIG3A can be implemented by calling a pre-trained first machine learning model to execute steps 1021B to 1022B of FIG3C , as described in detail below.
[0115] In step 1021B, a feature vector of the first image is extracted.
[0116] In some embodiments, a Transformer encoder, a Convolutional Neural Network (CNN), a Feature Pyramid Network (FPN), an Attention Model, a Graph Neural Network (GNN), and a Generative Adversarial Network can be used to extract features from the first image to obtain a feature vector of the first image. Convolutional neural networks include Visual Geometry Group Net (VGGNet), Residual Network (ResNet), and a lightweight deep neural network (MobileNet) for embedded devices such as mobile phones.
[0117] For example, taking the Transformer encoder as an example, for the first image, the first image is first divided into image blocks of fixed size; then, the divided image blocks are flattened into a sequence, and the flattened sequence is a vector sequence of fixed length, and each vector in the vector sequence represents an image block; secondly, an embedding layer is applied to each element of the sequence to introduce position information and other contextual information. For image blocks, the embedding layer can include position embedding and linear embedding; finally, the Transformer encoder is used to process the embedded sequence, and a multi-head attention mechanism is used to assign weights to each element in the embedded sequence, and the weighted sum is obtained to obtain a new sequence representation. The new sequence representation is then mapped to a high-dimensional space through the fully connected layer and the intermediate layer in the feedforward neural network to capture the complex relationship between the elements in the sequence, and finally the feature vector of the first image is obtained.
[0118] In step 1022B, the feature vector is mapped to probabilities corresponding to different states, and the state corresponding to the maximum probability is determined as the state of the specific part when the first image is acquired.
[0119] In some embodiments, a classifier is used to determine the probability that a feature vector corresponds to different states. The different states include multiple candidate states of a specific part, for example, a static state and a moving state. The state with the largest probability value between the probability of the static state and the probability of the moving state is selected as the state of the specific part when the first image is captured.
[0120] For example, assuming that the probability of the feature vector mapping to the static state is 30% and the probability of the feature vector mapping to the motion state is 70%, it is considered that the state of the specific part is the motion state when the first image is acquired.
[0121] In some embodiments, before calling the pre-trained first machine learning model, see Figure 3D, which is a fourth flow chart of the image processing method provided in an embodiment of the present application. The pre-trained first machine learning model can be constructed through steps 201 to 204 of Figure 3D, as described in detail below.
[0122] In step 201, an initialized first machine learning model is obtained.
[0123] For example, the first machine learning model can be an AlexNet model, see Figure 4, which is a schematic diagram of the structure of the AlexNet model provided in an embodiment of the present application. In Figure 4, the AlexNet model can include a convolutional layer and a fully connected layer. Initialization represents a random assignment of parameters to the model, for example, all parameters of the model are assigned to 0 or all are assigned to 1.
[0124] In step 202, a plurality of image samples and true state labels of the plurality of image samples are obtained, wherein the image samples include specific parts of the sample objects, the specific parts of the sample objects include biometric features of the sample objects, and the true state labels represent the true state of the specific parts of the sample objects.
[0125] In some embodiments, if the actual state of a specific part of a sample object included in an image sample is a motion state, the motion state is used as the actual state label of the image sample. The states of specific parts included in different image samples may be different.
[0126] For example, the true state labels of the image samples include a motion state and a static state. For example, the true state labels can be obtained through manual annotation.
[0127] In step 203, the initialized first machine learning model is called to perform prediction processing based on the multiple image samples to obtain predicted state labels of the multiple image samples, wherein the predicted state labels represent the predicted states of specific parts of the sample objects.
[0128] In some embodiments, the predicted state labels include a stationary state and a moving state.
[0129] For example, referring to Figure 4, taking the first machine learning model as the AlexNet model as an example, the image sample is input into the initialized AlexNet model, and a convolution operation is performed through the convolution layer in the initialized AlexNet model to obtain a feature vector of the image sample. The feature vector of the image sample is then input into the fully connected layer, and then the predicted state label is obtained through the fully connected layer.
[0130] In step 204, a state loss value is determined based on the true state label and the predicted state label, and the parameters of the initialized first machine learning model are updated based on the state loss value to obtain a pre-trained first machine learning model.
[0131] In some embodiments, the state loss value between the true state label and the predicted state label is determined by a loss function, and the state loss value is back-propagated to update the parameters of the initialized first machine learning model. The process of calculating the state loss value and updating the parameters is iterated multiple times until the state loss value no longer increases or decreases, and the iterative process is stopped to form a pre-trained first machine learning model.
[0132] As examples, the loss function may be a mean square error loss function, a cross entropy loss function, a multi-label classification loss function, and a triplet loss function.
[0133] For example, backpropagation is implemented using the backpropagation algorithm, which calculates the gradient of each neuron from the output layer to the input layer. The weights and biases of the neurons are updated based on the gradient, and the parameters are continuously updated using gradient descent to reduce the loss value. Gradient descent can use various gradient descent algorithms, such as batch gradient descent, stochastic gradient descent, adaptive gradient descent, and momentum gradient descent.
[0134] The embodiment of the present application determines the probability that the feature vector corresponds to different states through a pre-trained first machine learning model. The automated process can quickly process a large amount of image data without the need for manual analysis one by one, thereby improving work efficiency. The pre-trained first machine learning model is usually trained on a large amount of data and can learn rich feature representations, thereby improving the accuracy of state recognition. The judgment criteria of the model are consistent, avoiding the subjectivity and inconsistency that may be caused by human judgment.
[0135] In some embodiments, in response to the absolute value corresponding to the pixel points exceeding a preset proportion in the first image being less than an absolute value threshold, it is determined that the target object is in a stationary state when the first image is captured, feature extraction is performed on the first image to obtain a feature vector of the first image, and an image database is searched based on the feature vector of the first image to obtain a reference feature vector with the highest similarity to the feature vector of the first image as the first target reference feature vector, wherein the image database includes reference feature vectors of specific parts in multiple pre-registered images, and the pre-registered image corresponding to the first target reference feature vector is used as an image belonging to the same object as the first image.
[0136] As an example, the first image can be feature extracted by using a grayscale co-occurrence matrix, specifically: grayscale processing is performed on the first image to obtain a first grayscale image; according to preset distance and direction parameters, the grayscale value difference between each pixel pair (any two adjacent pixels) in the first grayscale image is calculated, where the distance is usually a positive integer, indicating the distance between pixels; the direction can be 0 degrees, 45 degrees, 90 degrees or 135 degrees, indicating the relative direction between pixels; and the number of occurrences of each grayscale value difference is counted, and the multiple times are arranged in the order of grayscale values to obtain a co-occurrence matrix, where the row of the co-occurrence matrix represents the first pixel in the pixel pair The grayscale value of the first pixel in the co-occurrence matrix is the grayscale value of the second pixel in the pixel pair. The elements in the co-occurrence matrix represent the number of times a pixel pair with a specific grayscale value difference occurs. For example, if the grayscale value of the first pixel in a pixel pair is 50 and the grayscale value of the second pixel is 60, then the element value of the element in the 51st row (because the grayscale value starts from 0) and the 61st column in the co-occurrence matrix will increase by 1; multiple texture features of the first image are extracted from the co-occurrence matrix, such as contrast, mean, variance, entropy, etc. Texture features are used to describe the texture characteristics of the first image, such as roughness, directionality, regularity, etc.; multiple texture features are connected to form a feature vector of the first image. The similarity between the feature vector of the first image and the reference feature vector can be calculated by cosine similarity. Specifically, the cosine value of the angle between the feature vector of the first image and the reference feature vector is calculated as the similarity. The larger the cosine value of the angle, the higher the similarity.
[0137] In step 103 , in response to the state of the specific part being a moving state, edge detection is performed on the specific part in the first image to obtain an edge region of the specific part.
[0138] In some embodiments, referring to FIG. 3E , FIG. 3E is a fifth flow chart of the image processing method provided in embodiments of the present application. Step 103 of FIG. 3A , "performing edge detection on a specific portion of the first image to obtain an edge region of the specific portion," can be implemented via steps 1031 to 1035 of FIG. 3E , as described in detail below.
[0139] In step 1031, a bounding box of a specific part is identified from the first image, and a cutout operation is performed on the first image based on the bounding box to obtain a target image corresponding to the specific part.
[0140] In some embodiments, a target recognition algorithm can be used to identify the bounding box of a specific part from the first image, such as a target recognition algorithm based on a support vector machine, a target recognition algorithm based on naive Bayes, and a target recognition algorithm based on a neural network. Referring to Figure 6, Figure 6 is a schematic diagram of the principle of the target recognition algorithm provided in an embodiment of the present application. The first image is input into a deep convolutional neural network (Deep ConvNet) to obtain a feature map of the image, and feature mapping is performed according to the coordinate mapping relationship between the candidate area and the overall image, so that a feature matrix of each candidate area can be obtained. Each feature matrix is passed through a pooling layer, pooled to a fixed size, and then flattened into a vector. After passing through two fully connected layers, a candidate feature vector is obtained. Finally, the feature vector passes through a fully connected layer to obtain the position of the bounding box of the target object, and the first image is subjected to a cutout operation based on the bounding box to obtain a target image corresponding to a specific part.
[0141] In step 1032, a filtering operation is performed on the target image to obtain a smoothed image.
[0142] In some embodiments, a filtering operation is performed on the target image using a Gaussian filter, for example, convolution is performed on the target image to obtain a smoothed image.
[0143] For example, a Gaussian filter is used to filter the target image, specifically: first, the Gaussian kernel size is determined, where the Gaussian kernel size refers to the size of the kernel matrix used when performing Gaussian filtering, which is usually expressed as an odd number, such as 3x3, 5x5, 7x7, etc. The size of the Gaussian kernel determines the range of filtering, that is, how many adjacent pixels each pixel will refer to during the filtering process. The Gaussian kernel size can be set manually; then, the Gaussian kernel is convolved with the target image, specifically: for each pixel in the target image, the following processing is performed: the center of the Gaussian kernel is aligned with the current pixel, and the product of the weight value of any position in the Gaussian kernel and the grayscale value of the pixel corresponding to the position is determined; the sum of all products in the area where the Gaussian kernel is located is determined, and the ratio of the sum to the number of pixels in the area where the Gaussian kernel is located is determined as the weighted average of the current pixel, and the weighted average is used to replace the grayscale value of the current pixel to obtain a smoothed image.
[0144] In step 1033 , the gradient values and gradient directions of the plurality of pixel points in the smoothed image are determined, wherein the gradient direction includes a positive gradient direction and a negative gradient direction.
[0145] In some embodiments, four operators are used to detect horizontal, vertical, and diagonal edges in an image, wherein the edge detection operator returns the first-order derivative values of the smoothed image in the horizontal and vertical directions, such as the Roberts operator, the Prewitt operator, and the Sobel operator. The sum of the square of the first-order derivative value of the smoothed image in the horizontal direction and the square of the first-order derivative value in the vertical direction is calculated, and the square root of the sum is taken to obtain the gradient value of the pixel point. The ratio of the first-order derivative value of the smoothed image in the vertical direction to the first-order derivative value in the horizontal direction is calculated, and the ratio is substituted into the inverse tangent function to obtain the gradient direction of the pixel point.
[0146] For example, if the first-order derivative value of the smoothed image in the horizontal direction is a and the first-order derivative value of the smoothed image in the vertical direction is b, then the square of the first-order derivative value of the smoothed image in the horizontal direction is a 2 , the square of the first-order derivative of the smoothed image in the vertical direction is b 2 , then the sum is a 2 +b 2 , the square root of the sum is √(a 2 +b 2 ), that is, the gradient value of the pixel is √(a 2 +b 2 The ratio of the first-order derivative value b in the vertical direction of the smoothed image to the first-order derivative value a in the horizontal direction is b / a. Substituting the ratio into the inverse tangent function arctan(), the gradient direction of the pixel point is arctan(b / a).
[0147] In step 1034, multiple pixel points in the smoothed image are traversed, and the following operations are performed for the current pixel point that has been traversed: adjacent pixel points of the current pixel point that meet the filtering conditions are filtered out in the smoothed image, where the filtering conditions include: the gradient value of the current pixel point is greater than the gradient value of the adjacent pixel points in the positive gradient direction, and the gradient value of the current pixel point is greater than the gradient value of the adjacent pixel points in the negative gradient direction.
[0148] In some embodiments, the gradient value of the current pixel point is compared with the pixel values of the pixel points along the positive gradient direction and the negative gradient direction respectively. If the gradient value of the current pixel point is greater than the gradient value of the pixel point in the positive gradient direction and greater than the gradient value of the pixel point in the negative gradient direction, the current pixel point is retained; if the gradient value of the current pixel point is less than the gradient value of the pixel point in the positive gradient direction and less than the gradient value of the pixel point in the negative gradient direction, the current pixel point is filtered.
[0149] As an example, refer to FIG. 7. FIG. 7 is a schematic diagram of the positive gradient direction and negative gradient direction of the current pixel point provided by an embodiment of the present application. In FIG. 7, taking the endpoint at the lower left corner of the smoothed image as the origin of the coordinate system, and taking the lower edge of the smoothed image as the positive half-axis of the horizontal axis of the coordinate system. If the position of the current pixel point i in the coordinate system is (x, y) and the gradient value is 5, and the positive gradient direction of the pixel point i is the same as the positive half-axis direction. Assume that the coordinates of the pixel point j in the positive gradient direction of the current pixel point i are (m, n), where m > x, the gradient value of the pixel point j is 3, and the coordinates of the pixel point k in the negative gradient direction of the current pixel point i are (p, q), where p < x, and the gradient value of the pixel point k is 1. Then, the current pixel point i is retained. Assume that the gradient value of the pixel point j is 7 and the gradient value of the pixel point k is 9. Then, the pixel point i is filtered out.
[0150] In step 1035, based on the remaining pixel points after filtering, the edge region of a specific part is determined.
[0151] In some embodiments, the remaining pixel points after filtering are fitted, and the curve formed by the fitting is used as the edge region of the specific part.
[0152] By identifying the bounding box of a specific part and performing a matting operation in the embodiments of the present application, the specific part can be accurately located, avoiding the interference of background noise, thereby improving the accuracy of edge detection. Filtering and gradient calculation are performed on the target image, reducing unnecessary computational complexity and improving processing efficiency. The filtering operation can smooth the image, reduce noise, and enhance edge information, making the gradient calculation more accurate. Through the analysis of gradient values and gradient directions, and the application of filtering conditions, the edges can be effectively refined, pseudo-edges removed, and a clear and coherent edge region obtained.
[0153] In some embodiments, refer to FIG. 3F. FIG. 3F is a sixth process schematic diagram of the image processing method provided by an embodiment of the present application. Step 1035 in FIG. 3E can be implemented by steps 10351 to 10354 in FIG. 3F, which will be specifically described below.
[0154] In step 10351, in response to the gradient value of the remaining pixel points being greater than the strong edge gradient threshold, the remaining pixel points are used as strong edge pixel points, where the strong edge gradient threshold is used to identify strong edge pixel points.
[0155] In some embodiments, the strong edge gradient threshold is preset. An automatic threshold selection algorithm can be used to determine the strong edge gradient threshold, such as the Otsu method, K-means clustering, entropy method, etc. The histogram of the first image is obtained, and based on the gray level distribution in the histogram of the first image, the threshold for separating the foreground and background is determined as the strong edge gradient threshold.
[0156] For example, if the strong edge gradient threshold is 10 and the gradient value of the remaining pixels is 20, the remaining pixels are regarded as strong edge pixels.
[0157] In step 10352, in response to the gradient values of the remaining pixels being less than the strong edge gradient threshold and greater than the weak edge gradient threshold, the remaining pixels are treated as weak edge pixels, where the weak edge gradient threshold is used to identify weak edge pixels.
[0158] In some embodiments, the weak edge gradient threshold is pre-set and can be determined by a proportional method, an empirical rule, an automatic threshold selection algorithm, an adaptive threshold, or cross-validation. Taking the proportional method as an example, a proportional coefficient is selected, the proportional coefficient is between 0 and 1, the product of the proportional coefficient and the strong edge gradient threshold is determined, and the product is used as the weak edge gradient threshold. Taking the adaptive threshold as an example, the first image is divided into multiple windows; for each window, the local statistics of the window are calculated, wherein the local statistics include the average gradient and the standard deviation; the product of a constant and the standard deviation is determined, and the sum of the product and the average gradient is determined, and the sum is used as the weak edge gradient threshold, wherein the constant is used to control the position of the weak edge gradient threshold relative to the average and the standard deviation.
[0159] For example, if the strong edge gradient threshold is 10, the weak edge gradient threshold is 8, and the gradient value of the remaining pixels is 9, the remaining pixels are regarded as weak edge pixels.
[0160] In some embodiments, in response to the gradient of the remaining pixel points being less than a weak edge gradient threshold, the remaining pixel points are deleted.
[0161] For example, the weak edge gradient threshold is preset. If the weak edge gradient threshold is 8 and the gradient value of the remaining pixel is 5, the remaining pixel is deleted.
[0162] In step 10353, in response to the pixel points whose distance from the weak edge pixel point is less than the distance threshold including at least one strong edge pixel point, the weak edge pixel point is used as a target weak edge pixel point.
[0163] In some embodiments, in response to a preset number of pixels whose distance from a weak edge pixel is less than a distance threshold including at least one strong edge pixel, the weak edge pixel is selected as a target weak edge pixel. Different preset numbers can be tried, and based on the edge detection results, a preset number that maintains edge continuity while reducing the impact of noise can be selected.
[0164] For example, the distance threshold is 10, the preset number is 5, and if at least one of the five pixels whose distance to the weak edge pixel is less than 10 is a strong edge pixel, the weak edge pixel is used as the target weak edge pixel.
[0165] In step 10354, the strong edge pixels and the target weak edge pixels are fitted into an edge region.
[0166] In some embodiments, strong edge pixels and target weak edge pixels are fitted, and a curve formed by the fitting is used as the edge region.
[0167] For example, the least squares method can be used for fitting. Assume that the total number of strong edge pixels and target weak edge pixels is m, and any strong edge pixel or target weak edge pixel is represented by , where = 1, 2, ..., , find the approximate curve determined by the strong edge pixel and the target weak edge pixel, calculate the deviation of the approximate curve at point , = 1, 2, ..., , and take the approximate curve with the minimum deviation as the edge region.
[0168] The embodiments of the present application can more accurately identify edges in an image by setting a strong edge gradient threshold and a weak edge gradient threshold. The strong edge gradient threshold is used to identify obvious edges, while the weak edge gradient threshold is used to identify less obvious edges, thereby improving the comprehensiveness and accuracy of edge detection. By determining whether there are strong edge pixels around weak edge pixels, weak edge pixels can be effectively distinguished from noise, avoiding mistaking noise for edges. Fitting strong edge pixels and target weak edge pixels into edge regions helps maintain edge continuity.
[0169] In step 104 , the sharpness of the edge area is detected.
[0170] In some embodiments, referring to FIG3G , FIG3G is a seventh flow chart of the image processing method provided in an embodiment of the present application. Step 104 of FIG3A can be implemented by steps 1041 to 1043 of FIG3G , which are described in detail below.
[0171] In step 1041 , the number of pixels included in the first image is determined as a first number.
[0172] In some embodiments, the size of the first image is obtained. Image size is typically expressed in pixels and includes width and height. The product of the width and height is determined, and the product is used as the number of pixels in the first image. If the first image includes color channels, the product of the width, height, and the number of color channels is determined as the number of pixels in the first image.
[0173] For example, if the width of the first image is 400 pixels and the height is 800 pixels, the product of the width and the height is 40×80=3200, that is, the number of pixels included in the first image is 3200. If the first image is an RGB image, the number of color channels of the first image is 3, and the product of the width, height, and the number of color channels is 40×80×3=9600, that is, the number of pixels included in the first image is 9600.
[0174] In step 1042 , the number of pixels included in the edge area is determined as the second number.
[0175] In some embodiments, the number of strong edge pixels and the number of target weak edge pixels included in the edge area are counted, the sum of the number of strong edge pixels and the number of target weak edge pixels is determined, and the sum is used as the number of pixels included in the edge area, that is, the second number.
[0176] For example, if the edge area includes 600 strong edge pixels and 1000 target weak edge pixels, and the sum of the number of strong edge pixels and the number of target weak edge pixels is 1600, then the number of pixels included in the edge area is 1600, and 1600 is used as the second number.
[0177] In step 1043 , a ratio of the second number to the first number is determined as the clarity of the edge area.
[0178] Continuing with the example of step 1041 and step 1042 above, the first number is 9600 and the second number is 1600, then the clarity of the edge area is 1600 / 9600=1 / 6.
[0179] The embodiment of the present application calculates the ratio of the number of pixels in the edge area to the number of pixels in the entire image to quantify the edge clarity, providing an objective indicator for image quality assessment. The calculation process is simple, improving the efficiency and simplicity of the calculation.
[0180] In step 105 , the first focus parameter is adjusted based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including a specific portion of the target object.
[0181] In some embodiments, referring to FIG3H , FIG3H is a schematic diagram of an eighth flow chart of an image processing method provided in an embodiment of the present application. Step 105 of FIG3A , "adjusting the first focus parameter based on the clarity to obtain the second focus parameter," can be implemented through steps 1051 to 1053 of FIG3H , as described in detail below.
[0182] In step 1051 , the membership of the first image is determined based on the definition, wherein the membership represents the probability that the definition belongs to a preset reference definition set.
[0183] In some embodiments, the membership includes a clear membership and a fuzzy membership. The clear membership represents the probability that the clarity belongs to a preset reference clarity set in the clear dimension, and the fuzzy membership represents the probability that the clarity belongs to a preset reference clarity set in the fuzzy dimension. See FIG3I , which is a ninth flow chart of the image processing method provided in an embodiment of the present application. Step 1051 of FIG3H , "Determining the membership of the first image based on clarity," can be implemented via steps 10511 to 10513 of FIG3I , as described in detail below.
[0184] In step 10511, a preset reference definition set is obtained, where the preset reference definition set includes a plurality of reference definitions with different values.
[0185] In some embodiments, first, a definition of clarity standards is performed. The expected edge clarity standards for different scenarios vary. For example, different types of images, such as landscape photos, portrait photos, and document scans, have different clarity standards. A set of representative sample images is collected, covering different types of scenarios and clarity levels. Edge detection is performed on these sample images, and the edge clarity of each image is calculated. Based on the edge clarity of the sample images, multiple reference clarity values with different values are determined, covering different clarity levels from very blurry to very clear. The multiple reference clarity values with different values are combined into a preset reference clarity set.
[0186] For example, the reference definition in the preset reference definition set may range from 0 to 100.
[0187] In step 10512, a ratio of the definition to the maximum reference definition in a preset reference definition set is determined as the definition membership.
[0188] Continuing with the example of step 10511 above, the range of reference clarity in the preset reference clarity set is 0 to 100, wherein the maximum reference clarity is 100. If the clarity is 60, the clarity membership is 60 / 100=0.6.
[0189] In step 10513, the difference between the clarity membership and the preset clarity is determined as the fuzzy membership.
[0190] Continuing with the example of step 10512 above, the preset clarity is 1, the clarity membership is 0.6, and the fuzzy membership is 1-0.6=0.4.
[0191] The present embodiment uses clarity membership and blur membership to perform a multi-dimensional assessment of image clarity. The membership describes the degree to which clarity belongs to a reference clarity set in a probabilistic manner, providing a quantitative and standardized approach to image quality assessment. The preset reference clarity set can be adjusted to suit different application requirements, thereby increasing the flexibility and applicability of the assessment.
[0192] In step 1052, an adjustment coefficient is determined based on the degree of membership.
[0193] In some embodiments, referring to Figure 3J, which is a tenth flow chart of the image processing method provided in an embodiment of the present application, step 1052 of Figure 3H can be implemented by steps 10521 to 10525 of Figure 3J, as described in detail below.
[0194] In step 10521, a first product of the clarity membership and a first preset value is determined.
[0195] For example, if the clarity membership is 0.6 and the first preset value is 0, the first product is 0.
[0196] In step 10522, a second product of the fuzzy membership and a second preset value is determined.
[0197] For example, if the fuzzy membership is 0.4 and the second preset value is 1, the second product is 0.4.
[0198] The first and second preset values are typically determined based on experience and experimental data. For example, if clarity is more important than blur in a particular application scenario, the first preset value may be set to be greater than the second preset value to emphasize clarity. Conversely, if blur is more important, the second preset value may be set to be greater than the first preset value.
[0199] In step 10523, a first sum of the first product and the second product is determined.
[0200] For example, if the first product is 0 and the second product is 0.4, then the first sum is 0.4.
[0201] In step 10524, a second sum of the sharp membership and the fuzzy membership is determined.
[0202] For example, if the clear membership is 0.6 and the fuzzy membership is 0.4, the second sum is 1.
[0203] In step 10525, a ratio of the first sum to the second sum is determined as an adjustment coefficient.
[0204] For example, if the first sum is 0.4 and the second sum is 1, the adjustment coefficient is 0.4.
[0205] By setting a first preset value and a second preset value, the embodiments of the present application can assign different weights to the clarity and blur memberships, thereby emphasizing or weakening the influence of one dimension in the calculation of the adjustment coefficient. The preset values can be adjusted according to specific application scenarios and requirements, so that the adjustment coefficient can better reflect the actual image quality. The adjustment coefficient comprehensively considers the clarity and blur memberships, providing a comprehensive image quality assessment indicator.
[0206] In step 1053, the first focus parameter is adjusted according to the adjustment coefficient and the focus parameter step size to obtain a second focus parameter, wherein the focus parameter step size is the maximum value of the focus parameter of the image sensor performance adjustment, and the image sensor is used to capture the first image.
[0207] In some embodiments, as an alternative to steps 1051 to 1053, a zoom camera can be used to obtain a non-depth image of a specific part in the first image; a focus area that needs to be focused in the non-depth image is obtained; a depth image of the specific part in the first image is obtained using a depth camera; the depth camera and the zoom camera are aligning to obtain the depth value of each pixel in the focus area in the non-depth image; the depth information of the area is calculated based on the depth value of each pixel in the focus area, the focal length of the zoom camera lens is adjusted based on the depth information, and a second image is captured based on the adjusted focal length.
[0208] In some embodiments, as an alternative to steps 1051 to 1053, environmental parameters such as light, air quality, and humidity can be obtained based on changes in the external environment, and the environmental parameters can be input into a preset mathematical model to calculate the appropriate focal length. The physical distance between the lens and the image sensor can be changed according to the focal length to capture a clear second image.
[0209] In some embodiments, a pre-built parameter control model is called according to the adjustment coefficient and the focus parameter step size to adjust the first focus parameter to obtain the second focus parameter.
[0210] In some embodiments, when the parameter control model is a linear regression model, see FIG3K , which is a schematic diagram of the eleventh flow chart of the image processing method provided in an embodiment of the present application. Before calling the pre-built parameter control model, steps 301 to 303 of FIG3K can be implemented, as described in detail below.
[0211] In step 301, an initialized linear regression model is obtained, and the initialized linear regression model is used to determine the third product of the adjustment coefficient and the focus parameter step size, and the sum of the first focus parameter and the third product is determined as the second focus parameter, wherein the adjustment coefficient is an unknown quantity.
[0212] In some embodiments, the linear regression model may be: second focus parameter = first focus parameter + adjustment coefficient * focus parameter step size, where the adjustment coefficient is an unknown quantity.
[0213] For example, the second focus parameter is A, the first focus parameter is B, the focus parameter step is C, and the adjustment coefficient is x, where A, B, and C are all constants and x is an unknown quantity. The linear regression model can be expressed as: A=B+x*C.
[0214] In step 302 , a plurality of samples are acquired, wherein different samples include different combinations of the first focus parameter and the second focus parameter.
[0215] In some embodiments, different samples include different combinations of the first focus parameter and the second focus parameter.
[0216] For example, the first focus parameter included in the sample may be a focus parameter used when capturing an image of the sample object. When the first focus parameter is used to capture an image of the sample object, the sample object may be in a stationary state or a moving state. The second focus parameter may be a focus parameter obtained after adjusting the first focus parameter. When the second focus parameter is used to capture an image of the sample object, the clarity of a specific part of the sample object in the captured image is greater than a clarity threshold.
[0217] In step 303, multiple samples are substituted into the initialized linear regression model to obtain a solution to obtain an adjustment coefficient, and the adjustment coefficient is substituted into the initialized linear regression model to obtain a pre-built linear regression model.
[0218] In some embodiments, the focus parameter step size is constant. Substituting multiple samples, i.e., multiple combinations of the first focus parameter and the second focus parameter, can determine the unknown quantity, i.e., the adjustment coefficient. The determined adjustment coefficient is then substituted into the initialized linear regression model to obtain the pre-built linear regression model.
[0219] For example, the initialized linear regression model is: A=B+x*C, where A is the second focus parameter, B is the first focus parameter, x is the adjustment coefficient, and C is the focus parameter step size. If the adjustment coefficient x is 0.4, the pre-built linear regression model is: A=B+0.4*C.
[0220] In some embodiments, when the parameter control model is a pre-trained second machine learning model, see FIG. 3L , which is a twelfth flow chart of the image processing method provided in an embodiment of the present application. Before calling the pre-built parameter control model, steps 401 to 404 of FIG. 3L can be implemented, as described in detail below.
[0221] In step 401, a first focus parameter, a second focus parameter, and a focus parameter step size are used as data samples.
[0222] For example, the format of the data sample may be <first focus parameter, second focus parameter, focus parameter step size>.
[0223] In step 402, the adjusted coefficients are labeled as true coefficients.
[0224] Here, the real coefficient label represents the real adjustment coefficient corresponding to the current first focus parameter, second focus parameter and focus parameter step size.
[0225] In step 403, a second machine learning model is called based on the image sample to perform prediction processing to obtain a prediction coefficient label.
[0226] In some embodiments, the image sample can be predicted by the fully connected layer of the second machine learning model to obtain a prediction coefficient label, wherein the prediction coefficient label represents the adjustment coefficient obtained by predicting the first focus parameter, the second focus parameter and the focus parameter step size.
[0227] For example, the second machine learning model can be a neural network model, see Figure 5, which is a schematic diagram of the structure of the neural network model provided in an embodiment of the present application. The data sample is input into the neural network model, and a convolution operation is performed through the convolution layer in the neural network model to obtain a feature vector of the data sample. The feature vector of the data sample is then input into the fully connected layer, and the prediction coefficient label is obtained through the fully connected layer.
[0228] In step 404, the coefficient loss value is determined based on the true coefficient label and the predicted coefficient label, and the parameters of the second machine learning model are updated based on the coefficient loss value to obtain the trained second machine learning model.
[0229] In some embodiments, the coefficient loss value between the true coefficient label and the predicted coefficient label is determined by a loss function, and the coefficient loss value is back-propagated to update the parameters of the second machine learning model. The process of calculating the coefficient loss value and updating the parameters is iterated multiple times until the coefficient loss value no longer increases or decreases. The iterative process is stopped to form a trained second machine learning model.
[0230] Example loss functions include mean squared error, cross entropy, multi-label classification, and triplet loss. Backpropagation is implemented using the backpropagation algorithm, which calculates the gradient of each neuron from the output layer to the input layer and updates the neuron weights and biases based on the gradient. Gradient descent is used to continuously update the parameters, reducing the loss. Gradient descent can employ various algorithms, such as batch gradient descent, stochastic gradient descent, adaptive gradient descent, and momentum gradient descent.
[0231] The embodiment of the present application detects the state of a specific part in a first image. If the specific part is in motion when the first image is captured, the clarity of the specific part including the biometric feature is located by edge detection, and the first focus parameter used when the first image is captured is adjusted according to the clarity to obtain a second focus parameter, so as to capture the second image using the second focus parameter. This allows the focus parameter for the next capture to be adaptively adjusted in a timely manner according to the state of the specific part when the previous image was captured. The entire process does not require manual intervention, ensuring that a clear image can be captured even when the specific part is in motion, thereby improving the clarity of image capture.
[0232] In some embodiments, referring to FIG3M , which is a thirteenth flow chart of the image processing method provided in an embodiment of the present application, after acquiring a second image including a specific portion of the target object, steps 501 to 503 of FIG3M are executed, as described in detail below.
[0233] In step 501, feature extraction is performed on the second image to obtain a feature vector of the second image, and the feature vector of the second image is used as a feature vector to be verified.
[0234] In some embodiments, referring to FIG. 3N , FIG. 3N is a fourteenth flow chart of an image processing method provided by an embodiment of the present application. Step 501 of FIG. 3M , "Extracting features from the second image to obtain a feature vector for the second image," can be implemented via steps 5011 to 5013 of FIG. 3N , as described in detail below.
[0235] In step 5011, the second image is divided into a plurality of image blocks.
[0236] In some embodiments, the width of the second image is divided into equal parts to obtain sub-widths, and the height of the second image is divided into equal parts to obtain sub-heights. The size of each image block is the product of the sub-width and the sub-height, and the sizes of multiple image blocks are the same.
[0237] For example, the size of the second image is 900*900 pixels. If the second image is divided into 9 equal parts, that is, the width of the second image is divided into 3 equal parts, the sub-width is 300 pixels; the height of the second image is divided into 3 equal parts, the sub-height is 300 pixels, and a total of 9 image blocks of the same size are obtained. Then the size of each image block is 300*300 pixels.
[0238] In step 5012, a filtering operation is performed on the multiple image blocks to obtain multiple partial feature vectors corresponding to the multiple image blocks.
[0239] In some embodiments, a filtering operation can be performed on multiple image blocks to obtain partial feature vectors corresponding to the multiple image blocks by any of the following filtering operations: Gabor filter group, linear filtering, nonlinear filtering, edge detection filtering, adaptive filtering, wavelet filtering, and morphological filtering.
[0240] For example, taking the Gabor filter group as an example, the Gabor filter group includes a real filter and an imaginary filter. The image block is filtered with the corresponding real filter and imaginary filter respectively to obtain the real value and the imaginary value. Then, the square root of the sum of the square of the real value and the square of the imaginary value is taken to obtain the partial feature vector corresponding to the image block.
[0241] In step 5013, multiple partial feature vectors are concatenated into a second feature vector of the second image.
[0242] In some embodiments, partial feature vectors corresponding to the image blocks are sequentially spliced according to the positions of the image blocks to obtain a second feature vector of the second image.
[0243] For example, if the partial eigenvectors corresponding to the multiple image blocks are a1 and a2 respectively, then the mathematical form of the second eigenvector of the second image is (a1, a2).
[0244] In step 502, an image database is searched based on the feature vector to be verified, and a reference feature vector having the highest similarity to the feature vector to be verified is used as a second target reference feature vector, wherein the image database includes reference feature vectors of specific parts in multiple pre-registered images.
[0245] In some embodiments, referring to FIG. 3O , FIG. 3O is a schematic diagram of the fifteenth flow chart of the image processing method provided in embodiments of the present application. Step 502 of FIG. 3M , "searching the image database based on the feature vector to be verified to obtain a reference feature vector with the highest similarity to the feature vector to be verified, to serve as the target reference feature vector," can be implemented via steps 5021 through 5024 of FIG. 3O , as described in detail below.
[0246] In step 5021, the feature vector to be verified is converted into a first character string.
[0247] In some embodiments, each element in the feature vector to be verified is concatenated in sequence according to the storage order to obtain the first character string.
[0248] For example, for the feature vector to be verified [1, 2, 3, 4, 5], each element is concatenated in sequence according to the storage order to form the first character string "1, 2, 3, 4, 5".
[0249] In step 5022, the plurality of reference feature vectors are converted into a plurality of second character strings, wherein the length of the first character string is the same as the length of the second character string.
[0250] In some embodiments, each element in the plurality of reference feature vectors is concatenated in sequence according to the storage order to obtain a plurality of second character strings.
[0251] For example, for the reference feature vector [5, 6, 7, 8, 9], each element is concatenated in sequence according to the storage order to form the second string "5, 6, 7, 8, 9.
[0252] In step 5023 , the number of different characters in the same position between the first character string and each second character string is determined as the similarity between the feature vector to be verified and the reference feature vector.
[0253] For example, if the first character string is 1011101 and any second character string is 1001001, the number of different characters at the same position between the first character string and the second character string is 2, which serves as the similarity between the feature vector to be verified and the reference feature vector.
[0254] In step 5024, the reference feature vector corresponding to the highest similarity is used as the second target reference feature vector.
[0255] In some embodiments, if the similarity between one of the plurality of second character strings and the first character string is greater than the similarities between the other second character strings and the first character string, the reference feature vector corresponding to the second character string is used as the second target reference feature vector.
[0256] For example, the similarity between the second character string A and the first character string is 0.9, the similarity between the second character string B and the first character string is 0.7, and the similarity between the second character string C and the first character string is 0.5. Then, the reference feature vector corresponding to the second character string A is used as the second target reference feature vector.
[0257] In step 503, the pre-registered image corresponding to the second target reference feature vector is regarded as an image belonging to the same object as the second image.
[0258] Here, the pre-registered image corresponding to the second target reference feature vector is taken as the pre-registered image with the highest similarity to the second image.
[0259] In some embodiments, a local matching strategy can also be introduced for image matching, that is, the second image is divided to obtain multiple first local images, and then feature extraction is performed on the multiple first local images to obtain multiple first local features. Similarly, the pre-registered image is divided to obtain multiple second local images, and the size of each second local image is the same as the size of the first local image at the corresponding position. Feature extraction is performed on the multiple second local images to obtain multiple second local features. The cosine similarity algorithm is used to calculate multiple local similarities between the multiple first local features and the corresponding second local features, the multiple local similarities are added, and then the ratio of the sum to the number of first local images is calculated as the similarity between the second image and the pre-registered image, and the pre-registered image with the highest similarity to the second image is found.
[0260] In some embodiments, in the face recognition scenario, it is possible to detect whether the pre-registered image with the highest similarity to the second image in the image database reaches a preset similarity threshold. If it is higher than the similarity threshold, the face recognition is determined to be successful, otherwise the face recognition is determined to have failed.
[0261] The embodiment of the present application adjusts the first focus parameter to obtain the second focus parameter when the specific part included in the first image is in motion, and re-captures the second image based on the second focus parameter to improve the clarity of the captured image, so that during the image recognition process, the second image with high clarity is used to complete image recognition, thereby improving the accuracy of image recognition.
[0262] Below, an exemplary application of the embodiment of the present application in an application scenario of electronic payment in an instant messaging APP will be described.
[0263] Taking the scenario of electronic payment through iris recognition as an example, the image sensor often captures unclear iris images due to pupil twitching, resulting in a low recognition rate when iris recognition is performed using the iris image. The image processing method provided in the embodiment of the present application can detect the state of the pupil (i.e., a specific part) when acquiring the original iris image (i.e., the first image). When pupil twitching is detected in the original iris image, the pupil in the original iris image is edge detected to obtain the edge area of the pupil, and the clarity of the edge area is obtained, thereby adjusting the first focus parameter to obtain the second focus parameter to capture a clear iris image (i.e., the second image), thereby enabling subsequent iris recognition using the clear iris image and improving the accuracy of iris recognition.
[0264] See Figure 8, which shows the overall architecture of iris recognition provided by an embodiment of the present application. The iris recognition process is divided into five parts: image acquisition (responsible for acquiring eye images); pupil twitching detection (detecting pupil twitching conditions); pupil edge detection (real-time detection of pupil edges and calculation of clarity); primary focus parameter adjustment (dynamic adjustment of primary focus parameters based on edge detection results); and feature extraction and matching (feature extraction and matching of the second image to complete recognition).
[0265] The image acquisition process uses a high-speed camera that includes a complementary metal-oxide-semiconductor (CMOS) image sensor. CMOS sensors offer high performance in real-time image acquisition applications due to their low power consumption, high integration, and fast response speed.
[0266] When detecting pupil twitching, a graphics processing unit (GPU) and a digital signal processor (DSP) can be used to perform parallel computing of image processing and deep learning tasks. Among them, the GPU can use image analysis methods to detect pupil twitching (i.e., motion state) by calculating the differences and correlations between each pixel in the digital image. The image analysis methods include inter-frame difference method and optical flow method. The inter-frame difference method detects the state of the pupil by calculating the pixel difference between adjacent frames (i.e., every two consecutive first images) (i.e., the difference between the grayscale values of the pixels of the first image), which is suitable for pupil twitching detection. The optical flow method estimates the pupil state by calculating the motion vector field of the pupil in the image scene, and has high detection accuracy; the DSP can use deep learning methods, using deep learning algorithms such as convolutional neural networks (CNN) or recurrent neural networks (RNN) to detect the pupil state. First, a large amount of pupil twitching data needs to be labeled for training the deep learning model. Then, the trained model is used to perform pupil movement detection on new eye image data to achieve automatic recognition.
[0267] If the pupil is beating (i.e., a specific part is in motion), pupil edge detection is performed. If the pupil is not beating, feature extraction can be performed directly based on the original iris image in the current state.
[0268] Pupil edge detection can be achieved in real time using edge detection algorithms such as the Sobel operator and the Canny operator. The Sobel operator is an edge detection algorithm that calculates edge strength based on the spatial gradient of an image. Edges are detected by calculating the horizontal and vertical gradients of the image, and the edge strength is determined based on the magnitude and direction of the gradients. The Sobel operator uses two convolution kernels (one for horizontal gradient calculation and the other for vertical gradient calculation) to convolve the original iris image to obtain a horizontal gradient matrix and a vertical gradient matrix. The square root of the sum of the squares of these two matrices is calculated to obtain a gradient magnitude image, which is then binarized using a set threshold to obtain the edge region. The Canny operator is a multi-stage edge detection algorithm that offers advantages over other edge detection algorithms in terms of noise suppression and edge detection performance. The Canny operator detection process is as follows: apply a Gaussian filter to smooth the original iris image (i.e., filtering operation) to suppress noise; use the Sobel operator or other similar methods to calculate the gradient amplitude (i.e., gradient value) and gradient direction of the original iris image; apply the non-maximum suppression (NMS) technology to suppress pixels with non-maximum amplitude in the edge area to obtain the refined edge area; use the double threshold method to binarize the refined edge area, that is, set two thresholds, the strong edge gradient threshold is used to obtain strong edges, and the weak edge gradient threshold is used to connect weak edges around strong edges. If the gradient value of a pixel point is higher than the strong edge gradient threshold, it is considered a strong edge pixel point; if it is lower than the weak edge gradient threshold, it is considered a non-edge pixel point; if the gradient value of a pixel point is between the two thresholds, it is considered a weak edge pixel point; and edge detection is finally completed by suppressing isolated weak edge pixels.
[0269] Specifically, in order to minimize the impact of noise on edge detection results, noise must be filtered out to prevent false detection caused by noise. To smooth the image, a Gaussian filter is used to convolve with the original iris image to obtain a smoothed image to reduce the obvious noise effect on the edge detector.
[0270] The resulting binary iris edge matrix (i.e., edge region) is then calculated. To describe the clarity of the iris edge, the pupil edge can be calculated using the following two methods: Clarity can be calculated using edge continuity, which calculates the average length of consecutive edge pixels. Edge continuity can be determined by testing the connectivity of adjacent edge pixels. A higher edge continuity indicates a more coherent and clearer edge region. Clarity is a specific value. For example, if an edge region is E and contains a set of pixels P with n elements, the continuity of this edge region can be expressed using the following formula: Continuous(E) = n / N, where Continuous represents the continuity fraction (i.e., clarity), N is the total number of pixels in the original iris image, and n is the number of pixels in the edge region of the original iris image. This formula indicates that the resulting clarity is the ratio of the number of pixels in the edge region to the total number of pixels. A larger value indicates stronger connectivity and a clearer pupil edge region. Clarity can also be calculated using edge density, which calculates the density of pixels in the edge region within the original iris image. Edge density can be calculated by calculating the density of pixels in the edge area in all directions (vertical, horizontal, and diagonal). A higher edge density indicates a tighter and clearer pupil edge area. This clarity is a specific value. Using the above two methods, a clarity value is ultimately obtained, which is used to adjust the primary focus parameter.
[0271] The process of adjusting the first focus parameter can be seen in Figure 9, which is a schematic diagram of the principle of focus parameter adjustment provided by an embodiment of the present application. In Figure 9, the pupil edge detection result, i.e., the clarity, is input into a fuzzy controller to dynamically adjust the first focus parameter. The fuzzy controller is a control method based on fuzzy sets, fuzzy relations, and fuzzy reasoning, capable of handling nonlinear, time-varying, and uncertain systems. The basic components of a fuzzy controller include: fuzzification, fuzzy reasoning, and defuzzification.
[0272] Fuzzification converts the clarity of the iris edge detection results into a membership value in a fuzzy set, that is, converting a precise value into a fuzzy value. For example, the clarity range (i.e., the preset reference clarity set) is 0 to 100, where 0 represents complete blur and 100 represents perfect clarity. First, two membership functions need to be defined to map clarity to these two fuzzy concepts. Assuming that for the concept of "clarity," an increasing linear membership function can be defined, i.e., when clarity is 0, the membership is 0; when clarity is 100, the membership is 1. Then, the calculated membership function is: clarity membership = clarity / 100. Correspondingly, for the concept of "fuzziness," a decreasing linear membership function can be defined, i.e., when clarity is 0, the membership is 1; when clarity is 100, the membership is 0. The calculated membership function is: fuzzy membership = 1-clarity / 100. When pupil edge detection yields a clarity of 60, the membership function described above is used to calculate the fuzzy concept membership corresponding to this clarity: clarity membership = 60 / 100 = 0.6, fuzzy membership = 1-60 / 100 = 0.4. This fuzzifies the original clarity of 60 into two fuzzy concepts, one with a clarity membership of 0.6 and the other with a fuzzy membership of 0.4. During the fuzzification process, the original clarity's membership in the two fuzzy concepts is preserved, facilitating subsequent fuzzy reasoning.
[0273] Fuzzy inference calculates the output fuzzy value from the input fuzzy value based on defined fuzzy rules and membership functions. Fuzzy rules describe the system's control strategy and include a qualitative analysis of the system's effectiveness. Assume there is an output fuzzy concept, "focus adjustment level," which has three levels: unchanged, slightly adjusted, and significantly adjusted. First, a set of fuzzy rules must be defined to describe the relationship between the input fuzzy concept and the output fuzzy concept. For example, if the pupil edge is sharp, the first focus parameter remains unchanged; if the pupil edge is blurred, the first focus parameter requires significant adjustment. Fuzzy inference is then performed, converting the input fuzzy value into the output fuzzy value using these rules. Based on the existing iris clarity membership function, fuzzy inference can be used to calculate the output fuzzy value. For example, if the input clarity membership function is 0.6, the pupil edge is sharp and the first focus parameter remains unchanged, resulting in an output of 0.6. If the input fuzzy membership function is 0.4, the pupil edge is blurred and the first focus parameter requires significant adjustment, resulting in an output of 0.4. The results are weighted 0.6 (corresponding to "focus parameters remain unchanged") and 0.4 (corresponding to "focus parameters need to be significantly adjusted"). Then, after visualizing the results as fuzzy subsets, the degree of adjustment will be between "remain unchanged" and "significantly adjusted." Finally, a defuzzification process is required to convert the output fuzzy values back into numerical values.
[0274] Defuzzification converts the output fuzzy value into an accurate value for actual control. Defuzzification methods can include the centroid method and the maximum membership method. The centroid method is used to output the fuzzy value between "remain unchanged" (weight 0.6) and "substantially adjusted" (weight 0.4) according to the assigned membership value. The centroid method is used to calculate the weighted average to obtain the final focus adjustment parameter signal (i.e., the adjustment coefficient). The calculation formula for the focus adjustment parameter signal is: (0.6*the corresponding value for remaining unchanged + 0.4*the corresponding value for substantially adjusting) / (0.6+0.4). Assuming that the corresponding value for remaining unchanged is 0 and the corresponding value for substantially adjusting is 1, the calculated result is: (0.6*0+0.4*1) / (1)=0.4, that is, the value of the focus parameter adjustment signal is 0.4.
[0275] After blurring, fuzzy inference, and deblurring, the first focus parameter is dynamically adjusted. This involves inputting pupil edge detection results into a fuzzy controller. Based on the focus adjustment parameter signal output by the fuzzy controller, the iris camera's first focus parameter is adjusted in real time. By dynamically adjusting the first focus parameter, the camera focuses according to the adjusted second focus parameter to recapture a clearer second image, ensuring iris image clarity and improving recognition accuracy.
[0276] As an example, the calculation process for obtaining the second focus parameter by adjusting the first focus parameter using the focus adjustment parameter signal is as follows: First, two parameters, currentFocus and maxFocusAdjust, are defined. CurrentFocus represents the current focus parameter of the camera (i.e., the first focus parameter), such as the current focal length or the current lens position, and maxFocusAdjust represents the maximum adjustment value that the camera focus parameter can reach (i.e., the focus parameter step size). The maximum adjustment value can be set based on the actual camera hardware parameters. First, currentFocus is adjusted according to the focus adjustment parameter signal output by the fuzzy controller, and a simple linear strategy is designed: the amplitude of the first focus parameter adjustment is equal to the focus adjustment parameter signal multiplied by the maximum adjustment value, that is, amplitude (i.e., the third product) = signalValue (i.e., adjustment coefficient) * maxFocusAdjust; then, the adjusted focus parameter newFocus (i.e., the second focus parameter) is calculated, where the adjusted focus parameter newFocus is equal to the sum of the current focus parameter currentFocus and the amplitude of the focus parameter adjustment, which can be expressed as: newFocus = currentFocus + signalValue * maxFocusAdjust. For example, if currentFocus is 500 microns, maxFocusAdjust is 100 microns, and signalValue = 0.4, then newFocus = 500 + 0.4 * 100 = 540, which means the second focus adjustment parameter calculated by the fuzzy controller is 540 microns. Finally, the first focus parameter is dynamically adjusted based on the input pupil edge detection result to ensure the clarity of the iris image.
[0277] Second image feature extraction is to extract distinctive feature information from a clear iris image (i.e., the image recaptured by the camera after adjusting the first focus parameter, i.e., the second image). For example, feature extraction is performed using a Gabor filter or in combination with a local binary pattern (LBP, Local Binary Pattern). A Gabor filter is used to extract spatial frequency features from a clear iris image (i.e., the feature vector of the second image, which is used as the feature vector to be verified). This can adapt to slight changes in the clear iris image when the pupil twitches; local texture features are extracted in combination with a local binary pattern (i.e., the feature vector of the second image, which is used as the feature vector to be verified). This is stable and robust to changes in illumination and scale. Second image feature matching is to compare the extracted feature vector to be verified with the reference feature vector already in the image database to determine whether they belong to the same pupil. For example, Hamming distance matching or local matching strategy is adopted. Hamming distance matching is applicable to binary-coded feature vectors, that is, the feature vector to be verified is converted into a first string and multiple reference feature vectors are converted into multiple second strings respectively. The similarity is measured by calculating the number of different characters in the same position of the first string and each second string. For the case of beating pupils, weighted Hamming distance matching is performed to give higher weights to key areas; a local matching strategy is introduced to perform local segmentation on the second image and perform regional matching on local features to improve the robustness of the matching algorithm.
[0278] The embodiment of the present application detects the state of a specific part in a first image. If the specific part is in motion when the first image is captured, the clarity of the specific part including the biometric feature is located by edge detection. The first focus parameter used when the first image is captured is adjusted according to the clarity to obtain a second focus parameter. The second image is captured using the second focus parameter. This allows the focus parameter for the next capture to be adaptively adjusted in a timely manner based on the state of the specific part when the previous image was captured. The entire process does not require manual intervention, ensuring that a clear image can be captured even when the specific part is in motion, thereby improving the clarity of image capture. By using a high-definition second image for image recognition to obtain a target image, the accuracy of image recognition is improved, the time cost of repeated capture due to low image clarity is reduced, and the efficiency of image recognition is improved.
[0279] The following further describes an exemplary structure of the image processing device 233 provided in an embodiment of the present application implemented as a software module. In some embodiments, as shown in FIG2 , the software modules stored in the image processing device 233 in the memory 230 may include:
[0280] The acquisition module 2331 is configured to acquire a first image including a specific part of the target object, wherein the first image is collected based on a first focus parameter, and the specific part includes a biological feature of the target object.
[0281] The detection module 2332 is configured to detect the state of the specific part when the first image is captured; in response to the state of the specific part being a motion state, perform edge detection on the specific part in the first image to obtain an edge area of the specific part; and detect the clarity of the edge area.
[0282] The adjustment module 2333 is configured to adjust the first focus parameter based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including a specific part of the target object.
[0283] In some embodiments, when the number of first images is multiple and the multiple first images are continuous frame images, the detection module 2332 is further configured to obtain the grayscale values of the pixel points of the multiple first images; determine the difference between the grayscale values of the pixel points of each two consecutive first images, and determine the absolute value of the difference; in response to the absolute value corresponding to the pixel points in the first image exceeding a preset proportion being greater than the absolute value threshold, determine that the specific part is in motion when the first image is collected.
[0284] In some embodiments, when the number of first images is one, the detection module 2332 is further configured to call the pre-trained first machine learning model to perform the following processing: extract the feature vector of the first image; map the feature vector to probabilities corresponding to different states, and determine the state corresponding to the maximum probability as the state of the specific part when the first image was collected.
[0285] In some embodiments, before calling the pre-trained first machine learning model, the detection module 2332 is further configured to obtain the initialized first machine learning model; obtain multiple image samples and true state labels of multiple image samples, wherein the image samples include specific parts of the sample objects, the specific parts of the sample objects include biological features of the sample objects, and the true state labels represent the true state of the specific parts of the sample objects; call the initialized first machine learning model based on the multiple image samples to perform prediction processing to obtain predicted state labels of the multiple image samples, wherein the predicted state labels represent the predicted state of the specific parts of the sample objects; determine the state loss value based on the true state label and the predicted state label, and update the parameters of the initialized first machine learning model based on the state loss value to obtain the pre-trained first machine learning model.
[0286] In some embodiments, the detection module 2332 is further configured to identify a bounding box of a specific part from the first image, perform a cutout operation on the first image based on the bounding box to obtain a target image corresponding to the specific part; perform a filtering operation on the target image to obtain a smoothed image; determine the gradient values and gradient directions of multiple pixel points in the smoothed image, wherein the gradient direction includes a positive gradient direction and a negative gradient direction; traverse multiple pixel points in the smoothed image, and perform the following operations for the current pixel point traversed: filter out adjacent pixel points in the smoothed image that meet the filtering conditions, wherein the filtering conditions include: the gradient value of the current pixel point is greater than the gradient value of the adjacent pixel points in the positive gradient direction, and the gradient value of the current pixel point is greater than the gradient value of the adjacent pixel points in the negative gradient direction; determine the edge area of the specific part based on the remaining pixel points after filtering.
[0287] In some embodiments, the detection module 2332 is further configured to, in response to the gradient values of the remaining pixel points being greater than the strong edge gradient threshold, treat the remaining pixel points as strong edge pixel points, wherein the strong edge gradient threshold is used to identify strong edge pixel points; in response to the gradient values of the remaining pixel points being less than the strong edge gradient threshold and greater than the weak edge gradient threshold, treat the remaining pixel points as weak edge pixel points, wherein the weak edge gradient threshold is used to identify weak edge pixel points; in response to the pixel points whose distance to the weak edge pixel points is less than the distance threshold include at least one strong edge pixel point, treat the weak edge pixel points as target weak edge pixel points; and fit the strong edge pixel points and the target weak edge pixel points into an edge area.
[0288] In some embodiments, the detection module 2332 is further configured to determine the number of pixels included in the first image as a first number; determine the number of pixels included in the edge area as a second number; and determine the ratio of the second number to the first number as the clarity of the edge area.
[0289] In some embodiments, the adjustment module 2333 is further configured to determine the membership of the first image based on the clarity, wherein the membership represents the probability that the clarity belongs to a preset reference clarity set; determine the adjustment coefficient based on the membership; and adjust the first focus parameter according to the adjustment coefficient and the focus parameter step to obtain the second focus parameter, wherein the focus parameter step is the maximum value of the focus parameter of the image sensor's performance adjustment at one time, and the image sensor is used to capture the first image.
[0290] In some embodiments, the membership includes clear membership and fuzzy membership. The clear membership represents the probability that the clarity belongs to a preset reference clarity set in the clear dimension, and the fuzzy membership represents the probability that the clarity belongs to a preset reference clarity set in the fuzzy dimension. The adjustment module 2333 is also configured to obtain a preset reference clarity set, wherein the preset reference clarity set includes multiple reference clarity with different values; determine the ratio of the clarity to the maximum reference clarity in the preset reference clarity set as the clear membership; and determine the difference between the clear membership and the preset clarity as the fuzzy membership.
[0291] In some embodiments, the adjustment module 2333 is further configured to determine a first product of the clear membership and a first preset value; determine a second product of the fuzzy membership and a second preset value; determine a first sum of the first product and the second product; determine a second sum of the clear membership and the fuzzy membership; and determine a ratio of the first sum to the second sum as an adjustment coefficient.
[0292] In some embodiments, the adjustment module 2333 is further configured to call a pre-built parameter control model according to the adjustment coefficient and the focus parameter step size, adjust the first focus parameter, and obtain the second focus parameter.
[0293] In some embodiments, when the parameter control model is a linear regression model, before calling the pre-built parameter control model, the adjustment module 2333 is also configured to obtain an initialized linear regression model, the initialized linear regression model is used to determine the third product of the adjustment coefficient and the focus parameter step, determine the sum of the first focus parameter and the third product as the second focus parameter, wherein the adjustment coefficient is an unknown quantity; obtain multiple samples, wherein different samples include different combinations of the first focus parameter and the second focus parameter; substitute the multiple samples into the initialized linear regression model for solution to obtain the adjustment coefficient, substitute the adjustment coefficient into the initialized linear regression model to obtain the pre-built linear regression model.
[0294] In some embodiments, when the parameter control model is a pre-trained second machine learning model, before calling the pre-built parameter control model, the adjustment module 2333 is also configured to take the first focus parameter, the second focus parameter and the focus parameter step as data samples; take the adjustment coefficient as the true coefficient label; call the second machine learning model based on the image sample to perform prediction processing to obtain the predicted coefficient label; determine the coefficient loss value based on the true coefficient label and the predicted coefficient label, and update the parameters of the second machine learning model based on the coefficient loss value to obtain the trained second machine learning model.
[0295] In some embodiments, the adjustment module 2333 is further configured to perform feature extraction on the first image to obtain a feature vector of the first image; search the image database based on the feature vector of the first image, and use the reference feature vector with the highest similarity to the feature vector of the first image as the first target reference feature vector, wherein the image database includes reference feature vectors of specific parts in multiple pre-registered images; and use the pre-registered image corresponding to the first target reference feature vector as the image belonging to the same object as the first image.
[0296] In some embodiments, the adjustment module 2333 is further configured to grayscale the first image to obtain a first grayscale image; determine the grayscale value difference between any two adjacent pixels in the first grayscale image based on preset distance and direction parameters; count the number of occurrences of each grayscale value difference, and combine multiple numbers into a co-occurrence matrix; extract multiple texture features of the first image from the co-occurrence matrix; and combine the multiple texture features into a feature vector of the first image.
[0297] In some embodiments, after acquiring a second image including a specific part of the target object, the adjustment module 2333 is further configured to perform feature extraction on the second image to obtain a feature vector of the second image, and use the feature vector of the second image as the feature vector to be verified; search the image database based on the feature vector to be verified, and use the reference feature vector with the highest similarity to the feature vector to be verified as the second target reference feature vector, wherein the image database includes reference feature vectors of specific parts in multiple pre-registered images; and use the pre-registered image corresponding to the second target reference feature vector as the image belonging to the same object as the second image.
[0298] In some embodiments, the adjustment module 2333 is further configured to divide the second image into multiple image blocks; perform filtering operations on the multiple image blocks to obtain multiple partial feature vectors corresponding to the multiple image blocks; and splice the multiple partial feature vectors into a second feature vector of the second image.
[0299] In some embodiments, the adjustment module 2333 is further configured to convert the feature vector to be verified into a first string; convert multiple reference feature vectors into multiple second strings respectively, wherein the first string and the second string have the same length; determine the number of different characters in the same position of the first string and each second string as the similarity between the feature vector to be verified and the reference feature vector; and use the reference feature vector corresponding to the highest similarity as the second target reference feature vector.
[0300] In some embodiments, the adjustment module 2333 is further configured to divide the second image to obtain multiple first local images; perform feature extraction on the multiple first local images respectively to obtain multiple first local features; divide the pre-registered images in the image database to obtain multiple second local images; perform feature extraction on the multiple second local images respectively to obtain multiple second local features; for each first local feature, determine the local similarity between the first local feature and the corresponding second local feature; determine the sum of the multiple local similarities, determine the ratio of the sum to the number of the multiple first local images, use the ratio as the similarity between the second image and the pre-registered image, and use the pre-registered image with the highest similarity as the image belonging to the same object as the second image.
[0301] The present invention provides a computer program product including a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the image processing method described in the present invention.
[0302] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, which stores computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the image processing method provided by an embodiment of the present application, for example, the image processing method shown in FIG3A.
[0303] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0304] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0305] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, e.g., in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0306] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0307] In summary, the state of a specific part in the first image is detected by the embodiment of the present application. If the specific part is in motion when the first image is collected, the clarity of the specific part including the biometric feature is located by edge detection, and the first focus parameter used when the first image is used is adjusted according to the clarity to obtain the second focus parameter, so that the second image can be collected by the second focus parameter. This allows the focus parameter for the next collection to be adaptively adjusted in a timely manner according to the state of the specific part when the previous image was collected. The entire process does not require manual intervention, ensuring that a clear image can be collected even when the specific part is in motion, thereby improving the clarity of image collection. By using a second image with high clarity for image recognition to obtain a target image, the accuracy of image recognition is also improved, the time cost of repeated collection due to low image clarity is reduced, and the efficiency of image recognition is improved.
[0308] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. An image processing method, applied to an electronic device, comprising: Acquire a first image including a specific portion of a target object, wherein the first image is acquired based on a first focus parameter, and the specific portion includes a biological feature of the target object; detecting a state of the specific part when acquiring the first image; In response to the state of the specific part being a moving state, performing edge detection on the specific part in the first image to obtain an edge region of the specific part; detecting the clarity of the edge area; The first focus parameter is adjusted based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including the specific part of the target object.
2. The method according to claim 1, wherein When there are multiple first images and the multiple first images are continuous frame images, detecting the state of the specific part when the first images are acquired includes: Obtaining grayscale values of a plurality of pixels of the first image; Determine the difference between the grayscale values of every two consecutive pixels of the first image, and determine the absolute value of the difference; In response to the absolute values corresponding to the pixel points exceeding a preset proportion in the first image being greater than an absolute value threshold, it is determined that the specific part is in a motion state when the first image is acquired.
3. The method according to claim 1, wherein When the number of the first images is one, detecting the state of the specific part when the first image is acquired includes: Call the pre-trained first machine learning model to perform the following processing: extracting a feature vector of the first image; The feature vector is mapped into probabilities corresponding to different states, and the state corresponding to the maximum probability is determined as the state of the specific part when the first image is acquired.
4. The method according to claim 3, wherein: Before calling the pre-trained first machine learning model, the method further includes: Obtain the initialized first machine learning model; Acquire a plurality of image samples and true state labels of the plurality of image samples, wherein the image samples include specific parts of a sample object, the specific parts of the sample object include a biometric feature of the sample object, and the true state labels represent true states of the specific parts of the sample object; Calling the initialized first machine learning model to perform prediction processing based on the multiple image samples to obtain predicted state labels of the multiple image samples, wherein the predicted state labels represent the predicted states of specific parts of the sample objects; A state loss value is determined based on the true state label and the predicted state label, and the parameters of the initialized first machine learning model are updated based on the state loss value to obtain the pre-trained first machine learning model.
5. The method according to any one of claims 1 to 4, wherein: The performing edge detection on the specific portion in the first image to obtain an edge region of the specific portion includes: Identifying a bounding box of the specific part from the first image, and performing a cutout operation on the first image based on the bounding box to obtain a target image corresponding to the specific part; Performing a filtering operation on the target image to obtain a smoothed image; Determining gradient values and gradient directions of a plurality of pixel points in the smoothed image, wherein the gradient directions include positive gradient directions and negative gradient directions; Traverse the plurality of pixels in the smoothed image, and perform the following operations on the current pixel that has been traversed: Filtering out adjacent pixels of the current pixel that meet a filtering condition in the smoothed image, wherein the filtering condition includes: a gradient value of the current pixel is greater than a gradient value of the adjacent pixel in the positive gradient direction, and a gradient value of the current pixel is greater than a gradient value of the adjacent pixel in the negative gradient direction; An edge area of the specific part is determined based on the remaining pixel points after filtering.
6. The method according to claim 5, wherein: The determining the edge area of the specific part based on the remaining pixels after filtering includes: In response to the gradient values of the remaining pixels being greater than a strong edge gradient threshold, treating the remaining pixels as strong edge pixels, wherein the strong edge gradient threshold is used to identify strong edge pixels; In response to the gradient values of the remaining pixels being less than the strong edge gradient threshold and greater than the weak edge gradient threshold, the remaining pixels are regarded as weak edge pixels, wherein the weak edge gradient threshold is used to identify weak edge pixels; In response to the pixel points whose distance from the weak edge pixel point is less than a distance threshold including at least one of the strong edge pixel points, taking the weak edge pixel point as a target weak edge pixel point; The strong edge pixel points and the target weak edge pixel points are fitted into an edge region.
7. The method according to any one of claims 1 to 6, wherein: The detecting the clarity of the edge area includes: Determine the number of pixels included in the first image as a first number; Determining the number of the pixels included in the edge area as a second number; A ratio of the second number to the first number is determined as the clarity of the edge area.
8. The method according to any one of claims 1 to 7, wherein: The adjusting the first focus parameter based on the clarity to obtain a second focus parameter includes: determining a membership degree of the first image based on the definition, wherein the membership degree represents a probability that the definition belongs to a preset reference definition set; determining an adjustment coefficient based on the degree of membership; The first focus parameter is adjusted according to the adjustment coefficient and the focus parameter step to obtain a second focus parameter, wherein the focus parameter step is a maximum value of the focus parameter of a one-time performance adjustment of an image sensor, and the image sensor is used to capture the first image.
9. The method according to claim 8, wherein The membership includes a clear membership and a fuzzy membership, the clear membership represents the probability that the clarity belongs to the preset reference clarity set in the clear dimension, and the fuzzy membership represents the probability that the clarity belongs to the preset reference clarity set in the fuzzy dimension; The determining the membership of the first image based on the definition includes: Acquire the preset reference definition set, wherein the preset reference definition set includes a plurality of reference definitions with different values; determining a ratio of the definition to a maximum reference definition in the preset reference definition set as the definition membership; A difference between the clarity membership and a preset clarity is determined as the fuzzy membership.
10. The method according to claim 9, wherein: The determining of the adjustment coefficient based on the degree of membership includes: Determining a first product of the clarity membership and a first preset value; Determining a second product of the fuzzy membership and a second preset value; determining a first sum of the first product and the second product; determining a second sum of the sharp degree of membership and the fuzzy degree of membership; A ratio of the first sum to the second sum is determined as an adjustment coefficient.
11. The method according to any one of claims 8 to 10, wherein: The adjusting the first focus parameter according to the adjustment coefficient and the focus parameter step size to obtain a second focus parameter includes: According to the adjustment coefficient and the focus parameter step, a pre-built parameter control model is called to adjust the first focus parameter to obtain a second focus parameter.
12. The method according to claim 11, wherein When the parameter control model is a linear regression model, before calling the pre-built parameter control model, the method further includes: Obtaining an initialized linear regression model, wherein the initialized linear regression model is used to determine a third product of an adjustment coefficient and the focus parameter step size, and determining a sum of the first focus parameter and the third product as a second focus parameter, wherein the adjustment coefficient is an unknown quantity; Acquire a plurality of samples, wherein different samples include different combinations of the first focus parameter and the second focus parameter; Substituting the multiple samples into the initialized linear regression model to solve, obtaining the adjustment coefficient, substituting the adjustment coefficient into the initialized linear regression model to obtain a pre-built linear regression model.
13. The method according to claim 11, wherein When the parameter control model is a pre-trained second machine learning model, before calling the pre-built parameter control model, the method further includes: Taking the first focus parameter, the second focus parameter, and the focus parameter step as data samples; labeling the adjusted coefficient as the true coefficient; Calling the second machine learning model to perform prediction processing based on the image sample to obtain a prediction coefficient label; Determine the coefficient loss value based on the true coefficient label and the predicted coefficient label, and update the parameters of the second machine learning model based on the coefficient loss value to obtain the trained second machine learning model.
14. The method according to any one of claims 1 to 13, wherein: After acquiring the first image including the specific part of the target object, the method further includes: performing feature extraction on the first image to obtain a feature vector of the first image; searching an image database based on the feature vector of the first image, and using a reference feature vector having the highest similarity to the feature vector of the first image as a first target reference feature vector, wherein the image database includes reference feature vectors of the specific part in a plurality of pre-registered images; The pre-registered image corresponding to the first target reference feature vector is regarded as an image belonging to the same object as the first image.
15. The method according to claim 14, wherein The extracting features from the first image to obtain a feature vector of the first image includes: performing grayscale processing on the first image to obtain a first grayscale image; determining a grayscale value difference between any two adjacent pixels in the first grayscale image according to preset distance and direction parameters; Counting the number of occurrences of each gray value difference, and combining multiple of the numbers into a co-occurrence matrix; extracting a plurality of texture features of the first image from the co-occurrence matrix; The plurality of texture features are combined into a feature vector of the first image.
16. The method according to any one of claims 1 to 13, wherein: After acquiring the second image including the specific part of the target object, the method further includes: performing feature extraction on the second image to obtain a feature vector of the second image, and using the feature vector of the second image as a feature vector to be verified; Searching an image database based on the feature vector to be verified, and using a reference feature vector having the highest similarity to the feature vector to be verified as a second target reference feature vector, wherein the image database includes the reference feature vectors of the specific part in a plurality of pre-registered images; The pre-registered image corresponding to the second target reference feature vector is regarded as an image belonging to the same object as the second image.
17. The method according to claim 16, wherein The performing feature extraction on the second image to obtain a second feature vector of the second image includes: dividing the second image into a plurality of image blocks; Performing a filtering operation on the multiple image blocks to obtain multiple partial feature vectors corresponding to the multiple image blocks respectively; The multiple partial feature vectors are concatenated into a second feature vector of the second image.
18. The method according to claim 16, wherein The searching of the image database based on the feature vector to be verified and using the reference feature vector having the highest similarity to the feature vector to be verified as the second target reference feature vector includes: Converting the feature vector to be verified into a first character string; converting the plurality of reference feature vectors into a plurality of second character strings, respectively, wherein the first character string has the same length as the second character string; determining the number of different characters in the same position between the first character string and each of the second character strings as the similarity between the feature vector to be verified and the reference feature vector; The reference feature vector corresponding to the highest similarity is used as the second target reference feature vector.
19. The method according to any one of claims 1 to 13, wherein: After acquiring the second image including the specific part of the target object, the method further includes: dividing the second image to obtain a plurality of first partial images; Performing feature extraction on each of the plurality of first partial images to obtain a plurality of first partial features; Dividing the pre-registered image in the image database to obtain a plurality of second partial images; performing feature extraction on each of the plurality of second partial images to obtain a plurality of second partial features; For each of the first local features, determining a local similarity between the first local feature and the corresponding second local feature; Determine a sum of the multiple local similarities, determine a ratio of the sum to the number of the multiple first partial images, use the ratio as the similarity between the second image and the pre-registered image, and use the pre-registered image with the highest similarity as an image belonging to the same object as the second image.
20. An image processing device, comprising: an acquisition module configured to acquire a first image including a specific portion of a target object, wherein the first image is acquired based on a first focus parameter, and the specific portion includes a biological feature of the target object; a detection module configured to detect a state of the specific part when the first image is captured; in response to the state of the specific part being in motion, perform edge detection on the specific part in the first image to obtain an edge region of the specific part; and detect the clarity of the edge region; An adjustment module is configured to adjust the first focus parameter based on the clarity to obtain a second focus parameter, wherein the second focus parameter is used to replace the first focus parameter to capture a second image including the specific part of the target object.
21. An electronic device, comprising: a memory for storing computer-executable instructions; A processor, configured to implement the image processing method according to any one of claims 1 to 19 when executing the computer-executable instructions stored in the memory.
22. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein the computer-executable instructions or the computer program, when executed by a processor, implement the image processing method according to any one of claims 1 to 19.
23. A computer program product, comprising computer executable instructions or a computer program, wherein when the computer executable instructions or the computer program are executed by a processor, the image processing method according to any one of claims 1 to 19 is implemented.
Citation Information
Patent Citations
Image acquisition method and equipment
CN113709353A
Dynamic focusing method, device and equipment and readable storage medium
CN116744111A
Automatic focusing method and device, computer equipment and computer readable storage medium
CN116804788A
Focusing method, apparatus and device
WO2021168707A1
Cited By
Synchronous flaw detection method and system for inner ring and outer ring of bearing
CN121482019A