Image processing method, image processing device, terminal and readable storage medium
By segmenting and data processing of the color acquisition image to be collected, color data of multiple regions is generated, and the problem of low color acquisition efficiency and accuracy of multi-color block areas in the prior art is solved, and efficient and accurate color information acquisition is achieved.
Patent Information
- Application Number
- CN202210722343.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-06-17
AI Technical Summary
When there are multiple color blocks in the existing color collector, it is impossible to obtain accurate color information, resulting in low color collection efficiency and accuracy.
By obtaining the color image to be picked, dividing it into multiple areas according to the boundary of the color block, and data processing is performed on each area to generate color data of the corresponding color block.
It realizes the acquisition of color information in multiple color block areas at the same time, improving color collection efficiency and accuracy.
Smart Images

Figure CN115035286B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and more specifically, to an image processing method, an image processing device, a terminal, and a non-volatile computer-readable storage medium. Background Art
[0002] Generally, the color picker is designed based on the three-primary color filtering method, and the color measurement of the object to be picked up is achieved by measuring the three-primary color data. During use, the collected three-primary color data is compared and analyzed with the database to determine the color function of the photographed object, and then the target color is obtained. However, the color picker must ensure the color consistency of the color picking area when in use, that is, the color picking area must be a monochrome area. If there are multiple color block areas in the color picking area, accurate color information cannot be obtained, resulting in low color picking efficiency and accuracy. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, an image processing device, a terminal and a non-volatile computer-readable storage medium, which are used to at least solve the problem of low color extraction efficiency and accuracy.
[0004] The image processing method of the embodiment of the present application includes: obtaining an image to be colored, wherein the image to be colored has a plurality of color blocks; dividing the image to be colored into a plurality of regions according to the boundaries of the color blocks in the image to be colored; and performing data processing on each of the regions to generate color data of the corresponding color blocks.
[0005] The image processing device of the embodiment of the present application includes a first acquisition module, a segmentation module and a first generation module. The first acquisition module is used to acquire a color image to be extracted, wherein the color image to be extracted has multiple color blocks; the segmentation module is used to segment the color image to be extracted into multiple regions according to the boundaries of the color blocks in the color image to be extracted; and the first generation module is used to perform data processing on each of the regions to generate color data of the corresponding color blocks.
[0006] The terminal of an embodiment of the present application includes one or more processors, a memory and one or more programs, wherein one or more of the programs are stored in the memory and executed by one or more of the processors, and the program includes a method for executing the following image processing: obtaining an image to be colored, wherein the image to be colored has a plurality of color blocks; dividing the image to be colored into a plurality of regions according to the boundaries of the color blocks in the image to be colored; and performing data processing on each of the regions to generate color data of the corresponding color blocks.
[0007] The non-volatile computer-readable storage medium storing a computer program in the embodiment of the present application implements the following image processing method when the computer program is executed by one or more processors: obtaining an image to be colored, wherein the image to be colored has a plurality of color blocks; dividing the image to be colored into a plurality of regions according to the boundaries of the color blocks in the image to be colored; and performing data processing on each of the regions to generate color data of the corresponding color blocks.
[0008] In the image processing method, image processing device, terminal and non-volatile computer-readable storage medium of the embodiment of the present application, the acquired image to be color-selected has multiple color blocks, the image to be color-selected is divided into multiple regions according to the boundaries of the color blocks in the image to be color-selected, and data processing is performed on the multiple regions to generate color data of the corresponding color blocks. Since the image to be color-selected is divided into multiple regions according to the boundaries of the multiple color blocks in the image to be color-selected, it is possible to simultaneously obtain the color data of the color blocks corresponding to the multiple regions, thereby improving the color selection efficiency. At the same time, data processing is performed on the multiple regions respectively, and the color data of the corresponding color blocks in the multiple regions are obtained through data processing, thereby improving the accuracy of the color selection result.
[0009] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0011] Figure 1 is a flowchart of an image processing method of certain embodiments of the present application;
[0012] Figure 2 is a schematic diagram of the structure of an image processing device in some embodiments of the present application;
[0013] Figure 3 is a schematic diagram of the structure of a terminal in some implementation modes of the present application;
[0014] Figure 4 is a flowchart of an image processing method of certain embodiments of the present application;
[0015] Figure 5 It is a schematic diagram of a process for determining a scene to be color-selected and an area to be color-selected in an image processing method in certain embodiments of the present application;
[0016] Figure 6 It is a structural schematic diagram of a color picking device in an image processing method in certain embodiments of the present application;
[0017] Figure 7 is a flowchart of an image processing method of certain embodiments of the present application;
[0018] Figure 8 It is a schematic diagram of the principle of determining the segmented area in the image processing method in certain embodiments of the present application;
[0019] Fig. 9 is a flowchart of an image processing method of certain embodiments of the present application;
[0020] Fig.10 It is a structural schematic diagram of light source calibration in the image processing method in certain embodiments of the present application;
[0021] Fig.11 is a schematic diagram of a light source spectrum obtained by calibrating a light source in an image processing method in certain embodiments of the present application;
[0022] Fig.12 is a flowchart of an image processing method of certain embodiments of the present application;
[0023] Fig.13 It is a schematic diagram of the principle of obtaining color data in the image processing method of certain embodiments of the present application;
[0024] Fig.14 is a flowchart of an image processing method of certain embodiments of the present application;
[0025] Fig.15 is a schematic diagram of the structure of an image processing device in some embodiments of the present application;
[0026] Fig.16 is a schematic diagram of a scene of an image processing method in some embodiments of the present application;
[0027] Fig.17 It is a schematic diagram of a process for obtaining a target image in an image processing method in certain embodiments of the present application;
[0028] Fig.18 It is a schematic diagram of the connection status of a non-volatile computer-readable storage medium and a processor in certain embodiments of the present application. DETAILED DESCRIPTION
[0029] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0030] At present, the color picker must ensure the color consistency of the color picking area when in use, that is, the color picking area must be a monochrome area. If there are multiple color block areas in the color picking area, the accurate color cannot be obtained, which limits the applicable scenarios and leads to low color picking efficiency and accuracy. How to simultaneously obtain the color information of multiple color blocks and improve the color picking efficiency and accuracy has become a difficult problem that technicians in this field need to solve urgently. To solve this problem, the present application provides an image processing method and an image processing device 10( Figure 2 As shown), a terminal 100 ( Figure 3 ) and a non-volatile computer-readable storage medium ( Fig.18 shown).
[0031] See also Figure 1 The image processing method of the embodiment of the present application includes:
[0032] 01: Get the image to be color-selected, which has multiple color blocks;
[0033] 03: dividing the image to be color-selected into multiple regions according to the boundaries of the color blocks in the image to be color-selected; and
[0034] 05: Perform data processing on each area to generate color data of the corresponding color block.
[0035] See also Figure 2 The above-mentioned image processing method can be applied to an image processing device 10. The image processing device 10 of the embodiment of the present application includes a first acquisition module 11, a segmentation module 12, and a first generation module 13. The first acquisition module 11 is used to acquire the image to be color-selected, and the image to be color-selected has multiple color blocks. The segmentation module 12 is used to segment the image to be color-selected into multiple regions according to the boundaries of the color blocks in the image to be color-selected. The first generation module 13 is used to perform data processing on each region to generate color data of the corresponding color block.
[0036] See also Figure 3 , the above-mentioned image processing method can be applied to the terminal 100. The terminal 100 of one embodiment of the present application includes a body 20, one or more processors 40, a memory 30, and one or more programs. Among them, the one or more processors 40 and the memory 30 are installed in the body 20, the one or more programs are stored in the memory 30, and are executed by the one or more processors 40, and the program includes a program for executing the image processing methods in 01, 03 and 05. That is, the one or more processors 40 are used to: obtain the image to be color-selected, which has multiple color blocks; divide the image to be color-selected into multiple regions according to the boundaries of the color blocks in the image to be color-selected; and perform data processing on each region to generate color data of the corresponding color block.
[0037] The terminal 100 of another embodiment of the present application may include a body 20, and the image processing device 10 is installed in the body 20. The terminal 100 may be a mobile phone, a tablet computer, a digital camera, a laptop computer, a smart watch, a head-mounted display device, a game console, etc. The embodiment of the present application is described by taking the terminal 100 as a mobile phone as an example, and it can be understood that the specific form of the terminal 100 is not limited to a mobile phone.
[0038] Please continue reading Figure 3 In some embodiments, the terminal 100 may also include a microscopic color picker, which includes a microscope lens 50 and a processing unit (which may be a processor 40 or another processor different from the processor 40). The image to be picked up may be directly photographed by the microscope lens 50. The user photographs the desired area to be picked up through the microscope lens 50 to obtain the image to be picked up. In another embodiment, the image to be picked up may also be an image already on the terminal 100, such as an image stored in an album APP. In another embodiment, the image to be picked up may also be an image imported from the outside into the terminal 100, for example, an image obtained from other terminals, servers, or the cloud through Bluetooth, WIFI, optical transmission, etc. is used as the image to be picked up. After obtaining the image to be picked up, the processing unit of the microscopic color picker may perform color picking processing on the image to be picked up to obtain color data.
[0039] Specifically, the acquired image to be color-selected may have one or more different color blocks. The image to be color-selected is divided into multiple regions according to the boundaries of different color blocks in the image to be color-selected, and data processing is performed on the multiple regions to generate color data of corresponding color blocks in the multiple regions. Since the image to be color-selected is divided into multiple regions according to the boundaries of multiple color blocks in the image to be color-selected, it is possible to simultaneously obtain color data of corresponding color blocks in multiple regions, thereby improving the efficiency of color selection. At the same time, data processing is performed on multiple regions respectively, and color data of corresponding color blocks is obtained through data processing, thereby improving the accuracy of color selection results.
[0040] In some embodiments, the color data may be RGB color data. RGB is based on the three basic colors of R (Red), G (Green), and B (Blue), and is superimposed to varying degrees to produce rich and extensive colors, also known as the three-primary color model. RGB color data is more intuitive and easy to understand. Other color features can be derived from the RGB color data using linear or nonlinear transformations. In another embodiment, the color data may be color-opposition space (Lab color space, Lab) color data. Lab is composed of a brightness channel and two color channels. In Lab color data, each color is represented by three numbers: L (brightness), a (component from green to red), and b (component from blue to yellow). The colors of Lab color data are broad, uniform in perception, and easy to adjust. It should be noted that RGB color data and Lab color data can be converted to each other to provide users with more accurate and objective color data.
[0041] In the image processing method, image processing device 10 and terminal 100 of the present application, the image to be color-selected is divided into multiple regions according to the boundaries of different color blocks in the image to be color-selected, and data processing is performed on the multiple regions to generate color data of the corresponding color blocks in the multiple regions. Since the image to be color-selected is divided into multiple regions according to the boundaries of multiple color blocks in the image to be color-selected, it is possible to simultaneously obtain color data of the corresponding color blocks in multiple regions, thereby improving the color-selection efficiency. At the same time, data processing is performed on multiple regions respectively, and the color data of the corresponding color blocks is obtained through data processing, thereby improving the accuracy of the color-selection result.
[0042] See also Figure 4 In some embodiments, 01: obtaining an image to be color-selected, comprising:
[0043] 011: Select the scene to be colored;
[0044] 013: Use light sources to fill in the scene; and
[0045] 015: Focus on the scene and take a photo to obtain the image to be colored.
[0046] Please combine Figure 2 The first acquisition module 11 is also used to select a scene to be color-selected; use a light source to fill in the scene; and focus and take a picture of the scene to obtain an image to be color-selected.
[0047] Please combine Figure 3, one or more programs are executed by one or more processors 40, and the programs also include the method for executing the image processing methods in 011, 013 and 015. That is, the processor 40 is also used to select a scene to be color-selected; use a light source to fill in the scene; and focus and take a picture of the scene to obtain an image to be color-selected.
[0048] Specifically, a scene to be picked is selected, and the scene to be picked is micro-magnified to determine the area to be picked of the image to be picked, wherein the scene to be picked is a photographic scene that the user is interested in, that is, the scene has the color that the user is interested in. For example, refer to Figure 5 Assuming that the scene to be color-selected that the user is interested in is a mask, the scene area, that is, the area to be color-selected of the image to be color-selected can be determined by micro-magnifying the mask, and the area to be color-selected can be processed as the image to be color-selected to obtain the target color data.
[0049] In some embodiments, the terminal 100 may further include a light source 70. When the microlens 50 is used to select colors for the scene 60, the light source 70 may be used to perform fill light operation for the scene 60 to be selected. The light source 70 may be a fill light element integrated inside the microlens 50, or may be a fill light element disposed near the microlens 50 and independent of the microlens 50. Specifically, the microlens 50 illuminates the scene 60 to be selected through the light source 70. After being illuminated by the light source 70, the scene 60 to be selected generates reflected light, which is collected and recorded by the sensor in the microlens 50. Figure 6 , because there is a certain distance between the microscope lens 50 and the scene 60 to be picked up, when picking up colors, external stray light or dust and other substances may enter the interior of the microscope lens 50, causing the data collected by the microscope lens 50 to be inaccurate, thereby affecting the color processing result when the processing unit in the microscopic color picker performs the color picking operation, resulting in a certain deviation between the color data obtained by the microscopic color picker and the actual color data. Therefore, the terminal 100 of the present application sets a light source 70 for fill light, thereby reducing the proportion of external interference or stray light entering the interior of the microscope lens 50, and increasing the proportion of light reflected by the scene 60, so as to accurately obtain the reflection data of the scene 60 to be picked up on the light source 70, thereby obtaining accurate color data of the target scene.
[0050] It should be noted that in some embodiments, the scene can be focused by auto focus, manual focus, multiple focus, holographic auto focus, etc., which are not limited here. Different focusing methods are selected according to different scenes to avoid the problem of insufficient clarity of the captured image due to shaking, light or other reasons, so that the acquired image to be picked up is clearer and more realistic.
[0051] In the image processing method, image processing device 10 and terminal 100 of the present application, considering that external interference or stray light may cause certain deviations in the color data, the present application uses a light source 70 to perform fill light operation on the area to be color-selected, thereby reducing the proportion of external interference or stray light entering the interior of the microscope lens 50 and increasing the proportion of light reflected by the scene 60, so as to accurately obtain the reflection data of the light source in the area to be color-selected, and ensure the authenticity of the color data output by the microscopic color picker. Then, the scene 60 to be color-selected is photographed through the corresponding focus mode to ensure that the image to be color-selected is more accurate and clear.
[0052] See also Figure 7 In some embodiments, 03: dividing the image to be color-selected into a plurality of regions according to the boundaries of the color blocks in the image to be color-selected, including:
[0053] 031: Obtain color information in the image to be extracted;
[0054] 033: Determine the boundary of the color block based on the color information;
[0055] 035: Use the boundaries of the color blocks as cutting boundaries to cut the image to be colored to obtain multiple areas.
[0056] Please combine Figure 2 The segmentation module 12 is also used to: obtain color information in the image to be color extracted; determine the boundary of the color block according to the color information; and cut the image to be color extracted using the boundary of the color block as a cutting boundary to obtain multiple areas.
[0057] Please combine Figure 3 , one or more programs are executed by one or more processors 40, and the programs also include the method for executing the image processing methods in 031, 033 and 035. That is, the processor 40 is also used to obtain color information in the image to be color-extracted; determine the boundary of the color block according to the color information; and cut the image to be color-extracted using the boundary of the color block as the cutting boundary to obtain multiple areas.
[0058] Specifically, there are many different color blocks in the image to be colored, and different color blocks have different color information, and the color information includes information such as brightness value and / or RGB value. It should be noted that the brightness value comes from the three elements of color difference: brightness, hue and saturation. Among them, brightness refers to the brightness and darkness of the color; hue refers to the physical light reflected from the object to the optic nerve of the human eye, and the color of these different wavelengths of light; saturation is also called chroma, which refers to the degree of color in the color, generally calculated according to the degree of gray in the color. The chroma will be different due to different hues, and even if the hue is the same, the chroma will change due to different brightness.
[0059] See also Figure 8, use RGB information to distinguish different color blocks in the image to be color-selected, for example, the RGB value corresponding to red is RGB(255, 0, 0), the RGB value corresponding to yellow is RGB(255, 255, 0), the RGB value corresponding to yellow-green is RGB(154, 205, 50), the RGB value corresponding to brown is RGB(128, 42, 42), the RGB value corresponding to blue-purple is RGB(102, 0, 102), the RGB value corresponding to purple-red is RGB(255, 0, 102), etc. Different color blocks are distinguished by different RGB values, and then the boundaries of different color blocks are determined, so as to avoid large errors in color-selected data caused by multiple color blocks in the image to be color-selected.
[0060] Furthermore, the image to be colored is divided into multiple regions by different color information, so as to avoid inaccurate image segmentation regions due to uneven lighting, noise, image shadows and other reasons, and improve the accuracy of segmented regions. It should be noted that in some embodiments, the image segmentation method can also be a threshold-based segmentation method, a region-based segmentation method, a segmentation method based on a specific theory, etc., which are not limited here.
[0061] In the image processing method, image processing device 10 and terminal 100 of the present application, when dividing the image to be color-selected into multiple regions, the color information in the image to be color-selected is first obtained, and the boundaries of the color blocks are determined by the different color information in the image to be color-selected, so as to cut the image to be color-selected and obtain multiple regions. The image to be color-selected is divided into multiple regions, and by selecting colors from multiple regions, the color data of the color blocks corresponding to the multiple regions can be measured simultaneously, thereby improving the color selection efficiency of the color selector.
[0062] See also Fig. 9 Specifically, in some embodiments, 05: performing data processing on each region to generate color data of a corresponding color block may include:
[0063] 051: In the process of acquiring the color image to be acquired, the actual photon information reflected by the scene is collected;
[0064] 053: Obtaining reflectivity functions of various parts of the scene corresponding to each area according to preset spectral information and actual photon information; and
[0065] 055: Obtain color data of the corresponding color block according to the reflectance function corresponding to each area and a preset color database.
[0066] Please combine Figure 2The first generation module 13 is also used for: collecting actual photon information reflected by the scene in the process of acquiring the image to be colored; acquiring the reflectivity function of each part of the scene corresponding to each area according to the preset spectral information and the actual photon information; and acquiring the color data of the corresponding color block according to the reflectivity function corresponding to each area and the preset color database.
[0067] Please combine Figure 3 , one or more programs are executed by one or more processors 40, and the programs also include the method for executing the image processing methods in 051, 053 and 055. That is, the processor 40 is also used to collect the actual photon information reflected by the scene in the process of acquiring the color image to be acquired; acquire the reflectivity function of each part of the scene corresponding to each area according to the preset spectrum information and the actual photon information; and acquire the color data of the corresponding color block according to the reflectivity function corresponding to each area and the preset color database.
[0068] Specifically, first, the light source 70 of the terminal 100 is calibrated to obtain the spectrum information of the light source 70, and as the preset spectrum information, it can be stored in the memory 30 and can be obtained (read) by the processor 40; then, the image to be picked up is illuminated by the light source 70 with the calibrated spectrum, and the photon information reflected by the scene 60 in the image to be picked up is collected and recorded by the sensor in the microscope lens 50, and the reflectivity function corresponding to each area is calculated by the preset spectrum information and the actual photon information collected by the sensor, and the reflectivity function is analyzed and processed with the preset color database, so as to obtain the color data of the color block corresponding to each area. Among them, the image processing method and the terminal 100 in the present application use the reflectivity function to compare and analyze the color data in the preset color database, which can ensure the accuracy of the color data output by the microscopic color picker and improve the color picking efficiency.
[0069] More specifically, see Fig.10 , the spectrum information of the light emitted by the light source 70 can be calibrated by the spectroradiometer 80, that is, the light source 70 is irradiated directly to the spectroradiometer 80, and after the light enters the spectroradiometer 80, the spectroradiometer 80 can directly output the spectrum of the light source 70, and then the spectrum diagram of the light source 70 is obtained, as shown in FIG. Fig.11 as shown and used as the preset spectral information.
[0070] See also Fig.12 In some embodiments, 055: obtaining color data of a corresponding color block according to a reflectivity function corresponding to each region and a preset color database may include:
[0071] 0551: Use a light source with a calibrated spectrum to illuminate color cards of different colors in sequence, and collect the calibration photon information reflected by the color cards. Each color card has different color data;
[0072] 0553: Obtain the reflectance function of each color card according to the spectral information and the calibration photon information; and
[0073] 0555: Generate a color database based on the reflectance function of each color card and the color data of the color card.
[0074] Please combine Figure 2 The first generation module 13 is also used to: use a light source with a calibrated spectrum to sequentially illuminate color cards of different colors, and collect calibration photon information reflected by the color cards, each color card has different color data; obtain the reflectance function of each color card according to the spectrum information and the calibration photon information; and generate a color database according to the reflectance function of each color card and the color data of the color card.
[0075] Please combine Figure 3 , one or more programs are executed by one or more processors 40, and the programs also include a method for executing the image processing methods in 0551, 0553 and 0555. That is, the processor 40 is also used to use a light source with a calibrated spectrum to sequentially illuminate color cards of different colors, and collect calibration photon information reflected by the color cards, each color card has different color data; obtain the reflectance function of each color card according to the spectrum information and the calibration photon information; and generate a color database according to the reflectance function of each color card and the color data of the color card.
[0076] In the image processing method, image processing device 10 and terminal 100 in the present application, a preset color database may also be stored in the memory 30, and the processor 40 may obtain (read) the color database from the memory 30. The color database includes preset spectral information, preset color data, and preset reflectance function of the light source 70. Among them, the preset spectral information has been obtained by the previous calibration method. The method for obtaining the preset color data is as follows: the light source 70 irradiates different color cards, and the sensor in the microscope lens 50 collects the calibration photon information reflected by each color card, and the reflectance function of each color card is obtained according to the spectral information and the calibration photon information, and is used as the preset reflectance function, and then the color database is generated according to the preset reflectance function of each color card and the color data of the color card (also known).
[0077] More specifically, the preset light source spectrum information is pre-stored in the color database, recorded as S0(λ) (known quantity), and then the light source 70 with the calibrated spectrum is sequentially irradiated with different color cards, and different color cards have different color data (known) and can reflect light so that the sensor in the microscope lens 50 collects and records the photon information corresponding to each color card, and serves as the calibration photon information, recorded as I i(λ) (a known quantity, the number is the same as the number of color cards, for example, i color cards experience i reflections, and the sensor will obtain i calibration photon information), correspondingly, there are i reflectivity functions, denoted by ρ i (λ); Due to the light source spectrum information S0(λ), calibration photon information I i ((λ), and the reflectance function ρ of each color card i (λ) has the following relationship:
[0078] I i (λ)=S0(λ)*ρ i (λ)
[0079] According to the light source spectrum S0(λ) and the calibration photon information I i (λ) Get the reflectance function ρ of each color card i (λ) as the preset reflectivity function. i (λ) Arrange the records to form a color database.
[0080] See also Fig.13 In some embodiments, the reflectivity function ρ i (λ) forms a one-to-one mapping relationship with the preset color data. The actual photon information I is obtained by using the method in 051 实际 After that, since the preset light source spectrum information is known, as mentioned above, it is the calibrated S0(λ), then according to the light source spectrum information S0(λ), the actual photon information I 实际 (λ), and reflectivity function ρ 实际 (λ) Relationship between: I 实际 (λ)=S0(λ)*ρ 实际 (λ), calculate ρ 实际 (λ). Finally, according to the mapping relationship (reflectivity function ρ i (λ) and the preset color data), calculate the 实际 (λ) The corresponding color data.
[0081] In actual use, different color blocks in the image to be extracted are illuminated by a light source 70 with a calibrated spectrum, thereby obtaining actual photon information I reflected by different color blocks. 实际 (λ), calculate the actual reflectance function of different color blocks in the image to be colored according to the actual photon information and the calibrated light source spectrum, and classify and compare them with the reflectance function in the color database, and finally obtain the color data of the color block. In this way, the color data of different color blocks in the image to be colored can be quickly obtained, thereby realizing a more refined, accurate and responsive color acquisition function.
[0082] In some embodiments, the color database may be pre-stored in the memory 30 and may be read by the processor 40. By pre-storing the color database, when the microscopic color picker obtains the color data of different color blocks in the image to be picked, the reflectivity function obtained according to the actual photon data collected can be directly compared and analyzed with the preset reflectivity function pre-stored in the color database, thereby obtaining the color data of the color block, ensuring the smoothness of the color picking operation, and making the responsiveness of color collection more convenient.
[0083] Furthermore, in another embodiment, the color database can be generated in real time during the process of acquiring the image to be color-picked. When the color database is pre-stored in the memory 30, the pre-stored color database will have certain differences between the pre-stored color data and the actual color data due to the particularity of the color-picking environment, resulting in a decrease in the accuracy of the obtained color data. By generating the color database in real time during the process of acquiring the image to be color-picked, the real-time update of the color data can be guaranteed, avoiding the problem of mismatch between the pre-stored color data and the actual color data, so that the color data obtained by the color-picking operation is more accurate.
[0084] See also Fig.14 , the image processing method of the embodiment of the present application further includes:
[0085] 04: Get the image to be processed;
[0086] 06: Perform portrait edge detection and recognition on the image to be processed to obtain the portrait image and contour image;
[0087] 07: Select one color block from multiple color blocks, and generate a background plate based on the color data of the selected color block;
[0088] 08: Process the background plate and the contour image to obtain a color background plate with contour information; and
[0089] 09: Combine the color background plate and the portrait image to output the target image.
[0090] See also Fig.15, the above-mentioned image processing method can be applied to the image processing device 10, and the image processing device 10 of the embodiment of the present application also includes a second acquisition module 14, a detection module 15, a second generation module 16, a processing module 17 and a synthesis module 18. The second acquisition module 14 is used to acquire the image to be processed. The detection module 15 is used to perform portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image. The second generation module 16 is used to select one from multiple color blocks and generate a background plate according to the color data of the selected color block. The processing module 17 is used to process the background plate and the contour image to obtain a color background plate with contour information. The synthesis module 18 is used to synthesize the color background plate and the portrait image to output the target image.
[0091] See also Figure 3 The above image processing method can be applied to the terminal 100, one or more programs are stored in the memory 30 and executed by one or more processors 40, and the programs include programs for executing the image processing methods in 04, 06, 07, 08 and 09. That is, the one or more processors 40 are used to: obtain the image to be processed; perform portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image; select one of the multiple color blocks and generate a background plate according to the color data of the selected color block; process the background plate and the contour image to obtain a color background plate with contour information; and synthesize the color background plate and the portrait image to output the target image.
[0092] The image processing method, image processing device 10 and terminal 100 in the present application are based on performing portrait edge detection and recognition on the portrait in the image to be processed, thereby obtaining the portrait image and contour image of the portrait in the image to be processed, and then by picking the color that the user wants to obtain, a background plate of the same size as the image to be processed is generated according to the color data of the selected color, and then the background plate and the contour image are processed to obtain a color background plate with contour information, and the color background plate and the portrait image are synthesized to output the target image. Furthermore, it is possible to select appropriate color information according to different needs, and achieve the effect of freely changing the image background.
[0093] Specifically, in some embodiments, the terminal 100 may include a camera module, and the camera module is not limited to front or rear photography. The image processing method, image processing device 10 and terminal 100 of the present application can obtain the image to be processed through the camera module, perform portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image, extract the color data of different color blocks in the image to be processed through a microscopic color picker, select the required color block, and generate a background plate of the same size as the image to be processed according to the color data of the color block, thereby achieving the effect of quickly, efficiently, accurately and automatically changing the image background. It should be noted that in some embodiments, the microscopic color picker can be installed on the main body 20; or the microscopic color picker can also be an external device purchased separately. Through the joint action of the camera module and the microscopic color picker, it can help users more independently select the required color to replace the background of the image to be processed, thereby improving the user experience.
[0094] More specifically, see Fig.16 , the edge information of the portrait is algorithmically processed according to the original information of the portrait in the image to be processed, that is, after the edge information of the portrait is extracted and identified, a portrait image is obtained, in which the original background in the image to be processed is red, the clothes of the person are blue, and there is only the portrait in the portrait image, without the background and foreground in the image to be processed. The image to be processed is then binarized to obtain a contour image, and the background, foreground and the part where the portrait is cut out are all black and white. The required color is picked by a microscopic color picker, and a background plate of the same size as the image to be processed is generated according to the color data of the selected color. Finally, the background plate and the contour image are processed to obtain a color background plate with contour information, and the color background plate and the portrait image are synthesized to output the target image. If the microscopic color picker picks color for the person's clothes, that is, picks blue, a blue background plate can be generated, and the background color in the final target image is blue. Of course, if the microscopic color picker is aimed at other parts (such as the color part that the user is interested in, such as the corresponding Figure 8 The color block corresponding to the sequence number 12 in the image is used for color picking, and the generated background plate is the color that the user is interested in. The background in the final target image is also the color that the user is interested in. Since the color data of each color block has been obtained in the 05 method, it is convenient for the user to subdivide each color area in the image to be picked, so that the color picking is more accurate and more in line with the color that the user wants. The background in the final target image is also the background that the user wants.
[0095] In some embodiments, the image to be processed may be obtained by directly photographing with a camera module; in another embodiment, the image to be processed may also be an image already present on the terminal 100, such as an image stored in a photo album APP; in yet another embodiment, the image to be processed may also be an image imported into the terminal 100 from the outside, for example, an image obtained from other terminals, servers, the cloud, etc. through Bluetooth, WIFI, optical transmission, etc. as the image to be processed.
[0096] See also Fig.17 In some embodiments, 06: performing portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image may include:
[0097] 061: Get the original information of the portrait;
[0098] 063: Extracting and identifying edge information of the portrait according to the original information to obtain a portrait image; and
[0099] 065: Binarize the graphics to be processed to obtain a contour map.
[0100] Please combine Fig.15 The detection module 15 is also used for: obtaining original information of the portrait; extracting and identifying edge information of the portrait according to the original information to obtain a portrait image; and performing binarization processing on the image to be processed to obtain a contour image.
[0101] Please combine Figure 3 , one or more programs are executed by one or more processors 40, and the programs also include the method for executing the image processing methods in 061, 063 and 065. That is, obtaining the original information of the portrait; extracting and identifying the edge information of the portrait according to the original information to obtain the portrait image; and binarizing the image to be processed to obtain the contour image.
[0102] Specifically, the original information of the portrait is obtained, that is, the RGB value, grayscale value, pixel value and other data of the portrait are obtained to determine the original information of the portrait, and the edge detection and recognition of the portrait are performed based on the original information of the portrait. It should be noted that the edge detection and recognition of the portrait are performed by an algorithm.
[0103] It should be noted that binarization of the image to be processed is to set the grayscale value of the pixel on the image to be processed to 0 or 255, that is, to make the entire image appear in obvious black and white. That is, the grayscale image with 256 brightness levels is selected through an appropriate threshold to obtain a binary image that can still reflect the overall and local features of the image. By binarizing the image to be processed, the target contour is highlighted, and the amount of data is reduced, which is conducive to the next step of image processing.
[0104] Furthermore, in some implementations, 063: extracting and identifying edge information of the portrait according to the original information to obtain a portrait image may also include: 0631: extracting the portrait using a traditional edge recognition algorithm or an artificial intelligence algorithm.
[0105] The detection module 15 is also used to extract the portrait using a traditional edge recognition algorithm or an artificial intelligence algorithm. One or more programs are executed by one or more processors 40, and the program also includes an image processing method for executing 0631. That is, the processor 40 is also used to extract the portrait using a traditional edge recognition algorithm or an artificial intelligence algorithm. At this time, the traditional edge recognition algorithm or artificial intelligence algorithm can be used to extract the portrait first. When executing 065, the portrait image obtained by the algorithm recognition is used, and the image to be processed is binarized to obtain a contour image. It should be noted that in some embodiments, the traditional edge recognition algorithm can be gradient descent.
[0106] In the image processing method, image processing device 10, terminal 100 and non-volatile computer-readable storage medium of the implementation mode of the present application, an image to be processed is acquired through a camera module, portrait edge detection and recognition are performed on the image to be processed to acquire a portrait image and a contour image, and color is picked up by using a microscopic color picker. A background plate as large as the image to be processed is generated according to the color data of the selected color blocks, the background plate and the contour image as large as the image to be processed are processed to acquire a color background plate with contour information, and the color background plate is synthesized with the portrait image to output a target image, thereby realizing the selectivity of background color replacement and providing a better user experience.
[0107] See also Fig.18 The present application also provides a non-volatile computer-readable storage medium 200 storing a computer program. When the computer program 202 is executed by one or more processors 40, the image processing method of any embodiment described above is implemented.
[0108] For example, when the program 202 is executed by the processor 40, the following image processing method is implemented:
[0109] 01: Get the image to be color-selected, which has multiple color blocks;
[0110] 03: dividing the image to be color-selected into multiple regions according to the boundaries of the color blocks in the image to be color-selected; and
[0111] 05: Perform data processing on each area to generate color data of the corresponding color block.
[0112] For another example, when the program 202 is executed by the processor 40, the following image processing method is implemented:
[0113] 04: Get the image to be processed;
[0114] 06: Perform portrait edge detection and recognition on the image to be processed to obtain the portrait image and contour image;
[0115] 07: Select one color block from multiple color blocks, and generate a background plate based on the color data of the selected color block;
[0116] 08: Process the background plate and the contour image to obtain a color background plate with contour information; and
[0117] 09: Combine the color background plate and the portrait image to output the target image.
[0118] For another example, when program 202 is executed by processor 40, the image processing methods in 011, 013, 015, 031, 033, 035, 051, 053, 055, 0551, 0553, 0555, 061, 063 and 065 can also be implemented.
[0119] In the non-volatile computer-readable storage medium 200 of the present application, the acquired image to be color-picked has multiple color blocks, and the image to be color-picked is divided into multiple regions according to the boundaries of the color blocks in the image to be color-picked, and data processing is performed on the multiple regions to generate color data of the corresponding color blocks. Since the image to be color-picked is divided into multiple regions according to the boundaries of the multiple color blocks in the image to be color-picked, it is possible to simultaneously obtain color data of color blocks corresponding to multiple regions, thereby improving the efficiency of color-picking. At the same time, data processing is performed on multiple regions respectively, and color data of corresponding color blocks is obtained through data processing, thereby improving the accuracy of color-picking results.
[0120] In the description of this specification, the descriptions with reference to the terms "certain embodiments", "in an example", "exemplarily", etc., mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0121] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0122] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. An image processing method, characterized in that: include: Acquire a color image to be extracted, wherein the color image to be extracted has multiple color blocks; Dividing the image to be color extracted into a plurality of regions according to the boundaries of the color blocks in the image to be color extracted; and Performing data processing on each of the regions to generate color data of the corresponding color block, wherein performing data processing on each of the regions to generate color data of the corresponding color block includes: In the process of acquiring the image to be colored, actual photon information reflected by the scene is collected; Obtaining reflectivity functions of various parts of the scene corresponding to each of the regions according to preset spectral information and the actual photon information; and the preset spectral information is spectral information of the light source obtained by calibrating the light source of the terminal; The color data of the corresponding color block is obtained according to the reflectivity function corresponding to each of the regions and a preset color database.
2. The image processing method according to claim 1, characterized in that: The step of obtaining the image to be colored includes: Select the scene to be colored; Using a light source to fill in the scene; and The scene is focused and photographed to obtain the image to be colored.
3. The image processing method according to claim 1, characterized in that: The step of dividing the image to be color extracted into a plurality of regions according to the boundaries of the color blocks in the image to be color extracted comprises: Acquire color information in the image to be color extracted; determining a boundary of the color block according to the color information; The image to be color-extracted is cut using the boundaries of the color blocks as cutting boundaries to obtain a plurality of the regions.
4. The image processing method according to claim 1, characterized in that: Also includes: Using a light source with a calibrated spectrum to sequentially illuminate color cards of different colors, and collecting calibration photon information reflected by the color cards, each of the color cards having different color data; Obtaining a reflectance function of each of the color cards according to the spectral information and the calibration photon information; and The color database is generated according to the reflectance function of each color card and the color data of the color card.
5. The image processing method according to claim 1, characterized in that: Also includes: Get the image to be processed; Performing portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image; Selecting one of the plurality of color blocks, and generating a background plate according to the color data of the selected color block; Processing the background plate and the contour image to obtain a color background plate with contour information; and The color background plate is synthesized with the portrait image to output a target image.
6. The image processing method according to claim 5, characterized in that: The performing of portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image includes: Get the original information of the portrait; Extracting and identifying edge information of the portrait according to the original information to obtain the portrait image; and The image to be processed is binarized to obtain the contour map.
7. An image processing device, characterized in that: include: A first acquisition module is used to acquire an image to be color-extracted, wherein the image to be color-extracted has a plurality of color blocks; A segmentation module, used for segmenting the image to be color extracted into a plurality of regions according to the boundaries of the color blocks in the image to be color extracted; and A first generating module is used to perform data processing on each of the regions to generate color data of the corresponding color block, and the first generating module is also used to: collect actual photon information reflected by the scene in the process of acquiring the image to be acquired; obtain the reflectivity function of each part of the scene corresponding to each of the regions according to preset spectral information and the actual photon information, wherein the preset spectral information is spectral information of the light source obtained by calibrating the light source of the terminal; And obtaining the color data of the corresponding color block according to the reflectivity function corresponding to each of the regions and a preset color database.
8. The image processing device according to claim 7, characterized in that: Also includes: A second acquisition module, used for acquiring an image to be processed; A detection module, used for performing portrait edge detection and recognition on the image to be processed to obtain a portrait image and a contour image; A second generating module, used for selecting one of the plurality of color blocks, and generating a background plate according to the color data of the selected color block; A processing module, used for processing the background plate and the contour image to obtain a color background plate with contour information; and The synthesis module is used to synthesize the color background plate and the portrait image to output a target image.
9. A terminal, characterized in that: include: One or more processors, memory; and One or more programs, wherein one or more of the programs are stored in the memory and executed by one or more of the processors, and the programs include instructions for executing the image processing method according to any one of claims 1 to 6.
10. A non-volatile computer-readable storage medium storing a computer program, which, when executed by one or more processors, implements the image processing method according to any one of claims 1 to 6.
