Image Processing Method, Computer Device, and Storage Medium

By identifying and processing the bald areas of characters in images or videos, the lack of self-confidence caused by baldness in video communication is solved, and automated image processing and user image maintenance are achieved.

CN114863502BActive Publication Date: 2025-06-03FU TAI HUA IND SHENZHEN +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110158958.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-04
Publication Date
2025-06-03
Estimated Expiration
2041-02-04

AI Technical Summary

Technical Problem

The prior art is difficult to automatically detect and process bald areas of characters in images or videos, resulting in baldness problems causing insufficient self-confidence in video communications.

Method used

By obtaining the user's avatar taken by the camera, identifying the hair area and scalp area, calculating the proportion of the scalp area, determining whether the user is bald, and performing color processing on the bald area to generate a completed image or video.

Benefits of technology

It realizes automatic detection and processing of bald areas, maintains user image, and reduces psychological problems caused by baldness in video communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863502B_ABST
    Figure CN114863502B_ABST
Patent Text Reader

Abstract

The present invention provides an image processing method, including obtaining a user's head portrait captured by a camera; identifying a hair region and a scalp region from the user's head portrait; calculating a proportion of the scalp region based on the hair region and the scalp region; determining whether the user is bald based on a comparison between the proportion of the scalp region and a preset value; and when it is determined that the user is bald, performing a color filling process on the scalp region to obtain a user's head portrait after the color filling process. The present invention also provides a computer device and a storage medium for implementing the image processing method. The present invention can automatically detect baldness and fill the bald area with the original hair color.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly to an image processing method and a computer device. Background Art

[0002] In today's society, the survival pressure is high, so that many people start to lose a large amount of hair and become bald at a young age. When some users are video - communicating with other users, they will also lack confidence due to baldness. Summary of the Invention

[0003] In view of the above, it is necessary to propose an image processing method and a computer device, which can automatically detect the bald area of a person in an image or video, and fill in the original hair color to generate a completed image or video, maintaining the user's image, so that people will not have psychological problems due to being photographed with baldness during video calls.

[0004] The image processing method includes: obtaining a user's head image captured by a camera; identifying a hair area and a scalp area from the user's head image; calculating the proportion of the scalp area based on the hair area and the scalp area; determining whether the user is bald based on the comparison between the proportion of the scalp area and a preset value; and when it is determined that the user is bald, performing a color - filling process on the scalp area to obtain a user's head image after the color - filling process.

[0005] Preferably, the method further includes: transmitting the user's head image after the color - filling process to other terminals.

[0006] Preferably, the identifying the hair area and the scalp area of the user from the user's head image includes: using a face detection algorithm to determine the coordinates of a face frame from the user's head image; determining an initial position based on the coordinates of the face frame; and determining the hair area and the scalp area based on the initial position, the coordinates of each pixel point in the user's head image, and the RGB value of each pixel point.

[0007] Preferably, the face frame is determined by four coordinate points, namely the first coordinate P1(Xmin, Ymax), the second coordinate P2(Xmax, Ymax), the third coordinate P3(Xmin, Ymin), and the fourth coordinate P4(Xmax, Ymin). Among them, Xmax refers to the maximum X coordinate corresponding to the face frame in the user's avatar, Xmin refers to the minimum X coordinate corresponding to the face frame in the user's avatar, Ymax refers to the maximum Y coordinate corresponding to the face frame in the user's avatar, and Ymin refers to the minimum Y coordinate corresponding to the face frame in the user's avatar. The initial position refers to the position in the user's avatar where the straight line formed by the fifth coordinate P5(X5, Y5) and the sixth coordinate P6(X6, Y6) is located. Among them, X5 = Xmin, Y5 = Ymax + a; X6 = Xmax, Y6 = Ymax + a, and a is a preset value. Among them, the ordinate of each pixel point included in the hair area is greater than Y5 and Y6, and the RGB value of each pixel point included in the hair area belongs to a first preset range. Among them, the ordinate of each pixel point included in the scalp area is greater than Y5 and Y6, and the RGB value of each pixel point included in the scalp area belongs to a second preset range. Among them, the first preset range and the second preset range have no intersection.

