Image highlight separation method, device, storage medium and electronic device

By establishing and matching three-dimensional models, combining the grayscale histogram statistics of YCbCr space, the stability and deviation problems of the existing highlight separation methods under dynamic lighting conditions are solved, and efficient and accurate highlight separation is achieved.

CN116452452BActive Publication Date: 2025-02-28CHINA THREE GORGES CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310400097.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-13
Publication Date
2025-02-28
Estimated Expiration
2043-04-13

AI Technical Summary

Technical Problem

The existing high-light separation method has poor high-light detection stability under dynamic lighting conditions, and the high-light component estimation is prone to large deviations, resulting in image structure damage.

Method used

By establishing a three-dimensional model of the area to be processed in the target image, projection processing is performed to obtain different template images, match the target area, convert it to the YCbCr space, perform grayscale histogram statistics to determine the highlight threshold, and finally perform highlight separation of the target area based on the highlight threshold.

Benefits of technology

This method can accurately determine the highlight threshold of the target area, improve the accuracy of highlight separation, and eliminate interference from lighting in other areas of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116452452B_ABST
    Figure CN116452452B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, storage medium and electronic device for separating highlights of an image. The method comprises: establishing a three-dimensional model of a target object based on a to-be-processed area in a target image, projecting the three-dimensional model of the target object to obtain different template images, matching the different template images with the target image, determining a target area, converting the target area to a YCbCr space, performing grayscale value histogram statistics on a Y channel of the target area, determining a corresponding highlight threshold, and separating highlights of the target area based on the highlight threshold, thereby eliminating interference from illumination of other areas on the image, accurately determining the highlight threshold of the target area, and improving the accuracy of highlight separation.
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 in particular to a method, device, storage medium and electronic equipment for separating highlights from an image. Background Art

[0002] Intelligent inspection has gradually become an important auxiliary operation and maintenance means in the current unmanned power station mode. Relay secondary equipment protection plates are important protection devices in the power operation system. Due to their large number, traditional manual inspections are heavy and complicated, and false detections or missed detections often occur. Therefore, the use of intelligent robots for inspection has become a research hotspot. Outdoor natural light, indoor lighting, and shooting flash will affect the light distribution of the protection plate image. The light distribution is complex, and highlights often occur on the image, which seriously affects the inspection effect of the protection plate.

[0003] Existing highlight separation methods include a filtering-based highlight separation method, which regards highlights as noise, constructs a correction image without highlights using pseudo-chrominance, and uses filtering to achieve highlight separation based on the correction image. However, this method is greatly affected by dynamic lighting, has poor highlight detection stability, and highlight component estimation is prone to large deviations, which leads to the destruction of the image structure of the separated highlights. Summary of the invention

[0004] Therefore, the technical problem to be solved by the present invention is to overcome the defect that the existing highlight component estimation is prone to large deviations, thereby providing a highlight separation method, device, storage medium and electronic device for an image.

[0005] According to a first aspect, an embodiment of the present invention discloses a method for separating highlights of an image, comprising: establishing a three-dimensional model of a target object based on an area to be processed in a target image; performing projection processing on the three-dimensional model of the target object to obtain different template images; matching the different template images with the target image to determine a target area; converting the target area to a YCbCr space, performing grayscale value histogram statistics on the Y channel of the target area, and determining a corresponding highlight threshold; and performing highlight separation on the target area based on the highlight threshold.

[0006] Optionally, the three-dimensional model of the target object is projected to obtain corresponding different template images, including: establishing a spherical coordinate system and placing the three-dimensional model at the origin of the spherical coordinate system; changing the spherical position of the virtual camera in the spherical coordinate system, and obtaining corresponding different template images based on the projection of the three-dimensional model by the virtual camera at different positions.

[0007] Optionally, changing the spherical position of the virtual camera in the spherical coordinate system includes: using multiple vertices of a regular dodecahedron to evenly divide the sphere of the spherical coordinate system, and determining the vertices and center point of the regular dodecahedron as viewpoints; using regular hexagons to divide the spherical surface of each viewpoint neighborhood to obtain multiple fine matching viewpoints corresponding to each viewpoint; and using the viewpoint and the multiple fine matching viewpoints as the spherical position of the virtual camera in the spherical coordinate system.

