CN111784558A - Image processing method and device, electronic equipment and computer storage medium - Google Patents

Image processing method and device, electronic equipment and computer storage medium Download PDF

Info

Publication number
CN111784558A
CN111784558A CN202010558331.2A CN202010558331A CN111784558A CN 111784558 A CN111784558 A CN 111784558A CN 202010558331 A CN202010558331 A CN 202010558331A CN 111784558 A CN111784558 A CN 111784558A
Authority
CN
China
Prior art keywords
lookup table
storage area
display lookup
storage
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010558331.2A
Other languages
Chinese (zh)
Inventor
唐文峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202010558331.2A priority Critical patent/CN111784558A/en
Publication of CN111784558A publication Critical patent/CN111784558A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The application provides an image processing method, an image processing device, an electronic device and a computer storage medium, wherein a reference target display lookup table is used for reducing stored data by storing a conversion matrix without storing all RGB values in the target display lookup table. On the basis of the reduction of the stored data, the data acquisition amount can be reduced, and the overall time of image processing can be further shortened, so that the overall efficiency of image processing is improved. Moreover, the conversion matrix corresponding to the RGB value of each pixel can represent the conversion relationship between the RGB value of each pixel and the corresponding RGB value, so that the RGB value of each pixel is converted based on the conversion relationship between the RGB value of each pixel and the corresponding RGB value, and the RGB value of each pixel can be converted without destroying the continuity of the color space, thereby ensuring the conversion accuracy and improving the accuracy of image processing.

Description