[0008] Preferably, calculating the proportion of the scalp area based on the hair area and the scalp area includes: calculating the total number of pixel points T1 occupied by the hair area; calculating the total number of pixel points T2 occupied by the scalp area; and calculating the proportion P of the scalp area, where P = T2 / (T1 + T2) * 100%.

[0009] Preferably, performing color compensation processing on the scalp area includes: setting the RGB value of each pixel point in the scalp area to any value within the first preset range.

[0010] Preferably, performing color compensation processing on the scalp area includes: calculating the average value of the RGB values of all pixel points in the hair area; and setting the RGB value of each pixel point in the scalp area to the average value.

[0011] Preferably, performing color compensation processing on the scalp area includes: using a contour extraction algorithm to extract the contour corresponding to the scalp area; copying an image from the hair area according to the shape and size of the contour; and filling the copied image into the scalp area.

[0012] The computer device includes a memory and a processor. The memory is used to store at least one instruction, and the processor is used to implement the image processing method when executing the at least one instruction.

[0013] The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the image processing method is implemented.

[0014] Compared with the prior art, the image processing method and computer device provided by the present invention

[0015] can automatically detect the bald area of a person in an image or video, fill in the original hair color to generate a completed image or video, and maintain the user's image, so that people will not have psychological problems due to being photographed with a bald head during a video call. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0017] Figure 1 is a flowchart of the image processing method provided by a preferred embodiment of the present invention.

[0018] Figure 2 An example of a face frame is illustrated.

[0019] Figure 3 is a functional block diagram of the image processing system provided by a preferred embodiment of the present invention.

[0020] Figure 4 is a structural diagram of the computer device provided by a preferred embodiment of the present invention.

[0021] MAIN ELEMENT SYMBOL DESCRIPTION

[0022] Computer device 3 Image processing system 30 Acquisition module 301 Execution module 302 Memory 31 Processor 32 Camera 33 User avatar 5 Face frame 51 Hair area 52 Scalp area 53 Coordinate point P1, P2, P3, P4, P5, P6

[0023] The following specific embodiments will further illustrate the present invention in conjunction with the above drawings. SPECIFIC EMBODIMENTS

[0024] In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below in conjunction with the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.

[0025] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The described embodiments are merely a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0027] Figure 1 is a flowchart of an image processing method provided by a preferred embodiment of the present invention.

[0028] In this embodiment, the image processing method can be applied to a computer device. For a computer device that needs to perform image processing, the functions for image processing provided by the method of the present invention can be directly integrated on the computer device, or run on the computer device in the form of a Software Development Kit (SDK).

[0029] As Figure 1 shown, the image processing method specifically includes the following steps. According to different requirements, the order of the steps in this flowchart can be changed, and some steps can be omitted.

[0030] Step S1: The computer device acquires a user's head image captured by a camera.

[0031] In one embodiment, the camera continuously captures the user. The computer device acquires the video captured by the camera. The user's head image may refer to the image corresponding to any frame of the video captured by the camera.

[0032] Step S2: The computer device identifies the hair region and the scalp region from the user's head image.

[0033] In one embodiment, the identifying the hair region and the scalp region of the user from the user's head image includes (a1)-(a3):

[0034] (a1) Using a face detection algorithm to determine the coordinates of the face frame from the user's head image.

[0035] In one embodiment, the face frame is determined by four coordinate points, namely the first coordinate P1(Xmin, Ymax), the second coordinate P2(Xmax, Ymax), the third coordinate P3(Xmin, Ymin), and the fourth coordinate P4(Xmax, Ymin), where Xmax refers to the maximum X coordinate corresponding to the face frame in the user's avatar, Xmin refers to the minimum X coordinate corresponding to the face frame in the user's avatar, Ymax refers to the maximum Y coordinate corresponding to the face frame in the user's avatar, and Ymin refers to the minimum Y coordinate corresponding to the face frame in the user's avatar.

[0036] For example, refer to Figure 2 As shown, the face frame 51 in the user's avatar 5 is determined by the first coordinate P1, the second coordinate P2, the third coordinate P3, and the fourth coordinate P4.

[0037] (a2) Determine an initial position based on the coordinates of the face frame.