[0008] Optionally, matching the different template images with the target image to determine the target area includes: calculating the gradient directional features of the target image; extracting the gradient directional features of the different template images; matching the gradient directional features of the target image with the gradient directional features of the different template images to obtain the first area with the greatest similarity between each template image and the target image and the first similarity value corresponding to each first area; and screening out the first area corresponding to the largest first similarity value as the target area.

[0009] Optionally, converting the target area to YCbCr space, performing grayscale value histogram statistics on the Y channel of the target area, and determining the corresponding highlight threshold value includes: converting the target area from RGB space to YCbCr space; performing grayscale value histogram statistics on the Y channel of the target area to obtain a grayscale value curve graph of the target area; drawing auxiliary lines to connect the highlight peak point and the grayscale value maximum point in the grayscale value curve graph; and using the grayscale value corresponding to the point on the histogram curve that is the longest distance from the auxiliary line as the highlight threshold value.

[0010] Optionally, performing highlight separation processing on the target area based on the highlight threshold includes: subtracting the highlight threshold from the Y channel value of the target area to obtain a second Y channel value.

[0011] Optionally, the method further includes: determining the second Y channel value as the Y channel value of the target area after highlight separation processing; and reconstructing the target image using the Y channel value of the target area after highlight separation processing to obtain an image after highlight separation.

[0012] According to the second aspect, an embodiment of the present invention further discloses a highlight separation device for an image, comprising: a model building module, used to build a three-dimensional model of a target object based on an area to be processed in a target image; a model projection processing module, used to perform projection processing on the three-dimensional model of the target object to obtain different template images; an image matching module, used to match the different template images with the target image to determine the target area; a highlight threshold determination module, used to convert the target area to YCbCr space, perform grayscale value histogram statistics on the Y channel of the target area, and determine the corresponding highlight threshold; a highlight separation processing module, used to perform highlight separation on the target area based on the highlight threshold.

[0013] According to the third aspect, an embodiment of the present invention also discloses an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the highlight separation method of the image as described in the first aspect or any optional embodiment of the first aspect.

[0014] According to a fourth aspect, an embodiment of the present invention further discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the highlight separation method of an image as described in the first aspect or any optional embodiment of the first aspect.

[0015] The technical solution of the present invention has the following advantages:

[0016] The highlight separation method of an image provided by the present invention establishes a three-dimensional model of a target object based on a to-be-processed area in a target image, performs projection processing on the three-dimensional model of the target object to obtain different template images, matches the different template images with the target image, determines the target area, converts the target area to a YCbCr space, performs grayscale value histogram statistics on a Y channel of the target area, determines a corresponding highlight threshold, performs highlight separation on the target area based on the highlight threshold, determines the target area by matching the template image with the target image, calculates the highlight threshold only for the target area and performs highlight separation, thereby eliminating interference from light illumination in other areas on the image, accurately determining the highlight threshold of the target area, and improving the accuracy of highlight separation. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A flowchart of a specific example of a method for separating highlights of an image in an embodiment of the present invention;

[0019] Figure 2 A specific example diagram of a spherical coordinate system of the highlight separation method of an image in an embodiment of the present invention;

[0020] Figure 3 An example diagram of a spherical surface uniformly divided by a regular dodecahedron in a method for separating highlights of an image in an embodiment of the present invention;

[0021] Figure 4 An example diagram of obtaining fine matching viewpoints by dividing the viewpoints into regular hexagons in the highlight separation method of an image in an embodiment of the present invention;

[0022] Figure 5 A grayscale value curve diagram of a target area of ​​a highlight separation method of an image in an embodiment of the present invention;

[0023] Figure 6 is a principle block diagram of a specific example of a highlight separation device for an image in an embodiment of the present invention;

[0024] Figure 7 FIG. 4 is a specific example diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0027] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0028] The embodiment of the present invention discloses a method for separating highlights of an image. Figure 1 As shown, the method comprises the following steps:

[0029] Step 101: Establish a three-dimensional model of a target object based on the area to be processed in the target image.

[0030] Exemplarily, in the embodiment of the present application, the target image can be an intelligent inspection image, or it can be other highlight images affected by other factors such as lighting, without limitation. The target object in the area to be processed is selected for highlight separation processing. First, the CAD model of the target object can be rendered using OpenGL, as an example only.

[0031] Step 102: Project the three-dimensional model of the target object to obtain different template images.