Image processing method and device, electronic equipment and computer storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image processing method and apparatus, an electronic device, and a computer storage medium.
Background
In the field of image processing, an LUT (Look-Up Table) is used to store RGB values obtained by converting original RGB values based on a certain requirement, for example, RGB values obtained by converting original RGB values based on a filter effect requirement. The image processing system converts the image to be processed into an image different from the image to be processed by reading the LUT and adjusting RGB values in the image to be processed according to the LUT.
However, currently, the number of RGB values in the LUT is at most 256 × 256, and thus, the amount of data stored in the LUT is large, and the image processing system needs to take a long time to read the LUT due to the large amount of data, and the overall efficiency of image processing is reduced.
In order to solve the above problem, the LUT is generally simplified, but the simplified LUT may cause a reduction in the accuracy of image processing. Therefore, the prior art has the problem that the efficiency and the precision of the image processing cannot be obtained at the same time.
Disclosure of Invention
In order to solve the foregoing technical problems, embodiments of the present application provide an image processing method, an image processing apparatus, an electronic device, and a computer storage medium, so as to achieve the purpose of simultaneously ensuring efficiency and accuracy of image processing, and the technical solution is as follows:
one aspect of the present application provides an image processing method, including:
acquiring an image to be processed, wherein the image to be processed comprises a plurality of pixels;
respectively determining a conversion matrix corresponding to each pixel by using a reference display lookup table, wherein the conversion matrix is used for representing the conversion relation of RGB values of a source storage area and a target storage area, the source storage area consists of a plurality of storage positions in the source display lookup table, and the target storage area consists of a plurality of storage positions in the target display lookup table corresponding to the plurality of storage positions in the source display lookup table; wherein at least one conversion matrix is stored in the reference display lookup table;
and converting the RGB value of each pixel based on the conversion matrix corresponding to the RGB value of each pixel to obtain a target RGB value corresponding to each pixel, so as to obtain a target image.
Optionally, the transformation matrix is constructed by:
acquiring a source display lookup table in which all RGB values of an RGB color space are stored;
respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB value meeting the set requirement as a target display lookup table;
respectively dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number by adopting the same division mode, wherein the storage areas are composed of at least two storage positions;
for a first storage area in the source display lookup table, determining the conversion matrix according to the RGB value of the first storage area and the RGB value of a second storage area; the first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
Optionally, the setting requirement is a set filter effect requirement.
Optionally, the set number is 512.
Optionally, the determining, by using a reference display lookup table, a conversion matrix corresponding to each pixel respectively includes:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a storage area corresponding to the first storage position in the reference display lookup table;
and taking the conversion matrix stored in the storage area as a first conversion matrix corresponding to the pixel.
Optionally, the determining, by using a reference display lookup table, a conversion matrix corresponding to each pixel respectively includes:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a second storage position of each target RGB value in the source display lookup table for each target RGB value having a set relationship with the RGB value of each pixel in the image to be processed;
determining a first storage area corresponding to the first storage position and a second storage area corresponding to the second storage position in the reference display lookup table;
and performing weighted summation on the conversion matrix stored in the first storage area and the conversion matrix stored in the second storage area to obtain a conversion matrix which is used as the first conversion matrix corresponding to the pixel.
Another aspect of the present application provides an image processing apparatus comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an image to be processed, and the image to be processed comprises a plurality of pixels;
a determining module, configured to determine a conversion matrix corresponding to each pixel by using a reference display lookup table, where the conversion matrix is used to represent a conversion relationship between RGB values of a source storage area and a target storage area, the source storage area is composed of a plurality of storage locations in the source display lookup table, and the target storage area is composed of a plurality of storage locations in the target display lookup table corresponding to the plurality of storage locations in the source display lookup table; wherein at least one conversion matrix is stored in the reference display lookup table;
and the conversion module is used for converting the RGB value of each pixel based on the conversion matrix corresponding to the RGB value of each pixel to obtain a target RGB value corresponding to each pixel, so that a target image is obtained.
Optionally, the apparatus further comprises:
a build module to:
acquiring a source display lookup table in which all RGB values of an RGB color space are stored;
respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB value meeting the set requirement as a target display lookup table;
respectively dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number by adopting the same division mode, wherein the storage areas are composed of at least two storage positions;
for a first storage area in the source display lookup table, determining the conversion matrix according to the RGB value of the first storage area and the RGB value of a second storage area; the first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
Optionally, the setting requirement is a set filter effect requirement.
Optionally, the set number is 512.
Optionally, the determining module is specifically configured to:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a storage area corresponding to the first storage position in the reference display lookup table;
and taking the conversion matrix stored in the storage area as a first conversion matrix corresponding to the pixel.
Optionally, the determining module is specifically configured to:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a second storage position of each target RGB value in the source display lookup table for each target RGB value having a set relationship with the RGB value of each pixel in the image to be processed;
determining a first storage area corresponding to the first storage position and a second storage area corresponding to the second storage position in the reference display lookup table;
and performing weighted summation on the conversion matrix stored in the first storage area and the conversion matrix stored in the second storage area to obtain a conversion matrix which is used as the first conversion matrix corresponding to the pixel.
A third aspect of the present application provides an electronic device comprising:
a memory for storing at least one set of instructions;
a processor for calling and executing the instruction set in the memory, and executing the instruction set to perform the steps of the image processing method according to any one of the above items.
A computer storage medium having stored thereon a computer program for execution by a processor for carrying out the steps of the image processing method according to any one of the preceding claims.
Compared with the prior art, the beneficial effect of this application is:
in the present application, the reference target display lookup table stores the conversion matrix for representing the conversion relationship between the RGB values of the first storage area in the source display lookup table and the second storage area in the target display lookup table, and does not need to store all RGB values in the target display lookup table, so that the stored data is reduced. On the basis of the reduction of the stored data, the data acquisition amount can be reduced, and the overall time of image processing can be further shortened, so that the overall efficiency of image processing is improved.
Moreover, the conversion matrix corresponding to the RGB value of each pixel can represent the conversion relationship between the RGB value of each pixel and the corresponding RGB value, so that the RGB value of each pixel is converted based on the conversion relationship between the RGB value of each pixel and the corresponding RGB value, and the RGB value of each pixel can be converted without destroying the continuity of the color space, thereby ensuring the conversion accuracy and improving the accuracy of image processing.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a flowchart of an image processing method provided in embodiment 1 of the present application;
FIG. 2(a) is a schematic diagram of a storage structure of a target display look-up table provided in the present application;
FIG. 2(b) is a schematic diagram of a storage structure of a reference display look-up table provided in the present application;
FIG. 3 is a flow chart of a construction process of a transformation matrix provided herein;
fig. 4 is a flowchart of an image processing method provided in embodiment 2 of the present application;
fig. 5 is a flowchart of an image processing method provided in embodiment 3 of the present application;
fig. 6 is a schematic diagram of a logic structure of an image processing apparatus provided in the present application.
Detailed Description
Currently, the ways commonly employed by those skilled in the art to simplify LUTs are: dividing a plurality of RGB values in the LUT into a plurality of groups, selecting one RGB value from each group of RGB values in the LUT according to a certain selection mode to be used as a representative value of the group of RGB values, and forming a brand-new LUT by the representative values of the groups of RGB values to finish the simplification of the LUT. For example, the LUT includes 256 × 256 RGB values, each 8 RGB values are grouped, and one RGB value is selected from the group as an RGB value to be used, so that 32 × 32 RGB values are finally obtained. Although the amount of data stored by the LUT is reduced, more RGB values are lost, resulting in discontinuity of the color space to which the LUT corresponds. Processing an image based on an LUT with discontinuous color space may affect the accuracy of image processing. In order to solve the above problem, the inventors have found that, on the premise of ensuring continuity of the color space, a higher accuracy of image processing can be ensured as well if the data amount is reduced. Therefore, the present application provides an image processing method, and the following describes the image processing method in detail.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, a flowchart of an image processing method provided in embodiment 1 of the present application may include the following steps:
step S11, acquiring an image to be processed, wherein the image to be processed comprises a plurality of pixels;
in this embodiment, the manner of acquiring the image to be processed is not limited. Optionally, the image to be processed may be an image acquired by the acquisition device and including a plurality of pixels, or may be an image acquired by other methods and channels and including a plurality of pixels, such as user upload, network download, and the like.
Step S12, determining a conversion matrix corresponding to each pixel by using the reference display look-up table.
At least one conversion matrix is stored in the reference display lookup table. And the conversion matrix is used for representing the conversion relation of the RGB values of the source storage area and the target storage area, the source storage area is composed of a plurality of storage positions in a source display lookup table, and the target storage area is composed of a plurality of storage positions in the target display lookup table, which correspond to the plurality of storage positions in the source display lookup table.
The source display look-up table may be understood as: and the display lookup table at least comprises RGB values of all pixels in the image to be processed. Preferably, the source display look-up table comprises all RGB values of the RGB color space, i.e. 256 × 256 RGB values.
The target display look-up table may be understood as: and the display lookup table is obtained by carrying out certain conversion on each RGB value in the source display lookup table. The number of storage locations in the target display look-up table is the same as the number of storage locations in the source display look-up table, and the distribution of storage locations in the target display look-up table is the same as the distribution of storage locations in the source display look-up table. On the premise that the number and distribution of the storage locations are the same, the RGB values of the target display lookup table and the source display lookup table at the corresponding storage locations are also corresponding, for example, the source display lookup table includes 256 × 256 storage locations, each storage location stores a different RGB value, the target display lookup table corresponds to a storage location in the source display lookup table, and also includes 256 × 256 storage locations, and the RGB value stored at each storage location is obtained by converting the RGB value stored at the storage location corresponding to the source display lookup table.
It is understood that, in the reference display lookup table, the storage area corresponding to the target storage area in the target display lookup table stores the conversion matrix, but not all RGB values in the target storage area, as shown in fig. 2(a), 1 indicates the target display lookup table, 10 indicates the target storage area, 101 indicates the storage location, 1011 indicates the RGB value, each storage location 101 in the target display lookup table 1 stores one RGB value 1011, and the target storage area 10 composed of a plurality of storage locations 101 stores a plurality of RGB values 1011; as shown in fig. 2(b), 2 denotes a reference display look-up table, 20 denotes a storage area corresponding to the target storage area 10, 201 denotes a storage location in the storage area 20 corresponding to the target storage area 10, and 2011 denotes a conversion matrix, and the storage area 20 corresponding to the target storage area 10 in the reference display look-up table 2 stores a conversion matrix 2011 which represents a conversion relationship between RGB values of the source storage area and the target storage area 10.
Because the source display lookup table at least comprises the RGB values of all pixels of the image to be processed, the conversion matrix in the reference display lookup table can cover the conversion relation of the RGB values of all pixels of the image to be processed, and the conversion matrix corresponding to each pixel can be respectively determined by utilizing the reference display lookup table which is constructed in advance and stores at least one conversion matrix.
In this embodiment, the manner of obtaining the reference display lookup table is not limited. For example, the reference display lookup table may be pre-constructed and stored locally, so that when the reference display lookup table needs to be used, the reference display lookup table is obtained quickly, and the obtaining efficiency is improved.
Of course, the reference display look-up table may also be obtained from the server when the image processing task needs to be executed, so as to save the local storage space.
Alternatively, when the image processing task needs to be executed, the reference display lookup table may be temporarily constructed based on a set construction template.
Step S13, converting the RGB values of each pixel based on the conversion matrix corresponding to the RGB values of each pixel, respectively, to obtain a target RGB value corresponding to each pixel, thereby obtaining a target image.
In this embodiment, the RGB values of each pixel may be converted by using the following relation:
Figure BDA0002545172180000081
a represents a conversion matrix corresponding to a certain pixel in the image to be processed,
Figure BDA0002545172180000082
representing the RGB value of the pixel in the image to be processed,
Figure BDA0002545172180000083
representing the target RGB value for that pixel.
It should be noted that the number of columns of the transformation matrix A is equal to
Figure BDA0002545172180000084
The number of rows of (c) is the same. Of course, the number of columns of the transformation matrix a may not be equal to 3, and in the case that the number of columns of the transformation matrix a is greater than 3, the transformation matrix a may be divided into two or more rows
Figure BDA0002545172180000085
Adjusted to the number of rows and the number of columns of the conversion matrix AThe same matrix. For example, in the case where the number of columns of the conversion matrix a is 4, the conversion matrix a may be divided into two
Figure BDA0002545172180000086
Is adjusted to
Figure BDA0002545172180000087
In the present application, the reference target display lookup table stores the conversion matrix for representing the conversion relationship between the RGB values of the first storage area in the source display lookup table and the second storage area in the target display lookup table, and does not need to store all RGB values in the target display lookup table, so that the stored data is reduced. On the basis of the reduction of the stored data, the data acquisition amount can be reduced, and the overall time of image processing can be further shortened, so that the overall efficiency of image processing is improved.
Moreover, the conversion matrix corresponding to the RGB value of each pixel can represent the conversion relationship between the RGB value of each pixel and the corresponding RGB value, so that the RGB value of each pixel is converted based on the conversion relationship between the RGB value of each pixel and the corresponding RGB value, and the RGB value of each pixel can be converted without destroying the continuity of the color space, thereby ensuring the conversion accuracy and improving the accuracy of image processing.
It can be understood that the reference display lookup table only needs to store the conversion matrix, and the reference display lookup table can be used to convert the RGB values of each pixel of the image to be processed, so as to improve the overall efficiency of image processing and the accuracy of image processing. The manner of obtaining the transformation matrix is not limited herein. For example, the transformation matrix may be constructed in advance, or may be acquired from a server. Wherein, under the condition that the transformation matrix needs to be constructed, the transformation matrix can be constructed in the following way:
as shown in fig. 3, the construction process of the transformation matrix may include the following steps:
step S121, a source display look-up table storing all RGB values of the RGB color space is obtained.
The total RGB values of the RGB color space are 256 × 256 different RGB values. Accordingly, the source display look-up table includes 256 × 256 storage locations, each of which stores an RGB value.
And step S122, respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB values meeting the set requirement as a target display lookup table.
In this embodiment, the setting requirements can be set as needed. Specifically, the setting requirements may be set to, but are not limited to: the set filter effect requirement, for example, a black and white filter requirement or a negative filter, etc. Of course, the setting requirement may also be set as a set beautifying effect requirement, such as a skin polishing requirement or a spot removing requirement.
The filter effect requirement can be understood as: by mapping the RGB values of a pixel to another RGB value, the requirements for setting colour and/or brightness effects are achieved.
The requirement of beautifying effect can be understood as follows: the requirement of setting the beautifying effect is realized by processing the RGB value of the pixel such as noise reduction or filtering.
It will be appreciated that the target display look-up table and the source display look-up table have the same number of storage locations and the same distribution.
And step S123, dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number respectively by adopting the same dividing mode, wherein the storage areas are composed of at least two storage positions.
The storage positions of the source display lookup table and the target display lookup table are divided into storage areas with set numbers respectively in the same dividing mode, so that the storage positions of the source display lookup table and the target display lookup table can be divided, the obtained storage areas are in one-to-one correspondence, and the precision of subsequent operation processing is guaranteed.
The set number may be set as needed, and is not limited in this embodiment. Of course, the set number may be set on the premise of acceptable image distortion degrees. On the premise of acceptable image distortion degree, the set number is set, so that excessive distortion after image conversion can be avoided, and the accuracy of image processing is improved.
The set number may be set to, but is not limited to: 8 by 8 to 512.
When the set number is set to 512, the reference display look-up table stores a smaller amount of data and the image processing efficiency is faster than the LUT including 32 × 32 RGB in the related art.
Step S124, for the first storage area in the source display lookup table, determining a conversion matrix according to the RGB values of the first storage area and the RGB values of the second storage area.
The first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
The first storage area may be understood as: the source displays one of the memory regions in the look-up table.
Determining the conversion matrix according to the RGB values of the first storage area and the RGB values of the second storage area may be understood as: and determining parameters representing the conversion relation between the RGB values of the first storage area and the second storage area, and taking a matrix formed by the parameters representing the conversion relation between the RGB values of the first storage area and the second storage area as a conversion matrix.
In this embodiment, all parameters characterizing the conversion relationship between the RGB values of the first storage area and the second storage area may be determined, and a matrix composed of all parameters characterizing the conversion relationship between the RGB values of the first storage area and the second storage area may be used as the conversion matrix. By the method, the comprehensiveness of parameters representing the conversion relation among the RGB values can be ensured, and the accuracy of the conversion matrix is further ensured.
However, the above-described method of determining the parameters of the conversion relationship between RGB values has a problem of a large amount of calculation and low efficiency. In order to solve the above problem and make the accuracy of the transformation matrix meet the accuracy requirement, a fitting algorithm may be used to determine parameters for characterizing the transformation relationship between the RGB values of the first storage region and the second storage region, and a matrix composed of the parameters for characterizing the transformation relationship between the RGB values may be used as the transformation matrix.
In this embodiment, the fitting algorithm is not limited. For example, the fitting algorithm may be, but is not limited to: a least squares curve fitting algorithm implemented based on matrix operations (e.g., the inverse of a matrix).
By utilizing a fitting algorithm, parameters for representing the conversion relationship between the RGB values of the first storage area in the source display lookup table and the RGB values of the second storage area in the target display lookup table are determined, so that the precision of the parameters for representing the conversion relationship between the RGB values of the first storage area in the source display lookup table and the RGB values of the second storage area in the target display lookup table can be ensured, and the precision of image conversion is ensured when image conversion is carried out based on a conversion matrix.
It should be noted that, in the case that the source display lookup table is divided into a plurality of storage areas, the steps S121 to S124 can be referred to as the process of constructing one of the conversion matrices in steps S121 to S124. In the case where the conversion matrix of each storage area is constructed, all the constructed conversion matrices are stored in the reference display look-up table.
In this embodiment, when the set number is set to 512, the reference display look-up table stores a smaller amount of data and the image processing efficiency is faster than the LUT including 32 × 32 RGB values in the related art. In addition, in the LUT including 32 × 32 RGB values in the prior art, when the RGB values in the LUT are divided into a plurality of groups, and one RGB value is selected from each group of RGB values in the LUT according to a certain selection method and determined as a representative value of the group of RGB values, the RGB values of each pixel can be converted without destroying the continuity of the color space by converting the image based on the 512 conversion matrices stored in the reference display look-up table in this embodiment, so that the conversion accuracy is ensured, and the accuracy of image processing is improved.
As another alternative embodiment 2 of the present application, mainly a refinement of the image processing method described in the above embodiment 1, as shown in fig. 4, the method may include, but is not limited to, the following steps:
step S21, acquiring a to-be-processed image, where the to-be-processed image includes a plurality of pixels.
The detailed process of step S21 can be referred to the related description of step S11 in embodiment 1, and is not repeated here.
Step S22, determining a first storage location of the RGB values of the pixel in the source display look-up table for each pixel in the image to be processed.
Because the source display lookup table at least contains the RGB values of all pixels in the image to be processed, the storage location of the RGB value of each pixel of the image to be processed in the source display lookup table can be found in the source display lookup table.
Each storage position in the source display lookup table corresponds to an index, and if the index corresponding to each storage position is an RGB value of an RGB color space, the storage position corresponding to the RGB value of a pixel in the image to be processed in the source display lookup table may be directly used as a first storage position of the RGB value of the pixel in the source display lookup table.
Step S23 specifies the storage area corresponding to the first storage location in the reference display look-up table.
At least one conversion matrix is stored in the reference display lookup table. And the conversion matrix is used for representing the conversion relation of the RGB values of the source storage area and the target storage area, the source storage area is composed of a plurality of storage positions in a source display lookup table, and the target storage area is composed of a plurality of storage positions in the target display lookup table, which correspond to the plurality of storage positions in the source display lookup table.
Because the conversion matrix in the reference display lookup table is used for representing the conversion relation between the RGB values of the source storage area and the target storage area, and the storage area where the conversion matrix in the reference display lookup table is located corresponds to the source storage area in the source display lookup table, a storage area corresponding to the storage location in the source storage area in the source display lookup table exists in the reference display lookup table. Based on this, after the first storage location is determined, the storage area corresponding to the first storage location in the reference display lookup table may be determined.
Step S24, the conversion matrix stored in the storage area is used as the first conversion matrix corresponding to the pixel.
In the reference display lookup table, each storage region stores a corresponding conversion matrix, and after determining the storage region corresponding to the first storage location in the reference display lookup table, the conversion matrix in the storage region corresponding to the first storage location in the reference display lookup table may be used as the first conversion matrix corresponding to the pixel
Steps S22-S24 are a specific implementation of step S12 in example 1.
Step S25, converting the RGB values of each pixel based on the conversion matrix corresponding to the RGB values of each pixel, respectively, to obtain a target RGB value corresponding to each pixel, thereby obtaining a target image.
The detailed process of step S25 can be referred to the related description of step S13 in embodiment 1, and is not repeated here.
In this embodiment, the conversion matrix is obtained according to the corresponding relationship between the RGB values and the storage locations and the corresponding relationship between the storage locations and the storage areas, and the efficiency of obtaining the conversion matrix is ensured. In the case where the efficiency of conversion matrix acquisition is improved, the efficiency of image processing is further improved.
As another alternative embodiment 3 of the present application, mainly a refinement of the image processing method described in the above embodiment 1, as shown in fig. 5, the method may include, but is not limited to, the following steps:
step S31, acquiring a to-be-processed image, where the to-be-processed image includes a plurality of pixels.
The detailed process of step S31 can be referred to the related description of step S11 in embodiment 1, and is not repeated here.
Step S32, determining a first storage location of the RGB values of the pixel in the source display look-up table for each pixel in the image to be processed.
The detailed process of step S32 can be referred to the related description of step S22 in embodiment 2, and is not repeated here.
And step S33, determining a second storage position of the target RGB value in the source display lookup table for each target RGB value with a set relation with the RGB value of each pixel in the image to be processed.
The setting relationship may be set as needed, and is not limited in this embodiment. For example, the set relationship may set, but is not limited to: the adjacent relationship.
For each target RGB value having a set relationship with the RGB value of each pixel in the image to be processed, the detailed process of determining the second storage location of the target RGB value in the source display look-up table may also refer to the related description of step S22 in embodiment 2, and is not described herein again.
Step S34 is to determine a first storage area corresponding to the first storage location and a second storage area corresponding to the second storage location in the reference display lookup table.
At least one conversion matrix is stored in the reference display lookup table. And the conversion matrix is used for representing the conversion relation of the RGB values of the source storage area and the target storage area, the source storage area is composed of a plurality of storage positions in a source display lookup table, and the target storage area is composed of a plurality of storage positions in the target display lookup table, which correspond to the plurality of storage positions in the source display lookup table.
Because the conversion matrix in the reference display lookup table is used for representing the conversion relation between the RGB values of the source storage area and the target storage area, and the storage area where the conversion matrix in the reference display lookup table is located corresponds to the source storage area in the source display lookup table, a storage location corresponding to a storage location in the source storage area in the source display lookup table exists in the storage area where the conversion matrix in the reference display lookup table is located. Based on this, after the first storage location and the second storage location are determined, the first storage area corresponding to the first storage location and the second storage area corresponding to the second storage location in the reference display lookup table may be determined.
Step S35, a conversion matrix obtained by performing weighted summation on the conversion matrix stored in the first storage area and the conversion matrix stored in the second storage area is used as the first conversion matrix corresponding to the pixel.
In the reference display lookup table, each storage area stores a corresponding conversion matrix, and after the first storage area and the second storage area are determined, the conversion matrices may be acquired in the first storage area and the second storage area.
The weighted summation of the transformation matrix stored in the first storage area and the transformation matrix stored in the second storage area can be understood as follows: and adding the result obtained by multiplying the conversion matrix stored in the first storage area by the first weight and the result obtained by multiplying the conversion matrix stored in the second storage area by the second weight.
Steps S32-S35 are a specific implementation of step S12 in example 1.
Step S36, converting the RGB values of each pixel based on the conversion matrix corresponding to the RGB values of each pixel, respectively, to obtain a target RGB value corresponding to each pixel, thereby obtaining a target image.
The detailed process of step S36 can be referred to the related description of step S13 in embodiment 1, and is not repeated here.
In this embodiment, in addition to respectively determining and acquiring the conversion matrix corresponding to the RGB value of each pixel in the image to be processed, the conversion matrix corresponding to the RGB value having a set relationship with the RGB value of each pixel in the image to be processed is also respectively determined and acquired, and the acquired conversion matrices are subjected to weighted summation, so as to realize the fusion of a plurality of conversion matrices.
Next, an image processing apparatus provided in the present application will be described, and the image processing apparatus described below and the image processing method described above may be referred to in correspondence with each other.
As shown in fig. 6, the image processing apparatus includes: an acquisition module 100, a determination module 200 and a conversion module 300.
An obtaining module 100, configured to obtain an image to be processed, where the image to be processed includes a plurality of pixels;
a determining module 200, configured to respectively determine, by using a reference display lookup table, a conversion matrix corresponding to each pixel, where the conversion matrix is used to represent a conversion relationship between RGB values of a source storage area and a target storage area, the source storage area is composed of a plurality of storage locations in the source display lookup table, and the target storage area is composed of a plurality of storage locations in the target display lookup table corresponding to the plurality of storage locations in the source display lookup table; wherein at least one conversion matrix is stored in the reference display lookup table;
the conversion module 300 is configured to convert the RGB values of each pixel based on the conversion matrix corresponding to the RGB values of each pixel, so as to obtain a target RGB value corresponding to each pixel, thereby obtaining a target image.
In this embodiment, the image processing apparatus may further include:
a build module to:
acquiring a source display lookup table in which all RGB values of an RGB color space are stored;
respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB value meeting the set requirement as a target display lookup table;
respectively dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number by adopting the same division mode, wherein the storage areas are composed of at least two storage positions;
for a first storage area in the source display lookup table, determining the conversion matrix according to the RGB value of the first storage area and the RGB value of a second storage area; the first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
Among them, the setting requirements may be, but are not limited to: and (5) setting the filter effect requirement.
The set number may be, but is not limited to, 512.
In this embodiment, the determining module 200 may be specifically configured to:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a storage area corresponding to the first storage position in the reference display lookup table;
and taking the conversion matrix stored in the storage area as a first conversion matrix corresponding to the pixel.
The determining module 200 may specifically be configured to:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a second storage position of each target RGB value in the source display lookup table for each target RGB value having a set relationship with the RGB value of each pixel in the image to be processed;
determining a first storage area corresponding to the first storage position and a second storage area corresponding to the second storage position in the reference display lookup table;
and performing weighted summation on the conversion matrix stored in the first storage area and the conversion matrix stored in the second storage area to obtain a conversion matrix which is used as the first conversion matrix corresponding to the pixel.
In another embodiment of the present application, there is provided an electronic device, which may include: a memory for storing at least one set of instructions;
a processor for calling and executing the instruction set in the memory, for performing the steps of the image processing method as described in any one of method embodiments 1-3 by executing the instruction set.
In another embodiment of the application, a computer storage medium is provided, on which a computer program is stored, the computer program being executable by a processor for carrying out the steps of the image processing method as claimed in any one of the method embodiments 1 to 3.
It should be noted that each embodiment is mainly described as a difference from the other embodiments, and the same and similar parts between the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The foregoing describes an image processing method and apparatus provided by the present application in detail, and a specific example is applied to illustrate the principle and implementation of the present application, and the description of the foregoing embodiment is only used to help understand the method and core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. An image processing method, comprising:
acquiring an image to be processed, wherein the image to be processed comprises a plurality of pixels;
respectively determining a conversion matrix corresponding to each pixel by using a reference display lookup table, wherein the conversion matrix is used for representing the conversion relation of RGB values of a source storage area and a target storage area, the source storage area consists of a plurality of storage positions in the source display lookup table, and the target storage area consists of a plurality of storage positions in the target display lookup table corresponding to the plurality of storage positions in the source display lookup table; wherein at least one conversion matrix is stored in the reference display lookup table;
and converting the RGB value of each pixel based on the conversion matrix corresponding to the RGB value of each pixel to obtain a target RGB value corresponding to each pixel, so as to obtain a target image.
2. The method of claim 1, wherein the transformation matrix is constructed by:
acquiring a source display lookup table in which all RGB values of an RGB color space are stored;
respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB value meeting the set requirement as a target display lookup table;
respectively dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number by adopting the same division mode, wherein the storage areas are composed of at least two storage positions;
for a first storage area in the source display lookup table, determining the conversion matrix according to the RGB value of the first storage area and the RGB value of a second storage area; the first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
3. The method of claim 2, wherein the set requirement is a set filter effect requirement;
the set number is 512.
4. The method according to any one of claims 1 to 3, wherein the determining the conversion matrix corresponding to each pixel by using the reference display lookup table comprises:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a storage area corresponding to the first storage position in the reference display lookup table;
and taking the conversion matrix stored in the storage area as a first conversion matrix corresponding to the pixel.
5. The method according to any one of claims 1 to 3, wherein the determining the conversion matrix corresponding to each pixel by using the reference display lookup table comprises:
for each pixel in the image to be processed, determining a first storage position of the RGB value of the pixel in the source display lookup table;
determining a second storage position of each target RGB value in the source display lookup table for each target RGB value having a set relationship with the RGB value of each pixel in the image to be processed;
determining a first storage area corresponding to the first storage position and a second storage area corresponding to the second storage position in the reference display lookup table;
and performing weighted summation on the conversion matrix stored in the first storage area and the conversion matrix stored in the second storage area to obtain a conversion matrix which is used as the first conversion matrix corresponding to the pixel.
6. An image processing apparatus characterized by comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an image to be processed, and the image to be processed comprises a plurality of pixels;
a determining module, configured to determine a conversion matrix corresponding to each pixel by using a reference display lookup table, where the conversion matrix is used to represent a conversion relationship between RGB values of a source storage area and a target storage area, the source storage area is composed of a plurality of storage locations in the source display lookup table, and the target storage area is composed of a plurality of storage locations in the target display lookup table corresponding to the plurality of storage locations in the source display lookup table; wherein at least one conversion matrix is stored in the reference display lookup table;
and the conversion module is used for converting the RGB value of each pixel based on the conversion matrix corresponding to the RGB value of each pixel to obtain a target RGB value corresponding to each pixel, so that a target image is obtained.
7. The apparatus of claim 6, further comprising:
a build module to:
acquiring a source display lookup table in which all RGB values of an RGB color space are stored;
respectively adjusting each RGB value in the source display lookup table to be the RGB value meeting the set requirement, and taking the display lookup table storing the RGB value meeting the set requirement as a target display lookup table;
respectively dividing the storage positions in the source display lookup table and the target display lookup table into storage areas with set number by adopting the same division mode, wherein the storage areas are composed of at least two storage positions;
for a first storage area in the source display lookup table, determining the conversion matrix according to the RGB value of the first storage area and the RGB value of a second storage area; the first storage area is composed of at least two storage positions in the source display lookup table, and the second storage area is a storage area corresponding to the first storage area in the source display lookup table in the target display lookup table.
8. The apparatus of claim 7, wherein the set requirement is a set filter effect requirement;
the set number is 512.
9. An electronic device, comprising:
a memory for storing at least one set of instructions;
a processor for invoking and executing said set of instructions in said memory, the steps of the image processing method according to any of claims 1-5 being performed by executing said set of instructions.
10. A computer storage medium, having stored thereon a computer program for execution by a processor for performing the steps of the image processing method according to any one of claims 1 to 5.
CN202010558331.2A 2020-06-18 2020-06-18 Image processing method and device, electronic equipment and computer storage medium Pending CN111784558A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010558331.2A CN111784558A (en) 2020-06-18 2020-06-18 Image processing method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010558331.2A CN111784558A (en) 2020-06-18 2020-06-18 Image processing method and device, electronic equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN111784558A true CN111784558A (en) 2020-10-16