[0038] In one embodiment, the initial position refers to the position in the user's avatar where the line formed by the fifth coordinate P5(X5, Y5) and the sixth coordinate P6(X6, Y6) is located, where X5 = Xmin, Y5 = Ymax + a; X6 = Xmax, Y6 = Ymax + a, and a is a preset value, for example, a is equal to 5 centimeters.

[0039] (a3) Determine the hair region and the scalp region based on the initial position, the coordinates of each pixel point in the user's avatar, and the RGB values of each pixel point.

[0040] In one embodiment, the ordinate of each pixel point included in the hair region is greater than Y5 and Y6, and the RGB of each pixel point included in the hair region belongs to a first preset range. That is, the ordinate of each pixel point included in the hair region is above the initial position. For example, still refer to Figure 2 As described above, the computer device determines the hair region 52.

[0041] In one embodiment, the first preset range can be the range of RGB values corresponding to pure black and light black.

[0042] In one embodiment, the ordinate of each pixel point included in the scalp region is greater than Y5 and Y6, and the RGB value of each pixel point included in the scalp region belongs to a second preset range. That is, the ordinate of each pixel point included in the scalp region is above the initial position. For example, still refer to Figure 2 As described above, the computer device determines the scalp region 53.

[0043] In one embodiment, the first preset range may be a range of RGB values corresponding to pure skin color and light skin color.

[0044] In one embodiment, there is no intersection between the first preset range and the second preset range.

[0045] Step S3: The computer device calculates the proportion of the scalp area based on the hair area and the scalp area.

[0046] In one embodiment, calculating the proportion of the scalp area based on the hair area and the scalp area includes: calculating the total number of pixel points T1 occupied by the hair area; calculating the total number of pixel points T2 occupied by the scalp area; and calculating the proportion P of the scalp area, where P = T2 / (T1 + T2) * 100%.

[0047] Step S4: The computer device determines whether the user is bald based on the comparison between the proportion of the scalp area and a preset value (e.g., 20%). When it is determined that the user is bald, step S5 is executed. When it is determined that the user is not bald, step S6 is executed.

[0048] In one embodiment, when the proportion of the scalp area is greater than or equal to the preset value, the computer device determines that the user is bald. When the proportion of the scalp area is less than the preset value, the computer device determines that the user is not bald.

[0049] Step S5: When it is determined that the user is bald, the computer device performs color filling on the scalp area to obtain a user avatar after color filling.

[0050] In the first embodiment, performing color filling on the scalp area includes: setting the RGB value of each pixel point in the scalp area to any value within the first preset range.

[0051] In the second embodiment, performing color filling on the scalp area includes: calculating the average value of the RGB values of all pixel points in the hair area; and setting the RGB value of each pixel point in the scalp area to the average value.

[0052] In the third embodiment, performing color filling on the scalp area includes: using a contour extraction algorithm to extract the contour corresponding to the scalp area; copying an image from the hair area according to the shape and size of the contour; and filling the copied image into the scalp area.

[0053] In one embodiment, the shape of the copied image is the same as the shape of the contour, and the size of the copied image is the same as the size of the contour.

[0054] Step S6: The computer device transmits the user's avatar to other terminals.

[0055] It should be noted that when the process proceeds from Step S5 to Step S6, in Step S6, the computer device transmits the user's avatar after color compensation processing to the other terminals. When the process proceeds from Step S4 to Step S6, in Step S6, the computer device transmits the user's avatar obtained in Step S1 to the other terminals.

[0056] The other terminals can be devices such as computers, mobile phones, and tablet computers.

[0057] It should be noted that when in video communication, Step S6 may be included. If only using the computer device to take pictures and perform color compensation processing on the bald area, Step S6 may not be included.

[0058] In addition, as can be seen from the above steps of the present invention, when the computer device conducts video communication with the other terminals, since the computer device can judge baldness for each frame of the image captured by the camera, and when baldness is determined, color compensation processing is performed on the bald area, so that the bald area can be the same as the hair area. Thus, it is possible to prevent the bald images captured by the camera from being directly transmitted to other terminals.

[0059] The above Figure 1 has introduced in detail the image processing method of the present invention. Next, in combination with Figure 3 and Figure 4 , the functional modules of the software system for implementing the image processing method and the hardware device architecture for implementing the image processing method will be introduced.

