An image processing method, apparatus, device and medium
By acquiring and decomposing images of different resolutions, and utilizing resolution evaluation and image fusion algorithms, the problem of limited depth of field in traditional camera lenses is solved, thereby improving image quality.
Patent Information
- Application Number
- CN202211316904.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-10-26
AI Technical Summary
Traditional camera lenses have limited depth of field, resulting in some areas of the image being clear while others are blurry, which severely restricts the quality of image information.
First and second images with different resolutions are acquired and decomposed into images of the target color channels. The resolution evaluation algorithm is used to determine the resolution evaluation results of each image, and the resolution of the target image is obtained by using an image fusion algorithm.
Image fusion improves the overall quality of images, yields clearer target images, and enhances the focus of image information.
Smart Images

Figure CN115578301B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device and medium. Background Technology
[0002] In the information age, images, as an important information carrier, enable humans to better perceive the world and acquire information, and image information is profoundly changing people's production and lives. Traditional camera optical lenses have limited depth of field, and the lens can only focus on a specific area in a scene, resulting in some areas of the captured image being clear while others are blurry, which seriously restricts the quality of image information. Summary of the Invention
[0003] In view of this, this application provides an image processing method, apparatus, device, and medium to improve image quality.
[0004] In a first aspect, this application provides an image processing method, the method comprising:
[0005] Acquire a first image and a second image, the first image and the second image having different levels of sharpness;
[0006] The first image and the second image are respectively decomposed into images of the target color channels to obtain the corresponding third image and fourth image, each of which includes multiple images;
[0007] The sharpness evaluation results of the third image and the fourth image are determined based on the sharpness evaluation algorithm;
[0008] For the corresponding pixels in the first and second images, based on the sharpness evaluation results of the third and fourth images, an image fusion algorithm is used to obtain the target pixels to form a target image.
[0009] In one possible implementation, determining the sharpness evaluation results of the third image and the fourth image based on the sharpness evaluation algorithm includes:
[0010] For any image in the third image, with the first pixel as the center pixel of the sliding window, slide any image in the third image using the sliding window to obtain a first sub-image, where the first pixel is any pixel of any image in the third image;
[0011] For any image in the fourth image, with the second pixel as the center pixel of the sliding window, slide any image in the fourth image using the sliding window to obtain a second sub-image, where the second pixel is any pixel of any image in the fourth image;
[0012] The sharpness evaluation results of the first sub-image and the second sub-image are determined based on the sharpness evaluation algorithm.
[0013] In one possible implementation, determining the sharpness evaluation results of the first sub-image and the second sub-image based on the sharpness evaluation algorithm includes:
[0014] Obtain multiple first sub-images corresponding to multiple images in the third image, and multiple second sub-images corresponding to the multiple first sub-images in multiple images in the fourth image, wherein the position of the first pixel of the multiple first sub-images corresponds to the position of the second pixel of the multiple second sub-images;
[0015] The sharpness of the plurality of first sub-images and the plurality of second sub-images is calculated based on the image entropy algorithm, and a first evaluation matrix is determined. The first evaluation matrix represents the focus degree of the first pixel and the second pixel.
[0016] In one possible implementation, the step of obtaining a target image composed of target pixels based on the sharpness evaluation results of the third and fourth images at corresponding positions in the first and second images using an image fusion algorithm includes:
[0017] Based on the first evaluation matrix, obtain the first maximum value and the first minimum value of the sharpness corresponding to the plurality of first sub-images, and the second maximum value and the second minimum value of the sharpness corresponding to the plurality of second sub-images;
[0018] Based on the first maximum value, the first minimum value, the second maximum value, and the second minimum value, a second evaluation matrix is determined;
[0019] The pessimistic and optimistic functions are determined based on the second evaluation matrix;
[0020] The fusion function corresponding to the pessimistic function and the optimistic function is determined using the combination rule;
[0021] Based on the probability transformation algorithm and the fusion function, a first probability and a second probability are determined, where the first probability corresponds to the first pixel and the second probability corresponds to the second pixel.
[0022] Based on the comparison result of the first probability and the second probability, the pixel points of the first image or the second image are obtained as the target pixel points to form the target image.
[0023] In one possible implementation, determining the pessimistic and optimistic functions based on the second evaluation matrix includes:
[0024] The second evaluation matrix is normalized to obtain the third evaluation matrix;
[0025] The pessimistic function and the optimistic function are determined based on the third evaluation matrix.
[0026] In one possible implementation, obtaining the target pixel from the first image or the second image based on the comparison result of the first probability and the second probability includes:
[0027] When the first probability is greater than the second probability, the pixel in the first image corresponding to the first pixel is obtained as the target pixel.
[0028] When the first probability is less than the second probability, the pixel in the second image corresponding to the second pixel is obtained as the target pixel.
[0029] When the first probability equals the second probability, the pixel corresponding to the first pixel in the first image or the pixel corresponding to the second pixel in the second image is obtained as the target pixel.
[0030] In one possible implementation, the target color channel includes an R channel, a G channel, and a B channel.
[0031] Secondly, this application provides an image processing apparatus, the apparatus comprising:
[0032] The first acquisition unit is used to acquire a first image and a second image, wherein the first image and the second image have different resolutions;
[0033] The second acquisition unit is used to decompose the first image and the second image into images of target color channels respectively, and acquire corresponding third images and fourth images, wherein the third image and the fourth image each include multiple images;
[0034] The determining unit is used to determine the sharpness evaluation results of the third image and the fourth image based on the sharpness evaluation algorithm;
[0035] The processing unit is used to obtain a target image by using an image fusion algorithm to obtain target pixels at corresponding positions in the first image and the second image, based on the sharpness evaluation results of the third image and the fourth image.
[0036] Thirdly, this application provides an image processing device, the device comprising: a memory and a processor;
[0037] The memory is used to store the relevant program code;
[0038] The processor is used to call the program code to execute the image processing method described in any of the implementations of the first aspect above.
[0039] Fourthly, this application provides a computer-readable storage medium for storing a computer program for executing the image processing method described in any implementation of the first aspect above.
[0040] Therefore, this application has the following beneficial effects:
[0041] In the above implementation of this application, to obtain a clearer image, a first image and a second image to be fused are first obtained, wherein the first image and the second image have different sharpness. Then, the first image and the second image are decomposed into images of target color channels, respectively, to obtain corresponding third and fourth images, wherein each third and fourth image comprises multiple images, that is, images corresponding to each color channel in the target color channels. A sharpness evaluation algorithm is used to determine the sharpness evaluation results of the third image and the fourth image. For pixels at corresponding positions in the first image and the second image, based on the sharpness evaluation results of the third image and the fourth image, an image fusion algorithm is used to obtain target pixels to form the target image, that is, to obtain pixels with higher focus as target pixels. Through the image processing method provided by this application, based on the sharpness of the first image and the second image, the clearer pixels in either the first image or the second image can be obtained as pixels in the final target image, achieving image fusion and thus improving the quality of the target image. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments provided in this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0043] Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application;
[0044] Figure 2 A schematic diagram of an image processing apparatus provided in an embodiment of this application;
[0045] Figure 3 This is a schematic diagram of an image processing device provided in an embodiment of this application. Detailed Implementation
[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The described embodiments are merely exemplary implementations of this application and not all implementation methods. Those skilled in the art can obtain other embodiments in conjunction with the embodiments of this application without creative effort, and these embodiments are also within the protection scope of this application.
[0047] Traditional camera lenses have limited depth of field, meaning they can only focus on a specific area within a scene. This results in some areas of an image being clear while others are blurry, severely limiting the quality of the image information.
[0048] Based on this, embodiments of this application provide an image processing method to improve image quality. Specifically, a first image and a second image to be fused are first acquired, wherein the first and second images have different sharpness. Then, the first and second images are decomposed into images of target color channels, respectively, to obtain corresponding third and fourth images. Each third and fourth image comprises multiple images, corresponding to each color channel in the target color channels. A sharpness evaluation algorithm is used to determine the sharpness evaluation results of the third and fourth images. For corresponding pixels in the first and second images, based on the sharpness evaluation results of the third and fourth images, an image fusion algorithm is used to obtain target pixels to form the target image, i.e., pixels with higher focus are selected as target pixels. Through the image processing method provided by this application, based on the sharpness of the first and second images, sharper pixels in either the first or second image can be selected as pixels in the final target image, achieving image fusion and thus improving the quality of the target image.
[0049] To facilitate understanding of the technical solutions provided in the embodiments of this application, a detailed description will be given below in conjunction with the accompanying drawings.
[0050] See Figure 1 , Figure 1 This is a flowchart of an image processing method provided in an embodiment of this application.
[0051] The method may include the following steps:
[0052] S101: Acquire a first image and a second image, wherein the first image and the second image have different resolutions.
[0053] To obtain higher quality images, image fusion can be performed on a first image and a second image that have the same captured content but different focus areas. That is, the clearer graphic part of the first image or the second image can be obtained as the target image.
[0054] Optionally, to improve the accuracy of image fusion processing, the first and second images can be registered, thereby minimizing influencing factors other than focus. For example, features can be extracted from the first and second images separately, matching feature point pairs can be found through similarity measurement, and image registration can be performed through coordinate transformation.
[0055] S102: Decompose the first image and the second image into images of the target color channels respectively, and obtain the corresponding third image and fourth image.
[0056] Because the focus of each pixel in the first and second images differs, to facilitate the evaluation of the focus of different pixels, the first and second images can be decomposed into images of the target color channels. For example, the target color channels may include an R (red) channel, a G (green) channel, and a B (blue) channel, with each channel corresponding to a specific image. Specifically, decomposing the first image based on the R channel yields a corresponding image, decomposing it based on the G channel yields a corresponding image, and decomposing it based on the B channel yields a corresponding image. Therefore, decomposing the first image into images of the target color channels results in a third image, which contains multiple images. Similarly, decomposing the second image into images of the target color channels yields a fourth image, which also contains multiple images.
[0057] S103: Determine the sharpness evaluation results of the third and fourth images based on the sharpness evaluation algorithm.
[0058] After obtaining the first image decomposed into a third image with different color channels and the second image decomposed into a fourth image with different color channels, a sharpness evaluation algorithm can be used to evaluate the sharpness of the third and fourth images and obtain the sharpness evaluation results.
[0059] Optionally, a sliding window can be used to traverse the third and fourth images to obtain multiple sub-images, allowing for sharpness evaluation of each corresponding pixel in the third and fourth images. Specifically, for any image in the third image, using the first pixel as the center pixel of the sliding window, the sliding window is used to slide any image in the third image to obtain the first sub-image. Here, the first pixel is any pixel in any image of the third image. As can be seen from the above embodiments, the third image can include multiple images corresponding to different color channels. For any image, taking any first pixel in that image as an example, using the first pixel as the center pixel of the sliding window, the sliding window is used to slide the image to obtain the first sub-image of that image. Since the third image includes multiple images, the same method can be used to obtain the first sub-image corresponding to each image, thereby obtaining multiple first sub-images corresponding to the third image. Similarly, for any image in the fourth image, using the second pixel as the center pixel of the sliding window, the sliding window is used to slide any image in the fourth image to obtain the second sub-image, thereby determining multiple second sub-images corresponding to the fourth image. The second pixel is any pixel in any image of the fourth image.
[0060] Then, a sharpness evaluation algorithm is used to evaluate the sharpness of the first and second sub-images, thereby determining the sharpness evaluation results of the third and fourth images. Specifically, multiple first sub-images corresponding to the third image are obtained, wherein the positions of these multiple first sub-images correspond to the positions of the multiple images of the third image. Multiple second sub-images corresponding to these multiple first sub-images are obtained in the fourth image, that is, the positions of the second pixels of the multiple second sub-images correspond to the positions of the first pixels of the multiple first sub-images. Optionally, the multiple first and multiple second sub-images can be obtained in the following way: taking the target color channels including R, G, and B channels as an example, after decomposing the first image into images of R, G, and B channels, the first pixel in the upper left corner of the image corresponding to the R channel can be selected as the center pixel of the sliding window to determine the first sub-image corresponding to the R channel. Similarly, the first pixel in the upper left corner of the image corresponding to the G channel is selected as the center pixel of the sliding window to determine the first sub-image corresponding to the G channel. The first pixel in the upper left corner of the image corresponding to the B channel is selected as the center pixel of the sliding window to determine the first sub-image corresponding to the B channel. In other words, a set of multiple first sub-images corresponding to the third image is determined. Similarly, after decomposing the second image into R, G, and B channels, the first pixel in the top-left corner of the image corresponding to the R channel can be selected as the center pixel of the sliding window to determine the second sub-image corresponding to the R channel. Similarly, the first pixel in the top-left corner of the image corresponding to the G channel can be selected as the center pixel of the sliding window to determine the second sub-image corresponding to the G channel. And so on, the first pixel in the top-left corner of the image corresponding to the B channel can be selected as the center pixel of the sliding window to determine the second sub-image corresponding to the B channel. This allows us to determine multiple second sub-images corresponding to multiple first sub-images.
[0061] Optionally, an image entropy algorithm can be used to calculate the sharpness of multiple first sub-images and multiple second sub-images to determine a first evaluation matrix. This first evaluation matrix can represent the focus degree of the first and second pixels. In specific implementations, it can be done using... This represents the center pixel within the current sliding window. express The corresponding sub-image. Here, (x, y) represents the position of the current pixel, i = 1, 2 indicates that the pixel comes from the third or fourth image respectively, and L = R, G, B represent the three color channels. The sharpness of each sub-image on the three color channels represents the focus of its center pixel. The sharpness evaluation result of each sub-image can be calculated using image entropy, forming the evaluation matrix C(p(x, y)) as follows:
[0062] Ind represents the sharpness evaluation result.
[0063] Image entropy reflects the average amount of information in an image and is a statistical characteristic of image information features. Sharp, focused images have large differences in pixel grayscale values and a wide distribution range, containing a large amount of information, and therefore have high image entropy values. The sharpness evaluation method based on image entropy is as follows:
[0064]
[0065] Where g represents the image grayscale value; G is the maximum grayscale value of the image; P(g) = n g / MN represents the probability of grayscale value g appearing in the image, n g is the number of pixels with a grayscale value of g, MN is the total number of pixels; b is the base of the logarithmic function and is a constant.
[0066] S104: For the corresponding pixels in the first and second images, based on the sharpness evaluation results of the third and fourth images, the target pixels are obtained by using an image fusion algorithm to form a target image.
[0067] After obtaining the sharpness evaluation results of the third and fourth images, the sharper pixel can be selected as the target pixel from the corresponding pixel pairs in the first and second images. After traversing all the pixels, the sharper target pixel is obtained and the target image is formed.
[0068] Optionally, based on the sharpness evaluation results of the third and fourth images, the first and second images can be fused using the FCOWA-ER image fusion algorithm to obtain target pixels from either the first or second image to form a target image. Specifically, based on the first evaluation matrix, the first maximum and first minimum values of sharpness corresponding to multiple first sub-images, and the second maximum and second minimum values of sharpness corresponding to multiple second sub-images can be obtained. For example, when the target color channels include R, G, and B channels, the multiple first sub-images are three images. The maximum value of sharpness corresponding to the three images can be selected as the first maximum value, and the minimum value of sharpness corresponding to the three images can be selected as the first minimum value. Similarly, the second maximum and second minimum values of sharpness corresponding to multiple second sub-images can be obtained. Then, the first maximum value, first minimum value, second maximum value, and second minimum value can be used to form a second evaluation matrix. The pessimistic and optimistic functions are determined based on the second evaluation matrix. Optionally, the second evaluation matrix can be normalized first to obtain a third evaluation matrix. For example, all values in the second evaluation matrix can be divided by the maximum value in the second evaluation matrix to determine the third evaluation matrix. When determining the pessimistic and optimistic functions based on the third evaluation matrix, it can be achieved in the following way: It can be done using E... Imp (C(p(x,y))) represents the third evaluation matrix.
[0069]
[0070] in, This represents the normalized value of the first minimum. This represents the normalized value of the first maximum value. This represents the normalized value of the second minimum. This represents the normalized value of the second maximum value. (Vector) These represent fuzzy membership functions for pessimistic and optimistic attitudes, respectively. Then, the α-cut method can be used to transform matrix E... Imp The fuzzy membership function in (C(p(x,y))) is transformed into a basic confidence assignment, i.e., for and Performing ascending sorting, the resulting sorting results can be categorized into the following four cases:
[0071]
[0072]
[0073] Taking the first ranking result as an example, the pessimistic function determined based on the third evaluation matrix includes:
[0074]
[0075] The optimistic functions determined based on the third evaluation matrix include:
[0076]
[0077] Then, the fusion function corresponding to the pessimistic and optimistic functions can be determined using the combination rules. Taking the above method for determining the pessimistic and optimistic functions as an example, the Dempster combination rules can be used to fuse the pessimistic and optimistic functions to determine the fusion function. Specifically, first, the normalization coefficient K is calculated using the pessimistic and optimistic functions. For example, K can be calculated as follows: K = m1({θ1,θ2})·m2({θ1}) + m1({θ1,θ2})·m2({θ1,θ2}) + m1({θ2})·m2({θ1,θ2}). Then, the fusion function is calculated based on the normalization coefficient K, the pessimistic function, and the optimistic function. The fusion function may include:
[0078]
[0079] Where θ1 represents the pixel of the first image and θ2 represents the pixel of the second image.
[0080] After determining the fusion function, a first probability and a second probability can be determined based on the probability transformation algorithm and the fusion function. The first probability can correspond to the first pixel, and the second probability can correspond to the second pixel. Then, based on the comparison between the first and second probabilities, a pixel from either the first or second image is selected as the target pixel to form the target image. For example, when the first probability is greater than the second probability, the pixel corresponding to the first pixel in the first image is selected as the target pixel; when the first probability is less than the second probability, the pixel corresponding to the second pixel in the second image is selected as the target pixel; when the first probability equals the second probability, either the pixel corresponding to the first pixel in the first image or the pixel corresponding to the second pixel in the second image is selected as the target pixel. Since the above sharpness evaluation process is performed on the third and fourth images, it is necessary to obtain the pixel from the first image corresponding to the first pixel in the third image, or the pixel from the second image corresponding to the second pixel in the fourth image.
[0081] Based on the above embodiments for determining the pessimistic function, optimistic function, and fusion function, the first probability and the second probability can be determined in the following way: The fusion function can be transformed onto a probabilistic framework using the Pignistic probability transformation for final decision-making. Let P(θ1) represent the first probability and P(θ2) represent the second probability. The calculation methods for the first probability P(θ1) and the second probability P(θ2) are as follows:
[0082]
[0083] When the first probability is greater than the second probability, it indicates that the sharpness of the first pixel is greater than that of the second pixel. Therefore, the pixel corresponding to the first pixel in the first image can be selected as the target pixel. Since the above process for determining the target pixel is performed on any single pixel, it is necessary to traverse the pixels in the third and fourth images to obtain all target pixels in either the first or second image, thus forming the target image.
[0084] The image processing method provided in this application embodiment can fuse two original images to obtain a clearer image portion to form a target image, thereby improving image quality.
[0085] Based on the above method embodiments, this application also provides an image processing apparatus. See also Figure 2 , Figure 2 This is a schematic diagram of an image processing apparatus provided in an embodiment of this application.
[0086] The device 200 includes:
[0087] The first acquisition unit 201 is used to acquire a first image and a second image, wherein the first image and the second image have different resolutions.
[0088] The second acquisition unit 202 is used to decompose the first image and the second image into images of target color channels respectively, and acquire corresponding third images and fourth images, wherein the third image and the fourth image each include multiple images;
[0089] The determining unit 203 is used to determine the sharpness evaluation results of the third image and the fourth image based on the sharpness evaluation algorithm;
[0090] The processing unit 204 is used to obtain a target image by using an image fusion algorithm based on the sharpness evaluation results of the third image and the fourth image, targeting the corresponding pixels in the first image and the second image.
[0091] In one possible implementation, the determining unit 203 is specifically configured to, for any image in the third image, use a first pixel as the center pixel of a sliding window, slide any image in the third image using the sliding window to obtain a first sub-image, wherein the first pixel is any pixel of any image in the third image; for any image in the fourth image, use a second pixel as the center pixel of the sliding window, slide any image in the fourth image using the sliding window to obtain a second sub-image, wherein the second pixel is any pixel of any image in the fourth image; and determine the sharpness evaluation results of the first sub-image and the second sub-image based on the sharpness evaluation algorithm.
[0092] In one possible implementation, the determining unit 203 is specifically used to acquire multiple first sub-images corresponding to multiple images in the third image, and multiple second sub-images corresponding to the multiple first sub-images in multiple images of the fourth image, wherein the position of the first pixel of the multiple first sub-images corresponds to the position of the second pixel of the multiple second sub-images; calculate the sharpness of the multiple first sub-images and the multiple second sub-images based on an image entropy algorithm, and determine a first evaluation matrix, wherein the first evaluation matrix represents the focus degree of the first pixel and the second pixel.
[0093] In one possible implementation, the processing unit 204 is specifically configured to: obtain, based on the first evaluation matrix, a first maximum and a first minimum value among the sharpness values corresponding to the plurality of first sub-images, and a second maximum and a second minimum value among the sharpness values corresponding to the plurality of second sub-images; determine a second evaluation matrix based on the first maximum, the first minimum, the second maximum, and the second minimum value; determine a pessimistic function and an optimistic function based on the second evaluation matrix; determine a fusion function corresponding to the pessimistic function and the optimistic function using a combination rule; determine a first probability and a second probability based on a probability transformation algorithm and the fusion function, wherein the first probability corresponds to the first pixel and the second probability corresponds to the second pixel; and, based on the comparison result of the first probability and the second probability, obtain the pixel of the first image or the second image as the target pixel to form the target image.
[0094] In one possible implementation, the processing unit 204 is specifically used to normalize the second evaluation matrix to obtain a third evaluation matrix; and to determine the pessimistic function and the optimistic function based on the third evaluation matrix.
[0095] In one possible implementation, the processing unit 204 is specifically configured to: when the first probability is greater than the second probability, acquire the pixel corresponding to the first pixel in the first image as the target pixel; when the first probability is less than the second probability, acquire the pixel corresponding to the second pixel in the second image as the target pixel; and when the first probability is equal to the second probability, acquire either the pixel corresponding to the first pixel in the first image or the pixel corresponding to the second pixel in the second image as the target pixel.
[0096] In one possible implementation, the target color channel includes an R channel, a G channel, and a B channel.
[0097] The beneficial effects of the image processing apparatus provided in this application embodiment can be found in the above method embodiment, and will not be repeated here.
[0098] Based on the above method and apparatus embodiments, this application also provides an image processing device. See also Figure 3 , Figure 3 This is a schematic diagram of an image processing device provided in an embodiment of this application.
[0099] The device 300 includes: a memory 301 and a processor 302;
[0100] The memory 301 is used to store relevant program code;
[0101] The processor 302 is used to call the program code and execute the image processing method described in the above method embodiments.
[0102] Furthermore, embodiments of this application also provide a computer-readable storage medium for storing a computer program for executing the image processing method described in the above method embodiments.
[0103] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. In particular, for system or device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The device embodiments described above are merely illustrative. The units or modules described as separate components may or may not be physically separate. The components shown as units or modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the units or modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0104] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0105] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0106] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0107] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, characterized by, The method comprises: acquiring a first image and a second image, the first image and the second image having different sharpness; decomposing the first image and the second image into images of target color channels respectively, acquiring corresponding third images and fourth images, the third images and the fourth images each comprising a plurality of images; determining sharpness evaluation results of the third images and the fourth images based on a sharpness evaluation algorithm; for pixel points at corresponding positions in the first image and the second image, acquiring target pixel points to form a target image based on the sharpness evaluation results of the third images and the fourth images by using an image fusion algorithm; the determination of the sharpness evaluation results of the third images and the fourth images based on the sharpness evaluation algorithm comprises: for any image in the third images, taking a first pixel point as a center pixel point of a sliding window, sliding the sliding window in any image in the third images to acquire a first sub-image, the first pixel point being any pixel point in any image in the third images; for any image in the fourth images, taking a second pixel point as the center pixel point of the sliding window, sliding the sliding window in any image in the fourth images to acquire a second sub-image, the second pixel point being any pixel point in any image in the fourth images; determining sharpness evaluation results of the first sub-images and the second sub-images based on the sharpness evaluation algorithm comprises: calculating the sharpness of the plurality of first sub-images and the plurality of second sub-images based on an image entropy algorithm to determine a first evaluation matrix, the first evaluation matrix representing the focusing degree of the first pixel point and the second pixel point; the acquisition of the target pixel points to form the target image based on the sharpness evaluation results of the third images and the fourth images by using the image fusion algorithm for the pixel points at the corresponding positions in the first image and the second image comprises: based on the first evaluation matrix, acquiring a first maximum value and a first minimum value in the sharpness corresponding to the plurality of first sub-images, and a second maximum value and a second minimum value in the sharpness corresponding to the plurality of second sub-images; determining a second evaluation matrix based on the first maximum value, the first minimum value, the second maximum value, and the second minimum value; determining a pessimistic function and an optimistic function based on the second evaluation matrix; wherein the pessimistic function is a first vector related to the minimum values of the sharpness of the plurality of first sub-images and second sub-images, and the optimistic function is a second vector related to the maximum values of the sharpness of the plurality of first sub-images and second sub-images; determining a fusion function corresponding to the pessimistic function and the optimistic function by using a combination rule; determining a first probability and a second probability for decision making based on a probability conversion algorithm and the fusion function, the first probability representing the probability of selecting a pixel point in the first image, and the second probability representing the probability of selecting a pixel point in the second image; acquiring the pixel point in the first image or the second image as the target pixel point based on the comparison result of the first probability and the second probability to form the target image.
2. The method of claim 1, wherein, The determining the sharpness evaluation results of the first sub-image and the second sub-image based on the sharpness evaluation algorithm comprises: obtaining a plurality of first sub-images corresponding to a plurality of images in the third image and a plurality of second sub-images corresponding to the plurality of first sub-images in a plurality of images of the fourth image, the positions of first pixel points of the plurality of first sub-images corresponding to the positions of second pixel points of the plurality of second sub-images.
3. The method of claim 1, wherein, The determining the pessimistic function and the optimistic function based on the second evaluation matrix comprises: normalizing the second evaluation matrix to obtain a third evaluation matrix; determining the pessimistic function and the optimistic function based on the third evaluation matrix.
4. The method of claim 3, wherein, The obtaining the pixel point of the first image or the second image as the target pixel point based on the comparison result of the first probability and the second probability comprises: when the first probability is greater than the second probability, obtaining the pixel point corresponding to the first pixel point in the first image as the target pixel point; when the first probability is less than the second probability, obtaining the pixel point corresponding to the second pixel point in the second image as the target pixel point; when the first probability is equal to the second probability, obtaining the pixel point corresponding to the first pixel point in the first image or the pixel point corresponding to the second pixel point in the second image as the target pixel point.
5. The method according to any one of claims 1 to 4, characterized in that, The target color channel comprises an R channel, a G channel and a B channel.
6. An apparatus for performing the method of claim 1, wherein The device comprises: a first obtaining unit configured to obtain a first image and a second image, the first image and the second image having different sharpness; a second obtaining unit configured to decompose the first image and the second image into images of a target color channel respectively, and obtain a corresponding third image and a fourth image, the third image and the fourth image each comprising a plurality of images; a determining unit configured to determine sharpness evaluation results of the third image and the fourth image based on a sharpness evaluation algorithm, comprising: for any image in the third image, taking a first pixel point as a center pixel point of a sliding window, and sliding the sliding window over any image in the third image to obtain a first sub-image, the first pixel point being any pixel point in any image in the third image; for any image in the fourth image, taking a second pixel point as the center pixel point of the sliding window, and sliding the sliding window over any image in the fourth image to obtain a second sub-image, the second pixel point being any pixel point in any image in the fourth image; determining sharpness evaluation results of the first sub-image and the second sub-image based on the sharpness evaluation algorithm, comprising: calculating the sharpness of the plurality of first sub-images and the plurality of second sub-images based on an image entropy algorithm to obtain a first evaluation matrix, the first evaluation matrix representing the focusing degree of the first pixel point and the second pixel point. The processing unit is configured to, for a pixel point at a corresponding position in the first image and the second image, based on the clarity evaluation results of the third image and the fourth image, obtain a target pixel point group to form a target image by using an image fusion algorithm, including: based on the first evaluation matrix, obtaining a first maximum value and a first minimum value in the clarity of the plurality of first sub-images, and a second maximum value and a second minimum value in the clarity of the plurality of second sub-images; based on the first maximum value, the first minimum value, the second maximum value, and the second minimum value, determining a second evaluation matrix; based on the second evaluation matrix, determining a pessimistic function and an optimistic function; wherein the pessimistic function is a first vector related to the minimum values of the clarity of the plurality of first sub-images and second sub-images, and the optimistic function is a second vector related to the maximum values of the clarity of the plurality of first sub-images and second sub-images; determining a fusion function corresponding to the pessimistic function and the optimistic function by using a combination rule; based on a probability conversion algorithm and the fusion function, determining a first probability and a second probability for decision-making, the first probability representing a probability of selecting a pixel point in the first image, and the second probability representing a probability of selecting a pixel point in the second image; based on a comparison result of the first probability and the second probability, obtaining a pixel point of the first image or the second image as the target pixel point to form the target image.
7. An image processing apparatus characterized by comprising: The device comprises a memory and a processor; The memory is configured to store related program codes; The processor is configured to call the program codes and execute the image processing method in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store a computer program, and the computer program is configured to execute the image processing method in any one of claims 1 to 5.
Citation Information
Patent Citations
Multi-focus sequence image fusion method
CN104182952A
Sample component analysis method, apparatus and device, and storage medium
CN114820488A