[0032] Exemplarily, the computer configuration used in the embodiments of the present application is 8G RAM, NVIDIA GTX1060 GPU, Intel core i7-8750H CPU. MATLAB R2020a is used to implement the subsequent embodiments. The embodiments of the present application do not limit the projection processing method and implementation software of the three-dimensional model of the target object. It can be a coordinate system of a fixed camera in a world coordinate system. By changing the coordinates of the three-dimensional model, such as forward, backward, left, right translation or rotation, different projection images corresponding to different coordinate points, i.e., template images, are obtained, which is only used as an example.

[0033] As an optional embodiment of the present invention, the three-dimensional model of the target object is projected to obtain corresponding different template images, including: establishing a spherical coordinate system and placing the three-dimensional model at the origin of the spherical coordinate system; changing the spherical position of the virtual camera in the spherical coordinate system, and obtaining corresponding different template images based on the projection of the three-dimensional model by the virtual camera at different positions.

[0034] For example, Figure 2 As shown, a spherical coordinate system is established with X, Y, and Z axes, and the three-dimensional model is placed at the origin of the spherical coordinate system. The virtual camera is located on the spherical surface of the spherical coordinate system. The spherical position of the virtual camera in the spherical coordinate system can be changed. At different spherical positions, the virtual camera projects the three-dimensional model, and different projection images corresponding to different spherical positions, namely template images, can be obtained. Based on obtaining multiple different template images for subsequent matching with the target image, the accuracy of acquiring the target area can be improved. This is just an example.

[0035] As a specific embodiment of the present invention, the changing of the spherical position of the virtual camera in the spherical coordinate system includes: using multiple vertices of a regular dodecahedron to evenly divide the spherical surface of the spherical coordinate system, and determining the vertices and center point of the regular dodecahedron as viewpoints; using regular hexagons to divide the spherical surface of each viewpoint neighborhood to obtain multiple fine matching viewpoints corresponding to each viewpoint; and using the viewpoint and the multiple fine matching viewpoints as the spherical position of the virtual camera in the spherical coordinate system.

[0036] For example, there is no limitation on the regular polygon, and it can be a regular hexahedron, etc. There is no limitation on the number and specific positions of the viewpoints, for example, only the vertices of the regular twelve faces can be used as viewpoints, such as Figure 3 As shown, the embodiment of the present application uses the 20 vertices of the regular dodecahedron to evenly divide the sphere, and sets the vertices and center point of the regular dodecahedron as viewpoints, so as to obtain 32 viewpoints with uniform spatial distribution. The regular polygons for dividing the sphere of each viewpoint neighborhood are not limited. The embodiment of the present application can use regular hexagons to divide the sphere of each viewpoint neighborhood of the 32 viewpoints, such as Figure 4 As shown, each viewpoint V i The 18 fine matching viewpoints l of the corresponding neighborhood are evenly distributed on the sides and diagonals of the regular hexagon. The positional relationship between all viewpoints and fine matching viewpoints is calculated based on the geometric relationship. The positions of all viewpoints and all fine matches are used as the spherical positions of the virtual camera in the spherical coordinate system. The embodiment of the present application uses a regular dodecahedron to obtain viewpoints, which can ensure that the template image is uniform and the number is appropriate, and will not cause a surge in the amount of calculation in subsequent steps. This is only taken as an example.

[0037] Step 103: Match the different template images with the target image to determine the target area.

[0038] Exemplarily, matching different template images with the target image can be performed by traversing the target image from left to right and from top to bottom on the target image to obtain a sub-image overlapping with the template image, and calculating the pixel matching degree of each template image and its corresponding overlapping sub-image. If the degree of matching is the largest, it is the target area. For example, the square difference matching method can be used to calculate the pixel matching degree of each template image and its corresponding overlapping sub-image. The worse the matching degree, the greater the degree of matching. The overlapping sub-image can be determined to be the target area. This is just an example.

[0039] As an optional embodiment of the present invention, the matching of the different template images with the target image to determine the target area includes: calculating the gradient directional features of the target image; extracting the gradient directional features of the different template images; matching the gradient directional features of the target image with the gradient directional features of the different template images to obtain the first area with the greatest similarity between each template image and the target image and the first similarity value corresponding to each first area; and screening out the first area corresponding to the largest first similarity value as the target area.