Family

ID=72756785

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010558331.2A Pending CN111784558A (en) 2020-06-18 2020-06-18 Image processing method and device, electronic equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN111784558A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113642555A (en) * 2021-07-29 2021-11-12 深圳市芯成像科技有限公司 Image processing method, computer readable medium and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113642555A (en) * 2021-07-29 2021-11-12 深圳市芯成像科技有限公司 Image processing method, computer readable medium and system
CN113642555B (en) * 2021-07-29 2022-08-05 深圳市芯成像科技有限公司 Image processing method, computer readable medium and system

Similar Documents

Publication Publication Date Title
CN109191395B (en) Image contrast enhancement method, device, equipment and storage medium
US9374510B2 (en) Tone mapping method
CN111489322B (en) Method and device for adding sky filter to static picture
CN111312141B (en) Color gamut adjusting method and device
US6067088A (en) Image processing method and apparatus thereof
US11962917B2 (en) Color adjustment method, color adjustment device, electronic device and computer-readable storage medium
CN109416831A (en) The inexpensive color expansion module of color for expanded images
CN110570506A (en) Map resource management method and device, computing equipment and storage medium
CN113450440A (en) Method and device for rendering image, computer readable storage medium and electronic equipment
CN111784558A (en) Image processing method and device, electronic equipment and computer storage medium
CN108564633B (en) Gray scale image compression method and device and computer equipment
CN101026680A (en) Apparatus, method, and program product for color correction
CN112243119B (en) White balance processing method and device, electronic equipment and storage medium
CN116843566A (en) Tone mapping method, tone mapping device, display device and storage medium
CN110097525A (en) A kind of image rendering method, device and calculate equipment
CN115908191A (en) Filter parameter acquisition method and device
CN117897723A (en) System and method for learning a tone curve for local image enhancement
JP2002118737A (en) Image converter and image conversion method
Liu et al. Fast color image quantization with error diffusion and morphological operations
KR102082070B1 (en) High precision gamut mapping
CN111583104B (en) Light spot blurring method and device, storage medium and computer equipment
Zini et al. Shallow Camera Pipeline for Night Photography Enhancement
CN116977154B (en) Visible light image and infrared image fusion storage method, device, equipment and medium
JPH01121930A (en) Data processor
JPH09284578A (en) Image processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination