A color restoration method for RGB images and computer-readable storage medium
By fusing and aligning RGB images with spectral images, the problem of color deviation in images captured by RGB cameras is solved, more accurate color restoration is achieved, and the color accuracy of the image is improved.
Patent Information
- Application Number
- CN202011418616.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-12-07
AI Technical Summary
RGB images captured by RGB cameras have color deviations and cannot accurately obtain the tristimulus value of the subject, resulting in inaccurate colors.
By obtaining the initial RGB image and its corresponding spectral image, fusion and alignment are performed, and the low spatial resolution of the spectral image is used to assist the RGB camera in color correction to generate a more accurate target RGB image.
Through this method, the color difference between the target RGB image and the real RGB image is reduced, the color accuracy is improved, and high-quality color reproduction is achieved.
Smart Images

Figure CN112562017B
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of image color restoration, and in particular, relates to a color restoration method for RGB images and a computer-readable storage medium. Background Art
[0002] The RGB color model is a color standard in the industry. It obtains various colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents the colors of the three channels of red, green, and blue. This standard covers almost all colors that can be perceived by human vision and is one of the most widely used color systems. After years of development, RGB cameras have a higher pixel resolution and are widely used in consumer electronics such as mobile phones and tablets. However, since the spectral response of RGB cameras is different from the characteristics of human visual perception, such cameras are still unable to accurately obtain the three stimulus values of the subject. As a result, the RGB images captured by RGB cameras still have color deviations.
[0003] With the advancement of micro-nano processing technology, another type of spectral camera based on spectral filter arrays has gradually been developed. This type of spectral camera arranges multi-band filters in a pixelated spatial periodic manner, and has the advantages of structural integration and high temporal resolution. However, this design reduces the sampling rate of each spectral channel captured by the spectral camera, and cannot reach the spatial resolution level of an RGB camera. Summary of the invention
[0004] The embodiments of the present application provide a color restoration method for an RGB image and a computer-readable storage medium, which can solve the problem of color deviation in an RGB image captured by an RGB camera.
[0005] In a first aspect, an embodiment of the present application provides a color restoration method for an RGB image, comprising:
[0006] Get the initial RGB image and its corresponding spectral image;
[0007] The initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image;
[0008] Get color correction information;
[0009] The color of the RGB spectral fusion image is restored according to the color correction information to obtain a restored target RGB fusion image.
[0010] Furthermore, the initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image, including:
[0011] Aligning and registering the initial RGB image and its corresponding spectral image;
[0012] The aligned and registered initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image.
[0013] Further, the initial RGB image is collected by an RGB camera, and the spectral image is collected by a spectral camera;
[0014] The aligning and registering the initial RGB image and its corresponding spectral image comprises:
[0015] The initial RGB image and its corresponding spectral image are aligned and registered according to a mapping relationship between the RGB camera and the spectral camera.
[0016] Furthermore, before aligning and registering the initial RGB image and its corresponding spectral image according to the mapping relationship between the RGB camera and the spectral camera, the method further includes:
[0017] A mapping relationship between the RGB camera and the spectral camera is obtained according to a preset calibration rule.
[0018] Further, the obtaining the mapping relationship between the RGB camera and the spectral camera according to a preset determination rule includes:
[0019] Calibrate the RGB camera and the spectral camera by using a preset checkerboard to obtain a first intrinsic parameter matrix of the RGB camera and a second intrinsic parameter matrix of the spectral camera;
[0020] The mapping relationship between the RGB camera and the spectral camera is determined according to the first intrinsic parameter matrix and the second intrinsic parameter matrix; the mapping relationship is the extrinsic parameter matrix corresponding to the RGB camera and the spectral camera; the extrinsic parameter matrix includes a rotation matrix and a translation matrix.
[0021] Furthermore, the initial RGB image and its corresponding spectral image after alignment are fused to obtain an RGB spectral fused image, including:
[0022] The pixel grayscale values of the aligned and registered spectral image are mapped to the aligned and registered initial RGB image according to a preset interpolation algorithm to obtain an RGB spectral fusion image.
[0023] Furthermore, mapping the pixel grayscale values of the aligned and registered spectral image to the aligned and registered initial RGB image according to a preset interpolation algorithm to obtain an RGB spectral fusion image includes:
[0024] Obtaining the mapping coordinates corresponding to each pixel point in the initial RGB image on the spectral image;
[0025] If the mapping coordinates exist in the spectral image, obtaining a first pixel grayscale value of the pixel point corresponding to the mapping coordinates, and obtaining a second pixel grayscale value corresponding to the mapping coordinates in the spectral image, matching the first pixel grayscale value with the second pixel grayscale value, and obtaining a fused pixel value corresponding to the pixel point;
[0026] If the mapping coordinate does not exist in the spectral image, a first pixel grayscale value of the pixel point corresponding to the mapping coordinate is obtained, and a second pixel grayscale value corresponding to the mapping coordinate in the spectral image is calculated according to a preset interpolation algorithm, and the first pixel grayscale value is matched with the second pixel grayscale value to obtain a fused pixel value corresponding to the pixel point;
[0027] The RGB spectral fusion image is determined according to the fusion pixel value corresponding to each pixel point.
[0028] Furthermore, before obtaining the color correction information, the method further includes:
[0029] Obtain the color block RGB spectrum fusion image and color block tristimulus value corresponding to each color block in the preset color card;
[0030] Constructing a target color correction function according to the color block RGB spectrum fusion image and the color block tristimulus value;
[0031] Color correction information is determined according to the target color correction function.
[0032] In a second aspect, an embodiment of the present application provides a color restoration device for an RGB image, comprising:
[0033] A first acquisition unit, used to acquire an initial RGB image and its corresponding spectral image;
[0034] A fusion unit, used for fusing the initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image;
[0035] A second acquisition unit, used to acquire color correction information;
[0036] The restoration unit is used to perform color restoration on the RGB spectrum fusion image according to the color correction information to obtain a restored target RGB fusion image.
[0037] Furthermore, the fusion unit is specifically used for:
[0038] Aligning and registering the initial RGB image and its corresponding spectral image;
[0039] The aligned and registered initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image.
[0040] Further, the initial RGB image is collected by an RGB camera, and the spectral image is collected by a spectral camera;
[0041] The fusion unit is specifically used for:
[0042] The initial RGB image and its corresponding spectral image are aligned and registered according to a mapping relationship between the RGB camera and the spectral camera.
[0043] Furthermore, the fusion unit is specifically used for:
[0044] A mapping relationship between the RGB camera and the spectral camera is obtained according to a preset calibration rule.
[0045] Furthermore, the fusion unit is specifically used for:
[0046] Calibrate the RGB camera and the spectral camera by using a preset checkerboard to obtain a first intrinsic parameter matrix of the RGB camera and a second intrinsic parameter matrix of the spectral camera;
[0047] The mapping relationship between the RGB camera and the spectral camera is determined according to the first intrinsic parameter matrix and the second intrinsic parameter matrix; the mapping relationship is the extrinsic parameter matrix corresponding to the RGB camera and the spectral camera; the extrinsic parameter matrix includes a rotation matrix and a translation matrix.
[0048] Furthermore, the fusion unit is specifically used for:
[0049] The pixel grayscale values of the aligned and registered spectral image are mapped to the aligned and registered initial RGB image according to a preset interpolation algorithm to obtain an RGB spectral fusion image.
[0050] Furthermore, the fusion unit is specifically used for:
[0051] Obtaining the mapping coordinates corresponding to each pixel point in the initial RGB image on the spectral image;
[0052] If the mapping coordinates exist in the spectral image, obtaining a first pixel grayscale value of the pixel point corresponding to the mapping coordinates, and obtaining a second pixel grayscale value corresponding to the mapping coordinates in the spectral image, matching the first pixel grayscale value with the second pixel grayscale value, and obtaining a fused pixel value corresponding to the pixel point;
[0053] If the mapping coordinate does not exist in the spectral image, a first pixel grayscale value of the pixel point corresponding to the mapping coordinate is obtained, and a second pixel grayscale value corresponding to the mapping coordinate in the spectral image is calculated according to a preset interpolation algorithm, and the first pixel grayscale value is matched with the second pixel grayscale value to obtain a fused pixel value corresponding to the pixel point;
[0054] The RGB spectral fusion image is determined according to the fusion pixel value corresponding to each pixel point.
[0055] Furthermore, the color restoration device for RGB images further includes:
[0056] The third acquisition unit is used to obtain the color block RGB spectrum fusion image and the color block tristimulus value corresponding to each color block in the preset color card;
[0057] A construction unit, used for constructing a target color correction function according to the color block RGB spectrum fusion image and the color block tristimulus value;
[0058] A determination unit is used to determine color correction information according to the target color correction function.
[0059] In a third aspect, an embodiment of the present application provides an RGB image color restoration device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the RGB image color restoration method as described in the first aspect above is implemented.
[0060] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the color restoration method of an RGB image as described in the first aspect above is implemented.
[0061] In an embodiment of the present application, an initial RGB image and its corresponding spectral image are obtained; the initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fusion image; color correction information is obtained; and the RGB spectral fusion image is color restored according to the color correction information to obtain a restored target RGB fusion image. By obtaining an initial RGB image and its corresponding spectral image, combined with image fusion technology, and using spectral images with low spatial resolution, a high spatial resolution RGB camera is assisted to perform high-quality color reproduction. Therefore, the color difference between the target RGB fusion image restored by the present application and the real RGB image is smaller, and the color is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0063] Figure 1 is a schematic flow chart of a color restoration method for an RGB image provided in the first embodiment of the present application;
[0064] Figure 2 is a schematic diagram of a color restoration device for RGB images provided in a second embodiment of the present application;
[0065] Figure 3 It is a schematic diagram of a color restoration device for RGB images provided in the third embodiment of the present application. DETAILED DESCRIPTION
[0066] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0067] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0068] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0069] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0070] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0071] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0072] See also Figure 1 , Figure 1 1 is a schematic flow chart of a method for color restoration of an RGB image provided in the first embodiment of the present application. The execution subject of the method for color restoration of an RGB image in this embodiment is a device with a color restoration function of an RGB image, such as a server, a processor, etc. Figure 1 The color restoration method of the RGB image shown may include:
[0073] S101: Obtain an initial RGB image and its corresponding spectral image.
[0074] In one embodiment, the device obtains an initial RGB image and its corresponding spectral image, wherein the initial RGB image is acquired by an RGB camera and the spectral image is acquired by a spectral camera. The device can directly capture the initial RGB image and its corresponding spectral image through a camera module installed on the device, or can receive the initial RGB image and its corresponding spectral image sent by other devices through a network.
[0075] More specifically, the initial RGB image and its corresponding spectral image are obtained by an independently set RGB camera and a multispectral camera, and the spectral image can be obtained by a multispectral camera based on a multispectral filter array (MSFA). After obtaining the initial RGB image and its corresponding spectral image, the independently set RGB camera and the multispectral camera send the initial RGB image and its corresponding spectral image to the local device.
[0076] In one embodiment, the device can provide a synchronous trigger signal to the RGB camera and the multi-spectral camera to realize real-time operation. The acquisition of the initial RGB image and its corresponding spectral image can also be asynchronous, and the initial RGB image and its corresponding spectral image can be collected separately in a certain time sequence to reduce the requirements on the storage and computing power of the processor.
[0077] In one embodiment, the initial RGB image and the spectral image can be configured to be acquired from the same image sensor array, and the image sensor array sensor includes a filter. The filter can be arranged above the image sensor array so as to optically cover the image sensor array. The filter can optionally project a light beam of a specific wavelength band and prevent light outside the wavelength band from reaching the image sensor array. The blocked light can be absorbed, reflected and / or scattered, depending on the implementation of the filter, which is not limited here.
[0078] In one filtering state, the initial RGB image is generated based on visible light, and the filter can transmit visible light and block light outside the visible light band; in another filtering state, the spectral image is generated based on a light beam of a different band from that used by the initial RGB image, and the filter can transmit the light beam of the band included in the spectral image and block the light beam outside the band. It should be understood that the spectral image contains light beams of multiple bands, and the filter can be configured to switch between multiple filtering states of light beams of different bands to transmit light beams of any suitable band while blocking light beams outside the band.
[0079] S102: Fusing the initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image.
[0080] The device fuses the initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image. The fusion process actually maps the pixels of the spectral image to the initial RGB image, and the resulting image is the RGB spectral fused image. It should be understood that each pixel of the RGB spectral fused image obtained after fusion has the grayscale values of the three channels (R channel, G channel, B channel) of the RGB image and the grayscale values of the multiple channels of the spectral image.
[0081] In one embodiment, the RGB camera and the spectral camera are separately provided. In order to better fuse the initial RGB image and its corresponding spectral image, it is necessary to align and register the acquired initial RGB image and its corresponding spectral image. The device aligns and registers the initial RGB image and its corresponding spectral image. Then, the aligned and registered initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image.
[0082] In one implementation, the initial RGB image is acquired by an RGB camera, and the spectral image is acquired by a spectral camera. The initial RGB image and its corresponding spectral image are aligned and registered in the following manner:
[0083] The device aligns and registers the initial RGB image and its corresponding spectral image according to the mapping relationship between the RGB camera and the spectral camera. The mapping relationship between the RGB camera and the spectral camera is pre-stored in the device, and the mapping relationship between the RGB camera and the spectral camera is used to align and register the initial RGB image and its corresponding spectral image. The device aligns and registers the initial RGB image and its corresponding spectral image according to the mapping relationship.
[0084] Before aligning and registering the initial RGB image and its corresponding spectral image according to the mapping relationship between the RGB camera and the spectral camera, the device can obtain the mapping relationship between the RGB camera and the spectral camera according to the preset calibration rule. There is no restriction on the preset calibration rule here, that is, there is no restriction on the method of obtaining the mapping relationship. For example, the device can obtain the mapping relationship by calibrating the checkerboard, or can use a dot calibration plate or extract corresponding features from the acquired image to establish the mapping relationship, etc.
[0085] More specifically, obtaining the mapping relationship by calibrating the checkerboard is a specific implementation method, and the process of obtaining the mapping relationship is described in detail.
[0086] The device calibrates the RGB camera and the spectral camera through a preset chessboard to obtain a first intrinsic parameter matrix of the RGB camera and a second intrinsic parameter matrix of the spectral camera; a mapping relationship between the RGB camera and the spectral camera is determined according to the first intrinsic parameter matrix and the second intrinsic parameter matrix; the mapping relationship is an extrinsic parameter matrix corresponding to the RGB camera and the spectral camera; the extrinsic parameter matrix includes a rotation matrix and a translation matrix.
[0087] Furthermore, the device selects a corner point Q on the chessboard and its projection coordinates on the RGB image as q R , the spatial coordinate in the RGB camera coordinate system is Q R , the intrinsic parameter matrix of the RGB camera is H R ,q R With Q R The conversion relationship between them is as follows:
[0088] q R =H R Q R
[0089] Similarly, assuming Q D is the spatial coordinate of the same corner point Q on the reference object in the spectral camera coordinate system, q D is the projection coordinate of the point on the spectrum image, QD With Q R The relationship between them is represented by the external parameter matrix between the RGB camera and the spectral camera. The external parameter matrix includes two parts: the rotation matrix R and the translation matrix T; Q D With Q R The conversion relationship between them is as follows:
[0090] Q D =RQ R +T
[0091] Assume that the spatial coordinates of the same corner point Q in the spectral camera coordinate system are Q D , the projection coordinate on the spectral image is q D , Q D With q D The transformation relationship between them is determined by the intrinsic parameter matrix H of the spectral camera D Indicates that
[0092] q D =H D Q D
[0093] Then the spatial coordinates of point Q in the RGB camera coordinate system and the spectral camera coordinate system are Q R , Q D It can be obtained by the following formula:
[0094]
[0095] R R , T R are the rotation matrix and translation matrix of the RGB camera intrinsic parameter matrix, R R , T R is the first intrinsic parameter matrix of the RGB camera. D , T D are the rotation matrix and translation matrix in the intrinsic parameter matrix of the spectral camera, R D , T D is the second intrinsic parameter matrix of the spectral camera. R =R R Q+T R In the example, point Q will be replaced by R R , Q R , T R Expressed as Q D =RQ R +T, we get:
[0096]
[0097] After rearranging the above formula, we can get the external parameter matrix of RGB camera and spectral camera, that is, the expression of rotation matrix R and translation matrix T in the external parameter matrix is:
[0098]
[0099] That is, the mapping relationship between the RGB camera and the spectral camera is obtained.
[0100] The device fuses the aligned and registered initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image. The device may store a preset interpolation algorithm, and the device may map the pixel grayscale values of the aligned and registered spectral image to the aligned and registered initial RGB image according to the preset interpolation algorithm to obtain an RGB spectral fused image.
[0101] In one embodiment, the device obtains the mapping coordinates corresponding to each pixel point in the initial RGB image on the spectral image; if the mapping coordinates exist in the spectral image, the first pixel grayscale value of the pixel point corresponding to the mapping coordinates is obtained, and the second pixel grayscale value corresponding to the mapping coordinates in the spectral image is obtained, the first pixel grayscale value is matched with the second pixel grayscale value, and the fused pixel value corresponding to the pixel point is obtained; if the mapping coordinates do not exist in the spectral image, the first pixel grayscale value of the pixel point corresponding to the mapping coordinates is obtained, and the second pixel grayscale value corresponding to the mapping coordinates in the spectral image is calculated according to a preset interpolation algorithm, the first pixel grayscale value is matched with the second pixel grayscale value, and the fused pixel value corresponding to the pixel point is obtained; the RGB spectral fusion image is determined according to the fused pixel values corresponding to each pixel point.
[0102] More specifically, assume that at a point (x, y) on the initial RGB image, according to the obtained mapping relationship, the rotation matrix R in the extrinsic parameter matrix and the translation matrix T, the corresponding coordinates on the spectral image are obtained as (i+u, j+v). If u and v are 0, the obtained coordinate values are integer values, and it is determined that the mapping coordinates exist in the spectral image. Then, the grayscale value of the second pixel on the spectral image [I1…I N ] T The gray value of the first pixel in the RGB image [I R I G I B ] T Matching is performed to obtain the RGB spectral fusion image, where N represents the number of bands contained in the spectral image.
[0103] If the values of u and v are non-zero, it is determined that there is no mapping coordinate in the spectral image. Then, it is necessary to calculate the pixel grayscale value corresponding to (i+u, j+v) through an interpolation algorithm to obtain the second pixel grayscale value on the spectral image for image fusion.
[0104] Preferably, the interpolation algorithm may be a cubic convolution interpolation algorithm, which uses the grayscale values of 16 pixels near (i+u, j+v) to perform cubic interpolation for calculation. Assume that the grayscale value of point (i+u, j+v) is expressed as
[0105] f(i+u,j+v)=A×B×C
[0106] Among them, A=[s(1+u) s(u) s(1-u) s(2-u)]
[0107]
[0108] s(x) is the interpolation weight function, which is expressed as a polynomial:
[0109]
[0110] According to the above formula, the gray value of f(i+u,j+v) can be obtained and matched with the gray value of the corresponding coordinate pixel on the RGB image to obtain the RGB spectral fusion image, which is expressed as [I R I G I B I1…I N ] T , N represents the number of bands contained in the spectral image.
[0111] It should be understood that the expression of the gray value is not limited thereto. The interpolation algorithm may also be bilinear interpolation or nearest neighbor interpolation, which is not limited here.
[0112] S103: Acquire color correction information.
[0113] The device pre-stores color correction information, which is used to perform color restoration on the RGB spectral fusion image.
[0114] Before obtaining the color correction information, the color correction information may be determined in advance and the determined color correction information may be stored in the device. The color correction information may be determined in the following ways:
[0115] The device obtains the color block RGB spectrum fusion image and color block tristimulus value corresponding to each color block in the preset color card. Under the standard light source, the color card is imaged using an RGB camera and a spectral camera to obtain the RGB spectrum fusion image of the color block corresponding to the color card. The RGB spectrum fusion image corresponding to the mth color card, that is, the color block RGB spectrum fusion image is expressed as in, Represents the grayscale value of the mth color block obtained by the RGB camera, It is represented as the gray value of the mth color block obtained by a spectral camera with N spectral bands. The tristimulus value of the color card under the standard light source is obtained. The color card contains M color blocks. The tristimulus value of the mth color block in the color card, that is, the color block tristimulus value is expressed as [X m Y m Z m ] T .
[0116] The device constructs the target color correction function based on the color block RGB spectrum fusion image and the color block tristimulus value. Under standard light source, the target color correction function is constructed based on the color block RGB spectrum fusion image and the color block tristimulus value:
[0117]
[0118] The device determines the color correction information according to the target color correction function. The device minimizes the target color correction function and solves W, where W is represented as the color correction matrix, i.e., the color correction information, and ‖·‖2 is represented as the L2 norm:
[0119]
[0120] It should be understood that in addition to calibrating the color correction matrix under standard light sources, the tristimulus values of the color blocks can also be obtained at different color temperatures and the color correction matrix W can be calibrated so that the present application can be applied to color restoration under different white balance parameters.
[0121] S104: Performing color restoration on the RGB spectrum fusion image according to the color correction information to obtain a restored target RGB fusion image.
[0122] The device performs color restoration on the RGB spectrum fusion image according to the color correction information to obtain the restored target RGB fusion image. The grayscale value of the RGB spectrum fusion image is [I R I G I B I1…I N ] T , based on the color correction information, the grayscale value of the RGB spectrum fusion image is converted into tristimulus value. When the color correction information is the matrix W, the restored target RGB fusion image is:
[0123] [XYZ] T =W·[I R I G I B I1…I N ] T
[0124] It should be noted that [XYZ] TIt can be converted into RGB images of different standards such as sRGB and AdobeRGB for display output.
[0125] In an embodiment of the present application, an initial RGB image and its corresponding spectral image are obtained; the initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fusion image; color correction information is obtained; and the RGB spectral fusion image is color restored according to the color correction information to obtain a restored target RGB fusion image. By obtaining an initial RGB image and its corresponding spectral image, combined with image fusion technology, and using spectral images with low spatial resolution, a high spatial resolution RGB camera is assisted to perform high-quality color reproduction. Therefore, the color difference between the target RGB fusion image restored by the present application and the real RGB image is smaller, and the color is more accurate.
[0126] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0127] See also Figure 2 , Figure 2 Schematic diagram of a color restoration device for RGB images provided in the second embodiment of the present application. The units included are used to perform Figure 1 For details, please refer to the steps in the corresponding embodiment. Figure 1 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 2 , the color restoration device 2 for RGB images comprises:
[0128] A first acquisition unit 210 is used to acquire an initial RGB image and its corresponding spectral image;
[0129] A fusion unit 220 is used to fuse the initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image;
[0130] A second acquisition unit 230, configured to acquire color correction information;
[0131] The restoration unit 240 is used to perform color restoration on the RGB spectrum fusion image according to the color correction information to obtain a restored target RGB fusion image.
[0132] Furthermore, the fusion unit 220 is specifically configured to:
[0133] Align and register the RGB image and its corresponding spectral image;
[0134] The aligned initial RGB image and its corresponding spectral image are fused to obtain the RGB spectral fusion image.
[0135] Furthermore, the initial RGB image is acquired by an RGB camera, and the spectral image is acquired by a spectral camera;
[0136] The fusion unit 220 is specifically used for:
[0137] The initial RGB image and its corresponding spectral image are aligned and registered according to the mapping relationship between the RGB camera and the spectral camera.
[0138] Furthermore, the fusion unit 220 is specifically configured to:
[0139] The mapping relationship between the RGB camera and the spectral camera is obtained according to the preset calibration rules.
[0140] Furthermore, the fusion unit is specifically used for:
[0141] Calibrate the RGB camera and the spectral camera by using a preset checkerboard to obtain a first intrinsic parameter matrix of the RGB camera and a second intrinsic parameter matrix of the spectral camera;
[0142] A mapping relationship between the RGB camera and the spectral camera is determined according to the first intrinsic parameter matrix and the second intrinsic parameter matrix; wherein the mapping relationship is an extrinsic parameter matrix corresponding to the RGB camera and the spectral camera, and the extrinsic parameter matrix includes a rotation matrix and a translation matrix.
[0143] Furthermore, the fusion unit 220 is specifically configured to:
[0144] According to the preset interpolation algorithm, the pixel grayscale value of the aligned spectral image is mapped to the aligned initial RGB image to obtain the RGB spectral fusion image.
[0145] Furthermore, the fusion unit 220 is specifically configured to:
[0146] Obtain the mapping coordinates corresponding to each pixel point in the initial RGB image on the spectral image;
[0147] If there is a mapping coordinate in the spectral image, obtain a first pixel grayscale value of the pixel point corresponding to the mapping coordinate, and obtain a second pixel grayscale value corresponding to the mapping coordinate in the spectral image, match the first pixel grayscale value with the second pixel grayscale value, and obtain a fused pixel value corresponding to the pixel point;
[0148] If the mapping coordinates do not exist in the spectral image, the first pixel grayscale value of the pixel point corresponding to the mapping coordinates is obtained, and the second pixel grayscale value corresponding to the mapping coordinates in the spectral image is calculated according to a preset interpolation algorithm, and the first pixel grayscale value is matched with the second pixel grayscale value to obtain a fused pixel value corresponding to the pixel point;
[0149] The RGB spectral fusion image is determined according to the fusion pixel value corresponding to each pixel point.
[0150] Furthermore, the RGB image color restoration device 2 further includes:
[0151] The third acquisition unit is used to obtain the color block RGB spectrum fusion image and the color block tristimulus value corresponding to each color block in the preset color card;
[0152] A construction unit, used for constructing a target color correction function according to the color block RGB spectrum fusion image and the color block tristimulus value;
[0153] The determination unit is used to determine the color correction information according to the target color correction function.
[0154] Figure 3 3 is a schematic diagram of a color restoration device for RGB images provided in the third embodiment of the present application. In one embodiment, the color restoration device 3 for RGB images includes: a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30, such as a color restoration program for RGB images. When the processor 30 executes the computer program 32, the steps in the above-mentioned color restoration method embodiments for RGB images are implemented, such as Figure 1 Alternatively, when the processor 30 executes the computer program 32, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 2 The functions of modules 210 to 240 are shown.
[0155] Exemplarily, the computer program 32 may be divided into one or more modules / units, one or more modules / units are stored in the memory 31, and are executed by the processor 30 to complete the present application. One or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 32 in the color restoration device 3 of the RGB image. For example, the computer program 32 may be divided into a first acquisition unit, a fusion unit, a second acquisition unit, and a restoration unit, and the specific functions of each unit are as follows:
[0156] A first acquisition unit, used to acquire an initial RGB image and its corresponding spectral image;
[0157] A fusion unit, used for fusing the initial RGB image and its corresponding spectral image to obtain an RGB spectral fused image;
[0158] A second acquisition unit, used to acquire color correction information;
[0159] The restoration unit is used to perform color restoration on the RGB spectrum fusion image according to the color correction information to obtain a restored target RGB fusion image.
[0160] The color restoration device of the RGB image may include, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will appreciate that Figure 3 It is only an example of the color restoration device 3 for RGB images and does not constitute a limitation on the color restoration device 3 for RGB images. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the color restoration device for RGB images may also include input and output devices, network access devices, buses, etc.
[0161] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0162] The memory 31 may be an internal storage unit of the color restoration device 3 for RGB images, such as a hard disk or memory of the color restoration device 3 for RGB images. The memory 31 may also be an external storage device of the color restoration device 3 for RGB images, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the color restoration device 3 for RGB images. Further, the color restoration device 3 for RGB images may also include both an internal storage unit and an external storage device of the color restoration device 3 for RGB images. The memory 31 is used to store computer programs and other programs and data required by the color restoration device for RGB images. The memory 31 may also be used to temporarily store data that has been output or is to be output.
[0163] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0164] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0165] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on at least one processor, wherein the processor implements the steps in any of the above method embodiments when executing the computer program.
[0166] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0167] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0168] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0169] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0170] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0171] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0172] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0173] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A color restoration method for an RGB image, characterized in that: include: Get the initial RGB image and its corresponding spectral image; The initial RGB image and its corresponding spectral image are fused to obtain an RGB spectral fused image; Specifically, it includes: aligning and registering the initial RGB image and its corresponding spectral image; obtaining the mapping coordinates corresponding to each pixel point in the initial RGB image on the spectral image; if the mapping coordinates exist in the spectral image, obtaining the first pixel grayscale value of the pixel point corresponding to the mapping coordinates, and obtaining the second pixel grayscale value corresponding to the mapping coordinates in the spectral image, matching the first pixel grayscale value with the second pixel grayscale value, and obtaining the fused pixel value corresponding to the pixel point; if the mapping coordinates do not exist in the spectral image, obtaining the first pixel grayscale value of the pixel point corresponding to the mapping coordinates, and calculating the second pixel grayscale value corresponding to the mapping coordinates in the spectral image according to a preset interpolation algorithm, matching the first pixel grayscale value with the second pixel grayscale value, and obtaining the fused pixel value corresponding to the pixel point; determining the RGB spectral fusion image according to the fused pixel values corresponding to each pixel point; each pixel of the RGB spectral fusion image has the grayscale values of the three channels of the initial RGB image and the grayscale values of the multiple channels of the spectral image; Acquire color correction information; wherein, predetermine the color correction information, including: acquire the color block RGB spectrum fusion image and the color block tristimulus value corresponding to each color block in the preset color card; construct a target color correction function according to the color block RGB spectrum fusion image and the color block tristimulus value; determine the color correction information according to the target color correction function; wherein, under the standard light source, use the RGB camera and the spectral camera to image the color card, and acquire the RGB spectrum fusion image of the color block corresponding to the color card, and the RGB spectrum fusion image of the mth color block is expressed as ,in, Represents the grayscale value of the mth color block obtained by the RGB camera, It is represented as the gray value of the mth color block obtained by the spectral camera with N spectral bands; the three stimulus values of the color card under the standard light source are obtained. The color card contains M color blocks. The three stimulus values of the mth color block in the color card are expressed as ; Performing color restoration on the RGB spectral fusion image according to the color correction information to obtain a restored target RGB fusion image specifically includes: based on the color correction information, converting the grayscale value of the RGB spectral fusion image into a tristimulus value.
2. The color restoration method of RGB image according to claim 1, characterized in that: The initial RGB image is collected by an RGB camera, and the spectral image is collected by a spectral camera; The aligning and registering the initial RGB image and its corresponding spectral image comprises: The initial RGB image and its corresponding spectral image are aligned and registered according to a mapping relationship between the RGB camera and the spectral camera.
3. The color restoration method of RGB image according to claim 2, characterized in that: Before aligning and registering the initial RGB image and its corresponding spectral image according to the mapping relationship between the RGB camera and the spectral camera, the method further includes: A mapping relationship between the RGB camera and the spectral camera is obtained according to a preset calibration rule.
4. The color restoration method of RGB image according to claim 3, characterized in that: The obtaining the mapping relationship between the RGB camera and the spectral camera according to a preset calibration rule includes: Calibrate the RGB camera and the spectral camera by using a preset checkerboard to obtain a first intrinsic parameter matrix of the RGB camera and a second intrinsic parameter matrix of the spectral camera; The mapping relationship between the RGB camera and the spectral camera is determined according to the first intrinsic parameter matrix and the second intrinsic parameter matrix; the mapping relationship is the extrinsic parameter matrix corresponding to the RGB camera and the spectral camera; the extrinsic parameter matrix includes a rotation matrix and a translation matrix.
5. A color restoration device for RGB images, characterized in that: include: A first acquisition unit, used to acquire an initial RGB image and its corresponding spectral image; A fusion unit is used to fuse the initial RGB image and its corresponding spectral image to obtain an RGB spectral fusion image, wherein each pixel of the RGB spectral fusion image has the grayscale values of the three channels of the initial RGB image and the grayscale values of the multiple channels of the spectral image; the fusion unit is specifically used to: align and register the initial RGB image and its corresponding spectral image; obtain the corresponding mapping coordinates of each pixel point in the initial RGB image on the spectral image; If the mapping coordinates exist in the spectral image, obtaining a first pixel grayscale value of the pixel point corresponding to the mapping coordinates, and obtaining a second pixel grayscale value corresponding to the mapping coordinates in the spectral image, matching the first pixel grayscale value with the second pixel grayscale value, and obtaining a fused pixel value corresponding to the pixel point; If the mapping coordinate does not exist in the spectral image, obtain the first pixel grayscale value of the pixel point corresponding to the mapping coordinate, and calculate the second pixel grayscale value corresponding to the mapping coordinate in the spectral image according to a preset interpolation algorithm, match the first pixel grayscale value with the second pixel grayscale value to obtain the fused pixel value corresponding to the pixel point; determine the RGB spectral fusion image according to the fused pixel values corresponding to each pixel point; Each pixel of the RGB spectral fusion image has the grayscale values of the three channels of the initial RGB image and the grayscale values of the multiple channels of the spectral image; A second acquisition unit, used to acquire color correction information; A restoration unit, used for performing color restoration on the RGB spectrum fusion image according to the color correction information to obtain a restored target RGB fusion image; Wherein, the color correction information is predetermined, and the color restoration device further comprises: The third acquisition unit is used to obtain the color block RGB spectrum fusion image and the color block tristimulus value corresponding to each color block in the preset color card, including: using an RGB camera and a spectral camera to image the color card under a standard light source, and obtaining the RGB spectrum fusion image of the color block corresponding to the color card. The RGB spectrum fusion image of the mth color block is expressed as ,in, Represents the grayscale value of the mth color block obtained by the RGB camera, It is represented as the gray value of the mth color block obtained by the spectral camera with N spectral bands; the three stimulus values of the color card under the standard light source are obtained. The color card contains M color blocks. The three stimulus values of the mth color block in the color card are expressed as ; A construction unit, used for constructing a target color correction function according to the color block RGB spectrum fusion image and the color block tristimulus value; The determination unit is used to determine the color correction information according to the target color correction function.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Cited By
Image processing method, electronic device, and computer storage medium
EP4765013A1