[0040] Exemplarily, the embodiment of the present application reads the target image in the RGB space, calculates the x-direction and y-direction gradients of the target image in the three color channels by the following formula, and then obtains the gradient direction according to the x-direction and y-direction gradients:

[0041]

[0042] Among them, C is the RGB channel; x is the pixel coordinate; t is the threshold value, which can be determined according to actual human experience as long as the interference of noise in the image is reduced.

[0043] Read all template images in RGB space and obtain the gradient direction feature F according to the above formula T , and perform sliding window matching with the gradient direction features of the intelligent inspection image. The similarity between each template image and the target image is calculated by the following formula. The area with the largest similarity S is the target area:

[0044] S=∑cos(FF T )

[0045] The embodiment of the present application determines the target area by calculating the gradient directional features of the target image and the gradient directional features of the template image for matching, which can effectively suppress the influence of environmental factors and improve the accuracy of image matching.

[0046] Step 104, converting the target area into a YCbCr space, performing grayscale value histogram statistics on the Y channel of the target area, and determining a corresponding highlight threshold;

[0047] Exemplarily, the embodiment of the present application converts the target area from RGB space to YCbCr space, and does not limit the method for determining the highlight threshold. For example, after obtaining the Y channel grayscale value histogram of the target area, the grayscale histogram of the target area has obvious double peaks, and the grayscale value at the bottom of the valley can be selected as the highlight threshold, which is just an example.

[0048] As an optional implementation of the present invention, the target area is converted to YCbCr space, grayscale value histogram statistics are performed on the Y channel of the target area, and the corresponding highlight threshold is determined, including: converting the target area from RGB space to YCbCr space; performing grayscale value histogram statistics on the Y channel of the target area to obtain a grayscale value curve graph of the target area; drawing auxiliary lines to connect the highlight peak point and the grayscale value maximum point in the grayscale value curve graph; and using the grayscale value corresponding to the point on the histogram curve that is the longest distance from the auxiliary line as the highlight threshold.

[0049] For example, the embodiment of the present application converts the target area from the RGB space to the YCbCr space, and performs grayscale value histogram statistics on the Y channel of the target area to obtain the following: Figure 6 The gray value curve of the target area is shown in Figure 5 As shown, the horizontal axis is the grayscale value of the pixel from left to right, for example, from 0-255, the grayscale value close to 255 is larger, which is the grayscale value change caused by the highlight, and an auxiliary line is drawn to connect the highlight peak point and the grayscale value maximum point, and the grayscale value corresponding to the point on the curve with the largest distance from the auxiliary line is used as the highlight threshold. For example only, the embodiment of the present application converts the target area from the RGB space to the YCbCr space. Because the YCbCr space contains the brightness Y channel, it is more convenient to perform subsequent highlight separation, and the highlight threshold can be better and clearly determined through the histogram.

[0050] Step 105: performing highlight separation on the target area based on the highlight threshold.

[0051] As an optional implementation manner of the present invention, performing highlight separation processing on the target area based on the highlight threshold includes: subtracting the highlight threshold from the Y channel value of the target area to obtain a second Y channel value.

[0052] Exemplarily, after determining the highlight threshold, the embodiment of the present application adjusts the Y channel of the target area by the following formula:

[0053] Y n =max(Yp)

[0054] Among them, Y n Represents the second Y channel value; Y represents the original Y channel value of the target area; p represents the highlight threshold.

[0055] The highlight separation method of an image provided by the present invention establishes a three-dimensional model of a target object based on a to-be-processed area in a target image, performs projection processing on the three-dimensional model of the target object to obtain different template images, matches the different template images with the target image, determines the target area, converts the target area to a YCbCr space, performs grayscale value histogram statistics on a Y channel of the target area, determines a corresponding highlight threshold, performs highlight separation on the target area based on the highlight threshold, determines the target area by matching the template image with the target image, calculates the highlight threshold only for the target area and performs highlight separation, thereby eliminating interference from light illumination in other areas on the image, accurately determining the highlight threshold of the target area, and improving the accuracy of highlight separation.

[0056] As an optional embodiment of the present invention, the method also includes: determining the second Y channel value as the Y channel value of the target area after highlight separation processing; reconstructing the target image using the Y channel value of the target area after highlight separation processing to obtain an image after highlight separation.

