Face detection processing engine, shooting method and equipment involving face detection
By introducing a face detection processing engine into electronic devices and dynamically loading appropriate algorithms to process image sources, the resource waste and maintenance problems caused by closed-source chip platforms are solved, and processing efficiency and user experience are improved.
Patent Information
- Application Number
- CN202210930585.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-04
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-08-04
AI Technical Summary
The face detection function of existing electronic devices relies on closed-source chip platform modules, which results in low processing efficiency, waste of resources and power consumption, and is not conducive to equipment upgrades and maintenance.
Provides a face detection processing engine that dynamically loads different face detection algorithms through the algorithm plug-in management unit, processes the image source according to the shooting mode, reduces resource occupation, and improves processing efficiency and power consumption utilization.
It improves the processing efficiency and power consumption utilization of face detection, facilitates device upgrades and maintenance, and improves user experience.
Smart Images

Figure CN116052236B
Abstract
Description
Technical Field
[0001] The present application relates to the field of face detection technology, and in particular to a face detection processing engine, and a shooting method and device for face detection. Background Art
[0002] At present, the camera functions of electronic devices such as mobile phones are becoming more and more perfect, and users have higher and higher requirements for the camera experience. In order to better meet the needs of users, electronic devices support more and more shooting modes. Taking the shooting mode involving face detection as an example, the current method is based on the functional modules provided by the chip platform.
[0003] However, the face detection function module provided by the chip platform is closed source, so the application that implements the shooting cannot modify the calling logic, that is, it cannot choose which specific face detection steps to execute, and can only wait for the function module to execute all the face detection steps it provides in sequence before obtaining the detection result. This not only affects the processing efficiency, but also wastes the resources and power consumption of the electronic device. At the same time, the closed source form is not conducive to the electronic device manufacturers to upgrade and maintain the camera application. Summary of the invention
[0004] In order to solve the above-mentioned technical problems, the present application provides a face detection processing engine, a shooting method and a device involving face detection, aiming to provide a face detection processing engine. By modularly managing different face detection algorithms, different face detection algorithms can be loaded according to actual business needs such as shooting modes to process the collected image sources, thereby reducing the occupancy of device resources, and effectively improving the processing efficiency and power consumption. At the same time, face detection does not need to rely on the closed-source face detection function module provided by the chip platform, thereby facilitating manufacturers to upgrade and maintain camera applications.
[0005] In a first aspect, the present application provides a face detection processing engine. The face detection processing engine is arranged in a hardware abstraction layer of an electronic device, the electronic device having a camera, and comprising: an algorithm plug-in management unit, for determining a face detection algorithm corresponding to a shooting mode according to mode information and an algorithm rule table of a shooting mode corresponding to an image source acquired by the camera, wherein the algorithm rule table records a correspondence between each face detection algorithm and each shooting mode involving face detection; an algorithm processing unit, for loading a face detection algorithm determined by the algorithm plug-in management unit, and performing face detection on the image source according to the loaded face detection algorithm.
[0006] Therefore, by providing a face detection processing engine and utilizing the algorithm plug-in management unit in the face detection processing engine to manage different face detection algorithms / face detection sub-units, the face detection algorithm / face detection sub-unit determined by the parser from the algorithm rule table can be dynamically and flexibly loaded, so that the call of the face detection algorithm provided by the face detection processing engine can be edited, thereby improving the development and maintenance efficiency of the face detection processing engine.
[0007] In addition, by dynamically loading the face detection algorithm / face detection sub-unit suitable for the current scene and shooting mode, on-demand loading can be better implemented according to customer needs, providing a better user experience.
[0008] According to the first aspect, the face detection processing engine also includes: a public computing processing unit, the public computing processing unit includes at least one public computing processing sub-unit, and the public computing processing sub-unit encapsulates the same processing operations corresponding to different face detection algorithms; an algorithm processing unit, which is also used to transmit the image source to the public computing processing unit and inform the public computing processing unit of the face detection algorithm determined; the public computing processing unit, which is used to call the public computing processing sub-unit corresponding to the face detection algorithm, and the public computing processing sub-unit processes the image source; the public computing processing unit, which is also used to feed back the image source processed by the public computing processing sub-unit to the algorithm processing unit; the algorithm processing unit is also used to perform face detection on the processed image source according to the loaded face detection algorithm.
[0009] Therefore, by integrating a common computing processing unit in the face detection processing engine and utilizing the common computing processing unit to unify the same processing involved in each face detection link, the processing logic is greatly optimized, thereby achieving optimization in performance and power consumption.
[0010] According to the first aspect, or any implementation method of the first aspect above, the public computing processing unit includes a first public computing processing sub-unit and a second public computing processing sub-unit; the first public computing processing sub-unit encapsulates yuv2rgb processing operations and float2u8 processing operations; the second public computing processing sub-unit encapsulates resize processing operations, copy processing operations, and align processing operations; wherein, when the face detection algorithm is a face frame detection algorithm, a face tracking algorithm, or a face angle detection algorithm, the public computing processing unit calls the first public computing processing sub-unit to sequentially perform yuv2rgb processing operations and float2u8 processing operations on the image source; when the face detection algorithm is a face tracking algorithm or a face angle detection algorithm, the public computing processing unit calls the second public computing processing sub-unit to sequentially perform resize processing operations, copy processing operations, and align processing operations on the image source processed by the first public computing processing sub-unit.
[0011] The operations performed in each public computing processing sub-unit can be found in the following description and will not be elaborated here.
[0012] According to the first aspect, or any implementation method of the first aspect above, the face detection processing engine also includes: a parser; an algorithm plug-in management unit, which is also used to transmit mode information to the parser; a parser, which is used to parse the mode information provided by the algorithm plug-in management unit to determine the shooting mode corresponding to the mode information; the parser is also used to search the face detection algorithm corresponding to the shooting mode from the algorithm rule table, and feed back the determined face detection algorithm to the algorithm plug-in management unit.
[0013] According to the first aspect, or any implementation method of the first aspect above, the algorithm rule table is in XML format, or JS format, or TXT format, or Excel format; when the algorithm rule table is in XML format, the parser is an XML parser; when the algorithm rule table is in JS format, the parser is a JS parser; when the algorithm rule table is in TXT format, the parser is a TXTL parser; when the algorithm rule table is in Excel format, the parser is an Excel parser.
[0014] For the formats of different forms of algorithm rule tables, please refer to the following and will not be repeated here.
[0015] According to the first aspect, or any implementation of the first aspect above, the face detection processing engine also includes: an image source acquisition unit; an image source acquisition unit, used to receive the image source and mode information collected by the camera, and transmit the image source and mode information to the algorithm plug-in management unit.
[0016] According to the first aspect, or any implementation method of the first aspect above, the face detection processing engine also includes: a detection result output unit; a detection result output unit, which is used to receive the face detection result obtained by the algorithm processing unit by performing face detection on the image source according to the loaded face detection algorithm, and upload the face detection result and the image source captured by the camera to the application of the selected shooting mode.
[0017] According to the first aspect, or any implementation of the first aspect above, the face detection algorithm is any one or more of the following: a face frame detection algorithm, a face tracking algorithm, a face key point detection algorithm, a face angle detection algorithm, and a face expression detection algorithm.
[0018] It can be understood that based on the face detection processing engine provided by this application, units / modules that implement different face detection functions can be encapsulated according to business needs. By maintaining the algorithm rule table and uniformly managing the loading by the algorithm plug-in management engine, it can better adapt to various user needs.
[0019] According to the first aspect, or any implementation of the first aspect above, the face detection processing engine is integrated into the image engine.
[0020] In a second aspect, the present application provides a shooting method involving face detection. The method is applied to an electronic device that integrates the face detection processing engine of the first aspect and any implementation of the first aspect, the electronic device having a camera, including: displaying a first preview interface of a first application, the first preview interface including a shooting mode selection list, the shooting mode selection list including at least one shooting mode involving face detection; upon receiving a selection operation for a shooting mode involving face detection, determining a face detection algorithm corresponding to the shooting mode; loading the face detection algorithm, performing face detection on an image source collected by the camera in the shooting mode according to the loaded face detection algorithm, and obtaining a face detection result; reporting the image source and the face detection result to the first application.
[0021] The first application may be, for example, a camera application provided by the system, or may be an application provided by a third-party application developer that can call a camera to collect images. The following description will be made by taking the camera application as an example.
[0022] The first preview interface is, for example, an interface entered after the user starts the camera application, such as Figure 1b shown.
[0023] Among them, the shooting mode selection list, such as Figure 1b The shooting mode list 103 in FIG.
[0024] Among them, the shooting modes involving face detection include, for example, the face mode and smile shooting mode mentioned below, as well as the shooting mode A and shooting mode B illustrated in each embodiment.
[0025] According to the second aspect, determining the face detection algorithm corresponding to the shooting mode includes: searching the face detection algorithm corresponding to the shooting mode from an algorithm rule table, wherein the algorithm rule table records the correspondence between each face detection algorithm and each shooting mode involving face detection.
[0026] According to the second aspect, or any implementation method of the second aspect above, face detection is performed on the image source collected by the camera in the shooting mode according to the loaded face detection algorithm, including: processing the image source according to the public computing processing subunit corresponding to the face detection method; performing face detection on the processed image source according to the loaded face detection algorithm.
[0027] According to the second aspect, or any implementation method of the second aspect above, the face detection algorithm is a face frame detection algorithm; according to the public computing processing subunit corresponding to the face detection method, the image source is processed, including: determining that the public computing processing subunit corresponding to the face frame detection method is the first public computing processing subunit; processing the image source according to the first public computing processing subunit to obtain a first image source.
[0028] The first image source is, for example, the image source A' mentioned below.
[0029] According to the second aspect, or any implementation of the second aspect above, face detection is performed on the processed image source according to the loaded face detection algorithm, including: performing face frame detection on the first image source according to the loaded face frame detection algorithm.
[0030] According to the second aspect, or any implementation method of the second aspect above, the face detection algorithm is a face tracking algorithm; according to the public computing processing subunit corresponding to the face detection method, the image source is processed, including: determining that the public computing processing subunit corresponding to the face tracking algorithm is a first public computing processing subunit and a second public computing processing subunit; processing the image source according to the second public computing processing subunit to obtain a second image source; processing the second image source according to the second public computing processing subunit to obtain a third image source.
[0031] The second image source may be, for example, the image source B' mentioned below, and the third image source may be, for example, the image source B" mentioned below.
[0032] According to the second aspect, or any implementation of the second aspect above, performing face detection on the processed image source according to the loaded face detection algorithm includes: performing face tracking on the third image source according to the loaded face tracking algorithm.
[0033] According to the second aspect, or any implementation of the second aspect above, the face detection algorithm is a face frame detection algorithm and a face tracking algorithm; the public computing processing subunit corresponding to the face frame detection method is determined to be the first public computing processing subunit; the image source is processed according to the first public computing processing subunit to obtain the first image source; the public computing processing subunit corresponding to the face tracking algorithm is determined to be the first public computing processing subunit and the second public computing processing subunit; the first image source is processed according to the second public computing processing subunit to obtain the third image source.
[0034] According to the second aspect, or any implementation of the second aspect above, face detection is performed on the processed image source according to the loaded face detection algorithm, including: performing face frame detection on the first image source according to the loaded face frame detection algorithm; and performing face tracking on the third image source according to the loaded face tracking algorithm.
[0035] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0036] In a third aspect, the present application provides an electronic device. The electronic device includes: a camera, a memory, a processor, and a face detection processing engine in the first aspect or any possible implementation of the first aspect, the memory and the processor are coupled, and the face detection processing engine is set in a hardware abstraction layer; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes instructions of the method in the second aspect or any possible implementation of the second aspect.
[0037] The third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect, and the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the third aspect and any implementation of the third aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, and the technical effects corresponding to the second aspect and any implementation of the second aspect, which will not be repeated here.
[0038] In a fourth aspect, the present application provides a computer-readable medium for storing a computer program, wherein the computer program includes instructions for executing the method in the second aspect or any possible implementation of the second aspect.
[0039] The fourth aspect and any implementation of the fourth aspect correspond to the first aspect and any implementation of the first aspect, and the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, and the technical effects corresponding to the second aspect and any implementation of the second aspect, which will not be repeated here.
[0040] In a fifth aspect, the present application provides a computer program comprising instructions for executing the method in the second aspect or any possible implementation of the second aspect.
[0041] The fifth aspect and any implementation of the fifth aspect correspond to the first aspect and any implementation of the first aspect, and the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, and the technical effects corresponding to the second aspect and any implementation of the second aspect, which will not be repeated here.
[0042] In a sixth aspect, the present application provides a chip, the chip comprising a processing circuit and a transceiver pin, wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the method in the second aspect or any possible implementation of the second aspect to control the receiving pin to receive a signal and control the sending pin to send a signal.
[0043] The sixth aspect and any implementation of the sixth aspect correspond to the first aspect and any implementation of the first aspect, and the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the sixth aspect and any implementation of the sixth aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, and the technical effects corresponding to the second aspect and any implementation of the second aspect, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1a , Figure 1b A schematic diagram of an application scenario is shown as an example;
[0045] Figure 2aThe figure is a schematic diagram of a processing flow of a shooting mode involving face detection;
[0046] Figure 2b The figure is a schematic diagram showing another processing flow of a shooting mode involving face detection;
[0047] Figure 3 A schematic diagram showing the source of an algorithm rule table used in a photographing method involving face detection provided in an embodiment of the present application;
[0048] Figure 4a The figure is a schematic diagram of a processing flow of a shooting mode involving face detection according to a shooting method involving face detection provided in an embodiment of the present application;
[0049] Figure 4b The figure is a schematic diagram of a processing flow of another shooting mode involving face detection based on the shooting method involving face detection provided in an embodiment of the present application;
[0050] Figure 5 is a schematic diagram of the hardware structure of an electronic device shown as an example;
[0051] Figure 6 A schematic diagram of the software structure of an electronic device is shown as an example;
[0052] Figure 7 A schematic diagram of functional modules of a face detection processing engine involved in a photographing method involving face detection provided in an embodiment of the present application is exemplarily shown;
[0053] Figure 8 For Figure 7 The face detection processing engine shown in the figure exemplifies the interaction diagram between the algorithm plug-in management unit and the parser and the algorithm rule table;
[0054] Fig. 9 is a schematic diagram of a common computing processing unit in a face detection engine shown as an example;
[0055] Fig.10 A schematic diagram of functional modules of a face detection processing engine involved in a photographing method involving face detection provided in an embodiment of the present application is exemplarily shown;
[0056] Fig.11 A schematic diagram of vertical interaction of various functional modules involved in implementing the photographing method involving face detection provided in an embodiment of the present application is exemplified;
[0057] Fig.12 A timing diagram of a photographing method involving face detection provided by an embodiment of the present application is exemplarily shown;
[0058] Fig.13 A schematic diagram of an application scenario is shown as an example;
[0059] Fig.14 The present invention is a timing diagram of another shooting method involving face detection provided by an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0062] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0063] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0064] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0065] Photographing is one of the common application scenarios of electronic devices such as mobile phones. As users have higher and higher requirements for the experience of taking photos with mobile phones, the camera function of mobile phones is becoming more and more perfect. The following uses mobile phones as an example to explain the camera function of electronic devices.
[0066] Figure 1a A mobile phone interface is shown as an example. Figure 1a, the mobile phone interface displays multiple application icons, such as a camera application icon 101, a gallery application icon 102, etc. In some implementations, such as Figure 1a The mobile phone interface shown can be called the main interface. When the user clicks the camera application icon 101 in the interface, the camera application can be used to realize the shooting function.
[0067] Continue to refer to Figure 1a For example, when the user clicks the camera application icon 101, the mobile phone responds to the user operation, identifies the control corresponding to the user's click operation as the control of the camera application, and then calls the corresponding interface in the application framework layer to start the camera application, and starts the camera driver by calling the kernel layer, and collects images through the camera. At this time, the mobile phone displays the interface of the camera application, such as Figure 1b The mobile phone interface shown.
[0068] As the camera function of mobile phones improves, the camera application supports more and more shooting modes. For example, the shooting mode may include aperture mode, smile capture mode, portrait mode, normal shooting mode (hereinafter referred to as: shooting mode), video mode, professional mode, etc. Figure 1b When the user clicks on the icon option corresponding to a shooting mode, the mobile phone displays the camera application interface in the corresponding shooting mode. For example, if the user clicks on the icon option 1031 of the photo mode, the mobile phone displays the interface of the camera application in the photo mode. Figure 1b shown.
[0069] It should be noted that, in some embodiments, after the mobile phone starts the camera application, the camera application turns on the photo mode by default, that is, the photo mode is the default shooting mode of the camera application.
[0070] Continue to see Figure 1b For example, the display interface corresponding to the photo mode may include one or more controls, including but not limited to: a photo mode list 103, a preview window 104, a function option list 105, a shutter control 106, a front and rear camera switching control 107, and a picture viewing control 108.
[0071] The preview window 104 can display the image captured by the camera in real time. The shutter control 106 can monitor the user operation that triggers the photo shooting, that is, when the mobile phone detects the user operation acting on the shutter control 106, it will respond to the operation to take a photo and store the captured image in the gallery application.
[0072] For example, in some implementations, when a user wants to view a captured image, the user may click the control 108 to open a gallery application and view the captured image.
[0073] For example, in some other implementations, when the user wants to view the captured image, he can also click Figure 1a Open the gallery application by clicking the icon of the gallery application in the interface shown in the figure, and then view the captured images.
[0074] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0075] Continue to see Figure 1b For example, the function options list 105 displays the function options supported in the shooting mode, such as a flash function, an AI (Artificial Intelligence) function, a setting function, and the like.
[0076] Continue to see Figure 1b For example, when the user clicks the shutter control 106, the mobile phone will detect the user operation on the shutter control 106, and then take a photo in response to the operation.
[0077] In addition, it should be noted that in order to make the people in the photos more beautiful, the portrait mode of some electronic devices currently supports beauty settings.
[0078] For example, in some implementations, when a user clicks Figure 1b After selecting the icon option 1031 of the photo mode in the image processing, you can swipe from the left side of the screen to the right, or swipe from the right side of the screen to the left to enter the beauty setting interface. Follow the prompts on the screen to take personal photos of the front, side and head down, and then set various beauty parameters. After completing the settings, click the corresponding save control to save the set beauty parameters. After the user selects the portrait mode and clicks the shutter control 106, the portrait in the captured image can be beautified according to the set beauty parameters.
[0079] In addition, it should be noted that the above-mentioned smile capture mode is implemented in that when the user points at the object to be photographed and presses the shutter, the camera application will automatically detect the smile and take the photo.
[0080] It can be seen that whether it is portrait mode or smile shooting mode, its implementation is based on the face detection function. That is, if you want to achieve smile shooting and beautify the portraits taken in portrait mode, you need to detect the face first (face detection).
[0081] Regarding face detection, in some implementations, it can be refined into face frame detection, face tracking, face key point detection, face angle detection, face attributes (such as expression, the smile shooting mentioned above requires smile detection), etc., which will not be listed one by one here, and this embodiment does not limit this.
[0082] In practical applications, the face detection process is essentially different depending on the shooting mode. For example, for the smile shooting mode mentioned above, face frame detection is required, and then the face attributes of the face in the face frame are detected, specifically the smile expression detection; for the portrait mode with beauty parameters set, face frame detection, face angle detection, face key point detection, etc. are required.
[0083] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0084] In some existing implementations, the shooting mode involves a face detection link, and the face detection function is specifically implemented with the help of a face detection function module (hereinafter referred to as a third-party face detection algorithm processing module) provided by the chip platform used by the electronic device. However, since the third-party face detection algorithm processing mode is provided by the chip platform, it is closed source, and other application developers and electronic device manufacturers cannot see the internal implementation logic, nor can they modify the internal interface call logic, that is, they cannot choose which specific face detections to perform, such as performing one or more of face frame detection, face tracking, face key point detection, face angle detection, and face attributes. The only way is to wait for the third-party face detection algorithm processing module to sequentially execute all the face detection processes it provides, such as face frame detection, face tracking, face key point detection, and face angle detection, before obtaining the detection results.
[0085] In order to better understand the above-mentioned processing flow of face detection on captured images based on the third-party face detection algorithm processing module, the following is combined with Figure 2a , Figure 2b Provide explanation.
[0086] For example, in Figure 2a , Figure 2b In the scenario shown, it is assumed that the face detection algorithm integrated by the third-party face detection algorithm processing module is called in the following order: face frame detection algorithm, face tracking algorithm, face key point detection algorithm, and face angle detection algorithm. Figure 2a In the scene shown, the shooting mode selected by the user is a shooting mode that only requires face frame detection (hereinafter referred to as shooting mode A for easy distinction); Figure 2bIn the scene shown, the shooting mode selected by the user is a shooting mode that requires face frame detection and face tracking (hereinafter referred to as shooting mode B for easy distinction).
[0087] See also Figure 2a In shooting mode A, when the image data collected by the camera (hereinafter referred to as the image source) reaches the third-party detection node, such as the camera hardware abstraction layer in the hardware abstraction layer (HAL), the camera hardware abstraction layer will transmit the image source to the closed-source and invisible third-party face detection algorithm processing module provided by the chip platform. At this time, the third-party face detection algorithm processing module will perform face frame detection, face tracking detection, face key point detection, and face angle detection on the image source in sequence. After completing the last link (face angle detection), it will generate a face information detection result, and then transmit the generated face detection result to the upper-level application, such as the camera application.
[0088] Continue to see Figure 2a ,Since the third-party face detection algorithm processing module calls the face frame detection algorithm, face tracking algorithm, face key point detection algorithm, and face angle detection algorithm in sequence, and performs face frame detection, face tracking detection, face key point detection, and face angle detection, the final face information result includes the face frame detection result, face tracking result, face key point detection result, and face angle result.
[0089] However, shooting mode A actually only needs to perform face frame detection. Figure 2a The illustrated processing flow of performing face detection on the captured image based on the third-party face detection algorithm processing module involves the face detection link that is not concerned with shooting mode A, thereby affecting the processing efficiency. At the same time, since the generated face information detection result also includes other detection results in addition to the face frame detection result, when the camera application performs face frame marking on the image source according to the face information detection result, it is also necessary to filter other interference information, thereby causing a waste of device resources and power consumption.
[0090] See also Figure 2b In shooting mode B, when the image source collected by the camera reaches the third-party detection node, that is, the closed-source invisible third-party face detection algorithm processing module provided by the chip platform, the third-party face detection algorithm processing module will perform face frame detection, face tracking detection, face key point detection, and face angle detection on the image source in sequence. After completing the last link (face angle detection), the face information detection result will be generated, and then the generated face detection result will be transmitted to the upper-level application, such as the camera application, that is, the execution is performed with Figure 2aThe same face detection process as the shooting scene A shown generates face information detection results including the same types, such as face frame detection results, face tracking results, face key point detection results and face angle results.
[0091] However, shooting mode B actually only needs to perform face frame detection and face tracking detection. Figure 2b The illustrated processing flow of performing face detection on the captured image based on the third-party face detection algorithm processing module involves the face detection link that is not concerned with shooting mode B, thereby affecting the processing efficiency. At the same time, since the generated face information detection result also includes other detection results in addition to the face frame detection result and the face tracking result, the camera application needs to filter other interference information when performing face frame annotation and face tracking frame standard on the image source according to the face information detection result, thereby causing a waste of device resources and power consumption.
[0092] From the description of the above two scenarios, it can be seen that the current processing flow of face detection on the captured image based on the third-party face detection algorithm processing module, no matter which face detection link the shooting mode selected by the user corresponds to, the image source collected by the camera is transmitted to the third-party face detection node, and the closed-source invisible third-party face detection algorithm processing module performs face detection, face frame detection, face tracking, face key point detection, and face angle detection, and then outputs the face information detection result including the face detection frame result, face tracking result, face key point detection result, and face angle result, that is, all face detection processes provided by the third-party face detection algorithm processing module are executed according to the same calling logic, and then the detection results corresponding to each detection link are output. In this way, not only the processing efficiency is affected, but also the resources and power consumption of the electronic device are wasted. At the same time, the closed-source form is not conducive to the electronic device manufacturers to upgrade and maintain the camera application.
[0093] In view of this, in order to solve the above problems, the embodiment of the present application provides a shooting solution involving face detection. In this solution, by encapsulating a face detection processing engine at the same level as the face detection function module provided by the chip platform, in the face detection processing engine, by modularizing different face detection algorithms, different face detection algorithms can be loaded according to actual business needs such as shooting modes to process the collected image source, which can reduce the occupation of device resources and improve processing efficiency and power consumption.
[0094] Specifically, in the technical solution provided in the embodiment of the present application, the shooting method involving face detection can be applied to an electronic device equipped with a camera that can acquire the above-mentioned image source. The electronic device can be, for example, a mobile phone, a tablet computer, a desktop computer, a handheld computer, a notebook computer (laptop), an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an augmented reality (AR)\virtual reality (VR) device, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.
[0095] For the convenience of description, taking the electronic device as a mobile phone as an example, the shooting method involving face detection provided in the embodiment of the present application is described in detail in combination with the following drawings.
[0096] See also Figure 3 , is a business scenario example diagram provided by the embodiment of the present application. Figure 3 As shown, the developer can upload the algorithm rule table to the cloud through the terminal device 200, and on this basis, the electronic device 100 can download the algorithm rule table from the cloud. Among them, the algorithm rule table may include multiple face detection algorithms, such as face frame detection algorithm, face tracking algorithm, face key point detection algorithm, face angle detection algorithm, face label detection algorithm, etc., and the shooting mode corresponding to each face detection algorithm.
[0097] In addition, in order to achieve modular management, different face detection algorithms can also be encapsulated into different face detection submodules / units (hereinafter represented by subunits), and then the face detection subunit corresponding to each face detection algorithm is recorded.
[0098] Exemplarily, an algorithm rule table recording all the above correspondences is taken as an example, and its format is such as Table 1.
[0099] Table 1 Algorithm rules table
[0100]
[0101] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0102] In addition, if different face detection algorithms are also associated with actual application scenarios, the application scenarios corresponding to each face detection algorithm may also be recorded.
[0103] Exemplarily, taking the algorithm rule table that records the application scenarios as an example, its format is such as Table 2.
[0104] Table 2 Algorithm rules table
[0105]
[0106] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0107] In addition, it should be noted that the specific format and type of the algorithm rule table are not limited in this embodiment. In practical applications, the algorithm rule table can be processed into various forms such as Extensible Markup Language (XML) (as shown in Table 1 and Table 2), text format (TXT), Excel table, JavaScript (a lightweight, interpreted or just-in-time compiled programming language with function priority, JS), etc. according to business needs.
[0108] Furthermore, the algorithm rule table may also specify the execution order of the face detection algorithm corresponding to each group of shooting modes, taking TXT format and XML format as examples.
[0109] For a certain shooting mode, such as the normal shooting mode mentioned above, the face detection algorithm (node) involved and the sequence are in the algorithm rule table in TXT format, which can be expressed as follows:
[0110] Scene: Normal photo mode
[0111] Source node subnode: Public preprocessing node
[0112] Public preprocessing node subnode: face frame detection node
[0113] Face frame detection node subnode: face tracking node
[0114] Face tracking node subnode: smile detection node
[0115] Smile detection node child node: tail node
[0116] For another shooting mode, such as the portrait mode mentioned above, the face detection algorithm (nodes) involved and the sequence are in the algorithm rule table in TXT format, which can be expressed as follows:
[0117] Scene: Portrait mode
[0118] Source node subnode: Public preprocessing node
[0119] Public preprocessing node subnode: face frame detection node
[0120] Face frame detection node subnode: face tracking node
[0121] Face tracking node subnode: face angle detection node
[0122] Face tracking node subnode: face key point detection node
[0123] It should be noted that, in the algorithm rule table in TXT format, the source node mentioned above may be, for example, the image source acquisition unit mentioned below, and the public preprocessing node mentioned above may be, for example, a subunit corresponding to the public calculation processing unit mentioned below.
[0124] In addition, it should be noted that the face frame detection mentioned in this embodiment can also be directly expressed as face detection in practical applications.
[0125] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0126] For the normal camera mode and the portrait mode, the face detection algorithms (nodes) involved and their sequence are in the algorithm rule table in XML format, which can be expressed as follows:
[0127]
[0128]
[0129] Each child node can be used as the source node of the next child node.
[0130] It should be understood that the above description is only an example for better understanding the technical solution of this embodiment, and is not the only limitation to this embodiment. Specifically in this embodiment, the XML format is taken as an example.
[0131] In addition, the electronic device 100 may also upload the data it generates to the cloud, so that the cloud can perform big data analysis on the data uploaded by each electronic device 100 to update the algorithm rule table. In addition, the electronic device 100 and the terminal device 200 may also be directly connected to obtain the corresponding data. It should be noted that after the terminal device 200 uploads the algorithm rule table to the cloud, it may also modify the uploaded algorithm rule table.
[0132] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0133] It should be noted that the algorithm rule table mentioned above can be preset in a storage area specified by the electronic device in some implementations, or can be integrated into a face detection node for performing face detection in the embodiment of the present application (hereinafter referred to as: face detection processing engine). Specifically in this embodiment, the algorithm rule table obtained in the above manner is integrated into the face detection processing engine as an example.
[0134] Specifically, in this embodiment, when the face detection processing engine receives photo-taking requests triggered by different shooting modes and application scenarios, it can determine the face detection algorithms corresponding to different shooting modes and application scenarios based on the algorithm rule table, thereby loading different face detection algorithms based on actual business needs, and then only using the loaded face detection algorithm to process the collected image source.
[0135] In order to better understand the above-mentioned processing flow of face detection on a captured image based on the face detection processing engine provided by the present application, the following is combined with Figure 4a , Figure 4b Provide explanation.
[0136] For example, in Figure 4a , Figure 4b In the scenario shown, the face detection algorithms integrated in the face detection processing engine include face frame detection algorithm, face tracking algorithm, face key point detection algorithm, face angle detection algorithm, and face expression detection algorithm, and each face detection algorithm encapsulation corresponds to a face detection sub-unit, such as the face frame detection algorithm corresponds to the face frame sub-unit, the face tracking algorithm corresponds to the face tracking sub-unit, the face key point detection algorithm corresponds to the face key point sub-unit, the face angle detection algorithm corresponds to the face angle sub-unit, and the face expression detection algorithm corresponds to the face attribute sub-unit. Figure 4a In the scene shown, the shooting mode selected by the user is shooting mode A which only needs to perform face frame detection. Figure 4b In the scene shown, the shooting mode selected by the user is shooting mode B which requires face frame detection and face tracking.
[0137] See also Figure 4a In shooting mode A, when the image source collected by the camera reaches the face detection node of the present applicant, specifically the face detection processing engine integrated into the HAL layer, the face detection processing engine will determine the face detection algorithm / face detection subunit corresponding to the shooting mode A according to the above-mentioned algorithm rule table, and then load the face frame detection algorithm corresponding to the shooting mode A or directly call the face frame subunit corresponding to the face frame detection algorithm to perform face frame detection on the image source. After completing the face frame detection, the face frame detection result will be transmitted to the upper-level application, such as the camera application, as the face information detection result.
[0138] Continue to see Figure 4a In shooting mode A, based on the face detection processing engine provided by the present application, it is only necessary to load the face frame detection algorithm or directly call the face frame subunit corresponding to the face frame detection algorithm to perform face frame detection on the image source. The entire processing flow does not involve other face detection links that shooting mode A does not pay attention to, such as face tracking, face key point detection, face angle detection, face expression detection, etc., thereby ensuring the processing efficiency of the image source, that is, being able to quickly complete the processing required for the image source under shooting mode A. At the same time, since the generated face information detection result only includes the face frame detection result that shooting mode A pays attention to, the camera application does not need to perform the processing of filtering out interference information when annotating the face frame of the image source according to the face information detection result, which effectively improves the utilization rate of device resources and power consumption.
[0139] See also Figure 4b In shooting mode B, when the image source collected by the camera reaches the face detection processing engine, the face detection processing engine will determine the face detection algorithm / face detection subunit corresponding to shooting mode B according to the above-mentioned algorithm rule table, and then load the face frame detection algorithm and face tracking algorithm corresponding to shooting mode B, or directly call the face frame subunit corresponding to the face frame detection algorithm and the face tracking subunit corresponding to the face tracking algorithm to perform face frame detection and face tracking on the image source. After completing the face frame detection and face tracking, the face frame detection result and the face tracking result will be transmitted to the upper-level application, such as the camera application, as the face information detection result.
[0140] Continue to see Figure 4b In shooting mode B, based on the face detection processing engine provided by the present application, it is only necessary to load the face frame detection algorithm, the face tracking algorithm or directly call the face frame subunit corresponding to the face frame detection algorithm and the face tracking subunit corresponding to the face tracking algorithm to perform face frame detection on the image source. The entire processing flow does not involve other face detection links that shooting mode B does not pay attention to, such as face key point detection, face angle detection, face expression detection, etc., thereby ensuring the processing efficiency of the image source, that is, being able to quickly complete the processing required for the image source under shooting mode B. At the same time, since the generated face information detection results only include the face frame detection results and face tracking results that shooting mode B pays attention to, the camera application does not need to perform the processing of filtering out interference information when performing face frame annotation and face tracking frame standard on the image source according to the face information detection results, which effectively improves the utilization rate of device resources and power consumption.
[0141] From the description of the above two scenarios, it can be seen that by encapsulating a face detection processing engine at the same level as the face detection function module provided by the chip platform, the face detection function module provided by the chip platform can be skipped when performing face detection on an image, which greatly facilitates manufacturers to upgrade and maintain camera applications.
[0142] In addition, in the technical solution provided in the embodiment of the present application, in the face detection processing engine, different face detection algorithms are managed modularly, so that different face detection algorithms can be loaded according to actual business needs such as shooting modes to process the collected image sources, which can not only reduce the occupancy of device resources, but also improve processing efficiency and power consumption utilization.
[0143] In order to better understand the technical solution provided by the embodiments of the present application, Figure 5 and Figure 6 Introduce the hardware structure and software structure of electronic equipment.
[0144] See also Figure 5 The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0145] Exemplarily, in some implementations, the sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc., which are not listed one by one here and the present application does not limit this.
[0146] In addition, it should be noted that the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0147] It is understandable that the controller may be the nerve center and command center of the electronic device 100. In practical applications, the controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0148] In addition, it should be noted that a memory may be provided in the processor 110 for storing instructions and data. In some implementations, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0149] Exemplarily, in some implementations, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0150] Continue to see Figure 5 Exemplarily, the charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging implementations, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging implementations, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0151] Continue to see Figure 5 Exemplarily, the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other implementations, the power management module 141 can also be set in the processor 110. In other implementations, the power management module 141 and the charging management module 140 can also be set in the same device.
[0152] Continue to see Figure 5, exemplarily, the wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0153] It should be noted that antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other implementations, the antenna can be used in combination with a tuning switch.
[0154] Continue to see Figure 5 , exemplarily, the mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some implementations, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some implementations, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0155] In addition, it should be noted that the modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some implementations, the modem processor may be an independent device. In other implementations, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0156] Continue to see Figure 5Exemplarily, the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0157] Specifically, in the technical solution provided in the embodiment of the present application, the electronic device 100 can communicate with a cloud server or other servers through the mobile communication module 150 or the wireless communication module 160. For example, the cloud can be a server cluster composed of multiple servers.
[0158] In addition, it is understandable that the cloud server or other server mentioned above, for example, Figure 3 The cloud for providing the algorithm rule table required in the technical solution provided in the embodiment of the present application is shown. Regarding the source of the algorithm rule table stored in the cloud and the interaction with the electronic device 100, please refer to the above, which will not be repeated here.
[0159] In addition, it should be noted that the electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0160] Continue to see Figure 5, exemplarily, the display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some implementations, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0161] In addition, it should be noted that the electronic device 100 can achieve a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0162] In addition, it should be noted that the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some implementations, the ISP can be set in the camera 193.
[0163] In addition, it should be noted that the camera 193 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some implementations, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0164] In addition, it should be noted that the digital signal processor is used to process digital signals, and can process other digital signals in addition to digital image signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0165] In addition, it should be noted that the video codec is used to compress or decompress digital video. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0166] Continue to see Figure 5 Exemplarily, the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.
[0167] Continue to see Figure 5 , exemplarily, the internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0168] Specifically in the technical solution provided in the embodiment of the present application, the above-mentioned algorithm rule table can be pre-placed in the internal memory 121 of the electronic device 100, or can be directly loaded into the above-mentioned face detection processing engine.
[0169] In addition, it should be noted that the electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0170] In addition, it should be noted that the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some implementations, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0171] Continue to see Figure 5 For example, the key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0172] Continue to see Figure 5 , exemplarily, motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0173] Continue to see Figure 5 , exemplarily, the indicator 192 can be an indicator light, which can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0174] The hardware structure of the electronic device 100 is introduced here. It should be understood that: Figure 5 The electronic device 100 shown is only an example. In a specific implementation, the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have a different component configuration. Figure 5 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0175] For a better understanding Figure 5 The software structure of the electronic device 100 is shown, and the software structure of the electronic device 100 is described below. Before describing the software structure of the electronic device 100, the architecture that can be adopted by the software system of the electronic device 100 is first described.
[0176] Specifically, in actual applications, the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
[0177] In addition, it is understandable that the software systems used by the current mainstream electronic device 100 include but are not limited to Windows system, Android system and iOS system. For the sake of convenience, the embodiment of the present application takes the layered architecture Android system as an example to exemplify the software structure of the electronic device 100.
[0178] In addition, the subsequent shooting method involving face detection provided in the embodiments of the present application is also applicable to other systems in specific implementations.
[0179] See also Figure 6 , which is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0180] like Figure 6 As shown, the layered architecture of the electronic device 100 divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some implementations, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. However, there is also a HAL layer between the kernel layer and the system library. The self-developed packaged face detection processing engine in this embodiment is integrated in the HAL layer, so Figure 6 The HAL layer is also shown in the illustrated Android system architecture.
[0181] The application layer may include a series of application packages. Figure 6 As shown, the application package may include camera, settings, maps, WLAN, Bluetooth, gallery, music and other applications, which are not listed here one by one and are not limited in this application.
[0182] Specifically in this embodiment, the operation of triggering the face detection processing engine to perform face detection processing on the image source is, for example, the user opens a camera application and selects a shooting mode involving face detection provided by the camera application.
[0183] It should be understood that the above description is only an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the only limitation to this embodiment. In practical applications, the operation of triggering the face detection processing engine to perform face detection processing on the image source may also be an operation in which the user opens other cameras that require the use of electronic devices to collect image sources and performs face detection processing on the image sources.
[0184] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. In some implementations, these programming interfaces and programming frameworks can be described as functions. Figure 6 As shown, the application framework layer may include functions such as a window manager, a content provider, a resource manager, a notification manager, a view system, and a camera service, which are not listed one by one here and are not limited in this application.
[0185] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0186] The content provider is used to store and obtain data and make the data accessible to the application. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc., which are not listed here and are not limited by this application.
[0187] The resource manager provides various resources for the application, such as localized strings, icons, images, layout files, video files, etc., which are not listed here one by one and are not limited in this application.
[0188] The notification manager enables applications to display notification information in the status bar, which can be used to convey informational messages and disappear automatically after a short stay without user interaction.
[0189] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0190] The camera service is used to call the camera (including the front camera and / or the rear camera) in response to the application's request. Specifically in this embodiment, the camera service is used to respond to a request initiated by any application that calls the camera for image acquisition, such as the request initiated by the camera application mentioned above, and then call the camera for image acquisition according to the request to obtain image sources corresponding to different shooting modes.
[0191] Continue to see Figure 6 ,AndroidRuntime includes core libraries and virtual machines. AndroidRuntime is responsible for the scheduling and management of the Android system.
[0192] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0193] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0194] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0195] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0196] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0197] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0198] It can be understood that the 2D graphics engine mentioned above is a drawing engine for 2D drawing.
[0199] Continue to see Figure 6 , the HAL layer is an interface layer between the operating system kernel and the hardware circuit. The HAL layer includes but is not limited to: the audio hardware abstraction layer (Audio HAL) and the camera hardware abstraction layer (Camera HAL). Among them, the Audio HAL is used to process the audio stream, for example, to perform noise reduction, directional enhancement and other processing on the audio stream, and the Camera HAL is used to process the image stream, for example, the third-party face detection algorithm module provided by the chip platform performs face detection processing on the image stream.
[0200] In addition, it should be noted that, specifically in this embodiment, the HAL layer also includes the face detection processing engine provided by this application. The implementation logic of the face detection engine is detailed below and will not be repeated here.
[0201] In addition, it is understandable that the kernel layer in the Android system is a layer between hardware and software. The kernel layer includes at least a display driver, a camera driver, a microphone driver, a sensor driver, a Bluetooth driver, etc. Exemplarily, the camera driver can be used to transmit the image source collected by the camera to the face detection processing engine encapsulated in the technical solution provided in the embodiment of the present application, and the face detection processing engine loads the face detection algorithm or functional module suitable for the current image source to perform face detection, thereby obtaining the face detection result.
[0202] The software structure of the electronic device 100 is introduced here. It can be understood that: Figure 6 The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.
[0203] Regarding the above, the self-developed, encapsulated, and editable face detection processing engine of the embodiment of the present application may specifically include an image source acquisition unit, an algorithm plug-in management unit, a parser, an algorithm rule table, an algorithm processing unit, and a detection result output unit.
[0204] The image source acquisition unit is used to receive the image source collected by the camera and the mode information corresponding to the shooting mode selected by the user, and transmit the image source and mode information to the algorithm plug-in management unit.
[0205] The algorithm plug-in management unit is used to transmit the pattern information to the parser for parsing and processing, and notify the algorithm processing unit to load the corresponding face detection algorithm according to the face detection algorithm corresponding to the pattern information determined by the parser from the algorithm rule table, or directly notify the corresponding face detection sub-unit.
[0206] The parser is used to parse the mode information (which can also be the scene information) to determine the current shooting mode, and then query the algorithm rule table to determine the face detection algorithm or face detection sub-unit corresponding to the shooting mode according to the determined shooting mode, and feed back the determined face detection algorithm or face detection sub-unit information to the algorithm plug-in management unit.
[0207] It is understandable that the parser mentioned in this embodiment needs to correspond to the format of the algorithm rule table. For example, when the algorithm rule table is in the XML format mentioned above, the parser needs to be an XML parser.
[0208] Accordingly, if the algorithm rule table is in TXT format, the parser is a TXT parser; if the algorithm rule table is in JS format, the parser is a JS parser; if the algorithm rule table is in Excel format, the parser is an Excel parser.
[0209] In addition, it can also be understood that in some implementations, in order to make the parser applicable to various forms of algorithm rule tables, the parsers of the above formats can be integrated into one, so that when parsing, the parsing process of the corresponding format can be directly called for parsing according to the format of the algorithm rule table that currently needs to be traversed and queried.
[0210] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0211] The algorithm processing unit may be a processing unit for loading different face detection algorithms in some implementations, or may be the face detection subunit corresponding to different face detection algorithms mentioned above. For the former, after receiving the face detection algorithm and image source transmitted by the algorithm plug-in management unit, the algorithm processing unit will record the face detection algorithm transmitted by the algorithm plug-in management unit, and then perform face detection on the image source according to the loaded face detection algorithm; for the latter, the algorithm plug-in management unit may directly load the face detection subunit corresponding to the determined face detection algorithm, and then the loaded face detection subunit will perform face detection on the image source, and transmit the detection result and the image source to the detection result output unit.
[0212] The detection result output unit is used to output the detection result and image source obtained after the algorithm processing unit performs face detection processing on the image source to the upper application.
[0213] See also Figure 7 Regarding the specific working logic of the face detection processing engine of the above structure, for example, it is as follows: first, when the user starts an application that needs to call the camera, such as a camera application, and selects the corresponding shooting mode, the camera application will generate a request to transmit the mode information corresponding to the shooting mode to the camera, so that the camera can collect the image source corresponding to the shooting mode, and transmit the collected image source and the mode information carried in the request to the face detection processing engine through the camera driver. At this time, the image source acquisition unit in the face detection processing engine will receive the image source and the mode information corresponding to the image source.
[0214] Then, the algorithm plug-in management unit transmits the received mode information to the parser, which parses it to determine the shooting mode corresponding to the mode information, and then searches the algorithm rule table to determine the face detection algorithm corresponding to the shooting mode according to the shooting mode, and feeds the determined face detection algorithm back to the algorithm plug-in management unit.
[0215] Next, the algorithm plug-in management unit transmits the image source and the determined face detection algorithm to the algorithm processing unit in accordance with the loading method described above, and the algorithm processing unit loads the determined face detection algorithm to perform face detection on the image source, or the algorithm plug-in management unit directly loads the face detection sub-unit corresponding to the determined face detection algorithm, and then the loaded face detection sub-unit performs face detection on the image source.
[0216] See also Figure 8 For example, if the mode information received by the algorithm plug-in management unit is mode information A, after being parsed by the parser, it is determined that the corresponding shooting mode is shooting mode A. According to mode shooting A, the algorithm rule table can be queried to determine that the face detection to be performed on the image source is specifically face frame detection. Based on this, the algorithm plug-in management unit notifies the algorithm processing unit to load the face frame detection algorithm, and transmits the image source to the algorithm processing unit, and the algorithm processing unit performs face frame detection processing on the image source according to the loaded face frame detection algorithm.
[0217] Continue to see Figure 8 For example, if the mode information received by the algorithm plug-in management unit is mode information B, then after being parsed by the parser, it is determined that the corresponding shooting mode is shooting mode B. According to shooting mode B, the algorithm rule table can be queried to determine that the face detection to be performed on the image source is specifically face frame detection and face tracking. Based on this, the algorithm plug-in management unit notifies the algorithm processing unit to load the face frame detection algorithm and the face tracking algorithm, and transmits the image source to the algorithm processing unit, which performs face frame detection processing on the image source according to the loaded face frame detection algorithm, and performs face tracking processing on the image source according to the face tracking algorithm.
[0218] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0219] Then, after completing the face detection, the algorithm processing unit transmits the image source and the generated detection result to the detection result output unit, and the detection result output unit transmits the detection result and the image source to the upper layer application.
[0220] Therefore, the face detection processing engine provided by the embodiment of the present application manages different face detection algorithms / face detection sub-units by utilizing the algorithm plug-in management unit, and can dynamically and flexibly load the determined face detection algorithm / face detection sub-unit according to the face detection algorithm determined by the parser from the algorithm rule table, so that the call of the face detection algorithm provided by the face detection processing engine is editable, thereby improving the development and maintenance efficiency of the face detection processing engine.
[0221] In addition, by dynamically loading the face detection algorithm / face detection sub-unit suitable for the current scene and shooting mode, on-demand loading can be better implemented according to customer needs, providing a better user experience.
[0222] In addition, it is understandable that in practical applications, the image source acquisition unit can also be directly integrated into the algorithm plug-in management unit, that is, the image source and mode information transmitted by the camera driver is directly received by the algorithm plug-in management unit.
[0223] Correspondingly, the detection result output unit can also be directly integrated into the algorithm processing unit, that is, after the algorithm processing unit performs face detection on the image source, it directly outputs the obtained detection result and the image source to the upper-layer application.
[0224] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0225] Furthermore, considering that different face detection algorithms have similar processing operations, see Fig. 9 For example, face detection processing such as face frame detection, face tracking, and face angle detection all require the image source to be converted to a color space first, such as converting the image source from the YUV color space to the color mode (RedGreenBlue, RGB), that is, performing a yuv2rgb operation; then, the image source after the yuv2rgb operation is converted from a floating point type to an 8-bit unsigned integer type, that is, performing float2u8.
[0226] It can be understood that the so-called YUV is a type of encoded color space, in which "Y" represents brightness, which is usually called grayscale value; "U" and "V" represent chromaticity, which is used to describe the color saturation of the image and is used to specify the color of the pixel.
[0227] Continue to see Fig. 9 For example, for face tracking and face angle detection, in addition to executing yuv2rgb and float2u8, the image source size is adjusted, that is, the resize operation is performed, and the image source after the resize operation is copied, that is, the copy operation is performed, and the image source after the copy operation is verified, that is, the align operation is performed.
[0228] Based on this, in order to further optimize the performance and reduce power consumption, a public computing processing unit is also integrated in the face detection processing engine provided in this embodiment.
[0229] Specifically, the common computing processing unit is used to encapsulate the same operations, such as Fig. 9As shown, yuv2rgb and float1u8 can be encapsulated into a common computing processing subunit, and resize, copy and align can be encapsulated into a common computing processing subunit. In this way, for the input image source, the same processing operation only needs to be performed once by the common computing processing unit.
[0230] For the face detection processing engine that introduces the public computing processing unit, the interaction logic of its internal functional modules is as follows: Fig.10 shown.
[0231] See also Fig.10 When the camera driver transmits the mode information and the image source collected by the camera to the face detection processing engine, after a series of processing by the image source acquisition unit, the algorithm plug-in management unit, the parser, and the algorithm rule table (see the above pair for details), Figure 7 The description is not repeated here), when the algorithm processing unit performs face detection on the image source according to the determined face detection algorithm, the image source will be transmitted to the above-mentioned public computing processing unit, and the public computing processing unit will select the corresponding public computing processing sub-unit to process the image source, and then feed the processed image source back to the algorithm processing unit, and then the algorithm processing unit will perform specific face detection processing on the processed image source.
[0232] Taking the shooting mode as the shooting mode B mentioned above as an example, the determined face detection algorithm includes a face frame detection algorithm and a face tracking algorithm. Fig. 9 It can be seen from the public computing processing unit shown that both the face detection algorithm and the face tracking algorithm involve yuv2rgb processing and float2u8 processing, and the face tracking algorithm also involves resize processing, copy processing and align processing. Based on this, the public computing processing unit will call the public computing processing subunit encapsulating yuv2rgb and float1u8 to perform yuv2rgb operations and float1u8 operations on the image source in sequence to obtain a processed image source (in order to distinguish it, it is referred to as the first image source here), and then call the public computing processing subunit encapsulating resize, copy and align to perform resize operations, copy operations and align operations on the first image source in sequence to obtain a processed image source (in order to distinguish it, it is referred to as the second image source here), and then the obtained first image source and second image source are fed back to the algorithm processing unit, and the algorithm processing unit performs face frame detection on the first image source according to the face frame detection algorithm, and then obtains the face frame detection result, and the algorithm processing unit performs face tracking on the second image source according to the face tracking algorithm, that is, obtains the face tracking result.
[0233] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0234] Therefore, the face detection processing engine provided in the embodiment of the present application greatly optimizes the processing logic by utilizing a common computing processing unit to unify the same processing involved in each face detection link, thereby achieving optimization in performance and power consumption.
[0235] In addition, it should be noted that since the face detection processing engine mentioned above is used for face detection, and face detection is usually for image data, in some implementations, the face detection processing engine can be integrated into the image engine of the electronic device.
[0236] In addition, it should be noted that the face detection processing engine provided in the embodiment of the present application can be applied to any chip platform. For different chip platforms, only the calling interface needs to be adapted, and the internal processing logic is not affected by the platform, which greatly facilitates maintenance.
[0237] based on Figures 7 to 10 When implementing the shooting method involving face detection provided in the embodiment of the present application, the vertical interaction logic of each functional module involved in the Android system architecture is as follows: Fig.11 shown.
[0238] See also Fig.11 When adopting the shooting method involving face detection provided in the embodiment of the present application, the camera application calls the camera service and sends a shooting request carrying mode information corresponding to the shooting mode selected by the user to the camera service. After receiving the shooting request, the camera service performs corresponding processing.
[0239] For example, after the camera application is started (e.g. Figure 1a and Figure 1b ), if the user selects the desired shooting mode, such as clicking Figure 1b An icon option corresponding to a certain shooting mode displayed in the shooting mode list 103, such as smiling face capture, generates a shooting request with mode information of the smiling face capture mode, and then sends the shooting request to the camera service.
[0240] In addition, in actual applications, if the user does not select a shooting mode after launching the camera application, the default generated mode information is Figure 1b The shooting request corresponding to the photo mode in .
[0241] Exemplarily, in some implementations, the shooting request may also carry resolution information of the image source that needs to be captured by the camera.
[0242] The corresponding processing of the camera service may be, for example, the creation of a camera service instance, a camera device client instance, a camera device instance, a camera data stream instance, etc. The specific creation process can be found in the API of the camera service, which will not be described here.
[0243] Continue to see Fig.11 , the camera service calls the image engine and transmits the above-mentioned shooting request to the image engine, which then processes it accordingly.
[0244] Specifically, the camera device instance in the camera service may call the image engine, and then transparently transmit the shooting request to the image engine, so that the image engine can create a corresponding instance in response to the request.
[0245] It should be noted that in actual applications, the shooting request can be directly transmitted to the lower layer through the image engine, or can be transmitted to the lower layer through the existing camera hardware abstraction layer, and this embodiment does not limit this. For ease of explanation, this embodiment takes the example of the shooting request being directly transmitted to the lower layer through the image engine.
[0246] Continue to see Fig.11 ,The image engine calls the camera driver and transmits the shooting request to the camera driver, which then processes it accordingly.
[0247] It is understandable that due to the downstream process, only the corresponding functional module needs to be notified to create an instance and the received shooting request is further transmitted downward, so there is no need to do other processing on the shooting request. After the camera driver receives the shooting request, it executes the operation of creating the corresponding instance. After completing the creation of the instance, the camera driver calls the camera so that the camera can collect the image source according to the requirements corresponding to the mode information carried in the shooting request.
[0248] Continue to see Fig.11 After the camera acquires the image source in the corresponding shooting mode, it returns the image source and mode information to the camera driver, so that the camera driver transmits the image source and mode information to the face detection processing engine. For the specific implementation details of the face detection processing engine determining the shooting mode according to the mode information and then loading the corresponding face detection algorithm to perform face detection on the image, please refer to the description of the internal processing logic of the face detection processing engine above, and the following section on the implementation details of the face detection processing engine. Fig.12 and Fig.13 The description of the specific scenario application is given and will not be repeated here.
[0249] Continue to see Fig.11After the face detection processing engine processes the image source, it transmits the image source and the detection result to the camera service, and then the camera service reports the image source and the detection result to the camera application, so that the camera application can process the image source according to the detection result, and then Figure 1b The interface shown displays the processed image source.
[0250] against Fig.11 The processing logic shown is as follows. Taking the shooting modes selected by the user as the shooting mode A and the shooting mode B mentioned above as examples, the shooting methods involving face detection in these two shooting scenes are explained in conjunction with the accompanying drawings.
[0251] See also Fig.12 When the shooting mode is shooting mode A, the shooting method involving face detection specifically includes:
[0252] S101 : A camera application generates a shooting request A including mode information A corresponding to shooting mode A.
[0253] Exemplarily, the shooting request A is generated when the user starts the camera application and clicks on the shooting mode A in the shooting mode list. Therefore, the shooting mode A can be determined according to the mode information A later.
[0254] Accordingly, after the camera application generates a shooting request A, it will Fig.11 The camera service of the application framework layer, the image engine / camera hardware abstraction layer of the HAL layer, and the camera driver of the kernel layer shown transmit the shooting request A to the camera.
[0255] S102: The camera collects image source A corresponding to shooting mode A.
[0256] From the above description, it can be seen that the shooting mode A can be determined according to the mode information A. Therefore, after the camera receives the shooting request A, it can determine that the image source A needs to be captured according to the requirements of the shooting mode A by parsing the mode information A in the shooting request A.
[0257] Correspondingly, after the camera collects the image source A corresponding to the shooting mode A, it will transmit the image source A and the mode information A to the image source acquisition unit in the face detection processing engine through the camera driver, and the image source acquisition unit will transmit the image source A and the mode information A to the algorithm plug-in management unit in the face detection processing engine.
[0258] S103, the algorithm plug-in management unit triggers the parser to parse the mode information A to obtain the shooting mode A, and determines according to the algorithm rule table that the face detection algorithm corresponding to the shooting mode A is a face frame detection algorithm.
[0259] Regarding the specific implementation details of the algorithm plug-in management unit triggering the parser to determine the shooting mode A corresponding to the mode information A, and determining the face frame detection algorithm corresponding to the shooting mode A according to the algorithm rule table, please refer to the above and will not be repeated here.
[0260] For ease of explanation, this embodiment takes the algorithm processing unit as a processing unit that is fixedly loaded with different face detection algorithms as an example. After the algorithm plug-in management unit determines the face detection algorithm that needs to be performed on the image source A, such as the face frame detection algorithm mentioned above, the image source A and the instruction to instruct the algorithm processing unit to load the face frame detection algorithm are sent to the algorithm processing unit.
[0261] S104: the algorithm processing unit loads a face frame detection algorithm.
[0262] Continue to see Fig.12 After the algorithm processing unit loads the face frame detection algorithm according to the loading instruction sent by the algorithm plug-in management unit, it will also send the image source A to the public computing processing unit and inform the public computing processing unit that the face detection to be performed this time is face frame detection.
[0263] S105, the public computing processing unit processes the image source A according to the public computing processing sub-unit corresponding to the face frame detection algorithm to obtain the image source A'.
[0264] by Fig. 9 Taking the public computing processing unit shown as an example, in this embodiment, the public computing processing sub-unit corresponding to the face frame detection algorithm needs to perform yuv2rgb processing and float2u8 processing on the image source A.
[0265] Correspondingly, after the public computing processing unit calls the corresponding public computing processing sub-unit to process the image source A, the obtained image source A' is returned to the algorithm processing unit so that the algorithm processing unit performs face frame detection on the image source A'.
[0266] S106 , the algorithm processing unit performs face frame detection on the image source A′ based on the face frame detection algorithm to obtain coordinate information of the face frame.
[0267] Exemplarily, in some implementations, the face frame is, for example, a rectangular frame or a square frame, and its coordinate information is, for example, the coordinates of the upper left corner vertex and the length and width of the rectangular frame, or the side length of the square frame; or, the coordinates of the upper left corner vertex and the coordinates of the lower right corner vertex.
[0268] Exemplarily, in some other implementations, the face frame is, for example, a circular frame, and its coordinate information is, for example, the coordinates of the circle point and the length of the radius.
[0269] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0270] Correspondingly, the algorithm processing unit performs face frame detection on the image source A' based on the determined face frame detection algorithm. After obtaining the coordinate information of the face frame, the algorithm processing unit transmits the coordinate information of the face frame and the original image source A provided by the camera to the detection result output unit, and then the detection result output unit uploads the coordinate information of the face frame and the image source A to the camera application via the camera service.
[0271] S107, the camera application annotates the face frame in the image source A according to the coordinate information of the face frame, and displays the image source A after the face frame is annotated.
[0272] For example Fig.13 As shown, the preview window 104 displays the image source A after the face frame 109 is marked.
[0273] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0274] See also Fig.14 When the shooting mode is shooting mode B, the shooting method involving face detection specifically includes:
[0275] S201 : A camera application generates a shooting request B including mode information A corresponding to a shooting mode B.
[0276] Exemplarily, the shooting request B is generated after the user starts the camera application and clicks on the shooting mode B in the shooting mode list. Therefore, the shooting mode B can be determined according to the mode information B later.
[0277] Accordingly, after the camera application generates a shooting request B, it will Fig.11 The camera service of the application framework layer, the image engine / camera hardware abstraction layer of the HAL layer, and the camera driver of the kernel layer shown transmit the shooting request B to the camera.
[0278] S202: The camera captures image source B corresponding to shooting mode B.
[0279] From the above description, it can be seen that shooting mode B can be determined according to mode information B. Therefore, after the camera receives shooting request B, it can determine that image source B needs to be captured according to the requirements of shooting mode A by parsing mode information B in shooting request B.
[0280] Correspondingly, after the camera collects the image source B corresponding to the shooting mode B, it will transmit the image source B and the mode information B to the image source acquisition unit in the face detection processing engine through the camera driver, and the image source acquisition unit will transmit the image source B and the mode information B to the algorithm plug-in management unit in the face detection processing engine.
[0281] S203, the algorithm plug-in management unit triggers the parser to parse the mode information B to obtain the shooting mode B, and determines the face detection algorithm corresponding to the shooting mode B as a face frame detection algorithm and a face tracking algorithm according to the algorithm rule table.
[0282] Regarding the specific implementation details of the algorithm plug-in management unit triggering the parser to determine the shooting mode B corresponding to the mode information B, and determining the face frame detection algorithm and face tracking algorithm corresponding to the shooting mode B according to the algorithm rule table, please refer to the above and will not be repeated here.
[0283] For ease of explanation, this embodiment takes the algorithm processing unit as a processing unit that is fixedly loaded with different face detection algorithms as an example. After the algorithm plug-in management unit determines the face detection algorithm that needs to be performed on the image source B, such as the face frame detection algorithm and the face tracking algorithm mentioned above, the image source B and the instruction to instruct the algorithm processing unit to load the face frame detection algorithm and the face tracking algorithm are sent to the algorithm processing unit.
[0284] S204, the algorithm processing unit loads a face frame detection algorithm and a face tracking algorithm.
[0285] Continue to see Fig.14 After the algorithm processing unit loads the face frame detection algorithm and the face tracking algorithm according to the loading instruction sent by the algorithm plug-in management unit, it will also send the image source B to the public computing processing unit and inform the public computing processing unit that the face detection to be performed this time is face frame detection and face tracking.
[0286] S205, the public computing processing unit processes the image source B according to the public computing processing subunits corresponding to the face frame detection algorithm and the face tracking algorithm to obtain the image source B', and processes the image source B' according to the public computing processing subunits corresponding to the face tracking algorithm to obtain the image source B".
[0287] Still Fig. 9 Taking the public computing processing unit shown as an example, in this embodiment, the public computing processing subunit corresponding to the face frame detection algorithm and the face tracking algorithm needs to perform yuv2rgb processing and float2u8 processing on the image source B to obtain the image source image source B'.
[0288] In addition, since the face tracking algorithm also corresponds to a common computing processing subunit, it is also necessary to resize, copy, and align the image source B' to obtain the image source B".
[0289] Correspondingly, after the public computing processing unit calls the corresponding public computing processing sub-unit to process the image source B, it will return the obtained image source B' and image source B" to the algorithm processing unit so that the algorithm processing unit can perform face frame detection on the image source B' and perform face tracking on the image source B".
[0290] S206, the algorithm processing unit performs face frame detection on the image source B' based on the face frame detection algorithm to obtain coordinate information of the face frame, and performs face tracking on the image source B" based on the face tracking algorithm to obtain coordinate information of the face tracking frame.
[0291] It is understandable that the face tracking frame may be in the same form as the face frame type described above, and thus the coordinate information may be similar, which will not be described in detail here.
[0292] S207, the camera application marks the face frame and the face tracking frame in the image source B according to the coordinate information of the face frame and the face tracking frame, and displays the marked image source B.
[0293] The implementation method of labeling the face frame of the image source B and the face tracking frame is similar to the implementation method of labeling the face frame of the image source A in the above embodiment, and will not be repeated here.
[0294] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0295] In addition, it should be noted that the shooting request mentioned in each embodiment of the present application is not a specific instruction to shoot an image, but a call to the camera to collect an image source. Figure 1b The request to display the image source in the preview window 104 and the actual shooting instruction, that is, the operation of capturing the current content of the image source, saving it as a picture or video, and storing it in the gallery application, are made after the shutter control 106 is triggered.
[0296] In addition, it should be noted that in actual applications, for different shooting modes and application scenarios, the camera application can perform other processing based on the detection results provided by the face detection processing engine. For example, in the beauty scene, different beauty processing is performed on different positions according to key points; for example, in some common functions such as adding hair accessories to the face, hair accessory icons can be added according to the specific face position information.
[0297] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation to this embodiment.
[0298] In addition, it is understood that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0299] In addition, it should be noted that the shooting methods involving face detection provided by the above embodiments implemented by electronic devices in actual application scenarios can also be performed by a chip system included in the electronic device, wherein the chip system may include a processor. The chip system can be coupled to a memory so that when the chip system is running, the computer program stored in the memory is called to implement the steps performed by the above electronic device. The processor in the chip system can be an application processor or a processor other than an application processor.
[0300] In addition, an embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the shooting method involving face detection in the above-mentioned embodiment.
[0301] In addition, an embodiment of the present application further provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned related steps to implement the shooting method involving face detection in the above-mentioned embodiment.
[0302] In addition, an embodiment of the present application also provides a chip (which may also be a component or module), which may include one or more processing circuits and one or more transceiver pins; wherein the transceiver pins and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the above-mentioned related method steps to implement the shooting method involving face detection in the above-mentioned embodiment, so as to control the receiving pin to receive the signal, so as to control the sending pin to send the signal.
[0303] In addition, it can be seen from the above description that the electronic device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0304] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A face detection processing engine, characterized in that: A hardware abstraction layer is provided in an electronic device, the electronic device has a camera, the face detection processing engine is a packaged face detection processing engine at the same level as a closed-source face detection function module provided by a chip platform used by the electronic device, and is not a closed-source face detection function module provided by the chip platform used by the electronic device; The face detection processing engine comprises: an algorithm plug-in management unit, an algorithm processing unit, and a public computing processing unit, wherein the public computing processing unit comprises at least one public computing processing sub-unit, and the public computing processing sub-unit encapsulates the same processing operations corresponding to different face detection algorithms; The algorithm plug-in management unit is used to determine the face detection algorithm corresponding to the shooting mode according to the mode information of the shooting mode corresponding to the image source collected by the camera and the algorithm rule table, and send the image source and the loading instruction indicating the face detection algorithm to the algorithm processing unit, wherein the corresponding relationship between each face detection algorithm and each shooting mode involving face detection is recorded in the algorithm rule table; The algorithm processing unit is used to load the face detection algorithm determined by the algorithm plug-in management unit according to the loading instruction, send the image source to the public computing processing unit, and inform the public computing processing unit to use the face detection algorithm to process the image source; The public computing and processing unit is used to call the public computing and processing subunit corresponding to the face detection algorithm, so that the public computing and processing subunit processes the image source, and feeds back the image source processed by the public computing and processing subunit to the algorithm processing unit; The algorithm processing unit is further used to perform face detection on the image source processed by the public computing processing subunit according to the loaded face detection algorithm to obtain a face detection result; The face detection algorithms integrated in the closed-source face detection function module provided by the face detection processing engine and the chip platform include a first face detection algorithm and a second face detection algorithm, wherein the first face detection algorithm is any one or more of a face frame detection algorithm, a face tracking algorithm, a face key point detection algorithm, a face angle detection algorithm, and a face expression detection algorithm, and the second face detection algorithm is any one or more of a face frame detection algorithm, a face tracking algorithm, a face key point detection algorithm, a face angle detection algorithm, and a face expression detection algorithm, and the first face detection algorithm and the second face detection algorithm are different; In the case where the face detection algorithm corresponding to the shooting mode is the first face detection algorithm, when using the closed-source face detection function module provided by the chip platform to perform face detection on the image source, it is necessary to use the first face detection algorithm and the second face detection algorithm in sequence to perform face detection on the image source to obtain a face detection result corresponding to the first face detection algorithm and a face detection result corresponding to the second face detection algorithm; In the case where the face detection algorithm corresponding to the shooting mode is the first face detection algorithm, when the face detection processing engine is used to perform face detection on the image source, the algorithm processing unit only determines, based on the mode information of the shooting mode and the algorithm rule table, that the face detection algorithm corresponding to the shooting mode is the first face detection algorithm, and the algorithm processing unit only loads the first face detection algorithm to perform face detection on the image source to obtain a face detection result corresponding to the first face detection algorithm.
2. The face detection processing engine according to claim 1, characterized in that: The public computing processing unit includes a first public computing processing sub-unit and a second public computing processing sub-unit; The first public computing processing subunit encapsulates yuv2rgb processing operations and float2u8 processing operations; The second public computing processing subunit encapsulates a resize processing operation, a copy processing operation, and an align processing operation; Wherein, when the face detection algorithm is a face frame detection algorithm, a face tracking algorithm, or a face angle detection algorithm, the public computing processing unit calls the first public computing processing subunit to sequentially perform the yuv2rgb processing operation and the float2u8 processing operation on the image source; When the face detection algorithm is a face tracking algorithm or a face angle detection algorithm, the public computing processing unit calls the second public computing processing sub-unit to sequentially perform the resize processing operation, the copy processing operation, and the align processing operation on the image source processed by the first public computing processing sub-unit.
3. The face detection processing engine according to claim 1, characterized in that: The face detection processing engine also includes: a parser; The algorithm plug-in management unit is further used to transmit the mode information to the parser; The parser is used to parse the mode information provided by the algorithm plug-in management unit to determine the shooting mode corresponding to the mode information; The parser is further configured to search the algorithm rule table for the face detection algorithm corresponding to the shooting mode, and feed back the determined face detection algorithm to the algorithm plug-in management unit.
4. The face detection processing engine according to claim 3, characterized in that: The algorithm rule table is in XML format, or JS format, or TXT format, or Excel format; When the algorithm rule table is in XML format, the parser is an XML parser; When the algorithm rule table is in JS format, the parser is a JS parser; When the algorithm rule table is in TXT format, the parser is a TXTL parser; When the algorithm rule table is in Excel format, the parser is an Excel parser.
5. The face detection processing engine according to claim 1, characterized in that: The face detection processing engine also includes: an image source acquisition unit; The image source acquisition unit is used to receive the image source and the mode information collected by the camera, and transmit the image source and the mode information to the algorithm plug-in management unit.
6. The face detection processing engine according to claim 1, characterized in that: The face detection processing engine further includes: a detection result output unit; The detection result output unit is used to receive the face detection result obtained by the algorithm processing unit by performing face detection on the image source according to the loaded face detection algorithm, and upload the face detection result and the image source collected by the camera to the application that selects the shooting mode.
7. The face detection processing engine according to any one of claims 1 to 6, characterized in that: The face detection processing engine is integrated into the image engine.
8. A shooting method involving face detection, characterized in that: Applied to an electronic device integrated with the face detection processing engine according to any one of claims 1 to 7, the electronic device having a camera, the method comprising: Displaying a first preview interface of a first application, wherein the first preview interface includes a shooting mode selection list, wherein the shooting mode selection list includes at least one shooting mode involving face detection; Upon receiving a selection operation of the shooting mode involving face detection, determining a face detection algorithm corresponding to the shooting mode; Loading the face detection algorithm, performing face detection on the image source collected by the camera in the shooting mode according to the loaded face detection algorithm, and obtaining a face detection result; Report the image source and the face detection result to the first application.
9. The method according to claim 8, characterized in that The determining of the face detection algorithm corresponding to the shooting mode includes: The face detection algorithm corresponding to the shooting mode is searched from the algorithm rule table, wherein the algorithm rule table records the corresponding relationship between each face detection algorithm and each shooting mode involving face detection.
10. The method according to claim 8, characterized in that The performing face detection on the image source collected by the camera in the shooting mode according to the loaded face detection algorithm includes: Processing the image source according to the common computing and processing subunit corresponding to the face detection method; Perform face detection on the processed image source according to the loaded face detection algorithm.
11. The method according to claim 10, characterized in that The face detection algorithm is a face frame detection algorithm; The processing of the image source according to the common computing and processing subunit corresponding to the face detection method includes: Determine that the common computing and processing subunit corresponding to the face frame detection method is the first common computing and processing subunit; The image source is processed according to the first public computing processing subunit to obtain a first image source.
12. The method according to claim 11, characterized in that The performing face detection on the processed image source according to the loaded face detection algorithm comprises: Perform face frame detection on the first image source according to the loaded face frame detection algorithm.
13. The method according to claim 10, characterized in that The face detection algorithm is a face tracking algorithm; The processing of the image source according to the common computing and processing subunit corresponding to the face detection method includes: Determine that the public computing and processing subunits corresponding to the face tracking algorithm are the first public computing and processing subunit and the second public computing and processing subunit; Processing the image source according to the second public computing processing subunit to obtain a second image source; The second image source is processed according to the second public computing processing subunit to obtain a third image source.
14. The method according to claim 13, characterized in that The performing face detection on the processed image source according to the loaded face detection algorithm comprises: Perform face tracking on the third image source according to the loaded face tracking algorithm.
15. The method according to claim 10, characterized in that The face detection algorithm is a face frame detection algorithm and a face tracking algorithm; Determine that the common computing and processing subunit corresponding to the face frame detection method is the first common computing and processing subunit; Processing the image source according to the first public computing processing subunit to obtain a first image source; Determine that the public computing and processing subunits corresponding to the face tracking algorithm are the first public computing and processing subunit and the second public computing and processing subunit; The first image source is processed according to the second public computing processing subunit to obtain a third image source.
16. The method according to claim 15, characterized in that The performing face detection on the processed image source according to the loaded face detection algorithm comprises: Performing face frame detection on the first image source according to the loaded face frame detection algorithm; Perform face tracking on the third image source according to the loaded face tracking algorithm.
17. An electronic device, characterized in that: The electronic device comprises: a camera, a memory, a processor, a face detection processing engine as described in any one of claims 1 to 7, the memory and the processor are coupled, and the face detection processing engine is arranged in a hardware abstraction layer; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the shooting method involving face detection as described in any one of claims 8 to 16.
18. A computer-readable storage medium, characterized in that: It comprises a computer program, which, when executed on an electronic device, enables the electronic device to execute the shooting method involving face detection as claimed in any one of claims 8 to 16.