[0060] It should be understood that the above embodiments are for illustrative purposes only and are not limited by this structure in the scope of the patent application.

[0061] Refer to Figure 3 shown, which is a module diagram of the image processing system provided by a preferred embodiment of the present invention.

[0062] In some embodiments, the image processing system 30 runs on the computer device 3. The image processing system 30 may include multiple functional modules composed of program code segments. The program code of each program segment in the image processing system 30 can be stored in the memory 31 of the computer device 3 and executed by at least one processor 32 to implement the image processing function (see Figure 2 description).

[0063] In this embodiment, the image processing system 30 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an acquisition module 301 and an execution module 302. The modules referred to in the present invention refer to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0064] Specifically, the acquisition module 301 can be used to acquire the user's head portrait captured by the camera. The execution module 302 can be used to identify the hair area and the scalp area from the user's head portrait. The execution module 302 can also be used to calculate the proportion of the scalp area based on the hair area and the scalp area; determine whether the user is bald based on the comparison between the proportion of the scalp area and a preset value; and when it is determined that the user is bald, perform color filling on the scalp area to obtain the user's head portrait after color filling; and transmit the user's head portrait after color filling to other terminals.

[0065] Refer to Figure 4 As shown, it is a schematic structural diagram of a computer device provided by a preferred embodiment of the present invention. In a preferred embodiment of the present invention, the computer device 3 includes a memory 31, at least one processor 32, and a camera 33. Those skilled in the art should understand that Figure 4 The structure of the computer device shown does not constitute a limitation of the embodiments of the present invention. It can be a bus structure or a star structure. The computer device 3 may also include more or fewer other hardware or software than shown, or different component arrangements.

[0066] In some embodiments, the computer device 3 includes a terminal that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices, etc.

[0067] It should be noted that the computer device 3 is only an example, and other existing or future possible electronic products that can be adapted to the present invention should also be included in the protection scope of the present invention and are included herein by reference.

[0068] In some embodiments, the memory 31 is used to store program codes and various data, such as the image processing system 30 installed in the computer device 3, and can achieve high-speed and automatic access to programs or data during the operation of the computer device 3. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electrically-erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc memories, magnetic disc memories, magnetic tape memories, or any other computer-readable storage medium that can be used to carry or store data.

[0069] In some embodiments, the at least one processor 32 may be composed of integrated circuits. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The at least one processor 32 is the control core of the computer device 3, connects various components of the entire computer device 3 through various interfaces and circuits, and executes various functions of the computer device 3 and processes data by running or executing programs or modules stored in the memory 31 and calling data stored in the memory 31, such as executing the function of image processing.

[0070] Although not shown, the computer device 3 may further include a power supply (such as a battery) for powering each component. Preferably, the power supply can be logically connected to the at least one processor 32 through a power management device, so as to realize functions such as management of charging, discharging, and power consumption management through the power management device. The power supply may further include any components such as one or more DC or AC power supplies, a recharge device, a power failure detection circuit, a power converter or inverter, and a power status indicator. The computer device 3 may further include a variety of sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.

[0071] It should be understood that the above embodiments are for illustrative purposes only and the scope of the patent application is not limited by this structure.

[0072] The integrated units implemented in the form of software function modules can be stored in a computer-readable storage medium. The above software function modules stored in a storage medium include several instructions for causing a computer device (which can be a server, a personal computer, etc.) or a processor to execute a part of the methods described in the various embodiments of the present invention.

[0073] In a further embodiment, in combination with Figure 3 , the at least one processor 32 can execute the operating device of the computer device 3 and various installed application programs (such as the image processing system 30 described above), program codes, etc. For example, the above-mentioned various modules.

[0074] Program codes are stored in the memory 31, and the at least one processor 32 can call the program codes stored in the memory 31 to execute related functions. For example, Figure 3 the various modules described in

[0075] are program codes stored in the memory 31 and are executed by the at least one processor 32, so as to implement the functions of the various modules to achieve the purpose of image processing. Figure 1 the purpose of image processing shown in

[0076] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation.