[0057] Exemplarily, after adjusting the Y channel value, the embodiment of the present application determines the second Y channel value as the Y channel value of the target area, and uses the second Y channel sub-matrix and the original Cb sub-matrix and Cr sub-matrix to perform matrix merging to reconstruct the image, and then converts the reconstructed image from the YCbCr space back to the RGB space to obtain the image after highlight separation.

[0058] The embodiment of the present invention also discloses a device for separating highlights of an image. Figure 6 As shown, the device comprises:

[0059] A model building module 201 is used to build a three-dimensional model of the target object based on the area to be processed in the target image;

[0060] A model projection processing module 202 is used to perform projection processing on the three-dimensional model of the target object to obtain different template images;

[0061] An image matching module 203 is used to match the different template images with the target image to determine the target area;

[0062] A highlight threshold determination module 204 is used to convert the target area into a YCbCr space, perform grayscale value histogram statistics on the Y channel of the target area, and determine a corresponding highlight threshold;

[0063] The highlight separation processing module 205 is used to perform highlight separation on the target area based on the highlight threshold.

[0064] The highlight separation device of an image provided by the present invention establishes a three-dimensional model of a target object based on a to-be-processed area in a target image, performs projection processing on the three-dimensional model of the target object to obtain different template images, matches the different template images with the target image, determines the target area, converts the target area to a YCbCr space, performs grayscale value histogram statistics on a Y channel of the target area, determines a corresponding highlight threshold, performs highlight separation on the target area based on the highlight threshold, determines the target area by matching the template image with the target image, calculates the highlight threshold only for the target area and performs highlight separation, thereby eliminating interference from light illumination in other areas on the image, accurately determining the highlight threshold of the target area, and improving the accuracy of highlight separation.

[0065] As an optional embodiment of the present invention, the model projection processing module includes: a coordinate system establishment submodule, used to establish a spherical coordinate system and place the three-dimensional model at the origin of the spherical coordinate system; a model projection submodule, used to change the spherical position of the virtual camera in the spherical coordinate system, and obtain corresponding different template images based on the projection of the three-dimensional model by the virtual camera at different positions.

[0066] As an optional embodiment of the present invention, the model projection submodule includes: a viewpoint determination submodule, which is used to use multiple vertices of a regular dodecahedron to evenly divide the spherical surface of the spherical coordinate system, and determine the vertices and center point of the regular dodecahedron as viewpoints; a fine matching viewpoint determination submodule, which is used to divide the spherical surface of each viewpoint neighborhood by regular hexagons to obtain multiple fine matching viewpoints corresponding to each viewpoint; and a position determination submodule, which is used to use the viewpoint and the multiple fine matching viewpoints as the spherical surface position of the virtual camera in the spherical coordinate system.

[0067] As an optional embodiment of the present invention, the image matching module includes: a target image gradient directional feature calculation submodule, used to calculate the gradient directional features of the target image; a template image gradient directional feature submodule, used to extract the gradient directional features of the different template images; an image matching submodule, used to match the gradient directional features of the target image with the gradient directional features of the different template images to obtain the first region with the greatest similarity between each template image and the target image and the first similarity value corresponding to each first region; and a region screening submodule, used to screen out the first region corresponding to the largest first similarity value as the target region.

[0068] As an optional embodiment of the present invention, a highlight threshold determination module includes: a space conversion submodule, used to convert the target area from RGB space to YCbCr space; a curve graph determination submodule, used to perform grayscale value histogram statistics on the Y channel of the target area to obtain a grayscale value curve graph of the target area; an auxiliary line connection submodule, used to make auxiliary lines to connect the highlight peak point and the grayscale value maximum point in the grayscale value curve graph; a threshold determination submodule, used to use the grayscale value corresponding to the point on the histogram curve that is the longest distance from the auxiliary line as the highlight threshold.

[0069] As an optional implementation of the present invention, the highlight separation processing module includes: a Y channel adjustment submodule, which is used to subtract the highlight threshold from the Y channel value of the target area to obtain a second Y channel value.

[0070] As an optional embodiment of the present invention, the device also includes: a Y channel value determination module, used to determine the second Y channel value as the Y channel value of the target area after the highlight separation process; an image reconstruction module, used to reconstruct the target image using the Y channel value of the target area after the highlight separation process to obtain an image after highlight separation.

