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

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

Info

Publication number
CN115760578A
CN115760578A CN202211505894.0A CN202211505894A CN115760578A CN 115760578 A CN115760578 A CN 115760578A CN 202211505894 A CN202211505894 A CN 202211505894A CN 115760578 A CN115760578 A CN 115760578A
Authority
CN
China
Prior art keywords
size
image
template image
processed
histogram
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
CN202211505894.0A
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.)
State Grid Power Space Technology Co ltd
Original Assignee
State Grid Power Space Technology 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 State Grid Power Space Technology Co ltd filed Critical State Grid Power Space Technology Co ltd
Priority to CN202211505894.0A priority Critical patent/CN115760578A/en
Publication of CN115760578A publication Critical patent/CN115760578A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The embodiment of the invention discloses an image processing method, an image processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed; determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image; amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image; and carrying out light and color homogenizing treatment on the source image to be processed according to the target size template image. The technical scheme of the embodiment of the invention can improve the light and color homogenizing effects of the image.

Description

Image processing method and device, electronic equipment and storage medium
Technical Field
Embodiments of the present invention relate to the field of image processing, and in particular, to an image processing method and apparatus, an electronic device, and a storage medium.
Background
Resolution is a parameter used to measure how much data is in a bitmap image. The high-resolution image contains more data, and the data also provides more accurate information for tasks such as target detection semantic segmentation and the like. In the process of acquiring a high-resolution image, due to the influence of shooting time, shooting angle and shooting illumination, the actually obtained high-resolution image has some brightness and color differences. Therefore, in map applications, it is necessary to embed a high-resolution image into a low-resolution image at a corresponding position, and therefore, it is important to perform a light-uniformizing and color-uniformizing process on the image.
In the process of implementing the invention, the inventor finds that the existing image dodging and color-homogenizing processing technology only considers the tone brightness information between the source image to be processed and the template image, ignores the spatial context information contained in the size between the source image to be processed and the template image, and further causes the unsatisfactory image dodging and color-homogenizing processing.
Disclosure of Invention
The embodiment of the invention provides an image processing method and device, electronic equipment and a storage medium, which can improve the light and color homogenizing effects of an image.
According to an aspect of the present invention, there is provided an image processing method including:
acquiring a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed;
determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image;
amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image;
and carrying out light and color homogenizing treatment on the source image to be processed according to the target size template image.
According to another aspect of the present invention, there is provided an image processing apparatus including:
the image acquisition module is used for acquiring a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed;
the magnification size multiple determining module is used for determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image;
the target size template image acquisition module is used for amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image;
and the dodging and color-homogenizing processing module is used for carrying out dodging and color-homogenizing processing on the source image to be processed according to the histogram distribution of the target size template image by adopting a histogram matching method.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the image processing method according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the image processing method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the embodiment of the invention, a source image to be processed and a corresponding template image are firstly obtained, the magnification size multiple of the template image is determined according to the size of the source image to be processed and the size of the template image, the size of the template image is magnified to a target size by using the magnification size multiple to obtain the template image with the target size, and finally, the source image to be processed is subjected to light and color homogenizing treatment according to the template image with the target size.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of an image processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another image processing method according to a second embodiment of the present invention;
FIG. 3 is a flowchart comparing an image processing method according to a second embodiment of the present invention with a prior art;
fig. 4 is a flowchart of super-resolution up-sampling amplification according to a second embodiment of the present invention;
FIG. 5 is a flowchart illustrating an overall implementation of a dodging method according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of an image processing apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of an image processing method according to an embodiment of the present invention, where the embodiment is applicable to a case where a super-resolution technique is used to perform a light evening and color evening process on an image, and the method may be executed by an image processing apparatus, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device, where the electronic device may be a terminal device or a server device, and the embodiment of the present invention does not limit a specific device type of the electronic device. Accordingly, as shown in fig. 1, the method comprises the following operations:
and S110, acquiring a source image to be processed and a template image.
The source image to be processed can be a high-resolution foreground image which needs to be subjected to light and color homogenizing treatment. The template image can be a background image determined according to the coordinate information of the source image to be processed, and the size of the template image is smaller than that of the source image to be processed.
In the embodiment of the invention, the source image to be processed can be a high-resolution satellite remote sensing image obtained by using a remote sensing technology, and can also be a high-resolution spectral image obtained by using a detector technology, a precise optical machine, weak signal detection, a computer technology or an information processing technology.
Optionally, the source image to be processed is obtained by carrying various sensors by using a satellite to obtain data which comprehensively, truly and objectively reflect the surface features, and then the data is processed by a professional remote sensing technology to obtain the source image to be processed with high-precision geographic coordinate information. The source image to be processed can be obtained by simultaneously imaging a target region in tens of to hundreds of continuous and subdivided spectral bands in ultraviolet, visible light, near infrared and middle infrared regions of an electromagnetic spectrum, and then obtaining the source image to be processed. That is, any scene image type of the base map with the high-resolution image embedded in the corresponding position can be used as the source image to be processed, and the image type and the image content of the source image to be processed are not limited in the embodiment of the present invention.
The template image may be obtained by first obtaining a coordinate position of a source image to be processed, and then capturing the obtained image in a background image according to the obtained coordinate position of the source image.
And S120, determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image.
Wherein, the size of the source image to be processed can be determined by the length and the width of the image to be processed. The template image size may be determined by the length and width of the template image. The magnification size factor of the template image may be a gain value for expressing the size of the template image magnified to the size of the source image to be processed.
In the embodiment of the invention, the length width of the source image to be processed and the length width of the template image can be respectively obtained, the ratio of the length widths of the two images is calculated, and the obtained proportional numerical value is used as the magnification size multiple of the template image.
And S130, amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image.
Wherein the target size template image may be an image formed by enlarging the template image according to a magnification size. The target size may be a size value of a target size template image.
In the embodiment of the invention, the length and the width of the template image can be respectively amplified by corresponding times by utilizing the determined amplification size times to obtain the template image with the target size.
And S140, carrying out uniform light and color treatment on the source image to be treated according to the target size template image.
In the embodiment of the invention, a uniform light and color algorithm based on histogram matching can be selected to perform uniform light and color processing on the source image to be processed. The dodging and color-evening algorithm based on histogram matching is an operation of transforming the gray distribution of an image according to a certain mode. And in the change process, the histogram is equalized, namely the image is pulled up in the whole gray scale range, the histogram of the source image is equalized by modifying the histogram distribution of the source image and taking the target size template image as a reference, and then the equalized image is corrected according to the mapping relation.
In the embodiment of the invention, the source image to be processed can be subjected to light and color homogenizing treatment by selecting a light and color homogenizing algorithm based on a statistical method. The dodging and color-homogenizing algorithm based on the statistical method is to firstly carry out relevant parameter statistics on a source image to be processed and a target size template image and then correct the parameters of the source image to be processed into the parameters of the target size template image through mathematical transformation. Specifically, the average value and the method of the target size template image are used as standards by using an algorithm based on a Wallis filter, and the average value and the variance of the gray value of the source image to be processed are approximate to the average value and the variance of the target size template image by transforming the gray value of the source image to be processed, so that the light and color homogenizing processing of the source image to be processed is realized.
In the embodiment of the invention, the light and color homogenizing treatment can be carried out on the source image to be processed based on the global light and color homogenizing algorithm. The global light and color homogenizing algorithm takes the same color of the image to be processed at the same geographic position as prior evidence knowledge, and utilizes least square adjustment in the whole measuring area to minimize global color difference. The method independently corrects the color of each pixel, and directly obtains an independent affine model of each pixel by correspondingly solving least square probability movement through color features.
According to the embodiment of the invention, a source image to be processed and a corresponding template image are firstly obtained, the magnification size multiple of the template image is determined according to the size of the source image to be processed and the size of the template image, the size of the template image is magnified to a target size by using the magnification size multiple to obtain the template image with the target size, and finally, the source image to be processed is subjected to light and color homogenizing treatment according to the template image with the target size.
Example two
Fig. 2 is a flowchart of another image processing method according to an embodiment of the present invention, which is specifically detailed based on the above embodiment. Correspondingly, as illustrated in fig. 2, the method of this embodiment may include:
and S210, acquiring a source image to be processed and a template image.
In the embodiment of the present invention, optionally, the remote sensing image shot by the unmanned aerial vehicle may be used as the source image to be processed. The background image determined by the coordinate information of the source image to be processed can be used as a template image.
Specifically, the unmanned aerial vehicle image with high-precision geographic coordinate information and spatial resolution of 0.1m is obtained by acquiring data which comprehensively, truly and objectively reflects earth surface characteristics through the unmanned aerial vehicle. And then, intercepting the corresponding remote sensing image from the background image with low resolution by using the coordinate information of the unmanned aerial vehicle image as a template image. Wherein the resolution of the template image is 0.5-1m.
S220, calculating a size difference value between the size of the source image to be processed and the size of the template image.
And S230, determining the size multiple between the size of the source image to be processed and the size of the template image according to the size difference between the size of the source image to be processed and the size of the template image.
The size difference value may be a pixel difference value between the source image to be processed with the oversize size and the template image with the undersize size. The size multiple may be a value determined from the pixel difference of the size between the size of the source image to be processed and the size of the template image.
In the embodiment of the invention, the size difference between the size of the source image to be processed and the size of the template image can be calculated by utilizing the ratio of the width to the height of the image, and the size difference is taken as the size multiple.
Specifically, if the size of the source image to be processed is 10000 × 10000 pixels, the size of the corresponding background image captured from the low-resolution background image is 1000 × 1000 pixels according to the coordinate information of the source image to be processed. And calculating to obtain a size difference value between the size of the source image to be processed and the size of the template image by using the ratio of the width to the height of the image, wherein the obtained size difference value is 10. It can be understood that the multiple of the size between the size of the source image to be processed and the size of the template image is 10. And if the size of the source image to be processed is 10000 × 10000 pixels, the size of the corresponding background image intercepted from the low-resolution background image is 2000 × 2000 pixels according to the coordinate information of the source image to be processed. And calculating to obtain a size difference value between the size of the source image to be processed and the size of the template image by utilizing the ratio of the width to the height of the image, wherein the obtained size difference value is 5. It can be understood that the multiple of the size between the size of the source image to be processed and the size of the template image is 5.
In the embodiment of the present invention, in order to achieve a better image processing effect, the size range of the template image is limited, and the size range of the obtained template image is between 1000 × 1000 pixels and 2000 × 2000 pixels.
S240, determining the magnification size multiple of the template image according to the value situation of the size multiple.
In an alternative embodiment of the present invention, in the case where it is determined that the size multiple is an integer, the size multiple is directly taken as the enlarged size multiple of the template image. Specifically, if the size of the source image to be processed is 10000 × 10000 pixels, the size of the corresponding background image captured from the low-resolution background image is 1000 × 1000 pixels according to the coordinate information of the source image to be processed. And calculating to obtain a size difference value between the size of the source image to be processed and the size of the template image by using the ratio of the width to the height of the image, wherein the obtained size difference value is 10. And the multiple of the size between the size of the source image to be processed and the size of the template image is 10. The size factor is an integer, the magnification size factor of the template image can be determined to be 10.
In an optional embodiment of the present invention, in a case where it is determined that the size multiple is a non-integer, a value obtained by rounding up the size multiple is used as a magnification size multiple of the template image. Specifically, if the size of the source image to be processed is 10000 × 10000 pixels, the size of the corresponding background image captured from the low-resolution background image is 1500 × 1500 pixels according to the coordinate information of the source image to be processed. And calculating to obtain a size difference value between the size of the source image to be processed and the size of the template image by using the ratio of the width to the height of the image, wherein the obtained size difference value is 6.66. And the multiple of the size between the size of the source image to be processed and the size of the template image is 6.66. If the size multiple is a non-integer, rounding up the size multiple to obtain 7, and further determining that the magnification size multiple of the template image is 7.
And S250, inputting the template image to a super-resolution network based on deep learning to obtain a feature extraction image.
Among them, the super resolution network may be a method for realizing a high resolution image from a low resolution image. The feature extraction image may be an image including color information, texture information, shape information, and spatial relationship information of the template image. Meanwhile, the size of the feature extraction image is the same as that of the template image.
In the embodiment of the invention, the template image amplified according to the amplification size multiple of the template image is used as input data and sent to a super-resolution network for deep learning to perform a series of convolution operations, so as to obtain the feature extraction image. The size of the feature extraction image is kept consistent with the size of the template image.
S260, rearranging the channel number of each pixel of the feature extraction image to obtain the target size template image.
The channel of the feature extraction image may be a channel for storing image color information. The number of channels of the feature extraction image may be a numerical value used to count the number of channels.
In an alternative embodiment of the present invention, rearranging the number of channels of each pixel of the feature extraction image may include: determining the side length value of a preset square area according to the number of channels of the feature extraction image; and arranging the channels of all pixels of the feature extraction image into the preset square area according to the edge length value of the preset square area.
The preset square region may be a shape region obtained by rearranging the feature extraction images. The side length of the predetermined square region may be a value for determining the size of the predetermined square region.
Specifically, a feature extraction image is obtained by utilizing super-resolution network learning of deep learning, and the number of channels of the feature extraction image is a square value of a magnification size multiple. And if the number of channels of the feature extraction image is a square value of the magnification size multiple, taking the numerical value of the arithmetic square root of the number of channels of the feature extraction image as the side length value of the preset square area. Further, the channels of the pixels of the feature extraction image are rearranged into the preset square region according to the edge length value of the preset square region.
After the preset square area is determined, the channel number of each pixel of the feature extraction image is rearranged, and the target size template image can be obtained.
And S270, determining the histogram matching method as a dodging and color homogenizing processing algorithm.
S280, calculating a first histogram corresponding to the source image to be processed and a second histogram corresponding to the target size template image.
The histogram matching method may be a method for performing light and color uniformization processing on a source image to be processed. The first histogram may be a histogram for representing a luminance distribution in the source image to be processed, plotting the number of pixels per luminance value in the source image to be processed. The second histogram may be a histogram for representing a luminance distribution in the target-size template image, in which the number of pixels per luminance value in the target-size template image is plotted.
In the embodiment of the invention, a histogram matching method can be selected to perform light and color evening processing on the image to be processed. Firstly, selecting and utilizing a calHist function to perform first histogram calculation on a source image to be processed, then selecting and utilizing a minMaxLoc function to search the maximum value of the source image to be processed, and finally realizing the drawing of the first histogram according to the obtained statistical data. Similarly, a calcHist function can be selected to perform second histogram calculation on the target size template image, a minMaxLoc function is selected to find the maximum value of the target size template image, and finally the second histogram can be drawn according to the obtained statistical data.
And S290, performing equalization processing on the first histogram and the second histogram to obtain a first equalized histogram and a second equalized histogram.
The first equalization histogram may be a statistical graph obtained by adjusting the contrast using the first histogram. The second equalization histogram may be a statistical map obtained by performing adjustment processing on the contrast using the second histogram.
In the embodiment of the invention, the obtained first histogram is subjected to nonlinear stretching, image pixel values are divided again, the number of pixels in a certain gray scale range is approximately the same, uniform distribution of the pixels is realized, and the first equalized histogram can be obtained. In a similar way, the obtained second histogram is subjected to nonlinear stretching, image pixel values are divided again, the number of pixels in a certain gray scale range is approximately the same, uniform distribution of the pixels is achieved, and a second equalized histogram can be obtained.
S2100, mapping the pixels of the first equalization histogram and the second equalization histogram to obtain a pixel mapping relation.
And S2110, modifying the pixel values of the source image to be processed according to the pixel mapping relation and the second equalized histogram.
The pixel mapping relationship may be a corresponding relationship used to represent pixels between the image to be processed and the target size template image. The pixel values of the source image to be processed may be average luminance information representing each pixel in the image.
In the embodiment of the invention, the pixels of the first equalization histogram and the pixels of the second equalization histogram are used for mapping processing to obtain the pixel mapping relation between the pixels. And correspondingly calculating each pixel value of the source image to be processed according to the mapping relation based on the distribution condition of the second equalized histogram, and modifying the pixel values to realize the light and color evening processing of the source image to be processed.
In a specific embodiment, the unmanned aerial vehicle shot image with high resolution, high texture and high characteristics is used as a source image to be processed. Because the influence of shooting time, shooting angle and shooting illumination, there will be some luminance and color difference in every unmanned aerial vehicle image that actually obtains. In the map application, often need influence the unmanned aerial vehicle of high resolution to imbed in the base map that corresponds the position, because the inconsistent comparatively obvious color difference that can produce of color this moment causes the influence to the use of follow-up image, and then this problem is solved mainly through the mode of carrying out the even color of even light with the image at present.
Fig. 3 is a flowchart comparing an image processing method according to a second embodiment of the present invention with a flowchart of the prior art. As shown in fig. 3 (1), the conventional dodging and color-homogenizing technology mainly performs a dodging and color-homogenizing process on an image by using a dodging and color-homogenizing algorithm such as histogram equalization. As shown in fig. 3 (2), the dodging and color-homogenizing technique used in the present invention mainly starts from the mismatch of information existing in the dodging and color-homogenizing process, reduces the pixel information included in the template image to the size consistent with the source image by the dodging and color-homogenizing method, reduces the pixel information included in the template image, matches the spatial size, and reduces the difference of the dodging and color-homogenizing algorithm in calculating the key information such as the histogram of the source image and the template image.
Firstly, reading a source image to be processed and a template image which are required by light and color evening, and obtaining information of the number of channels, the size and the like contained in the two images.
Further, the size difference between the template image and the source image to be processed is calculated through the read image information, the multiple required when the template image is amplified to the source image to be processed is obtained, and if the multiple is not an integer, the operation of rounding up is carried out.
Fig. 4 is a flowchart of super-resolution up-sampling amplification according to an embodiment of the present invention. As shown in fig. 4, the input of the network is a template image with low resolution, and after passing through three convolutional layers, a feature image with the same size as the input image is obtained with the number of channels r 2. Wherein r is the magnification factor calculated in the previous step. And rearranging r2 channels of each pixel of the characteristic image into an r multiplied by r area corresponding to a r multiplied by r subblock in the high-resolution image, so that the characteristic image with the size of H multiplied by W multiplied by r2 is rearranged into an rH multiplied by rW multiplied by 1 high-resolution image. Where H and W are represented as the length and width of the image, respectively. The Sub-pixel dense upsampling technology in the super-resolution is used for amplifying the template image from the original size to the target size, and more sufficient space information is obtained on the template image.
Fig. 5 is a flowchart illustrating an overall implementation of a method for homogenizing and evening color according to an embodiment of the present invention. In the prior art, a histogram-based dodging and color-evening algorithm is frequently used, and the histogram distribution only needs to be calculated due to the matching of histogram matching, so that the calculation efficiency is high, but the distribution of the histogram is directly modified in the method, and when a template image is unclear or the difference between the template image and a source image to be processed is overlarge, histogram statistics cannot accurately obtain the histogram distribution, so that the final dodging and color-evening result of the source image to be processed has larger deviation in hue. The dodging and color-homogenizing algorithm based on the statistical method is essentially mathematical transformation, but accumulated errors occur in linear transmission in the calculation process, and uneven spots are easy to occur in a pure color area. Meanwhile, when the color difference of the overlapping area is large or the degree of the overlap is large, the color difference between the images cannot be completely eliminated. Although the global dodging and color homogenizing algorithm is used for independently correcting the color of each pixel, the method cannot ensure the reasonability of the number and the distribution of the matched features, and the final dodging and color homogenizing effect is poor under the condition that the feature difference is obvious. Meanwhile, the method has the defects of complex correction model, large required calculation amount and large dependence on calculation resources. Therefore, the source image to be processed and the image after super-resolution amplification are subjected to uniform light and color processing by using a histogram matching method. As shown in fig. 5, first, histograms corresponding to the source image to be processed and the template image are obtained through calculation, and the histograms of the two images are equalized. And after equalization, carrying out complete mapping on the source image to be processed and pixels corresponding to the template image, taking the mapping as the basis of light and color homogenization of the image, modifying corresponding pixel values in the source image to be processed according to a corresponding equalization histogram of the template image, and finally outputting the image after light and color homogenization.
The method comprises the steps of firstly obtaining a template image of a source image to be processed, simultaneously calculating the size difference between the size of the source image to be processed and the size of the template image, and determining the size difference as the size multiple between the size of the source image to be processed and the size of the template image. And determining the magnification size multiple of the template image according to the value condition of the size multiple, and magnifying the template image by using the obtained magnification size multiple. And inputting the obtained template image into a super-resolution network based on deep learning for training to obtain a feature extraction image, and rearranging the channel number of each pixel of the feature extraction image to obtain a target size template image. The histogram matching method is used as a light and color homogenizing processing method, histogram calculation is carried out on a source image to be processed and a target size template image, equalization processing is carried out on the source image to be processed and the target size template image at the same time, a first equalization histogram and a second equalization histogram are obtained, and then mapping processing is carried out on the two equalized histograms to obtain a pixel mapping relation. And finally, modifying the pixel value of the source image to be processed by utilizing the pixel mapping relation and the second equalization histogram. According to the technical scheme of the embodiment of the invention, the super-resolution technology is introduced before the light and color homogenizing treatment, so that the problem of uneven histogram matching caused by image unbalance is solved, and the light and color homogenizing effect of the image can be improved.
EXAMPLE III
Fig. 6 is a schematic diagram of an image processing apparatus according to a third embodiment of the present invention, and as shown in fig. 6, the apparatus includes: an image acquisition module 310, a magnification size factor determination module 320, a target size template image acquisition module 330, and a dodging and color-homogenizing processing module 340, wherein:
the image acquisition module 310 is configured to acquire a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed;
the magnification size multiple determining module 320 is configured to determine a magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image;
a target size template image obtaining module 330, configured to enlarge the size of the template image to a target size according to the enlargement size multiple, so as to obtain a target size template image;
and the light and color homogenizing processing module 340 is configured to perform light and color homogenizing processing on the source image to be processed according to the histogram distribution of the target size template image by using a histogram matching method.
According to the embodiment of the invention, a source image to be processed and a corresponding template image are firstly obtained, the magnification size multiple of the template image is determined according to the size of the source image to be processed and the size of the template image, the size of the template image is magnified to a target size by using the magnification size multiple to obtain the template image with the target size, and finally, the source image to be processed is subjected to light and color homogenizing treatment according to the template image with the target size.
Optionally, the magnification size factor determining module 320 is specifically configured to: calculating a size difference value between the size of the source image to be processed and the size of the template image; determining a size multiple between the size of the source image to be processed and the size of the template image according to a size difference value between the size of the source image to be processed and the size of the template image; and determining the magnification size multiple of the template image according to the value situation of the size multiple.
Optionally, the magnification size factor determining module 320 is specifically configured to: under the condition that the size multiple is determined to be an integer, directly taking the size multiple as the amplified size multiple of the template image; and under the condition that the size multiple is determined to be a non-integer, taking a numerical value obtained by rounding the size multiple upwards as the amplified size multiple of the template image.
Optionally, the target size template image obtaining module 330 is specifically configured to: inputting the template image to a super-resolution network based on deep learning to obtain a feature extraction image; and rearranging the channel number of each pixel of the feature extraction image to obtain the target size template image, wherein the size of the feature extraction image is the same as that of the template image.
Optionally, the target size template image obtaining module 330 is specifically configured to: determining the side length value of a preset square area according to the number of channels of the feature extraction image; and arranging the channels of all pixels of the feature extraction image into the preset square region according to the edge length value of the preset square region.
Optionally, the dodging and color-homogenizing processing module 340 is specifically configured to: determining a histogram matching method as a dodging and color-homogenizing processing algorithm; and carrying out light and color homogenizing treatment on the source image to be processed according to the histogram of the target size template image by adopting the histogram matching method.
Optionally, the dodging and color-homogenizing processing module 340 is specifically configured to: calculating a first histogram corresponding to the source image to be processed and a second histogram corresponding to the target size template image; carrying out equalization processing on the first histogram and the second histogram to obtain a first equalized histogram and a second equalized histogram; mapping the pixels of the first equalization histogram and the second equalization histogram to obtain a pixel mapping relation; and modifying the pixel value of the source image to be processed according to the pixel mapping relation and the second equalization histogram.
The image processing device can execute the image processing method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For details of the technology not described in detail in this embodiment, reference may be made to the image processing method provided in any embodiment of the present invention.
Example four
FIG. 7 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as an image processing method.
In some embodiments, the image processing method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the image processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the image processing method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
Embodiments of the present invention further provide a computer storage medium storing a computer program, which when executed by a computer processor is configured to perform the image processing method according to any one of the above embodiments of the present invention: acquiring a source image to be processed and a template image; determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image; amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image; and carrying out uniform light and color treatment on the source image to be treated according to the target size template image.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM, or flash Memory), an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An image processing method, comprising:
acquiring a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed;
determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image;
amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image;
and carrying out light and color homogenizing treatment on the source image to be processed according to the target size template image.
2. The method according to claim 1, wherein the determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image comprises:
calculating a size difference value between the size of the source image to be processed and the size of the template image;
determining a size multiple between the size of the source image to be processed and the size of the template image according to a size difference value between the size of the source image to be processed and the size of the template image;
and determining the magnification size multiple of the template image according to the value situation of the size multiple.
3. The method according to claim 2, wherein the determining the magnification size factor of the template image according to the value of the size factor comprises:
under the condition that the size multiple is determined to be an integer, directly taking the size multiple as the amplified size multiple of the template image;
and under the condition that the size multiple is determined to be a non-integer, taking a numerical value obtained by rounding the size multiple upwards as the amplified size multiple of the template image.
4. The method according to any one of claims 2-3, wherein the enlarging the size of the template image to a target size according to the magnification size factor to obtain a target size template image comprises:
inputting the template image to a super-resolution network based on deep learning to obtain a feature extraction image; wherein the size of the feature extraction image is the same as the size of the template image,
rearranging the channel number of each pixel of the feature extraction image to obtain the target size template image.
5. The method according to claim 4, wherein the number of channels of the feature extraction image is a square value of the magnification size multiple; rearranging the channel number of each pixel of the feature extraction image comprises:
determining the side length value of a preset square area according to the number of channels of the feature extraction image;
and arranging the channels of all pixels of the feature extraction image into the preset square region according to the edge length value of the preset square region.
6. The method according to claim 1, wherein the dodging and color-homogenizing the source image to be processed according to the target size template image comprises:
determining a histogram matching method as a dodging and color-homogenizing processing algorithm;
and carrying out light and color homogenizing treatment on the source image to be processed according to the histogram of the target size template image by adopting the histogram matching method.
7. The method according to claim 6, wherein the step of homogenizing the source image to be processed according to the histogram of the target size template image by using the histogram matching method comprises:
calculating a first histogram corresponding to the source image to be processed and a second histogram corresponding to the target size template image;
carrying out equalization processing on the first histogram and the second histogram to obtain a first equalized histogram and a second equalized histogram;
mapping the pixels of the first equalization histogram and the second equalization histogram to obtain a pixel mapping relation;
and modifying the pixel values of the source image to be processed according to the pixel mapping relation and the second equalized histogram.
8. An image processing apparatus characterized by comprising:
the image acquisition module is used for acquiring a source image to be processed and a template image; wherein the size of the template image is smaller than that of the source image to be processed;
the magnification size multiple determining module is used for determining the magnification size multiple of the template image according to the size of the source image to be processed and the size of the template image;
the target size template image acquisition module is used for amplifying the size of the template image to a target size according to the amplification size multiple to obtain a target size template image;
and the dodging and color-homogenizing processing module is used for carrying out dodging and color-homogenizing processing on the source image to be processed according to the histogram distribution of the target size template image by adopting a histogram matching method.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the image processing method of any one of claims 1-7.
10. A computer storage medium, characterized in that the computer readable storage medium stores computer instructions for causing a processor to implement the image processing method of any one of claims 1-7 when executed.
CN202211505894.0A 2022-11-28 2022-11-28 Image processing method and device, electronic equipment and storage medium Pending CN115760578A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211505894.0A CN115760578A (en) 2022-11-28 2022-11-28 Image processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211505894.0A CN115760578A (en) 2022-11-28 2022-11-28 Image processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115760578A true CN115760578A (en) 2023-03-07