[0077] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0078] In addition, the various functional modules in the various embodiments of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of hardware plus software function modules.

[0079] It is obvious to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, in any respect, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be embraced within the present invention. Any reference signs in the claims should not be construed as limiting the claims concerned. In addition, it is obvious that the word "comprising" does not exclude other elements or that the singular does not exclude the plural. The multiple elements or devices recited in the apparatus claims can also be implemented by one element or device through software or hardware. The words "first", "second", etc. are used to denote names and do not denote any particular order.

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. An image processing method, characterized in that, the method includes: Obtaining a user's head image captured by a camera; Identifying the hair region and the scalp region from the user's head image, including: determining the coordinates of the face frame from the user's head image using a face detection algorithm; determining an initial position based on the coordinates of the face frame; and determining the hair region and the scalp region based on the initial position, the coordinates of each pixel point in the user's head image, and the RGB value of each pixel point, where the RGB value of each pixel point included in the hair region belongs to a first preset range, and the RGB value of each pixel point included in the scalp region belongs to a second preset range; wherein, the first preset range and the second preset range have no intersection; Calculating the proportion of the scalp region based on the hair region and the scalp region; Determining whether the user is bald based on the comparison between the proportion of the scalp region and a preset value; and When it is determined that the user is bald, performing a color filling process on the scalp region to obtain a user's head image after the color filling process.

2. The image processing method according to claim 1, characterized in that, the method further includes: Transmitting the user's head image after the color filling process to other terminals.

3. The image processing method according to claim 1, characterized in that, The face frame is determined by four coordinate points, which are the first coordinate P1 (Xmin, Ymax), the second coordinate P2 (Xmax, Ymax), the third coordinate P3 (Xmin, Ymin), and the fourth coordinate P4 (Xmax, Ymin), where Xmax refers to the maximum X coordinate corresponding to the face frame in the user's head image, Xmin refers to the minimum X coordinate corresponding to the face frame in the user's head image, Ymax refers to the maximum Y coordinate corresponding to the face frame in the user's head image, and Ymin refers to the minimum Y coordinate corresponding to the face frame in the user's head image; The initial position refers to the position in the user's head image where the line formed by the fifth coordinate P5 (X5, Y5) and the sixth coordinate P6 (X6, Y6) is located, where X5 = Xmin, Y5 = Ymax + a; X6 = Xmax, Y6 = Ymax + a, and a is a preset value; wherein, the ordinate of each pixel point included in the hair region is greater than Y5 and Y6; wherein, the ordinate of each pixel point included in the scalp region is greater than Y5 and Y6.

4. The image processing method according to claim 3, characterized in that, The calculating the proportion of the scalp region based on the hair region and the scalp region includes: Calculating the total number of pixel points T1 occupied by the hair region; Calculating the total number of pixel points T2 occupied by the scalp region; and Calculate the proportion P of the scalp area occupied, where, .

5. The image processing method according to claim 4, characterized in that, The performing a color filling process on the scalp region includes: Setting the RGB value of each pixel point in the scalp region to any value within the first preset range.

6. The image processing method according to claim 4, characterized in that, The performing a color filling process on the scalp region includes: Calculate the average value of the RGB values of all the pixel points in the hair region; and Set the RGB value of each pixel point in the scalp region to the average value.

7. The image processing method according to claim 4,[[]] wherein,[[]] the complementary color processing of the scalp region includes:[[]] Extracting the contour corresponding to the scalp region by using a contour extraction algorithm; Copying an image from the hair region according to the shape and size of the contour; and Filling the copied image into the scalp region.

8. A computer device,[[]] wherein,[[]] the computer device includes a memory and a processor, the memory is used for storing at least one instruction, and the processor is used for implementing the image processing method according to any one of claims 1 to 7 when executing the at least one instruction.

9. A computer-readable storage medium,[[]] wherein,[[]] the computer-readable storage medium stores at least one instruction, and the at least one instruction is used for implementing the image processing method according to any one of claims 1 to 7 when being executed by a processor.

Citation Information

Patent Citations

  • Face image processing method and device, computer equipment and readable storage medium

    CN111476735A

  • Hair health condition evaluation method and device, mobile terminal and storage medium

    CN111489823A