[0071] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, the electronic device may include a processor 401 and a memory 402, wherein the processor 401 and the memory 402 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0072] The processor 401 may be a central processing unit (CPU). The processor 401 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0073] The memory 402 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the image highlight separation method in the embodiment of the present invention. The processor 401 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 402, that is, the image highlight separation method in the above method embodiment is implemented.

[0074] The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 401, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 402 may optionally include a memory remotely arranged relative to the processor 401, and these remote memories may be connected to the processor 401 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0075] The one or more modules are stored in the memory 402, and when executed by the processor 401, the following is performed: Figure 1 A highlight separation method for an image in the illustrated embodiment.

[0076] For details of the above electronic equipment, please refer to Figure 1 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.

[0077] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0078] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the defined scope.

Claims

1. A method for separating highlights of an image, characterized in that: The method comprises: Establishing a three-dimensional model of the target object based on the area to be processed in the target image; Performing projection processing on the three-dimensional model of the target object to obtain different template images; Matching the different template images with the target image to determine the target area; Convert the target area to YCbCr space, perform grayscale value histogram statistics on the Y channel of the target area, and determine the corresponding highlight threshold; Highlight separation is performed on the target area based on the highlight threshold.

2. The method for separating highlights of an image according to claim 1, characterized in that: The projecting process is performed on the three-dimensional model of the target object to obtain corresponding different template images, including: Establishing a spherical coordinate system, and placing the three-dimensional model at the origin of the spherical coordinate system; The spherical position of the virtual camera in the spherical coordinate system is changed, and corresponding different template images are obtained based on the projection of the three-dimensional model by the virtual camera at different positions.

3. The method for separating highlights of an image according to claim 2, characterized in that: The changing of the spherical position of the virtual camera in the spherical coordinate system comprises: The spherical surface of the spherical coordinate system is evenly divided using a plurality of vertices of a regular dodecahedron, and the vertices and the center point of the regular dodecahedron are determined as viewpoints; Dividing the spherical surface of each viewpoint neighborhood by regular hexagons to obtain a plurality of fine matching viewpoints corresponding to each viewpoint; The viewpoint and the multiple fine matching viewpoints are used as the spherical position of the virtual camera in the spherical coordinate system.

4. The method for separating highlights of an image according to claim 1, characterized in that: The matching of the different template images with the target image to determine the target area includes: Calculating the gradient direction features of the target image; Extracting gradient direction features of the different template images; Matching the gradient direction features of the target image with the gradient direction features of the different template images to obtain a first region of each template image with the greatest similarity to the target image and a first similarity value corresponding to each first region; A first region corresponding to the largest first similarity value is selected as the target region.

5. The method for separating highlights of an image according to claim 4, characterized in that: The step of converting the target area into a YCbCr space, performing grayscale value histogram statistics on a Y channel of the target area, and determining a corresponding highlight threshold value includes: Convert the target area from RGB space to YCbCr space; Performing grayscale value histogram statistics on the Y channel of the target area to obtain a grayscale value curve graph of the target area; Draw an auxiliary line to connect the highlight peak point and the gray value maximum point in the gray value curve graph; The grayscale value corresponding to the point on the histogram curve that is the largest distance from the auxiliary line is used as the highlight threshold.

6. The method for separating highlights of an image according to claim 5, characterized in that: The performing highlight separation processing on the target area based on the highlight threshold comprises: The highlight threshold is subtracted from the Y channel value of the target area to obtain a second Y channel value.

7. The method for separating highlights of an image according to claim 6, characterized in that: The method further comprises: Determine the second Y channel value as the Y channel value of the target area after highlight separation processing; The target image is reconstructed using the Y channel value of the target area after the highlight separation process to obtain an image after the highlight separation.

8. A device for separating highlights of an image, characterized in that: The device comprises: A model building module, used for building a three-dimensional model of the target object based on the area to be processed in the target image; A model projection processing module is used to perform projection processing on the three-dimensional model of the target object to obtain different template images; An image matching module, used to match the different template images with the target image to determine the target area; A highlight threshold determination module is used to convert the target area into a YCbCr space, perform grayscale value histogram statistics on the Y channel of the target area, and determine a corresponding highlight threshold; A highlight separation processing module is used to perform highlight separation on the target area based on the highlight threshold.

9. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the highlight separation method of the image as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the highlight separation method of an image according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • High-light area restoring method based on light field image

    CN107103589A

  • Method for highlight removal based on multi-view image feature matching

    CN107481201A