Family

ID=85339714

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211505894.0A Pending CN115760578A (en) 2022-11-28 2022-11-28 Image processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115760578A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422654A (en) * 2023-10-23 2024-01-19 武汉珈和科技有限公司 Remote sensing image color homogenizing method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422654A (en) * 2023-10-23 2024-01-19 武汉珈和科技有限公司 Remote sensing image color homogenizing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107403421B (en) Image defogging method, storage medium and terminal equipment
CN109977949B (en) Frame fine adjustment text positioning method and device, computer equipment and storage medium
US8565554B2 (en) Resizing of digital images
CN109118456B (en) Image processing method and device
US11776202B2 (en) Image processing method and apparatus, computer storage medium, and electronic device
CN111192239B (en) Remote sensing image change area detection method and device, storage medium and electronic equipment
CN107622504B (en) Method and device for processing pictures
CN109377508B (en) Image processing method and device
CN110288625B (en) Method and apparatus for processing image
US20180089812A1 (en) Method and system for image enhancement
CN111757100B (en) Method and device for determining camera motion variation, electronic equipment and medium
CN112419179B (en) Method, apparatus, device and computer readable medium for repairing image
CN111489322A (en) Method and device for adding sky filter to static picture
US10521918B2 (en) Method and device for filtering texture, using patch shift
CN115760578A (en) Image processing method and device, electronic equipment and storage medium
CN116883336A (en) Image processing method, device, computer equipment and medium
US11645793B2 (en) Curve antialiasing based on curve-pixel intersection
CN111179276A (en) Image processing method and device
CN113516697B (en) Image registration method, device, electronic equipment and computer readable storage medium
CN116665615B (en) Medical display control method, system, equipment and storage medium thereof
CN113766203B (en) Image white balance processing method
CN116503370A (en) Tobacco shred width determining method and device, electronic equipment and storage medium
CN110827254A (en) Method and device for determining image definition
CN114419086A (en) Edge extraction method and device, electronic equipment and storage medium
CN114820348A (en) Image processing method and device, electronic equipment and storage medium

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