WO2023206475A1 - Image processing method and apparatus, electronic device and storage medium - Google Patents

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

Info

Publication number
WO2023206475A1
WO2023206475A1 PCT/CN2022/090570 CN2022090570W WO2023206475A1 WO 2023206475 A1 WO2023206475 A1 WO 2023206475A1 CN 2022090570 W CN2022090570 W CN 2022090570W WO 2023206475 A1 WO2023206475 A1 WO 2023206475A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel
target
grid
target object
Prior art date
Application number
PCT/CN2022/090570
Other languages
French (fr)
Chinese (zh)
Inventor
刘阳晨旭
石啟凡
江浩
张锐
王宇
许兴涛
Original Assignee
北京小米移动软件有限公司
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 北京小米移动软件有限公司 filed Critical 北京小米移动软件有限公司
Priority to PCT/CN2022/090570 priority Critical patent/WO2023206475A1/en
Publication of WO2023206475A1 publication Critical patent/WO2023206475A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration by the use of more than one image, e.g. averaging, subtraction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems

Definitions

  • the present disclosure relates to the field of image processing but is not limited to the field of image processing, and in particular, to an image processing method, device, electronic equipment and storage medium.
  • image acquisition component After the image acquisition component collects the image, it needs to process the image to obtain the image that meets the needs.
  • the images that different image acquisition components can obtain when collecting images may be different. For example, in the same shooting scene, images of the same target object are collected, different image acquisition modules or the same image acquisition module uses different configuration parameters. Under this condition, the collected image of the target object will also be different.
  • the present disclosure provides an image processing method, device, electronic equipment and storage medium.
  • a first aspect of an embodiment of the present disclosure provides an image processing method, including: acquiring a first image and a second image; wherein both the first image and the second image include the same target object; in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image; wherein, The first pixel and the second pixel are pixels at the same position in the target object; the target grid in the third image is determined according to the reference grid in the first image; wherein, The target grid includes: a target position; a target pixel value of a pixel corresponding to the target position, and a reference pixel value of a pixel corresponding to the reference position in the reference grid that satisfies a preset condition; according to the reference grid and the The position correspondence relationship of the target grid is to adjust the position of the second pixel in the third image to the same position as the first pixel in the first image in the second direction; wherein, the The second direction is
  • determining the target grid in the third image based on the reference grid in the first image includes: creating M*N preset sizes in the first image a reference grid; according to the reference pixel values of the K pixels corresponding to the reference positions in the reference grid, determine in the third image that the K reference pixel values satisfy the preset condition K target pixel values; according to the K target pixel values, determine K target pixels corresponding to the target pixel value in the third image; determine the target network according to the K target pixels Grid; M, N and K are all positive integers.
  • the method further includes: determining the first average pixel value of each pixel in the preset area; wherein the preset area includes: centered on the pixel corresponding to the reference position, the preset number of pixels is an area of radius; determining the first average pixel value as the reference pixel value.
  • K target pixel values that meet the preset conditions with the K reference pixel values are determined in the third image
  • the method includes: determining K candidate pixel values in the third image; determining a second average pixel value of each pixel in the candidate area; wherein the candidate area includes: corresponding to the candidate pixel value The pixel is the center, and the preset number of pixels is the area of radius; the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset condition are, Determine the target pixel value.
  • the reference grid at least includes: a square grid or a triangular grid; the reference position at least includes: a corner point of the grid or a midpoint of an edge of the grid.
  • the preset condition at least includes: the sum of absolute values of differences between the reference pixel value and the target pixel value is less than a target threshold.
  • the position of the second pixel in the third image is adjusted to be consistent with the first pixel in the second direction.
  • the position in the first image is the same, including: determining the position correspondence relationship according to the reference position and the target position; the position correspondence relationship includes: a mapping transformation relationship in the second direction; according to the second The mapping transformation relationship in the direction, in the second direction, adjusts the position of the second pixel located in the target grid in the third image to be consistent with that of all the pixels located in the reference grid.
  • the positions of the first pixels in the first image are the same.
  • the mapping transformation relationship in the second direction includes: a homography transformation matrix in the second direction.
  • the position of the second pixel in the target object in the second image is adjusted to be consistent with the position of the first pixel in the target object in the first image. have the same position, and obtain the third image, including: extracting the first feature point of the target object in the first image; extracting the second feature point of the target object in the second image; wherein, The first feature point and the second feature point are matching feature point pairs at the same position in the target object; the mapping transformation relationship in the first direction is determined based on the first feature point and the second feature point.
  • the mapping transformation relationship in the first direction includes: a homography transformation matrix in the first direction.
  • a second aspect of an embodiment of the present disclosure provides an image processing device, including: an image acquisition module, configured to acquire a first image and a second image; wherein the first image and the second image both include the same target. Object; a first processing module configured to adjust the position of the second pixel in the target object in the second image in the first direction to the position of the first pixel in the target object in the first image.
  • the positions in are the same, and a third image is obtained; wherein the first pixel and the second pixel are pixels at the same position in the target object; a target grid determination module is used to determine according to the first image Reference grid, determine the target grid in the third image; wherein, the target grid includes: target position; target pixel value of the pixel corresponding to the target position, and the reference position in the reference grid The reference pixel value of the corresponding pixel satisfies the preset condition; the second processing module is configured to convert the second pixel in the second direction according to the position correspondence relationship between the reference grid and the target grid.
  • the position in the third image is adjusted to be the same as the position of the first pixel in the first image; wherein the second direction is perpendicular to the first direction.
  • a third aspect of the embodiment of the present disclosure provides an electronic device, including:
  • a fourth aspect of the embodiments of the present disclosure provides a non-transitory computer-readable storage medium.
  • Computer-executable instructions are stored in the computer-readable storage medium.
  • the computer-executable instructions are executed by a processor, any of the above are implemented. methods described in the examples.
  • the technical solution of the embodiment of the present disclosure is to adjust the position of the second pixel of the target object in the second image to be the same as the position of the first pixel in the first image in one direction. Since the first image and the second image are planar images, the positions of the pixels can be determined in two directions, and in the other direction, the adjusted second image can be adjusted again according to the positional relationship between the preset grid and the target grid. Adjustment, since the grid includes multiple pixels, this can reduce the determination of the position correspondence of a single pixel in the other direction, thereby reducing the amount of calculations required to adjust the pixel position of the target object in the other direction.
  • Figure 1 is a schematic flowchart of an image processing method according to an exemplary embodiment
  • Figure 2 is a schematic diagram of a first image and a second image according to an exemplary embodiment
  • Figure 3 is a schematic diagram of adjusting the position of the second pixel in the first direction according to an exemplary embodiment
  • Part (a) of Figure 4 is a schematic diagram of a first image according to an exemplary embodiment
  • Part (b) of Figure 4 is a schematic diagram of a second image according to an exemplary embodiment
  • Figure 5 is a schematic diagram after adjustment in the first direction according to an exemplary embodiment
  • Figure 6 is a schematic diagram of determining a target grid according to an exemplary embodiment
  • Part (a) of Figure 7 is a schematic diagram of a first image including a reference grid according to an exemplary embodiment
  • Part (b) of Figure 7 is a schematic diagram of a second image including a target grid according to an exemplary embodiment
  • Figure 8 is a schematic diagram of another image processing method according to an exemplary embodiment
  • Figure 9 is a schematic diagram of determining a target pixel value according to an exemplary embodiment
  • Figure 10 is a schematic diagram of adjustment in the second direction according to an exemplary embodiment
  • Figure 11 is a schematic diagram of an image processing device according to an exemplary embodiment
  • Figure 12 is a schematic diagram of another image processing method according to an exemplary embodiment
  • Figure 13 is a block diagram of a terminal device according to an exemplary embodiment.
  • first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or "when” or "in response to determining.”
  • image processing such as high dynamic range imaging (High Dynamic Range, HDR), multi-frame image super-resolution and image fusion
  • HDR High Dynamic Range
  • image processing it is necessary to use the image information of multiple images to fuse to obtain an image with improved image quality.
  • Multiple images need to be aligned first to achieve alignment between image pixels, and then subsequent processing can be carried out.
  • alignment between image pixels can be achieved through dense alignment methods. Most of these methods are based on dense optical flow methods for image alignment. This method requires determining the correspondence between pixels in a two-dimensional direction. Due to performance limitations, most of them can only handle images with smaller resolutions; at the same time, this method requires that the initial misaligned pixel distance is within a certain range, so when the pixel differences in multiple images are large, such as with large amplitude When the field of view changes, the alignment effect is poor.
  • the grid alignment method which is mostly used in the field of image splicing.
  • the grid is determined based on the characteristic feature points and the movement of the grid points is constrained. Alignment of images. This method requires the distribution of feature points across the entire image, so when aligning images with fewer feature points, the alignment effect is poor. For example, in images with weak textures where it is difficult to extract image feature points, it is difficult to obtain better image alignment effects.
  • FIG. 1 a schematic flow chart of an image processing method is provided as an example of the present disclosure.
  • the method includes:
  • Step S100 obtain a first image and a second image; wherein both the first image and the second image include the same target object.
  • Step S200 in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image; wherein, the first The pixel and the second pixel are pixels at the same position in the target object.
  • Step S300 determine the target grid in the third image based on the reference grid in the first image; wherein the target grid includes: the target position; the target pixel value of the pixel corresponding to the target position, and the target pixel value in the reference grid.
  • the reference pixel value of the pixel corresponding to the position meets the preset conditions.
  • Step S400 according to the positional relationship between the reference grid and the target grid, adjust the position of the second pixel located in the target grid in the third image in the second direction to be consistent with the position of the first pixel located in the reference grid.
  • the position in the first image is the same; where the second direction is perpendicular to the first direction.
  • the method of this disclosed example can be applied at least in user terminals, that is, the execution subject of the method can at least include user terminals, and user terminals can include mobile terminals and fixed terminals.
  • Mobile terminals can include mobile phones, tablet computers, vehicle-mounted central control devices, wearable devices, smart devices, etc. Smart devices can also include smart office equipment and smart home equipment.
  • the first image and the second image acquired in step S100 may be two-dimensional plane images, and both the first image and the second image include at least one identical target object. That is, the first image and the second image include common image information and are not exactly the same two images.
  • the target object can be determined based on the actual image collection scene. For example, it can be the object of the captured image in any scene such as people, animals, plants, mountains, and rivers.
  • the first image and the second image may be images obtained under different image acquisition parameters. They may be images acquired by the same image acquisition module under different image acquisition parameters, including images of the same target object.
  • the image acquisition parameters may be the field of view. angle and focal length etc.
  • the first image and the second image may also be images of the same target object collected by different image acquisition modules.
  • the first image acquisition module and the second image acquisition module respectively capture the same scene under different image acquisition parameters.
  • the captured image contains the target object in the scene.
  • the image acquisition parameters can be determined according to the configuration parameters of the image acquisition module and the image acquisition angle.
  • the first image and the second image only need to include the same part of image information, that is, there is common image information between the first image and the second image, and this part of the common image information is the target object.
  • the target object is person A.
  • the presentation effects of person A in the first image and person A in the second image may be different.
  • the magnification factor of person A in the first image is greater than the magnification factor of person A in the second image, and the magnification factor of person A in the first image may be different.
  • the position in the image is different from the position of person A in the second image.
  • Part (a) of Figure 2 is a schematic diagram of a target object.
  • Part (b) of Figure 2 is a schematic diagram of the first image.
  • Part (c) of Figure 2 Part is a schematic diagram of the second image.
  • the target objects are trees and people
  • the first image and the second image are images of the target object at different magnifications
  • both the first image and the second image include the same target object.
  • the first image may be an image of the target object collected by an image acquisition module with a magnification of 1 times
  • the second image may be an image of the target object collected by an image acquisition module with a magnification of 3 times.
  • the first image is an image of the target object at 1x magnification (1X)
  • the second image is an image of the target object at 3x magnification (3X).
  • the first image includes more image information than the second image. That is, in addition to the image information included in the second image, the first image also includes image information that is not included in the second image.
  • the image information included in the second image is the image information common to the first image and the second image
  • the content displayed in the second image is the target object.
  • the target object includes trees and people, and includes other than Background image beyond trees and people.
  • step S200 after obtaining the first image and the second image, since any pixel in the image has a corresponding position, the position of the pixel in the image can be determined through the positions in any two directions, for example, through the coordinates
  • the system can determine the position of any pixel in the first image in the first image, and can also determine the position of any pixel in the second image in the second image.
  • a coordinate system can be determined from two directions.
  • the first direction can be any direction, and the inclination angle between the first direction and the second direction is not limited, as long as the first direction is perpendicular to the second direction.
  • the first direction is a vertical direction
  • the second direction is a horizontal direction
  • the second direction is a vertical direction
  • the first direction is a horizontal direction, etc.
  • the pixels of the target object in the first image are first pixels, and the pixels of the target object in the second image are second pixels.
  • the pixel corresponding to the position in the first image is the first pixel
  • the pixel corresponding to the position in the second image is the second pixel. That is, the first pixel and the second pixel are pixels at the same position in the target object.
  • the first pixel and the second pixel match, and both the first pixel and the second pixel are the target. The position in pixels.
  • the pixel of the tree tip in the first image is the first pixel
  • the pixel in the second image is the second pixel
  • the position of the second pixel in the target object in the second image is adjusted to the same position as the position of the first pixel in the target object in the first image, and the adjusted second image is used as the third image.
  • each pixel in the target object is aligned in the first direction with the corresponding pixel of the target object in the first image, and the aligned first pixel and the second pixel have the same position in the first direction. .
  • the first direction is the vertical direction
  • the position in the vertical direction is represented by y.
  • the position of the tree tip in the first direction of the corresponding pixel in the first image is y1
  • the position of the tree tip in the first direction of the corresponding pixel in the second image is y2.
  • y2 is adjusted to be the same as y1.
  • the position of each corresponding pixel of the target object in the first direction in the second image is adjusted to be the same as the position in the first direction in the first image.
  • the position of the corresponding pixel of the target object in the second image is aligned with the position of the corresponding pixel in the first image, thereby aligning the position of the entire target object in the second image with the position of the corresponding pixel in the first image. Position alignment within an image.
  • the target grid in the third image is determined based on the reference grid in the first image.
  • the first image has a preset reference grid.
  • the reference grid may also be called a reference window.
  • the reference grid may be a virtual grid used to divide the first image into regions. There may be multiple reference grids in the first image, and the size and number of the reference grids may be determined according to actual usage requirements.
  • the shape of the reference grid can be a square grid or a triangular grid, etc., and can be determined according to actual needs. For example, there are N*N uniformly distributed square grids in the first image.
  • the square grids may be positive direction grids, and the reference grid divides the first image into N*N grid areas.
  • the reference grid includes a reference position, which can be the corner point of the grid or the midpoint of the edge of the grid, etc., and can be adjusted according to actual needs.
  • the reference position corresponds to a pixel in the first image, and the pixel value of the pixel corresponding to the reference position in the first image can be determined.
  • the target grid includes the target position, the target pixel value of the pixel corresponding to the target position, and the reference pixel value of the pixel corresponding to the reference position in the reference grid that meets the preset conditions.
  • the target grid can be determined by the target position, and the preset condition can be determined according to actual needs.
  • the preset condition at least includes: the sum of the absolute values of the differences between the reference pixel value and the target pixel value is less than the target threshold.
  • Each reference grid corresponds to a target grid. This embodiment takes one of the grids as an example for explanation.
  • the corresponding target grid can be determined based on each reference grid.
  • Step S400 after determining the target grid in the third image, adjust the position of the second pixel in the third image in the second direction to be consistent with the position of the reference grid and the target grid.
  • a pixel has the same position in the first image.
  • the position correspondence between the reference grid and the target grid can be determined based on the reference position and the target position.
  • the detailed determination process is not limited. You can refer to subsequent embodiments as long as the position correspondence can be determined.
  • the second direction is the horizontal direction
  • the position in the horizontal direction is represented by x.
  • the position of the tree tip in the first direction of the corresponding pixel in the first image is y1
  • the position of the tree tip in the first direction of the corresponding pixel in the second image is y2.
  • y2 is adjusted to be the same as y1.
  • the position of each corresponding pixel of the target object in the first direction in the second image is adjusted to be the same as the position in the first direction in the first image.
  • the position of the corresponding pixel of the target object in the second image is aligned with the position of the corresponding pixel in the first image, thereby aligning the position of the entire target object in the second image with the position of the corresponding pixel in the first image. Position alignment within an image.
  • the position of the second pixel in both the first direction and the second direction is adjusted to be the same as the position of the first pixel in the first image, so that the position of each pixel in the target object in the second image is the same as the position in the second image.
  • the positions in the first image are the same. When the positions are the same, the target object in the second image and the terminal target object in the first image are aligned.
  • the two pixels are not aligned, so when determining the target grid in step S300, the pixel value of the pixel corresponding to the target position in the second direction and the pixel value of the pixel corresponding to the reference position can be separately considered, thereby increasing the computational complexity of determining the target grid. , efficiency and accuracy.
  • the target grid is determined according to the pixel value of the pixel corresponding to the reference position in the reference grid, and then the pixel position is adjusted in the second direction according to the position correspondence between the target grid and the reference grid, which reduces the need for
  • the dependence on the feature points of the target object in the third image does not require determining the target grid based on the position of the feature points in the target object, nor does it need to be aligned in the second direction based on the position of the feature points of the target object in the third image.
  • Step S200 in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image, including:
  • Step S201 Extract the first feature point of the target object in the first image.
  • Step S202 extract the second feature point of the target object in the second image; wherein the first feature point and the second feature point are matching feature point pairs at the same position in the target object.
  • step S201 and step S202 can be executed at the same time, or any one of them can be executed first.
  • Step S203 Determine the mapping transformation relationship in the first direction based on the first feature point and the second feature point.
  • Step S204 According to the mapping transformation relationship in the first direction, adjust the position of the second pixel in the target object in the second image in the first direction to the same position as the position of the first pixel in the target object in the first image. , get the third image.
  • the first feature point and the second feature point are matching feature point pairs corresponding to the feature at the same position in the target object. For the same feature in the target object, it is the first feature point in the first image and it is the first feature point in the second image.
  • the second feature point, the first feature point and the second feature point are a pair of matching feature points.
  • part (a) of Figure 4 is a schematic diagram of a first image
  • part (b) of Figure 4 is a schematic diagram of a second image
  • the house and the person are the target objects.
  • the dots on the house and the dots on the person shown in the first image are the first features.
  • the dots on the house and the dots on the person shown in the second image are as the second characteristic.
  • the first feature and the second feature which is a pair of feature points matching the first feature, are connected by a dotted line. For a certain first feature point of the target object in the first image, there is a second feature point matching the first feature point in the second image.
  • the feature points of the feet in the first image are the first feature points
  • the feature points of the feet in the second image are the second feature points
  • the dotted lines represent the features of the feet.
  • the first feature point and the second feature point are connected, and the first feature point and the second feature point, which are both feature points of the foot, are a matching pair of feature points. The same applies to other feature points in Figure 4.
  • the feature points of the feet in the first image and the feature points of the character's hands in the second image are not matching feature point pairs.
  • the feature points of the feet in the first image are the first feature points
  • the character's hands in the second image The feature point of the part is not the second feature point that matches the first feature point.
  • first feature points and multiple second feature points there are multiple first feature points and multiple second feature points respectively, and the numbers of the first feature points and the second feature points may be the same.
  • the method of extracting the first feature point and the second feature point can be determined according to the business needs, as long as the first feature point and the second feature point can be extracted, for example, the feature point extraction algorithm includes scale-invariant feature transformation (Scale-invariant feature transform, SIFT) algorithm and ORB (ORiented Brief) feature extraction algorithm, etc.
  • SIFT Scale-invariant feature transform
  • ORB ORiented Brief
  • step S203 the mapping transformation relationship in the first direction is determined based on the matching first feature points and second feature points.
  • the position of the first feature point in the first image and the position of the second feature point in the second image can be obtained. According to multiple pairs of matching first features The position of the point and the second feature point can determine the mapping transformation relationship in the first direction.
  • mapping transformation relationship in the first direction can be determined based on the positions of four pairs of matching first feature points and second feature points, and the mapping transformation relationship can be a unitary transformation matrix.
  • the homography transformation matrix can be a 3*3 matrix, which can be expressed by the following formula:
  • H 1 represents the homography transformation matrix in the first direction; h 0 to h 8 represent the elements in H 1 .
  • the mapping transformation relationship can also be other forms of transformation matrices. According to the matching positions of the first feature point and the position of the second feature point, the position of the second pixel in the second image can be adjusted in the first direction. That’s it.
  • Step S204 After obtaining the mapping transformation relationship in the first direction, adjust the position of the second pixel in the target object in the second image in the first direction to be consistent with the target object according to the mapping transformation relationship in the first direction.
  • the position of the first pixel in the first image is the same, and the third image is obtained.
  • the homography transformation matrix H 1 in the first direction may also satisfy the following conditions:
  • i represents the matched i-th pair of feature points, that is, the i-th first feature point and the i-th second feature point that match
  • x i represents the first feature point in the i -th pair of feature points in the second direction Coordinates
  • y i represents the coordinate of the first feature point in the i-th pair of feature points in the first direction
  • y i ' represents the coordinate of the second feature point in the i-th pair of feature points in the first direction.
  • the position of the second pixel in the target object in the second image can be adjusted in the first direction to the same position as the position of the first pixel in the target object in the first image, Get the third image.
  • the first direction is a vertical direction.
  • the homography transformation matrix H 1 can also satisfy the following conditions:
  • x i ' represents the coordinate of the second feature point in the i-th pair of feature points in the first direction.
  • FIG. 5 is a schematic diagram of alignment in the first direction.
  • a schematic diagram is shown in which the position of each pixel of the target object in the first direction in the second image shown in part (b) of FIG. 4 is aligned with the position of the corresponding pixel in the first image.
  • the first direction here is the vertical direction.
  • the positions of the pixels corresponding to the target object are on the same line, achieving line alignment.
  • Step S300 determine the target grid in the third image based on the reference grid in the first image, including:
  • Step S301 Create M*N reference grids of preset sizes in the first image.
  • Step S302 Based on the reference pixel values of the pixels corresponding to the K reference positions in the reference grid, determine K target pixel values that meet the preset conditions with the K reference pixel values in the third image.
  • Step S303 Based on the K target pixel values, K target pixels corresponding to the target pixel values are determined in the third image.
  • Step S304 determine the target grid based on K target pixels; M, N and K are all positive integers. Through step S300, the target grid matching each reference grid can be determined.
  • the reference grid in the first image may be created in advance or may be created when step S300 is performed.
  • the size of the reference grid can be determined according to actual needs.
  • the size, shape, and quantity of the preset grid can be determined according to the preset configuration parameters.
  • M and N can be equal.
  • the reference positions and the number of reference positions in the reference grid can also be determined according to actual needs. For example, when the reference grid is a square, the reference positions are the four corner points of the reference grid, that is, four reference positions are included.
  • part (a) of FIG. 7 is a first image including a reference grid
  • part (b) of FIG. 7 is a second image including a target grid.
  • Part (a) of Figure 7 shows a reference grid.
  • the positive direction grid including four dots around the character is one of the reference grids.
  • the positions of the four dots are the reference grid.
  • Reference location For other reference grids, the four corner points of each reference grid are the reference locations.
  • the number of reference grids is 5*5, and the first image is divided into 5*5 reference grids.
  • Step S302 is explained by taking one of the reference grids as an example. According to the reference pixel values of the pixels corresponding to the K reference positions in the reference grid, determine the K reference pixel values that meet the preset conditions in the third image. target pixel value.
  • the pixel corresponding to the reference position in the first image can be determined, and then the pixel value of the corresponding pixel in the first image for each reference position can be determined. Then, based on the preset conditions and the pixel values of the corresponding pixels in the K reference positions in the first image, K target pixel values that meet the preset conditions with the K reference pixel values in the third image can be determined.
  • the determined target pixel value may also be different, and the preset conditions can be determined according to actual needs.
  • K target pixels corresponding to the K target pixel values can be determined in the third image based on the K target pixel values.
  • One target pixel value can correspond to one target pixel.
  • the target grid is determined based on the K target pixels; M, N, and K are all positive integers.
  • the position of the target pixel in the third image is the target position in the target grid, and the target grid can be determined based on the target position. For example, one target pixel corresponds to one target position, K target pixels correspond to K target positions, and the area surrounded by the K target positions is determined as the target grid.
  • the pixel value of the pixel corresponding to the four dots around the character is the target pixel value
  • the pixel corresponding to the four dots is the target pixel
  • the positive direction surrounded by the target pixels is the target grid.
  • the process of determining the corresponding target grid is the same as the above process, that is, the above process applies to each reference grid.
  • a target position corresponds to a reference position, and in the corresponding target position and reference position, the position of the target pixel and the position of the reference pixel are the same in the first direction.
  • the reference position corresponding to the upper left corner of the reference grid is recorded as the first reference position, and the reference position corresponding to the upper right corner is recorded as the second reference position.
  • the position corresponding to the upper left corner of the target grid is recorded as the first target position, and the position corresponding to the upper right corner is recorded as the second target position.
  • the first direction is the vertical direction
  • the first target position and the first reference position are the same in the first direction, that is, they are row aligned and on the same row.
  • the second target position and the second reference position are the same in the first direction, that is, row aligned, on the same row.
  • the position in the second direction is left with a one-dimensional variable, which can be convenient
  • the position in the second direction is adjusted so that the positions of the target position and the reference position in the first direction and the second direction are adjusted to be the same.
  • step S400 it also reduces the problem of large calculation amount and low accuracy of position adjustment when performing step S400 when the corresponding target position and reference position are different in the first direction and the second direction.
  • the amount of calculation is reduced and the accuracy of position adjustment is improved.
  • FIG. 8 is a schematic diagram of another image processing method, the method includes:
  • Step S10 determine the first average pixel value of each pixel in the preset area; wherein the preset area includes: an area with the pixel corresponding to the reference position as the center and the preset number of pixels as the radius;
  • Step S20 determine the first average pixel value as the reference pixel value.
  • the reference pixel value is determined by combining the pixel value of the pixel corresponding to the reference position and the pixel values of the surrounding pixels corresponding to the reference position.
  • the reference position may correspond to a certain pixel in the first image.
  • the pixel value of each pixel in the preset area is used as the basis.
  • the average value of the pixels is determined as the reference pixel.
  • the average value of each pixel in the preset area is recorded as the first average pixel value.
  • step S302 includes:
  • Step S3021 determine K candidate pixel values in the third image.
  • Step S3022 determine the second average pixel value of each pixel in the candidate area; wherein the candidate area includes: an area with the pixel corresponding to the candidate pixel value as the center and a preset number of pixels as the radius.
  • Step S3023 Determine the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset conditions as target pixel values.
  • K candidate pixel values are first determined in the third image, and then the average pixel value of the pixel values of each pixel in the candidate area corresponding to each candidate pixel value is determined, that is, the second average Pixel values.
  • One second average pixel value corresponds to one candidate pixel value, and the corresponding K candidate pixel values can be determined based on the K second average pixel values.
  • the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset conditions are determined as target pixel values.
  • This method improves the accuracy of determining the target pixel value and reduces the problem of low accuracy caused by determining the target pixel value based on the pixel value corresponding to a single pixel, thereby improving the accuracy of determining the target grid and further improving the accuracy of the target pixel value.
  • the position of each pixel of the target object in the third image is adjusted to the same accuracy as the position of the corresponding pixel of the target object in the first image in the first image.
  • Step S400 According to the position correspondence relationship between the reference grid and the target grid, in the second direction, adjust the position of the second pixel located in the target grid in the third image to be consistent with the position of the first pixel located in the reference grid.
  • the pixels are at the same position in the first image, including:
  • Step S401 determine the position correspondence relationship according to the reference position and the target position.
  • the position correspondence relationship includes: the mapping transformation relationship in the second direction;
  • Step S402 According to the mapping transformation relationship in the second direction, adjust the position of the second pixel located in the target grid in the third image in the second direction to be in the same position as the first pixel located in the reference grid. The same position in an image.
  • the position correspondence can be determined.
  • a reference grid and a matching target grid form a grid pair.
  • the position correspondence relationship of each grid pair can be determined, that is, the mapping transformation relationship in the second direction.
  • the position correspondence relationship in the second direction can be determined based on the target position in the target grid and the reference position in the reference grid.
  • the position in the second direction can be determined.
  • the corresponding relationship includes: mapping transformation relationship in the second direction.
  • the mapping transformation relationship in the second direction may be a transformation relationship in the form of a homography transformation matrix or the like.
  • the position of the second pixel of the target object in the target grid in the third image is adjusted, and the adjusted position of the second pixel of the target object in the target grid in the third image is,
  • the second direction is the same as the position corresponding to the first pixel in the reference grid in the first image, so that the position of each pixel of the target object in the target grid is aligned with the position of the pixel corresponding to the target object in the reference grid. That is, according to the second upward mapping transformation relationship, the position of each pixel in the target grid is adjusted in the second direction.
  • the position of each pixel of the target object located in the target grid in the second direction can be compared with the corresponding pixel of the target object in the reference grid in the second direction. Align the position on.
  • the target grid corresponding to the four dots where the character is located as shown in part (b) of Figure 7, and the position of each pixel in the target grid in the second direction are different from the target grid shown in part (a) of Figure 7.
  • the corresponding pixels in the reference grid corresponding to the four dots where the character is located are aligned in the second direction.
  • the position of the corresponding pixel in the second direction of the left fingertip of the person shown in part (b) of Figure 7 is compared with the position of the left fingertip of the person's left finger shown in part (a) of Figure 7
  • the positions of the corresponding pixels in the second direction are adjusted to be the same, that is, aligned.
  • the position of the pixel corresponding to the person's head shown in part (b) of Figure 7 in the second direction is compared with the position of the pixel corresponding to the person's head shown in part (a) of Figure 7 in the second direction. Adjust the positions in the two directions to be the same, that is, align.
  • mapping transformation relationship in the first direction can be determined based on the positions of four pairs of matching first feature points and second feature points, and the mapping transformation relationship can be a unitary transformation matrix.
  • the homography transformation matrix can be a 3*3 matrix, which can be expressed by the following formula:
  • H 2 represents the homography transformation matrix in the second direction; h 0 to h 8 represent the elements in H 2 .
  • the homography transformation matrix H 2 can also satisfy the following conditions:
  • the position of the second pixel located in the target grid in the third image in the second direction can be adjusted to be the same as the position of the first pixel located in the reference grid in the first image. are in the same position.
  • the homography transformation matrix H 2 can also satisfy the following conditions:
  • FIG. 11 is a schematic diagram of an image processing device, the device includes:
  • Image acquisition module 1 used to acquire a first image and a second image; wherein the first image and the second image include the same target object;
  • the first processing module 2 is configured to adjust the position of the second pixel in the target object in the second image in the first direction to the position of the first pixel in the target object in the first image.
  • the positions are the same, and a third image is obtained; wherein the first pixel and the second pixel are pixels at the same position in the target object;
  • Target grid determination module 3 configured to determine the target grid in the third image according to the reference grid in the first image; wherein the target grid includes: target position; the target The target pixel value of the pixel corresponding to the position satisfies the preset conditions with the reference pixel values of the pixels corresponding to the N reference positions in the reference grid;
  • the second processing module 4 is configured to add the second pixels located in the target grid to the third image in the second direction according to the positional relationship between the reference grid and the target grid.
  • the middle position is adjusted to the same position in the first image as the first pixel located within the reference grid; wherein the second direction is perpendicular to the first direction.
  • the target grid determination module 3 includes:
  • a creation unit configured to create M*N reference grids of preset sizes in the first image
  • a target pixel value determination unit configured to determine, in the third image, the K reference pixel values that satisfy the requirement based on the reference pixel values of the K pixels corresponding to the reference positions in the reference grid. K target pixel values of preset conditions;
  • a target pixel determination unit configured to determine K target pixels corresponding to the target pixel value in the third image based on the K target pixel values
  • a target grid determining unit is used to determine the target grid based on K target pixels; M, N and K are all positive integers.
  • the device further includes:
  • the first average pixel value determination module is used to determine the first average pixel value of each pixel in the preset area; wherein the preset area includes: with the pixel corresponding to the reference position as the center and the preset number of pixels as the radius. area;
  • a reference pixel value determination module configured to determine the first average pixel value as the reference pixel value.
  • the target pixel value determination unit includes:
  • Alternative pixel value determination subunit used to determine K alternative pixel values in the third image
  • the average pixel value determination subunit is used to determine the second average pixel value of each pixel in the candidate area; wherein the candidate area includes: centered on the pixel corresponding to the candidate pixel value, the preset The number of pixels is the area of the radius;
  • Target pixel value determination subunit configured to determine the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values satisfy the preset condition as the target pixels. value.
  • the reference grid at least includes: a square grid or a triangular grid; the reference position at least includes: a corner point of the grid or a midpoint of an edge of the grid.
  • the preset condition at least includes: the sum of absolute values of differences between the reference pixel value and the target pixel value is less than a target threshold.
  • the second processing module 4 includes:
  • a first position correspondence determination unit configured to determine the position correspondence according to the reference position and the target position; the position correspondence includes: a mapping transformation relationship in the second direction;
  • a first processing unit configured to position the second pixel located in the target grid in the third image in the second direction according to the mapping transformation relationship in the second direction, Adjusted to the same position in the first image as the first pixel located within the reference grid.
  • the mapping transformation relationship in the second direction includes: a homography transformation matrix in the second direction.
  • the first processing module 2 includes:
  • a first feature point extraction unit configured to extract the first feature point of the target object in the first image
  • a second feature point extraction unit is used to extract the second feature point of the target object in the second image; wherein the first feature point and the second feature point are at the same position in the target object. matching feature point pairs;
  • a second position correspondence relationship determination unit configured to determine the mapping transformation relationship in the first direction based on the first feature point and the second feature point;
  • a second processing unit configured to adjust the position of the second pixel in the target object in the second image in the first direction to be consistent with the position of the second pixel in the second image according to the mapping transformation relationship in the first direction.
  • the position of the first pixel in the target object in the first image is the same, and the third image is obtained.
  • the mapping transformation relationship in the first direction includes: a homography transformation matrix in the first direction.
  • an electronic device including:
  • the executable instructions execute the method described in any of the above embodiments.
  • a non-transitory computer-readable storage medium is also provided.
  • Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are executed by a processor, any of the above are implemented. methods described in the examples.
  • the disclosed example can be applied to the field of image alignment, and can be used to align images of the same scene captured by a single camera at different viewing angles, or can be used to align images of the same scene captured by multiple cameras.
  • the aligned images can be used as image input for multi-frame HDR and super-resolution algorithms, and can also be used as input for multi-camera image fusion algorithms.
  • the method includes:
  • Step 1 Extract feature points of the target object in the first image and the second image.
  • the same feature of the target object forms a feature point pair in the first image and the second image.
  • Step 2 By matching the feature point pairs, determine that in the first direction, the position of the pixel of the target object in the second image and the position of the corresponding pixel of the target object in the first image are adjusted to the same homography transformation matrix, for example
  • the first direction is the vertical direction
  • the homography matrix of the global row alignment of the image is used to realize the row alignment of the target object in the first image and the target object in the second image, and obtain the third image.
  • Step 3 Determine the corresponding target grid in the third image based on the reference grid in the first image. It includes: dividing the grid on the third image, that is, the row-aligned image, and obtaining the target grid corresponding to the grid point on the image through row search and matching of grid points.
  • Step 4 For each reference grid and the corresponding target grid, calculate the position transformation relationship of the target object in the first image and the third image in the second direction using the corresponding relationship between the preset position in the grid and the target position. The position of the target object in the third image is adjusted according to the position transformation relationship.
  • Step 1 Extract matching feature points of the target object in the first image and the target object in the second image.
  • Step 2 Calculate the global row-aligned homography matrix and perform row alignment on the image.
  • the global homography transformation matrix H specifically a 3*3 matrix, has the following form:
  • h 0 to h 8 represent elements of H.
  • the homography matrix contains a total of 8 degrees of freedom, and a set of matching feature point pairs in step 1 can provide two sets of constraints. Therefore, at least four pairs of matching feature point pairs are required to obtain a row-aligned homography matrix. At the same time, in order to achieve row alignment of the image, the obtained H matrix also needs to satisfy the transformed image, and the coordinates (i.e. y coordinate) of the matching feature point pairs in the row direction are equal, and the H matrix satisfies:
  • Step 3 On the third image after row alignment, use grid point row search to determine the target grid.
  • Step 4 Use the reference position of the reference grid and the target position of the target grid to determine the position transformation relationship between the target object in the first image and the target object in the third image.
  • step three the corresponding relationship between the reference position in each reference grid and the target position in the target grid can be obtained. Since each grid has four grid points, homography transformation can be used to calculate each reference The position correspondence between the pixels in the grid and the corresponding target grid.
  • the form of homography transformation is similar to the H matrix in step 2. By mapping the pixels in each target grid using homography transformation, the third image is aligned with the pixel positions of the target object in the first image.
  • Figure 13 is a block diagram of a terminal device according to an exemplary embodiment.
  • the terminal device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
  • the terminal device may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and communications component 816.
  • a processing component 802 a memory 804
  • a power component 806 a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and communications component 816.
  • I/O input/output
  • the processing component 802 generally controls the overall operations of the terminal device, such as operations associated with presentations, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • the memory 804 is configured to store various types of data to support operations at the terminal device. Examples of such data include instructions for any application or method operating on the terminal device, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 804 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory
  • flash memory magnetic or optical disk.
  • Power component 806 provides power to various components of the terminal device.
  • Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to end devices.
  • Multimedia component 808 includes a screen that provides an output interface between the terminal device and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. A touch sensor can not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • multimedia component 808 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera can receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (MIC) configured to receive external audio signals when the terminal device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode.
  • the received audio signal may be further stored in memory 804 or sent via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 814 includes one or more sensors for providing various aspects of status assessment for the terminal device.
  • the sensor component 814 can detect the open/closed state of the terminal device, the relative positioning of components, such as the display and keypad of the terminal device, and the sensor component 814 can also detect the position change of the terminal device or a component of the terminal device, The presence or absence of user contact with the terminal device, terminal device orientation or acceleration/deceleration and temperature changes of the terminal device.
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • the communication component 816 is configured to facilitate wired or wireless communication between the terminal device and other devices.
  • Terminal devices can access wireless networks based on communication standards, such as WiFi, 4G or 5G, or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • communications component 816 also includes a near field communications (NFC) module to facilitate short-range communications.
  • NFC near field communications
  • the NFC module can be implemented based on frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the terminal device may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Gate array
  • controller microcontroller, microprocessor or other electronic components are implemented for executing the above method.

Abstract

Embodiments of the present disclosure provide an image processing method and apparatus, an electronic device and a storage medium. The method comprises: obtaining a first image and a second image that comprise a same target object; adjusting the position of a second pixel in the target object in the second image to the same position as a first pixel in the target object in the first image in a first direction to obtain a third image, the first pixel and the second pixel being pixels at a same position in the target object; determining a target grid in the third image according to a reference grid in the first image, the target grid comprising a target position, and the target pixel value of a pixel corresponding to the target position and the reference pixel value of a pixel corresponding to a reference position in the reference grid meet a preset condition; and adjusting the position of the second pixel in the third image to the same position as the first pixel in the first image in a second direction according to the positional correspondence between the reference grid and the target grid. By means of the method, the alignment effect of the target object in the first image and the second image is improved.

Description

图像处理方法、装置、电子设备及存储介质Image processing methods, devices, electronic equipment and storage media 技术领域Technical field
本公开涉及图像处理领域但不限于图像处理领域,尤其涉及一种图像处理方法、装置、电子设备及存储介质。The present disclosure relates to the field of image processing but is not limited to the field of image processing, and in particular, to an image processing method, device, electronic equipment and storage medium.
背景技术Background technique
随着图像处理技术的应用越来越广,很多设备中都具有图像采集组件,在图像采集组件采集到图像后,需要对图像进行处理,从而得到满足需要的图像。不同的图像采集组件在采集图像时可以得到的图像可能会有差异,例如,在同一拍摄场景中,采集同一目标对象的图像,不同的图像采集模组或者同一图像采集模组在不同的配置参数下,采集到的目标对象的图像也会不同。As the application of image processing technology becomes more and more widespread, many devices have image acquisition components. After the image acquisition component collects the image, it needs to process the image to obtain the image that meets the needs. The images that different image acquisition components can obtain when collecting images may be different. For example, in the same shooting scene, images of the same target object are collected, different image acquisition modules or the same image acquisition module uses different configuration parameters. Under this condition, the collected image of the target object will also be different.
发明内容Contents of the invention
本公开提供一种图像处理方法、装置、电子设备及存储介质。The present disclosure provides an image processing method, device, electronic equipment and storage medium.
本公开实施例的第一方面,提供一种图像处理方法,包括:获取第一图像和第二图像;其中,所述第一图像和所述第二图像中都包括同一目标对象;在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像;其中,所述第一像素和所述第二像素为所述目标对象中同一位置的像素;根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格;其中,所述目标网格中包括:目标位置;所述目标位置对应像素的目标像素值,与所述参考网格中参考位置对应像素的参考像素值满足预设条件;根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同;其中,所述第二方向垂直于所述第一方向。A first aspect of an embodiment of the present disclosure provides an image processing method, including: acquiring a first image and a second image; wherein both the first image and the second image include the same target object; in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image; wherein, The first pixel and the second pixel are pixels at the same position in the target object; the target grid in the third image is determined according to the reference grid in the first image; wherein, The target grid includes: a target position; a target pixel value of a pixel corresponding to the target position, and a reference pixel value of a pixel corresponding to the reference position in the reference grid that satisfies a preset condition; according to the reference grid and the The position correspondence relationship of the target grid is to adjust the position of the second pixel in the third image to the same position as the first pixel in the first image in the second direction; wherein, the The second direction is perpendicular to the first direction.
在一些实施例中,所述根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格,包括:在所述第一图像中创建M*N个预设大小的参考网格;根据所述参考网格中K个所述参考位置对应像素的所述参考像素值,在所述第三图像中确定出与K个所述参考像素值满足所述预设条件的K个目标像素值;根据K个所述目标像素值,在所述第三图像中确定出与所述目标像素值对应的K个目标像素;根据K个所述目标像素确定所述目标网格;M、N和K都为正整数。In some embodiments, determining the target grid in the third image based on the reference grid in the first image includes: creating M*N preset sizes in the first image a reference grid; according to the reference pixel values of the K pixels corresponding to the reference positions in the reference grid, determine in the third image that the K reference pixel values satisfy the preset condition K target pixel values; according to the K target pixel values, determine K target pixels corresponding to the target pixel value in the third image; determine the target network according to the K target pixels Grid; M, N and K are all positive integers.
在一些实施例中,所述方法还包括:确定预设区域内各个像素的第一平均像素值;其中,所述预设区域包括:以所述参考位置对应像素为中心,预设像素数量为半径的区域;将所述第一平均像 素值确定为所述参考像素值。In some embodiments, the method further includes: determining the first average pixel value of each pixel in the preset area; wherein the preset area includes: centered on the pixel corresponding to the reference position, the preset number of pixels is an area of radius; determining the first average pixel value as the reference pixel value.
在一些实施例中,所述根据所述参考网格中K个参考位置对应像素的参考像素值,在第三图像中确定出与K个参考像素值满足预设条件的K个目标像素值,包括:在所述第三图像中确定出K个备选像素值;确定出备选区域内各个像素的第二平均像素值;其中,所述备选区域包括:以所述备选像素值对应像素为中心,所述预设像素数量为半径的区域;将与K个所述参考像素值满足所述预设条件的K个所述第二平均像素值分别对应的所述备选像素值,确定为所述目标像素值。In some embodiments, based on the reference pixel values of the pixels corresponding to the K reference positions in the reference grid, K target pixel values that meet the preset conditions with the K reference pixel values are determined in the third image, The method includes: determining K candidate pixel values in the third image; determining a second average pixel value of each pixel in the candidate area; wherein the candidate area includes: corresponding to the candidate pixel value The pixel is the center, and the preset number of pixels is the area of radius; the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset condition are, Determine the target pixel value.
在一些实施例中,所述参考网格至少包括:方形网格或三角形网格;所述参考位置至少包括:网格的角点或者网格的边线的中间点。In some embodiments, the reference grid at least includes: a square grid or a triangular grid; the reference position at least includes: a corner point of the grid or a midpoint of an edge of the grid.
在一些实施例中,所述预设条件至少包括:所述参考像素值与所述目标像素值的差的绝对值之和小于目标阈值。In some embodiments, the preset condition at least includes: the sum of absolute values of differences between the reference pixel value and the target pixel value is less than a target threshold.
在一些实施例中,根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同,包括:根据所述参考位置和目标位置,确定所述位置对应关系;所述位置对应关系包括:第二方向上的映射变换关系;根据所述第二方向上的映射变换关系,在所述第二方向上,将位于所述目标网格内的所述第二像素在所述第三图像中位置,调整至与位于所述参考网格内的所述第一像素在所述第一图像中的位置相同。In some embodiments, according to the position corresponding relationship between the reference grid and the target grid, the position of the second pixel in the third image is adjusted to be consistent with the first pixel in the second direction. The position in the first image is the same, including: determining the position correspondence relationship according to the reference position and the target position; the position correspondence relationship includes: a mapping transformation relationship in the second direction; according to the second The mapping transformation relationship in the direction, in the second direction, adjusts the position of the second pixel located in the target grid in the third image to be consistent with that of all the pixels located in the reference grid. The positions of the first pixels in the first image are the same.
在一些实施例中,所述第二方向上的映射变换关系包括:第二方向上的单应变换矩阵。In some embodiments, the mapping transformation relationship in the second direction includes: a homography transformation matrix in the second direction.
在一些实施例中,所述在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像,包括:提取所述目标对象在所述第一图像中的第一特征点;提取所述目标对象在所述第二图像中的第二特征点;其中,所述第一特征点和所述第二特征点为所述目标对象中同一位置的匹配特征点对;根据所述第一特征点和所述第二特征点,确定第一方向上的映射变换关系;根据所述第一方向上的映射变换关系,在所述第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像。In some embodiments, in the first direction, the position of the second pixel in the target object in the second image is adjusted to be consistent with the position of the first pixel in the target object in the first image. have the same position, and obtain the third image, including: extracting the first feature point of the target object in the first image; extracting the second feature point of the target object in the second image; wherein, The first feature point and the second feature point are matching feature point pairs at the same position in the target object; the mapping transformation relationship in the first direction is determined based on the first feature point and the second feature point. ;According to the mapping transformation relationship in the first direction, in the first direction, adjust the position of the second pixel in the target object in the second image to be consistent with the position of the first pixel in the target object The third image is obtained at the same position in the first image.
在一些实施例中,所述第一方向上的映射变换关系包括:第一方向上的单应变换矩阵。In some embodiments, the mapping transformation relationship in the first direction includes: a homography transformation matrix in the first direction.
本公开实施例的第二方面提供一种图像处理装置,包括:图像获取模块,用于获取第一图像和第二图像;其中,所述第一图像和所述第二图像中都包括同一目标对象;第一处理模块,用于在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像;其中,所述第一像素和所述第二像素为所述目标对象中同一位置的像素;目标网格确定模块,用于根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格;其中,所述目标网格中包括:目标位置;所述目标位置对应像素的目标像素值,与所述参考网格中参考位置对应像素的参考像素值满足预设条件;第二处理模块,用于根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将所述第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同;其中,所述第二方向垂直于所述第一方向。A second aspect of an embodiment of the present disclosure provides an image processing device, including: an image acquisition module, configured to acquire a first image and a second image; wherein the first image and the second image both include the same target. Object; a first processing module configured to adjust the position of the second pixel in the target object in the second image in the first direction to the position of the first pixel in the target object in the first image. The positions in are the same, and a third image is obtained; wherein the first pixel and the second pixel are pixels at the same position in the target object; a target grid determination module is used to determine according to the first image Reference grid, determine the target grid in the third image; wherein, the target grid includes: target position; target pixel value of the pixel corresponding to the target position, and the reference position in the reference grid The reference pixel value of the corresponding pixel satisfies the preset condition; the second processing module is configured to convert the second pixel in the second direction according to the position correspondence relationship between the reference grid and the target grid. The position in the third image is adjusted to be the same as the position of the first pixel in the first image; wherein the second direction is perpendicular to the first direction.
本公开实施例的第三方面提供一种电子设备,包括:A third aspect of the embodiment of the present disclosure provides an electronic device, including:
处理器和用于存储能够在所述处理器上运行的可执行指令的存储器,其中:处理器用于运行所述可执行指令时,所述可执行指令执行上述任一实施例所述的方法。A processor and a memory used to store executable instructions that can be run on the processor, wherein: when the processor is used to run the executable instructions, the executable instructions execute the method described in any of the above embodiments.
本公开实施例的第四方面,提供一种非临时性计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现上述任一实施例所述的方法。A fourth aspect of the embodiments of the present disclosure provides a non-transitory computer-readable storage medium. Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are executed by a processor, any of the above are implemented. methods described in the examples.
本公开的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
本公开实施例的技术方案通过在一个方向上将目标对象在第二图像中的第二像素的位置与第一图像中的第一像素的位置调整为相同。由于第一图像和第二图像为平面图像,在两个方向上即可确定像素的位置,在另一个方向上根据预设网格和目标网格的位置关系,将调整后的第二图像再次调整,由于网格中包括多个像素,这样即可减少在另一个方向上对单个像素进行位置对应关系的确定,从而减小了在另一个方向上调整目标对象的像素位置的运算量。The technical solution of the embodiment of the present disclosure is to adjust the position of the second pixel of the target object in the second image to be the same as the position of the first pixel in the first image in one direction. Since the first image and the second image are planar images, the positions of the pixels can be determined in two directions, and in the other direction, the adjusted second image can be adjusted again according to the positional relationship between the preset grid and the target grid. Adjustment, since the grid includes multiple pixels, this can reduce the determination of the position correspondence of a single pixel in the other direction, thereby reducing the amount of calculations required to adjust the pixel position of the target object in the other direction.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开实施例。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the embodiments of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明实施例,并与说明书一起用于解释本发明实施例的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the embodiments of the invention.
图1是根据一示例性实施例示出的一种图像处理方法的流程示意图;Figure 1 is a schematic flowchart of an image processing method according to an exemplary embodiment;
图2是根据一示例性实施例示出的一种第一图像和第二图像的示意图;Figure 2 is a schematic diagram of a first image and a second image according to an exemplary embodiment;
图3是根据一示例性实施例示出的一种在第一方向上调整第二像素位置的示意图;Figure 3 is a schematic diagram of adjusting the position of the second pixel in the first direction according to an exemplary embodiment;
图4的(a)部分为根据一示例性实施例示出的一种第一图像的示意图;Part (a) of Figure 4 is a schematic diagram of a first image according to an exemplary embodiment;
图4的(b)部分是根据一示例性实施例示出的一种第二图像的示意图;Part (b) of Figure 4 is a schematic diagram of a second image according to an exemplary embodiment;
图5是根据一示例性实施例示出的一种第一方向上调整后的示意图;Figure 5 is a schematic diagram after adjustment in the first direction according to an exemplary embodiment;
图6是根据一示例性实施例示出的一种确定目标网格的示意图;Figure 6 is a schematic diagram of determining a target grid according to an exemplary embodiment;
图7的(a)部分是根据一示例性实施例示出的一种包括参考网格的第一图像的示意图;Part (a) of Figure 7 is a schematic diagram of a first image including a reference grid according to an exemplary embodiment;
图7的(b)部分是根据一示例性实施例示出的一种包括目标网格的第二图像的示意图;Part (b) of Figure 7 is a schematic diagram of a second image including a target grid according to an exemplary embodiment;
图8是根据一示例性实施例示出的另一种图像处理方法的示意图;Figure 8 is a schematic diagram of another image processing method according to an exemplary embodiment;
图9是根据一示例性实施例示出的一种确定目标像素值的示意图;Figure 9 is a schematic diagram of determining a target pixel value according to an exemplary embodiment;
图10是根据一示例性实施例示出的一种在第二方向上进行调整的示意图;Figure 10 is a schematic diagram of adjustment in the second direction according to an exemplary embodiment;
图11是根据一示例性实施例示出的一种图像处理装置的示意图;Figure 11 is a schematic diagram of an image processing device according to an exemplary embodiment;
图12是根据一示例性实施例示出的另一种图像处理方法的示意图;Figure 12 is a schematic diagram of another image processing method according to an exemplary embodiment;
图13是根据一示例性实施例示出的一种终端设备的框图。Figure 13 is a block diagram of a terminal device according to an exemplary embodiment.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明实施例相一致的所有实施方式。相反,它们仅是本发明实施例的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with embodiments of the invention. Rather, they are merely examples of apparatus and methods consistent with some aspects of embodiments of the invention.
在本公开实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开实施例。在本公开所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the embodiments of the present disclosure is for the purpose of describing specific embodiments only and is not intended to limit the embodiments of the present disclosure. As used in this disclosure, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本公开实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the embodiments of the present disclosure, the first information may also be called second information, and similarly, the second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining."
在图像处理时,如高动态范围成像(High Dynamic Range,HDR)、图像多帧超分和图像融合等,需要利用多张图像的图像信息进行融合从而得到画质提升的图像,在这个过程中需要先对多张图像进行对齐操作,实现图像像素点之间的对齐,然后才能够进行后续的处理。In image processing, such as high dynamic range imaging (High Dynamic Range, HDR), multi-frame image super-resolution and image fusion, it is necessary to use the image information of multiple images to fuse to obtain an image with improved image quality. In this process Multiple images need to be aligned first to achieve alignment between image pixels, and then subsequent processing can be carried out.
通常情况下,通过稠密对齐方法可以实现图像像素点之间的对齐,该方法大多基于稠密光流法进行图像对齐,这种方法需要在二维方向上确定像素的对应关系。由于性能限制,大多仅能处理较小分辨率的图像;同时,这种方法要求初始未对齐的像素距离在一定范围内,因此在多张图像中的像素差异较大时,例如具有较大幅度的视场变化时,对齐效果较差。Normally, alignment between image pixels can be achieved through dense alignment methods. Most of these methods are based on dense optical flow methods for image alignment. This method requires determining the correspondence between pixels in a two-dimensional direction. Due to performance limitations, most of them can only handle images with smaller resolutions; at the same time, this method requires that the initial misaligned pixel distance is within a certain range, so when the pixel differences in multiple images are large, such as with large amplitude When the field of view changes, the alignment effect is poor.
还可以通过网格对齐方法,大多应用于图像拼接领域,通过利用图像中特征点之间的对应关系作为约束网格的条件,根据特性特征点确定网格,约束网格点的移动,进而实现图像的对齐。这种方法需要整张图像上均有特征点的分布,因此在特征点较少的图像对齐时,对齐效果较差。例如,弱纹理等较难提取图像特征点的图像中,难以得到较好的图像对齐效果。It can also be achieved through the grid alignment method, which is mostly used in the field of image splicing. By using the correspondence between feature points in the image as a condition to constrain the grid, the grid is determined based on the characteristic feature points and the movement of the grid points is constrained. Alignment of images. This method requires the distribution of feature points across the entire image, so when aligning images with fewer feature points, the alignment effect is poor. For example, in images with weak textures where it is difficult to extract image feature points, it is difficult to obtain better image alignment effects.
参考图1,为本公开示例提供的一种图像处理方法的流程示意图。该方法包括:Referring to Figure 1, a schematic flow chart of an image processing method is provided as an example of the present disclosure. The method includes:
步骤S100,获取第一图像和第二图像;其中,第一图像和第二图像中都包括同一目标对象。Step S100, obtain a first image and a second image; wherein both the first image and the second image include the same target object.
步骤S200,在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,得到第三图像;其中,第一像素和第二像素为目标对象中同一位置的像素。Step S200, in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image; wherein, the first The pixel and the second pixel are pixels at the same position in the target object.
步骤S300,根据第一图像中的参考网格,确定出第三图像中的目标网格;其中,目标网格中包括:目标位置;目标位置对应像素的目标像素值,与参考网格中参考位置对应像素的参考像素值满足预设条件。Step S300, determine the target grid in the third image based on the reference grid in the first image; wherein the target grid includes: the target position; the target pixel value of the pixel corresponding to the target position, and the target pixel value in the reference grid. The reference pixel value of the pixel corresponding to the position meets the preset conditions.
步骤S400,根据参考网格和目标网格的位置关系,在第二方向上,将位于目标网格内的第二像素在第三图像中位置,调整至与位于参考网格内的第一像素在第一图像中的位置相同;其中,第二方向垂直于第一方向。Step S400, according to the positional relationship between the reference grid and the target grid, adjust the position of the second pixel located in the target grid in the third image in the second direction to be consistent with the position of the first pixel located in the reference grid. The position in the first image is the same; where the second direction is perpendicular to the first direction.
该公开示例的方法至少可以应用在用户终端中,即该方法的执行主体至少可以包括用户终端,用户终端可以包括移动终端和固定终端。移动终端可以包括手机、平板电脑、车载中控设备、可穿戴设备、智能设备等,智能设备又可包括智能办公设备和智能家居设备等。The method of this disclosed example can be applied at least in user terminals, that is, the execution subject of the method can at least include user terminals, and user terminals can include mobile terminals and fixed terminals. Mobile terminals can include mobile phones, tablet computers, vehicle-mounted central control devices, wearable devices, smart devices, etc. Smart devices can also include smart office equipment and smart home equipment.
步骤S100中获取的第一图像和第二图像可以是二维平面图像,第一图像和第二图像中都包括至少一个相同的目标对象。也就是,第一图像和第二图像为包括共有的图像信息,并且不完全相同的两张图像。目标对象可以根据实际的图像采集场景确定,例如,可以是人物、动物、植物、山川和河流等任一场景中的被采集图像的对象。The first image and the second image acquired in step S100 may be two-dimensional plane images, and both the first image and the second image include at least one identical target object. That is, the first image and the second image include common image information and are not exactly the same two images. The target object can be determined based on the actual image collection scene. For example, it can be the object of the captured image in any scene such as people, animals, plants, mountains, and rivers.
第一图像和第二图像可以是在不同的图像采集参数得到的图像,可以是同一个图像采集模组在不同的图像采集参数下采集的图像包括同一目标对象的图像,图像采集参数可以视场角和焦距等。The first image and the second image may be images obtained under different image acquisition parameters. They may be images acquired by the same image acquisition module under different image acquisition parameters, including images of the same target object. The image acquisition parameters may be the field of view. angle and focal length etc.
第一图像和第二图像还可以是不同的图像采集模组采集的同一目标对象的图像,例如,第一图像采集模组和第二图像采集模组分别在不同的图像采集参数下对同一场景采集的图像,该场景中包括目标对象。The first image and the second image may also be images of the same target object collected by different image acquisition modules. For example, the first image acquisition module and the second image acquisition module respectively capture the same scene under different image acquisition parameters. The captured image contains the target object in the scene.
图像采集参数可以根据图像采集模组的配置参数和图像采集角度等确定。第一图像和第二图像中包括相同的一部分图像信息即可,也就是第一图像和第二图像存在共有的图像信息,这部分共有的图像信息即为目标对象。The image acquisition parameters can be determined according to the configuration parameters of the image acquisition module and the image acquisition angle. The first image and the second image only need to include the same part of image information, that is, there is common image information between the first image and the second image, and this part of the common image information is the target object.
例如,第一图像中包括人物A和树木B,第二图像中包括人物A和人物C,则目标对象为人物A。第一图像中的人物A和第二图像中的人物A的呈现效果可能不同,例如,人物A在第一图像中的放大倍数大于人物A在第二图像中的放大倍数,人物A在第一图像中的位置不同于人物A在第二图像中的位置。For example, if the first image includes person A and tree B, and the second image includes person A and person C, then the target object is person A. The presentation effects of person A in the first image and person A in the second image may be different. For example, the magnification factor of person A in the first image is greater than the magnification factor of person A in the second image, and the magnification factor of person A in the first image may be different. The position in the image is different from the position of person A in the second image.
参考图2,为一种第一图像和第二图像的示意图,图2的(a)部分为目标对象的示意图,图2的(b)部分为第一图像的示意图,图2的(c)部分为第二图像的示意图。Refer to Figure 2, which is a schematic diagram of a first image and a second image. Part (a) of Figure 2 is a schematic diagram of a target object. Part (b) of Figure 2 is a schematic diagram of the first image. Part (c) of Figure 2 Part is a schematic diagram of the second image.
目标对象为树木和人物,第一图像和第二图像为目标对象在不同放大倍数时的图像,第一图像和第二图像中都包括相同的目标对象。例如,第一图像可以是通过放大倍数为1倍的图像采集模组采集的目标对象的图像,第二图像可以是通过放大倍数为3倍的图像采集模组采集的目标对象的图像。第一图像为目标对象在1倍放大倍数(1X)时的图像,第二图像为目标对象在3倍放大倍数(3X)时的图像。第一图像中包括的图像信息多于第二图像中包括的图像信息,也就是第一图像中除了第二图像中包括的图像信息外,还包括第二图像中不包括的图像信息。The target objects are trees and people, the first image and the second image are images of the target object at different magnifications, and both the first image and the second image include the same target object. For example, the first image may be an image of the target object collected by an image acquisition module with a magnification of 1 times, and the second image may be an image of the target object collected by an image acquisition module with a magnification of 3 times. The first image is an image of the target object at 1x magnification (1X), and the second image is an image of the target object at 3x magnification (3X). The first image includes more image information than the second image. That is, in addition to the image information included in the second image, the first image also includes image information that is not included in the second image.
在该实施例中,第二图像中包括的图像信息为第一图像和第二图像共有的图像信息,第二图像中显示的内容即为目标对象,该目标对象包括树木和人物,还包括除了树木和人物之外的背景图像。In this embodiment, the image information included in the second image is the image information common to the first image and the second image, and the content displayed in the second image is the target object. The target object includes trees and people, and includes other than Background image beyond trees and people.
对于步骤S200,在得到第一图像和第二图像后,由于图像中的任意一个像素都具有对应的位置,通过任意两个方向上的位置即可确定出像素在图像中的位置,例如通过坐标系可以确定出第一图像 中任意一个像素在第一图像中的位置,同样可以确定出第二图像中任意一个像素在第二图像中的位置。两个方向即可确定出一个坐标系。For step S200, after obtaining the first image and the second image, since any pixel in the image has a corresponding position, the position of the pixel in the image can be determined through the positions in any two directions, for example, through the coordinates The system can determine the position of any pixel in the first image in the first image, and can also determine the position of any pixel in the second image in the second image. A coordinate system can be determined from two directions.
第一方向可以是任意一个方向,第一方向和第二方向的倾斜角度并不限定,第一方向垂直于第二方向即可。例如,第一方向为竖直方向,第二方向为水平方向,还可以是第二方向为竖直方向,第一方向为水平方向等。在第一方向垂直与第二方向时,调整第二像素在第一方向上的位置后,再次调整第二像素在第二方向上的位置时,不会改变第二像素在第一方向上的位置,从而可以便于单独在第二方向上调整第二像素的位置,提高调整第二像素的位置的准确度。The first direction can be any direction, and the inclination angle between the first direction and the second direction is not limited, as long as the first direction is perpendicular to the second direction. For example, the first direction is a vertical direction, the second direction is a horizontal direction, or the second direction is a vertical direction, the first direction is a horizontal direction, etc. When the first direction is perpendicular to the second direction, after adjusting the position of the second pixel in the first direction, and then adjusting the position of the second pixel in the second direction again, the position of the second pixel in the first direction will not be changed. position, thereby making it easy to adjust the position of the second pixel in the second direction alone and improving the accuracy of adjusting the position of the second pixel.
目标对象在第一图像中的像素为第一像素,目标对象在第二图像中的像素为第二像素。对于目标对象中的某一个位置,该位置在第一图像中对应的像素为第一像素,该位置在第二图像中对应的像素为第二像素。也就是第一像素和第二像素为目标对象中同一位置的像素,对于目标对象中某一目标位置,第一像素和第二像素是相匹配的,第一像素和第二像素均为该目标位置的像素。The pixels of the target object in the first image are first pixels, and the pixels of the target object in the second image are second pixels. For a certain position in the target object, the pixel corresponding to the position in the first image is the first pixel, and the pixel corresponding to the position in the second image is the second pixel. That is, the first pixel and the second pixel are pixels at the same position in the target object. For a certain target position in the target object, the first pixel and the second pixel match, and both the first pixel and the second pixel are the target. The position in pixels.
例如,图2所示目标对象中的树木中,树木的树尖在第一图像中的像素为第一像素,在第二图像中的像素为第二像素。For example, among the trees in the target object shown in Figure 2, the pixel of the tree tip in the first image is the first pixel, and the pixel in the second image is the second pixel.
在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,将调整后的第二图像作为第三图像。在调整后的第二图像中,目标对象中的各个像素在第一方向上与第一图像中目标对象的对应像素对齐,对齐后的第一像素和第二像素在第一方向上的位置相同。In the first direction, the position of the second pixel in the target object in the second image is adjusted to the same position as the position of the first pixel in the target object in the first image, and the adjusted second image is used as the third image. In the adjusted second image, each pixel in the target object is aligned in the first direction with the corresponding pixel of the target object in the first image, and the aligned first pixel and the second pixel have the same position in the first direction. .
例如,目标对象为图2所示的树木时,第一方向为竖直方向,竖直方向上的位置用y表示。树木的树尖在第一图像中对应的像素在第一方向上的位置为y1,树木的树尖在第二图像中对应的像素第一方向上的位置为y2,在第一方向上,将y2调整至与y1相同。同理,目标对象在第二图像中对应的各个像素在第一方向上的位置,都调整至与在第一图像中第一方向上的位置相同。这样就实现了在第一方向上,目标对象在第二图像中的对应像素的位置与在第一图像中对应像素的位置的对齐,从而将整个目标对象在第二图像中的位置与在第一图像中的位置对齐。For example, when the target object is the tree shown in Figure 2, the first direction is the vertical direction, and the position in the vertical direction is represented by y. The position of the tree tip in the first direction of the corresponding pixel in the first image is y1, and the position of the tree tip in the first direction of the corresponding pixel in the second image is y2. In the first direction, y2 is adjusted to be the same as y1. Similarly, the position of each corresponding pixel of the target object in the first direction in the second image is adjusted to be the same as the position in the first direction in the first image. In this way, in the first direction, the position of the corresponding pixel of the target object in the second image is aligned with the position of the corresponding pixel in the first image, thereby aligning the position of the entire target object in the second image with the position of the corresponding pixel in the first image. Position alignment within an image.
对于步骤S300,在第一方向上第二像素的位置与第一像素的位置对齐后,根据第一图像中的参考网格,确定出第三图像中的目标网格。第一图像中具有预设的参考网格,参考网格也可以称为参考窗口,参考网格可以是虚拟的网格,用于将第一图像进行区域的划分。第一图像中可以具有多个参考网格,参考网格的大小和数量可以根据实际的使用需求确定。For step S300, after the position of the second pixel in the first direction is aligned with the position of the first pixel, the target grid in the third image is determined based on the reference grid in the first image. The first image has a preset reference grid. The reference grid may also be called a reference window. The reference grid may be a virtual grid used to divide the first image into regions. There may be multiple reference grids in the first image, and the size and number of the reference grids may be determined according to actual usage requirements.
参考网格的形状可以是方形网格或三角形网格等,可以根据实际需求确定。例如,第一图像中具有N*N个均匀分布的方形网格,方形网格可以是正方向网格,参考网格将第一图像划分成N*N个网格区域。The shape of the reference grid can be a square grid or a triangular grid, etc., and can be determined according to actual needs. For example, there are N*N uniformly distributed square grids in the first image. The square grids may be positive direction grids, and the reference grid divides the first image into N*N grid areas.
参考网格中包括参考位置,参考位置可以是网格的角点或者网格的边线的中点等,可以根据实际需求调整。参考位置在第一图像中对应有像素,参考位置在第一图像中对应的像素的像素值是可以确定的。The reference grid includes a reference position, which can be the corner point of the grid or the midpoint of the edge of the grid, etc., and can be adjusted according to actual needs. The reference position corresponds to a pixel in the first image, and the pixel value of the pixel corresponding to the reference position in the first image can be determined.
目标网格中包括目标位置,目标位置对应像素的目标像素值,与参考网格中参考位置对应像素 的参考像素值满足预设条件。通过目标位置可以确定出目标网格,预设条件可以根据实际的需求确定,例如预设条件至少包括:参考像素值与目标像素值的差的绝对值之和小于目标阈值。The target grid includes the target position, the target pixel value of the pixel corresponding to the target position, and the reference pixel value of the pixel corresponding to the reference position in the reference grid that meets the preset conditions. The target grid can be determined by the target position, and the preset condition can be determined according to actual needs. For example, the preset condition at least includes: the sum of the absolute values of the differences between the reference pixel value and the target pixel value is less than the target threshold.
对于每个参考网格,分别对应一个目标网格,该实施例是以其中一个网格为例进行说明,可以根据每个参考网格,确定出对应的目标网格。Each reference grid corresponds to a target grid. This embodiment takes one of the grids as an example for explanation. The corresponding target grid can be determined based on each reference grid.
步骤S400,在确定出第三图像中的目标网格后,根据参考网格和目标网格的位置对应关系,在第二方向上,将第二像素在第三图像中位置,调整至与第一像素在第一图像中的位置相同。Step S400, after determining the target grid in the third image, adjust the position of the second pixel in the third image in the second direction to be consistent with the position of the reference grid and the target grid. A pixel has the same position in the first image.
参考网格和目标网格的位置对应关系,可以根据参考位置和目标位置确定,详细确定过程并不限定,可以参考后续实施例,能够确定出该位置对应关系即可。The position correspondence between the reference grid and the target grid can be determined based on the reference position and the target position. The detailed determination process is not limited. You can refer to subsequent embodiments as long as the position correspondence can be determined.
例如,目标对象为图2所示的树木时,第二方向为水平方向,水平方向上的位置用x表示。树木的树尖在第一图像中对应的像素在第一方向上的位置为y1,树木的树尖在第二图像中对应的像素第一方向上的位置为y2,在第一方向上,将y2调整至与y1相同。同理,目标对象在第二图像中对应的各个像素在第一方向上的位置,都调整至与在第一图像中第一方向上的位置相同。这样就实现了在第一方向上,目标对象在第二图像中的对应像素的位置与在第一图像中对应像素的位置的对齐,从而将整个目标对象在第二图像中的位置与在第一图像中的位置对齐。For example, when the target object is the tree shown in Figure 2, the second direction is the horizontal direction, and the position in the horizontal direction is represented by x. The position of the tree tip in the first direction of the corresponding pixel in the first image is y1, and the position of the tree tip in the first direction of the corresponding pixel in the second image is y2. In the first direction, y2 is adjusted to be the same as y1. Similarly, the position of each corresponding pixel of the target object in the first direction in the second image is adjusted to be the same as the position in the first direction in the first image. In this way, in the first direction, the position of the corresponding pixel of the target object in the second image is aligned with the position of the corresponding pixel in the first image, thereby aligning the position of the entire target object in the second image with the position of the corresponding pixel in the first image. Position alignment within an image.
这样就在第一方向和第二方向上将第二像素的位置都调整至与第一像素在第一图像中的位置相同,实现了目标对象中各个像素在第二图像中的位置都与在第一图像中的位置相同,在位置相同时,第二图像中的目标对象与第一图像终端目标对象就实现了对齐。In this way, the position of the second pixel in both the first direction and the second direction is adjusted to be the same as the position of the first pixel in the first image, so that the position of each pixel in the target object in the second image is the same as the position in the second image. The positions in the first image are the same. When the positions are the same, the target object in the second image and the terminal target object in the first image are aligned.
一方面,先从第一方向上,将目标对象在第二图像中的第二像素与在第一图像中的第一像素对齐,这样就剩下第二方向一个方向上,第一像素与第二像素未对齐,这样通过步骤S300确定目标网格时,可以单独考虑第二方向上目标位置对应像素的像素值和参考位置对应像素的像素值即可,从而提高了确定目标网格的运算量、效率和准确度。On the one hand, first align the second pixel of the target object in the second image with the first pixel in the first image from the first direction, so that only the first pixel and the first pixel in the second direction are left. The two pixels are not aligned, so when determining the target grid in step S300, the pixel value of the pixel corresponding to the target position in the second direction and the pixel value of the pixel corresponding to the reference position can be separately considered, thereby increasing the computational complexity of determining the target grid. , efficiency and accuracy.
另一方面,根据参考网格中的参考位置对应像素的像素值确定目标网格,然后再根据目标网格和参考网格的位置对应关系在第二方向上进行像素位置的调整,减少了对第三图像中目标对象的特征点的依赖,不需要根据目标对象中的特征点的位置确定目标网格,也不需要根据第三图像中目标对象的特征点的位置在第二方向上进行对齐。On the other hand, the target grid is determined according to the pixel value of the pixel corresponding to the reference position in the reference grid, and then the pixel position is adjusted in the second direction according to the position correspondence between the target grid and the reference grid, which reduces the need for The dependence on the feature points of the target object in the third image does not require determining the target grid based on the position of the feature points in the target object, nor does it need to be aligned in the second direction based on the position of the feature points of the target object in the third image. .
这样就减少了在第三图像中无法提取目标对象的特征点或者第三图像中目标对象的特征点较少时,导致在第二方向上目标对象中像素位置对齐的准确度较差的情况。提高了在第三图像中无法提取目标对象的特征点或者第三图像中目标对象的特征点较少时,在第二方向上目标对象中像素位置对齐的准确度,从而提高了目标对象的对齐效果。This reduces the situation where the accuracy of pixel position alignment in the target object in the second direction is poor when the feature points of the target object cannot be extracted in the third image or there are fewer feature points of the target object in the third image. When the feature points of the target object cannot be extracted in the third image or there are few feature points of the target object in the third image, the accuracy of pixel position alignment in the target object in the second direction is improved, thereby improving the alignment of the target object. Effect.
在另一实施例中,参考图3,为一种在第一方向上调整第二像素位置的示意图。步骤S200,在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,得到第三图像,包括:In another embodiment, refer to FIG. 3 , which is a schematic diagram of adjusting the position of the second pixel in the first direction. Step S200, in the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image, to obtain a third image, including:
步骤S201,提取目标对象在第一图像中的第一特征点。Step S201: Extract the first feature point of the target object in the first image.
步骤S202,提取目标对象在第二图像中的第二特征点;其中,第一特征点和第二特征点为目标 对象中同一位置的匹配特征点对。步骤S201和步骤S202没有必然的先后顺序关系,可以同时执行,也可以先执行其中的任意一个。Step S202, extract the second feature point of the target object in the second image; wherein the first feature point and the second feature point are matching feature point pairs at the same position in the target object. There is no necessary sequence relationship between step S201 and step S202. They can be executed at the same time, or any one of them can be executed first.
步骤S203,根据第一特征点和第二特征点,确定第一方向上的映射变换关系。Step S203: Determine the mapping transformation relationship in the first direction based on the first feature point and the second feature point.
步骤S204,根据第一方向上的映射变换关系,在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,得到第三图像。Step S204: According to the mapping transformation relationship in the first direction, adjust the position of the second pixel in the target object in the second image in the first direction to the same position as the position of the first pixel in the target object in the first image. , get the third image.
在得到第一图像和第二图像后,提取第一图像中目标对象的特征点和第二图像中目标对象的特征点,将提取的第一图像中目标对象的特征点记为第一特征点,将提取的第二图像中目标对象的特征点记为第二特征点。第一特征点和第二特征点是目标对象中同一位置对应特征的相匹配的特征点对,对于目标对象中的同一特征,在第一图像中为第一特征点,在第二图像中为第二特征点,第一特征点和第二特征点为相匹配的一对特征点。After obtaining the first image and the second image, extract the feature points of the target object in the first image and the feature points of the target object in the second image, and record the extracted feature points of the target object in the first image as the first feature point , record the extracted feature points of the target object in the second image as second feature points. The first feature point and the second feature point are matching feature point pairs corresponding to the feature at the same position in the target object. For the same feature in the target object, it is the first feature point in the first image and it is the first feature point in the second image. The second feature point, the first feature point and the second feature point are a pair of matching feature points.
参考图4,图4的(a)部分为一种第一图像的示意图,图4的(b)部分为一种第二图像的示意图。房子和人物为目标对象,第一图像中所示的房子上的圆点和人物中的圆点即为第一特征,第二图像中所示的房子上的圆点和人物中的圆点即为第二特征。第一特征和作为与第一特征相匹配的特征点对的第二特征通过虚线连接。对于第一图像中目标对象的某一个第一特征点,第二图像中存在与该第一特征点相匹配的第二特征点。Referring to Figure 4, part (a) of Figure 4 is a schematic diagram of a first image, and part (b) of Figure 4 is a schematic diagram of a second image. The house and the person are the target objects. The dots on the house and the dots on the person shown in the first image are the first features. The dots on the house and the dots on the person shown in the second image are as the second characteristic. The first feature and the second feature, which is a pair of feature points matching the first feature, are connected by a dotted line. For a certain first feature point of the target object in the first image, there is a second feature point matching the first feature point in the second image.
例如,人物的脚部作为特征点时,第一图像中脚部的特征点为第一特征点,第二图像中脚部的特征点为第二特征点,通过虚线将都为脚部的特征点的第一特征点和第二特征点连接,同为脚部的特征点的第一特征点和第二特征点为相匹配的特征点对。图4中其他特征点同理。For example, when the feet of a character are used as feature points, the feature points of the feet in the first image are the first feature points, the feature points of the feet in the second image are the second feature points, and the dotted lines represent the features of the feet. The first feature point and the second feature point are connected, and the first feature point and the second feature point, which are both feature points of the foot, are a matching pair of feature points. The same applies to other feature points in Figure 4.
第一图像中脚部的特征点与第二图像中人物手部的特征点不是相匹配的特征点对,第一图像中脚部的特征点为第一特征点时,第二图像中人物手部的特征点不是与第一特征点相匹配的第二特征点。The feature points of the feet in the first image and the feature points of the character's hands in the second image are not matching feature point pairs. When the feature points of the feet in the first image are the first feature points, the character's hands in the second image The feature point of the part is not the second feature point that matches the first feature point.
第一特征点和第二特征点分别有多个,第一特征点和第二特征点的数量可以是相同的。提取第一特征点和第二特征点的方法可以根据业务需求确定,能够提取到第一特征点和第二特征点即可,例如特征点提取算法,包括尺度不变特征变换(Scale-invariant feature transform,SIFT)算法和ORB(ORiented Brief)特征提取算法等。There are multiple first feature points and multiple second feature points respectively, and the numbers of the first feature points and the second feature points may be the same. The method of extracting the first feature point and the second feature point can be determined according to the business needs, as long as the first feature point and the second feature point can be extracted, for example, the feature point extraction algorithm includes scale-invariant feature transformation (Scale-invariant feature transform, SIFT) algorithm and ORB (ORiented Brief) feature extraction algorithm, etc.
在步骤S203中,根据相匹配的第一特征点和第二特征点,确定第一方向上的映射变换关系。In step S203, the mapping transformation relationship in the first direction is determined based on the matching first feature points and second feature points.
在确定出第一特征点和第二特征点后,即可得到第一特征点在第一图像中的位置和第二特征点在第二图像中的位置,根据多对相匹配的第一特征点和第二特征点的位置,可以确定出第一方向上的映射变换关系。After determining the first feature point and the second feature point, the position of the first feature point in the first image and the position of the second feature point in the second image can be obtained. According to multiple pairs of matching first features The position of the point and the second feature point can determine the mapping transformation relationship in the first direction.
例如,可以根据4对相匹配的第一特征点和第二特征点的位置,确定出第一方向上的映射变换关系,该映射变换关系可以是单元性变换矩阵。单应性变换矩阵可以是3*3的矩阵,可以用如下公式表示:For example, the mapping transformation relationship in the first direction can be determined based on the positions of four pairs of matching first feature points and second feature points, and the mapping transformation relationship can be a unitary transformation matrix. The homography transformation matrix can be a 3*3 matrix, which can be expressed by the following formula:
Figure PCTCN2022090570-appb-000001
Figure PCTCN2022090570-appb-000001
H 1表示第一方向上的单应性变换矩阵;h 0至h 8表示H 1中的元素。 H 1 represents the homography transformation matrix in the first direction; h 0 to h 8 represent the elements in H 1 .
映射变换关系还可以是其他形式的变换矩阵,根据相匹配的第一特征点的位置和第二特征点的位置,能够实现在第一方向上对第二像素在第二图像中的位置进行调整即可。The mapping transformation relationship can also be other forms of transformation matrices. According to the matching positions of the first feature point and the position of the second feature point, the position of the second pixel in the second image can be adjusted in the first direction. That’s it.
步骤S204,在得到第一方向上的映射变换关系后,根据第一方向上的映射变换关系,在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,得到第三图像。Step S204: After obtaining the mapping transformation relationship in the first direction, adjust the position of the second pixel in the target object in the second image in the first direction to be consistent with the target object according to the mapping transformation relationship in the first direction. The position of the first pixel in the first image is the same, and the third image is obtained.
在另一实施例中,第一方向上的单应性变换矩阵H 1还可以满足以下条件: In another embodiment, the homography transformation matrix H 1 in the first direction may also satisfy the following conditions:
Figure PCTCN2022090570-appb-000002
Figure PCTCN2022090570-appb-000002
i表示相匹配的第i对特征点,即相匹配的第i个第一特征点和第i个第二特征点,x i表示第 i对特征点中第一特征点在第二方向上的坐标,y i表示第i对特征点中第一特征点在第一方向上的坐标,y i’表示第i对特征点中第二特征点在第一方向上的坐标。 i represents the matched i-th pair of feature points, that is, the i-th first feature point and the i-th second feature point that match, x i represents the first feature point in the i -th pair of feature points in the second direction Coordinates, y i represents the coordinate of the first feature point in the i-th pair of feature points in the first direction, and y i ' represents the coordinate of the second feature point in the i-th pair of feature points in the first direction.
在H 1满足该条件时,根据H 1可以在第一方向上,将目标对象中第二像素在第二图像中位置,调整至与目标对象中第一像素在第一图像中的位置相同,得到第三图像。 When H 1 meets this condition, according to H 1 , the position of the second pixel in the target object in the second image can be adjusted in the first direction to the same position as the position of the first pixel in the target object in the first image, Get the third image.
在该实施例中,第一方向为竖直方向。In this embodiment, the first direction is a vertical direction.
在第一方向为水平方向时,第一方向的位置用x表示,第二方向的位置用y表示,单应性变换矩阵H 1还可以满足以下条件: When the first direction is the horizontal direction, the position in the first direction is represented by x, and the position in the second direction is represented by y. The homography transformation matrix H 1 can also satisfy the following conditions:
Figure PCTCN2022090570-appb-000003
Figure PCTCN2022090570-appb-000003
x i’表示第i对特征点中第二特征点在第一方向上的坐标。 x i ' represents the coordinate of the second feature point in the i-th pair of feature points in the first direction.
参考图5,为一种在第一方向上对齐的示意图。如图5所示,示出了将图4的(b)部分所示的第二图像中目标对象的各个像素在第一方向的位置,与第一图像中对应像素的位置对齐后的示意图。这里的第一方向为竖直方向,第一图像和第二图像中,目标对象对应位置的像素的位置在同一行上,实现了行对齐。Refer to Figure 5, which is a schematic diagram of alignment in the first direction. As shown in FIG. 5 , a schematic diagram is shown in which the position of each pixel of the target object in the first direction in the second image shown in part (b) of FIG. 4 is aligned with the position of the corresponding pixel in the first image. The first direction here is the vertical direction. In the first image and the second image, the positions of the pixels corresponding to the target object are on the same line, achieving line alignment.
在另一实施例中,参考图6,为一种确定目标网格的示意图。步骤S300,根据第一图像中的参考网格,确定出第三图像中的目标网格,包括:In another embodiment, refer to FIG. 6 , which is a schematic diagram of determining a target grid. Step S300, determine the target grid in the third image based on the reference grid in the first image, including:
步骤S301,在第一图像中创建M*N个预设大小的参考网格。Step S301: Create M*N reference grids of preset sizes in the first image.
步骤S302,根据所述参考网格中K个参考位置对应像素的参考像素值,在第三图像中确定出与K个参考像素值满足预设条件的K个目标像素值。Step S302: Based on the reference pixel values of the pixels corresponding to the K reference positions in the reference grid, determine K target pixel values that meet the preset conditions with the K reference pixel values in the third image.
步骤S303,根据K个目标像素值,在第三图像中确定出与目标像素值对应的K个目标像素。Step S303: Based on the K target pixel values, K target pixels corresponding to the target pixel values are determined in the third image.
步骤S304,根据K个目标像素确定目标网格;M、N和K都为正整数。通过步骤S300可以确 定出每个参考网格相匹配的目标网格。Step S304, determine the target grid based on K target pixels; M, N and K are all positive integers. Through step S300, the target grid matching each reference grid can be determined.
对于步骤S301,第一图像中的参考网格可以是预先创建的,也可以是在执行步骤S300时创建。参考网格的大小可以根据实际的需求确定,例如根据预设的配置参数即可确定出预设网格的大小、形状和数量等。M和N可以是相等的。For step S301, the reference grid in the first image may be created in advance or may be created when step S300 is performed. The size of the reference grid can be determined according to actual needs. For example, the size, shape, and quantity of the preset grid can be determined according to the preset configuration parameters. M and N can be equal.
参考网格中的参考位置和参考位置的数量也可以根据实际需求确定,例如在参考网格为正方形时,参考位置为参考网格的四个角点,也就是包括四个参考位置。The reference positions and the number of reference positions in the reference grid can also be determined according to actual needs. For example, when the reference grid is a square, the reference positions are the four corner points of the reference grid, that is, four reference positions are included.
参考图7,图7的(a)部分为一种包括参考网格的第一图像,图7的(b)部分为一种包括目标网格的第二图像。Referring to FIG. 7 , part (a) of FIG. 7 is a first image including a reference grid, and part (b) of FIG. 7 is a second image including a target grid.
图7的(a)部分示出了一种参考网格,人物周围包括四个圆点的正方向网格即为其中的一个参考网格,四个圆点所在的位置为该参考网格的参考位置。对于其他参考网格,每个参考网格的四个角点即为参考位置。参考网格的数量为5*5,将第一图像划分为5*5个参考网格。Part (a) of Figure 7 shows a reference grid. The positive direction grid including four dots around the character is one of the reference grids. The positions of the four dots are the reference grid. Reference location. For other reference grids, the four corner points of each reference grid are the reference locations. The number of reference grids is 5*5, and the first image is divided into 5*5 reference grids.
对于步骤S302,以其中一个参考网格为例进行说明,根据参考网格中K个参考位置对应像素的参考像素值,在第三图像中确定出与K个参考像素值满足预设条件的K个目标像素值。Step S302 is explained by taking one of the reference grids as an example. According to the reference pixel values of the pixels corresponding to the K reference positions in the reference grid, determine the K reference pixel values that meet the preset conditions in the third image. target pixel value.
在确定参考网格和参考网格中的参考位置后,即可确定出参考位置在第一图像中对应的像素,进而可以确定各个参考位置在第一图像中对应像素的像素值。然后根据预设条件和K个参考位置在第一图像中对应像素的像素值,可以在第三图像中确定出与K个参考像素值满足预设条件的K个目标像素值。After determining the reference grid and the reference position in the reference grid, the pixel corresponding to the reference position in the first image can be determined, and then the pixel value of the corresponding pixel in the first image for each reference position can be determined. Then, based on the preset conditions and the pixel values of the corresponding pixels in the K reference positions in the first image, K target pixel values that meet the preset conditions with the K reference pixel values in the third image can be determined.
在预设条件不同时,确定出的目标像素值可能也会不同,预设条件可以根据实际需求确定。When the preset conditions are different, the determined target pixel value may also be different, and the preset conditions can be determined according to actual needs.
对于步骤S303,在确定出K个目标像素值后,即可根据K个目标像素值,在第三图像中确定出与K个目标像素值对应的K个目标像素,一个目标像素值可以对应一个目标像素。For step S303, after the K target pixel values are determined, K target pixels corresponding to the K target pixel values can be determined in the third image based on the K target pixel values. One target pixel value can correspond to one target pixel.
对于步骤S304,在确定出K个目标像素后,根据K个目标像素确定目标网格;M、N和K都为正整数。目标像素在第三图像中的位置即为目标网格中的目标位置,根据目标位置即可确定出目标网格。例如,一个目标像素对应一个目标位置,K个目标像素对应K个目标位置,将K个目标位置围成的区域确定为目标网格。For step S304, after K target pixels are determined, the target grid is determined based on the K target pixels; M, N, and K are all positive integers. The position of the target pixel in the third image is the target position in the target grid, and the target grid can be determined based on the target position. For example, one target pixel corresponds to one target position, K target pixels correspond to K target positions, and the area surrounded by the K target positions is determined as the target grid.
参考图7的(b)部分,人物周围的四个圆点对应像素的像素值即为目标像素值,四个圆点对应像素即为目标像素,目标像素围成的正方向即为目标网格。Referring to part (b) of Figure 7, the pixel value of the pixel corresponding to the four dots around the character is the target pixel value, the pixel corresponding to the four dots is the target pixel, and the positive direction surrounded by the target pixels is the target grid. .
对于其他参考网格,确定对应目标网格的过程与上述过程相同,即上述过程适用于各个参考网格。For other reference grids, the process of determining the corresponding target grid is the same as the above process, that is, the above process applies to each reference grid.
在另一实施例中,一个目标位置对应一个参考位置,相对应的目标位置和参考位置中,目标像素的位置与参考像素的位置在第一方向上相同。In another embodiment, a target position corresponds to a reference position, and in the corresponding target position and reference position, the position of the target pixel and the position of the reference pixel are the same in the first direction.
参考图7,图7的(a)部分中参考网格的左上角对应的参考位置记为第一参考位置,右上角对应的参考位置记为第二参考位置,图7的(b)部分中目标网格的左上角对应的位置记为第一目标位置,右上角对应的位置记为第二目标位置。第一方向为竖直方向时,第一目标位置和第一参考位置在第一方向上相同,就是行对齐,在同一行上。第二目标位置和第二参考位置在第一方向上相同, 就是行对齐,在同一行上。Referring to Figure 7, in part (a) of Figure 7, the reference position corresponding to the upper left corner of the reference grid is recorded as the first reference position, and the reference position corresponding to the upper right corner is recorded as the second reference position. In part (b) of Figure 7 The position corresponding to the upper left corner of the target grid is recorded as the first target position, and the position corresponding to the upper right corner is recorded as the second target position. When the first direction is the vertical direction, the first target position and the first reference position are the same in the first direction, that is, they are row aligned and on the same row. The second target position and the second reference position are the same in the first direction, that is, row aligned, on the same row.
这样即可减少目标位置和参考位置在第一方向和第二方向上同时出现偏差的情况,在第一方向上的位置相同后,剩下第二方向上的位置一个维度的变量,即可便于调整第二方向上的位置,从而便于将目标位置和参考位置在第一方向和第二方向上的位置都调整为相同。This can reduce the situation where the target position and the reference position deviate simultaneously in the first and second directions. After the positions in the first direction are the same, the position in the second direction is left with a one-dimensional variable, which can be convenient The position in the second direction is adjusted so that the positions of the target position and the reference position in the first direction and the second direction are adjusted to be the same.
另外,也减少了在相对应的目标位置和参考位置在第一方向和第二方向上的位置都不相同时,导致的执行步骤S400时计算量较大和调整位置的准确度较低的问题,减少了计算量,提高了位置调整的准确度。In addition, it also reduces the problem of large calculation amount and low accuracy of position adjustment when performing step S400 when the corresponding target position and reference position are different in the first direction and the second direction. The amount of calculation is reduced and the accuracy of position adjustment is improved.
在另一实施例中,参考图8,为另一种图像处理方法的示意图,该方法包括:In another embodiment, referring to FIG. 8 , which is a schematic diagram of another image processing method, the method includes:
步骤S10,确定预设区域内各个像素的第一平均像素值;其中,预设区域包括:以参考位置对应像素为中心,预设像素数量为半径的区域;Step S10, determine the first average pixel value of each pixel in the preset area; wherein the preset area includes: an area with the pixel corresponding to the reference position as the center and the preset number of pixels as the radius;
步骤S20,将第一平均像素值确定为参考像素值。Step S20, determine the first average pixel value as the reference pixel value.
在确参考像素值时,结合参考位置对应像素的像素值和参考位置对应像素周围像素的像素值,确定参考像素值。参考位置可以对应第一图像中某一个像素,以该参考位置对应像素为中心,预设像素数量的像素为半径的预设区域中的各个像素的像素值为基准,将该预设区域内各个像素的平均值确定为参考像素。这里将预设区域内各个像素的平均值记为第一平均像素值。When determining the reference pixel value, the reference pixel value is determined by combining the pixel value of the pixel corresponding to the reference position and the pixel values of the surrounding pixels corresponding to the reference position. The reference position may correspond to a certain pixel in the first image. With the pixel corresponding to the reference position as the center and the radius of the preset number of pixels as the radius, the pixel value of each pixel in the preset area is used as the basis. The average value of the pixels is determined as the reference pixel. Here, the average value of each pixel in the preset area is recorded as the first average pixel value.
这样可以便于提高确定目标位置的准确度,减少根据每个参考位置对应的单一像素的像素值确定目标像素值,导致的精确度较低的问题。This can easily improve the accuracy of determining the target position and reduce the problem of low accuracy caused by determining the target pixel value based on the pixel value of a single pixel corresponding to each reference position.
在另一实施例中,参考图9,为确定目标像素值的示意图,步骤S302,包括:In another embodiment, referring to FIG. 9 , which is a schematic diagram of determining a target pixel value, step S302 includes:
步骤S3021,在第三图像中确定出K个备选像素值。Step S3021, determine K candidate pixel values in the third image.
步骤S3022,确定出备选区域内各个像素的第二平均像素值;其中,备选区域包括:以备选像素值对应像素为中心,预设像素数量为半径的区域。Step S3022, determine the second average pixel value of each pixel in the candidate area; wherein the candidate area includes: an area with the pixel corresponding to the candidate pixel value as the center and a preset number of pixels as the radius.
步骤S3023,将与K个参考像素值满足预设条件的K个第二平均像素值分别对应的所述备选像素值,确定为目标像素值。Step S3023: Determine the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset conditions as target pixel values.
在确定目标像素值时,先在第三图像中确定出K个备选像素值,然后在确定各个备选像素值对应的备选区域中各个像素的像素值的平均像素值,即第二平均像素值。一个第二平均像素值对应一个备选像素值,根据K个第二平均像素值可以确定出对应的K个备选像素值。结合预设条件和K个参考像素值,将与K个参考像素值满足预设条件的K个第二平均像素值分别对应的备选像素值,确定为目标像素值。When determining the target pixel value, K candidate pixel values are first determined in the third image, and then the average pixel value of the pixel values of each pixel in the candidate area corresponding to each candidate pixel value is determined, that is, the second average Pixel values. One second average pixel value corresponds to one candidate pixel value, and the corresponding K candidate pixel values can be determined based on the K second average pixel values. Combining the preset conditions and the K reference pixel values, the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values meet the preset conditions are determined as target pixel values.
通过该方法提高了确定目标像素值的准确度,减少了根据单一像素对应像素值确定出目标像素值导致的准确度较低的问题,从而提高了确定目标网格的准确度,进一步提高了在第二方向上,将目标对象的各个像素在第三图像中的位置,调整至与目标对象在第一图像中对应像素在第一图像中的位置相同的准确度。This method improves the accuracy of determining the target pixel value and reduces the problem of low accuracy caused by determining the target pixel value based on the pixel value corresponding to a single pixel, thereby improving the accuracy of determining the target grid and further improving the accuracy of the target pixel value. In the second direction, the position of each pixel of the target object in the third image is adjusted to the same accuracy as the position of the corresponding pixel of the target object in the first image in the first image.
在另一实施例中,参考图10,为在第二方向上进行调整的示意图。步骤S400,根据参考网格和目标网格的位置对应关系,在第二方向上,将位于目标网格内的第二像素在第三图像中位置,调整 至与位于参考网格内的第一像素在第一图像中的位置相同,包括:In another embodiment, refer to FIG. 10 , which is a schematic diagram of adjustment in the second direction. Step S400: According to the position correspondence relationship between the reference grid and the target grid, in the second direction, adjust the position of the second pixel located in the target grid in the third image to be consistent with the position of the first pixel located in the reference grid. The pixels are at the same position in the first image, including:
步骤S401,根据参考位置和目标位置,确定位置对应关系,位置对应关系包括:第二方向上的映射变换关系;Step S401, determine the position correspondence relationship according to the reference position and the target position. The position correspondence relationship includes: the mapping transformation relationship in the second direction;
步骤S402,根据第二方向上的映射变换关系,在第二方向上,将位于目标网格内的第二像素在第三图像中位置,调整至与位于参考网格内的第一像素在第一图像中的位置相同。Step S402: According to the mapping transformation relationship in the second direction, adjust the position of the second pixel located in the target grid in the third image in the second direction to be in the same position as the first pixel located in the reference grid. The same position in an image.
对于每个参考网格和与该参考网格相匹配的目标网格,都可以确定出位置对应关系。一个参考网格和相匹配的目标网格形成一个网格对,通过该方法可以确定出每个网格对的位置对应关系,即在第二方向上的映射变换关系。For each reference grid and the target grid matching the reference grid, the position correspondence can be determined. A reference grid and a matching target grid form a grid pair. Through this method, the position correspondence relationship of each grid pair can be determined, that is, the mapping transformation relationship in the second direction.
在该实施例中,确定目标网格后,根据目标网格中的目标位置和参考网格中的参考位置,即可确定出在第二方向上的位置对应关系,在第二方向上的位置对应关系包括:第二方向上的映射变换关系。在第二方向上的映射变换关系可以是单应性变换矩阵等形式的变换关系。In this embodiment, after the target grid is determined, the position correspondence relationship in the second direction can be determined based on the target position in the target grid and the reference position in the reference grid. The position in the second direction can be determined. The corresponding relationship includes: mapping transformation relationship in the second direction. The mapping transformation relationship in the second direction may be a transformation relationship in the form of a homography transformation matrix or the like.
通过第二方向上的映射变换关系,对第三图像中目标网格内目标对象的第二像素的位置进行调整,调整后的第三图像中目标网格内目标对象的第二像素的位置,在第二方向上与第一图像中参考网格内对应第一像素的位置相同,这样就将目标网格内目标对象的各个像素的位置与参考网格内对应目标对象的像素的位置对齐。也就是根据第二向上的映射变换关系,在第二方向上,对目标网格内的各个像素进行位置调整。Through the mapping transformation relationship in the second direction, the position of the second pixel of the target object in the target grid in the third image is adjusted, and the adjusted position of the second pixel of the target object in the target grid in the third image is, The second direction is the same as the position corresponding to the first pixel in the reference grid in the first image, so that the position of each pixel of the target object in the target grid is aligned with the position of the pixel corresponding to the target object in the reference grid. That is, according to the second upward mapping transformation relationship, the position of each pixel in the target grid is adjusted in the second direction.
通过M*N个参考网格对应的目标网格,可以将位于目标网格中的目标对象的各个像素在第二方向上的位置,与目标对象在参考网格内的对应像素在第二方向上的位置对齐。Through the target grid corresponding to the M*N reference grids, the position of each pixel of the target object located in the target grid in the second direction can be compared with the corresponding pixel of the target object in the reference grid in the second direction. Align the position on.
例如,图7的(b)部分所示的人物所在四个圆点对应的目标网格,该目标网格内各个像素在第二方向上的位置,与图7的(a)部分所示的人物所在四个圆点对应的参考网格内各个对应像素在第二方向上的位置对齐。根据第二方向上的映射变换关系,将图7的(b)部分所示的人物左手指尖对应像素在第二方向上的位置,与图7的(a)部分所示的人物左手指尖对应像素在第二方向上的位置调整至相同,即对齐。将图7的(b)部分所示的人物右手指尖对应像素在第二方向上的位置,与图7的(a)部分所示的人物右手指尖对应像素在第二方向上的位置对齐。For example, the target grid corresponding to the four dots where the character is located as shown in part (b) of Figure 7, and the position of each pixel in the target grid in the second direction are different from the target grid shown in part (a) of Figure 7. The corresponding pixels in the reference grid corresponding to the four dots where the character is located are aligned in the second direction. According to the mapping transformation relationship in the second direction, the position of the corresponding pixel in the second direction of the left fingertip of the person shown in part (b) of Figure 7 is compared with the position of the left fingertip of the person's left finger shown in part (a) of Figure 7 The positions of the corresponding pixels in the second direction are adjusted to be the same, that is, aligned. Align the position of the pixel corresponding to the fingertip of the person's right hand in the second direction shown in part (b) of Figure 7 with the position of the pixel corresponding to the fingertip of the person's right hand shown in part (a) of Figure 7 in the second direction. .
根据第二方向上的映射变换关系,将图7的(b)部分所示的人物头顶对应像素在第二方向上的位置,与图7的(a)部分所示的人物头顶对应像素在第二方向上的位置调整至相同,即对齐。According to the mapping transformation relationship in the second direction, the position of the pixel corresponding to the person's head shown in part (b) of Figure 7 in the second direction is compared with the position of the pixel corresponding to the person's head shown in part (a) of Figure 7 in the second direction. Adjust the positions in the two directions to be the same, that is, align.
例如,可以根据4对相匹配的第一特征点和第二特征点的位置,确定出第一方向上的映射变换关系,该映射变换关系可以是单元性变换矩阵。单应性变换矩阵可以是3*3的矩阵,可以用如下公式表示:For example, the mapping transformation relationship in the first direction can be determined based on the positions of four pairs of matching first feature points and second feature points, and the mapping transformation relationship can be a unitary transformation matrix. The homography transformation matrix can be a 3*3 matrix, which can be expressed by the following formula:
Figure PCTCN2022090570-appb-000004
Figure PCTCN2022090570-appb-000004
H 2表示第二方向上的单应性变换矩阵;h 0至h 8表示H 2中的元素。 H 2 represents the homography transformation matrix in the second direction; h 0 to h 8 represent the elements in H 2 .
在第一方向为竖直方向时,第二方向为水平方向,单应性变换矩阵H 2还可以满足以下条件: When the first direction is the vertical direction and the second direction is the horizontal direction, the homography transformation matrix H 2 can also satisfy the following conditions:
Figure PCTCN2022090570-appb-000005
Figure PCTCN2022090570-appb-000005
在H 2满足该条件时,根据H 2可以在第二方向上,位于目标网格内的第二像素在第三图像中位置,调整至与位于参考网格内的第一像素在第一图像中的位置相同。 When H2 meets this condition, according to H2 , the position of the second pixel located in the target grid in the third image in the second direction can be adjusted to be the same as the position of the first pixel located in the reference grid in the first image. are in the same position.
在第一方向为水平方向时,第一方向的位置用x表示,第二方向的位置用y表示,单应性变换矩阵H 2还可以满足以下条件: When the first direction is the horizontal direction, the position in the first direction is represented by x, and the position in the second direction is represented by y. The homography transformation matrix H 2 can also satisfy the following conditions:
Figure PCTCN2022090570-appb-000006
Figure PCTCN2022090570-appb-000006
在另一实施例中,参考图11,为一种图像处理装置的示意图,该装置包括:In another embodiment, referring to FIG. 11 , which is a schematic diagram of an image processing device, the device includes:
图像获取模块1,用于获取第一图像和第二图像;其中,所述第一图像和所述第二图像中都包括同一目标对象; Image acquisition module 1, used to acquire a first image and a second image; wherein the first image and the second image include the same target object;
第一处理模块2,用于在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像;其中,所述第一像素和所述第二像素为所述目标对象中同一位置的像素;The first processing module 2 is configured to adjust the position of the second pixel in the target object in the second image in the first direction to the position of the first pixel in the target object in the first image. The positions are the same, and a third image is obtained; wherein the first pixel and the second pixel are pixels at the same position in the target object;
目标网格确定模块3,用于根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格;其中,所述目标网格中包括:目标位置;所述目标位置对应像素的目标像素值,与所述参考网格中N个参考位置对应像素的参考像素值满足预设条件;Target grid determination module 3, configured to determine the target grid in the third image according to the reference grid in the first image; wherein the target grid includes: target position; the target The target pixel value of the pixel corresponding to the position satisfies the preset conditions with the reference pixel values of the pixels corresponding to the N reference positions in the reference grid;
第二处理模块4,用于根据所述参考网格和所述目标网格的位置关系,在第二方向上,将位于所述目标网格内的所述第二像素在所述第三图像中位置,调整至与位于所述参考网格内的所述第一像素在所述第一图像中的位置相同;其中,所述第二方向垂直于所述第一方向。The second processing module 4 is configured to add the second pixels located in the target grid to the third image in the second direction according to the positional relationship between the reference grid and the target grid. The middle position is adjusted to the same position in the first image as the first pixel located within the reference grid; wherein the second direction is perpendicular to the first direction.
在另一实施例中,目标网格确定模块3,包括:In another embodiment, the target grid determination module 3 includes:
建立单元,用于在所述第一图像中创建M*N个预设大小的参考网格;A creation unit configured to create M*N reference grids of preset sizes in the first image;
目标像素值确定单元,用于根据所述参考网格中K个所述参考位置对应像素的所述参考像素值,在所述第三图像中确定出与K个所述参考像素值满足所述预设条件的K个所述目标像素值;A target pixel value determination unit configured to determine, in the third image, the K reference pixel values that satisfy the requirement based on the reference pixel values of the K pixels corresponding to the reference positions in the reference grid. K target pixel values of preset conditions;
目标像素确定单元,用于根据K个所述目标像素值,在所述第三图像中确定出与所述目标像素值对应的K个目标像素;A target pixel determination unit configured to determine K target pixels corresponding to the target pixel value in the third image based on the K target pixel values;
目标网格确定单元,用于根据K个所述目标像素确定所述目标网格;M、N和K都为正整数。A target grid determining unit is used to determine the target grid based on K target pixels; M, N and K are all positive integers.
在另一实施例中,所述装置还包括:In another embodiment, the device further includes:
第一平均像素值确定模块,用于确定预设区域内各个像素的第一平均像素值;其中,所述预设区域包括:以所述参考位置对应像素为中心,预设像素数量为半径的区域;The first average pixel value determination module is used to determine the first average pixel value of each pixel in the preset area; wherein the preset area includes: with the pixel corresponding to the reference position as the center and the preset number of pixels as the radius. area;
参考像素值确定模块,用于将所述第一平均像素值确定为所述参考像素值。A reference pixel value determination module, configured to determine the first average pixel value as the reference pixel value.
在另一实施例中,目标像素值确定单元,包括:In another embodiment, the target pixel value determination unit includes:
备选像素值确定子单元,用于在所述第三图像中确定出K个备选像素值;Alternative pixel value determination subunit, used to determine K alternative pixel values in the third image;
爹平均像素值确定子单元,用于确定出备选区域内各个像素的第二平均像素值;其中,所述备 选区域包括:以所述备选像素值对应像素为中心,所述预设像素数量为半径的区域;The average pixel value determination subunit is used to determine the second average pixel value of each pixel in the candidate area; wherein the candidate area includes: centered on the pixel corresponding to the candidate pixel value, the preset The number of pixels is the area of the radius;
目标像素值确定子单元,用于将与K个所述参考像素值满足所述预设条件的K个所述第二平均像素值分别对应的所述备选像素值,确定为所述目标像素值。Target pixel value determination subunit, configured to determine the candidate pixel values corresponding to the K second average pixel values whose K reference pixel values satisfy the preset condition as the target pixels. value.
在另一实施例中,所述参考网格至少包括:方形网格或三角形网格;所述参考位置至少包括:网格的角点或者网格的边线的中间点。In another embodiment, the reference grid at least includes: a square grid or a triangular grid; the reference position at least includes: a corner point of the grid or a midpoint of an edge of the grid.
在另一实施例中,所述预设条件至少包括:所述参考像素值与所述目标像素值的差的绝对值之和小于目标阈值。In another embodiment, the preset condition at least includes: the sum of absolute values of differences between the reference pixel value and the target pixel value is less than a target threshold.
在另一实施例中,第二处理模块4包括:In another embodiment, the second processing module 4 includes:
第一位置对应关系确定单元,用于根据所述参考位置和目标位置,确定所述位置对应关系;所述位置对应关系包括:第二方向上的映射变换关系;A first position correspondence determination unit, configured to determine the position correspondence according to the reference position and the target position; the position correspondence includes: a mapping transformation relationship in the second direction;
第一处理单元,用于根据所述第二方向上的映射变换关系,在所述第二方向上,将位于所述目标网格内的所述第二像素在所述第三图像中位置,调整至与位于所述参考网格内的所述第一像素在所述第一图像中的位置相同。A first processing unit configured to position the second pixel located in the target grid in the third image in the second direction according to the mapping transformation relationship in the second direction, Adjusted to the same position in the first image as the first pixel located within the reference grid.
在另一实施例中,所述第二方向上的映射变换关系包括:第二方向上的单应变换矩阵。In another embodiment, the mapping transformation relationship in the second direction includes: a homography transformation matrix in the second direction.
在另一实施例中,第一处理模块2包括:In another embodiment, the first processing module 2 includes:
第一特征点提取单元,用于提取所述目标对象在所述第一图像中的第一特征点;A first feature point extraction unit configured to extract the first feature point of the target object in the first image;
第二特征点提取单元,用于提取所述目标对象在所述第二图像中的第二特征点;其中,所述第一特征点和所述第二特征点为所述目标对象中同一位置的匹配特征点对;A second feature point extraction unit is used to extract the second feature point of the target object in the second image; wherein the first feature point and the second feature point are at the same position in the target object. matching feature point pairs;
第二位置对应关系确定单元,用于根据所述第一特征点和所述第二特征点,确定第一方向上的映射变换关系;A second position correspondence relationship determination unit configured to determine the mapping transformation relationship in the first direction based on the first feature point and the second feature point;
第二处理单元,用于根据所述第一方向上的映射变换关系,在所述第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到所述第三图像。A second processing unit configured to adjust the position of the second pixel in the target object in the second image in the first direction to be consistent with the position of the second pixel in the second image according to the mapping transformation relationship in the first direction. The position of the first pixel in the target object in the first image is the same, and the third image is obtained.
在另一实施例中,所述第一方向上的映射变换关系包括:第一方向上的单应变换矩阵。In another embodiment, the mapping transformation relationship in the first direction includes: a homography transformation matrix in the first direction.
在另一实施例中,还提供了一种电子设备,包括:In another embodiment, an electronic device is also provided, including:
处理器和用于存储能够在所述处理器上运行的可执行指令的存储器,其中:A processor and memory for storing executable instructions capable of running on said processor, wherein:
处理器用于运行所述可执行指令时,所述可执行指令执行上述任一实施例所述的方法。When the processor is used to run the executable instructions, the executable instructions execute the method described in any of the above embodiments.
在另一实施例中,还提供了一种非临时性计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现上述任一实施例所述的方法。In another embodiment, a non-transitory computer-readable storage medium is also provided. Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are executed by a processor, any of the above are implemented. methods described in the examples.
需要说明的是,本公开实施例中的“第一”和“第二”仅为表述和区分方便,并无其他特指含义。It should be noted that the “first” and “second” in the embodiments of the present disclosure are only for convenience of expression and distinction and have no other specific meanings.
在另一实施例中,还提供了另一种图像处理方法。参考图12,为该方法的示意图。In another embodiment, another image processing method is also provided. Refer to Figure 12, which is a schematic diagram of this method.
通常情况下,基于单应变换的全局图像对齐方法难以对非同一个平面的物体进行对齐;基于稠密光流场的方法运算量较大,难以处理较大的图像;基于网格对齐的方法基本使用特征点对网格的 位移进行约束,在提取不到图像特征点的场景中对齐效果较差。Under normal circumstances, global image alignment methods based on homography transformation are difficult to align objects on different planes; methods based on dense optical flow fields require a large amount of calculations and are difficult to process larger images; methods based on grid alignment are basically Feature points are used to constrain the displacement of the grid, and the alignment effect is poor in scenes where image feature points cannot be extracted.
本公开示例可以应用于图像对齐领域,可以用于对齐单个摄像头在不同视角下拍摄的同一场景的图像,也可用于对齐多个摄像头拍摄的同一场景的图像。对齐的图像可以用做多帧HDR、超分辨率算法的图像输入,也可用于多摄图像融合算法的输入。The disclosed example can be applied to the field of image alignment, and can be used to align images of the same scene captured by a single camera at different viewing angles, or can be used to align images of the same scene captured by multiple cameras. The aligned images can be used as image input for multi-frame HDR and super-resolution algorithms, and can also be used as input for multi-camera image fusion algorithms.
以手机摄像头在1x放大倍数下采集的第一图像和3x放大倍数采集的第二图像为例进行说明。如图4所示,手机的1x及3x镜头,在拍摄同一场景时,由于拍摄角度有差异,且镜头的各项配置,如视场角、焦距等差异,使得第一图像和第二图像在视场大小等方面有较大差异,为了利用两镜头的图像进行图像融合,需要通过算法,对第一图像和第二图像进行图像对齐,才能进行后续的算法处理流程。Take the first image collected by the mobile phone camera at 1x magnification and the second image collected at 3x magnification as an example for explanation. As shown in Figure 4, when the 1x and 3x lenses of the mobile phone shoot the same scene, due to the difference in shooting angles and the differences in various configurations of the lenses, such as field of view, focal length, etc., the first image and the second image are in the same scene. There is a big difference in field of view size and other aspects. In order to use the images of the two lenses for image fusion, an algorithm needs to be used to align the first image and the second image before the subsequent algorithm processing process can be carried out.
参考图12,该方法包括:Referring to Figure 12, the method includes:
步骤一:提取第一图像和第二图像中目标对象的特征点,目标对象的同一个特征在第一图像中和第二图像中形成特征点对。Step 1: Extract feature points of the target object in the first image and the second image. The same feature of the target object forms a feature point pair in the first image and the second image.
步骤二:通过对个特征点对,确定在第一方向上,将第二图像中目标对象的像素的位置与第一图像中目标对象对应像素的位置调整至相同的单应性变换矩阵,例如第一方向为竖直方向,图像全局行对齐的单应矩阵,从而实现第一图像中目标对象和第二图像中目标对象的行对齐,得到第三图像。Step 2: By matching the feature point pairs, determine that in the first direction, the position of the pixel of the target object in the second image and the position of the corresponding pixel of the target object in the first image are adjusted to the same homography transformation matrix, for example The first direction is the vertical direction, and the homography matrix of the global row alignment of the image is used to realize the row alignment of the target object in the first image and the target object in the second image, and obtain the third image.
步骤三:根据第一图像中的参考网格,确定出第三图像中对应的目标网格。包括:在第三图像,即行对齐后的图像上划分网格,通过网格点的行搜索匹配获取网格点在图像上对应的目标网格。Step 3: Determine the corresponding target grid in the third image based on the reference grid in the first image. It includes: dividing the grid on the third image, that is, the row-aligned image, and obtaining the target grid corresponding to the grid point on the image through row search and matching of grid points.
步骤四:对于每个参考网格和对应的目标网格,利用网格中预设位置和目标位置的对应关系计算第一图像与第三图像中目标对象在第二方向上的位置变换关系,根据该位置变换关系对第三图像中目标对象的位置进行调整。Step 4: For each reference grid and the corresponding target grid, calculate the position transformation relationship of the target object in the first image and the third image in the second direction using the corresponding relationship between the preset position in the grid and the target position. The position of the target object in the third image is adjusted according to the position transformation relationship.
步骤一:提取第一图像中目标对象和第二图像中目标对象的相匹配对的特征点。Step 1: Extract matching feature points of the target object in the first image and the target object in the second image.
由于第一图像和第二图像之间可能存在旋转、平移、视场大小等差异,为了对第一图像和第二图像进行行对齐的全局单应变换,需要获取第一图像中目标对象和第二图像中目标对象的特征匹配点对。可以采用SIFT、ORB等常用特征点及匹配方法。参考图4。Since there may be differences in rotation, translation, field of view, etc. between the first image and the second image, in order to perform line-aligned global homography transformation on the first image and the second image, it is necessary to obtain the target object in the first image and the second image. Feature matching point pairs of target objects in two images. Common feature points and matching methods such as SIFT and ORB can be used. Refer to Figure 4.
步骤二:计算全局行对齐的单应矩阵,对图像做行对齐。Step 2: Calculate the global row-aligned homography matrix and perform row alignment on the image.
全局的单应变换矩阵H,具体为3*3的矩阵,形式如下:The global homography transformation matrix H, specifically a 3*3 matrix, has the following form:
Figure PCTCN2022090570-appb-000007
Figure PCTCN2022090570-appb-000007
h 0至h 8表示H的元素。 h 0 to h 8 represent elements of H.
单应矩阵一共包含8个自由度,而步骤一中一组匹配特征点对可以提供两组约束,因此需要至少四对匹配特征点对的位置,得到行对齐单应矩阵。同时,为了实现图像的行对齐,得到的H矩阵,还需要满足变换后的图像,其匹配特征点对在行方向上的坐标(即y坐标)相等,H矩阵满足:The homography matrix contains a total of 8 degrees of freedom, and a set of matching feature point pairs in step 1 can provide two sets of constraints. Therefore, at least four pairs of matching feature point pairs are required to obtain a row-aligned homography matrix. At the same time, in order to achieve row alignment of the image, the obtained H matrix also needs to satisfy the transformed image, and the coordinates (i.e. y coordinate) of the matching feature point pairs in the row direction are equal, and the H matrix satisfies:
Figure PCTCN2022090570-appb-000008
Figure PCTCN2022090570-appb-000008
即对于图4的(b)部分所示的特征点A的对应像素的位置(x,y)与图4的(a)部分所示的特征点A’对应像素的位置(x1,y1),A点对应像素的位置经过H变换后,y与y’相等。That is, for the position (x, y) of the corresponding pixel of the feature point A shown in part (b) of Figure 4 and the position (x1, y1) of the corresponding pixel of the feature point A' shown in part (a) of Figure 4, After the position of the pixel corresponding to point A undergoes H transformation, y and y' are equal.
步骤三:在行对齐后的第三图像上,利用网格点行搜索确定目标网格。Step 3: On the third image after row alignment, use grid point row search to determine the target grid.
利用全局的单应矩阵H实现图像的行对齐以后,在第一图像上划分均匀的参考网格,之后利用像素值的差的绝对值之和在行对齐的第三图像上,搜索目标网格,从而获得每个网格点在左右图的对应关系。网格搜索匹配的示意图参考图7。After using the global homography matrix H to achieve row alignment of the image, divide a uniform reference grid on the first image, and then use the sum of the absolute values of the differences in pixel values to search for the target grid on the row-aligned third image. , thereby obtaining the corresponding relationship between each grid point in the left and right images. Refer to Figure 7 for a schematic diagram of grid search matching.
步骤四:利用参考网格的参考位置和目标网格的目标位置,确定第一图像中目标对象和第三图像中目标对象的位置变换关系。Step 4: Use the reference position of the reference grid and the target position of the target grid to determine the position transformation relationship between the target object in the first image and the target object in the third image.
经过步骤三后,可以获得每个参考网格中参考位置和目标网格中目标位置的对应关系,由于每个网格都有四个网格点,因此可以用单应变换,计算每个参考网格内和对应目标网格内像素点的位置对应关系。单应变换的形式与步骤二中的H矩阵类似。通过对每个目标网格内的像素点利用单应变换做映射,将第三图像与第一图像中目标对象的像素位置对齐。After step three, the corresponding relationship between the reference position in each reference grid and the target position in the target grid can be obtained. Since each grid has four grid points, homography transformation can be used to calculate each reference The position correspondence between the pixels in the grid and the corresponding target grid. The form of homography transformation is similar to the H matrix in step 2. By mapping the pixels in each target grid using homography transformation, the third image is aligned with the pixel positions of the target object in the first image.
1.采用全局单应变换做行对齐,将图像未对齐的情况限定在列方向上,将网格点的搜索范围限制为一维,相比于基于光流的网格对齐方法减小了对齐过程中的运算量。1. Use global homography transformation for row alignment, limit image misalignment to the column direction, and limit the search range of grid points to one dimension. Compared with the grid alignment method based on optical flow, the alignment is reduced. amount of operations in the process.
2.在图像上进行网格划分,直接对网格匹配点进行搜索,增加了网格对齐时可用的参考信息,使得基于网格对齐的方法,网格点之间的约束不依赖于特征点的提取情况,提升了对齐的效果。2. Grid the image and directly search for grid matching points, which increases the reference information available for grid alignment, making the constraints between grid points independent of feature points based on grid alignment methods. The extraction situation improves the alignment effect.
图13是根据一示例性实施例示出的一种终端设备的框图。例如,终端设备可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Figure 13 is a block diagram of a terminal device according to an exemplary embodiment. For example, the terminal device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
参照图13,终端设备可以包括以下一个或多个组件:处理组件802,存储器804,电力组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。Referring to Figure 13, the terminal device may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and communications component 816.
处理组件802通常控制终端设备的整体操作,诸如与展示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operations of the terminal device, such as operations associated with presentations, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
存储器804被配置为存储各种类型的数据以支持在终端设备的操作。这些数据的示例包括用于在终端设备上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 804 is configured to store various types of data to support operations at the terminal device. Examples of such data include instructions for any application or method operating on the terminal device, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
电力组件806为终端设备的各种组件提供电力。电力组件806可以包括电源管理系统,一个或 多个电源,及其他与为终端设备生成、管理和分配电力相关联的组件。 Power component 806 provides power to various components of the terminal device. Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to end devices.
多媒体组件808包括在终端设备和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶展示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当终端设备处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 808 includes a screen that provides an output interface between the terminal device and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. A touch sensor can not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action. In some embodiments, multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the terminal device is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当终端设备处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。 Audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a microphone (MIC) configured to receive external audio signals when the terminal device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in memory 804 or sent via communication component 816 . In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
传感器组件814包括一个或多个传感器,用于为终端设备提供各个方面的状态评估。例如,传感器组件814可以检测到终端设备的打开/关闭状态,组件的相对定位,例如组件为终端设备的展示器和小键盘,传感器组件814还可以检测终端设备或终端设备一个组件的位置改变,用户与终端设备接触的存在或不存在,终端设备方位或加速/减速和终端设备的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor component 814 includes one or more sensors for providing various aspects of status assessment for the terminal device. For example, the sensor component 814 can detect the open/closed state of the terminal device, the relative positioning of components, such as the display and keypad of the terminal device, and the sensor component 814 can also detect the position change of the terminal device or a component of the terminal device, The presence or absence of user contact with the terminal device, terminal device orientation or acceleration/deceleration and temperature changes of the terminal device. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件816被配置为便于终端设备和其他设备之间有线或无线方式的通信。终端设备可以接入基于通信标准的无线网络,如WiFi,4G或5G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于发频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the terminal device and other devices. Terminal devices can access wireless networks based on communication standards, such as WiFi, 4G or 5G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communications component 816 also includes a near field communications (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,终端设备可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the terminal device may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本公开旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common common sense or customary technical means in the technical field that are not disclosed in the present disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It is to be understood that the present invention is not limited to the precise construction described above and illustrated in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (13)

  1. 一种图像处理方法,其中,所述方法包括:An image processing method, wherein the method includes:
    获取第一图像和第二图像;其中,所述第一图像和所述第二图像中都包括同一目标对象;Obtaining a first image and a second image; wherein both the first image and the second image include the same target object;
    在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像;其中,所述第一像素和所述第二像素为所述目标对象中同一位置的像素;In the first direction, adjust the position of the second pixel in the target object in the second image to the same position as the first pixel in the target object in the first image to obtain a third image ; Wherein, the first pixel and the second pixel are pixels at the same position in the target object;
    根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格;其中,所述目标网格中包括:目标位置;所述目标位置对应像素的目标像素值,与所述参考网格中参考位置对应像素的参考像素值满足预设条件;According to the reference grid in the first image, the target grid in the third image is determined; wherein the target grid includes: a target position; a target pixel value of a pixel corresponding to the target position, and The reference pixel value of the pixel corresponding to the reference position in the reference grid meets the preset condition;
    根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将所述第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同;其中,所述第二方向垂直于所述第一方向。According to the position correspondence relationship between the reference grid and the target grid, in the second direction, the position of the second pixel in the third image is adjusted to be consistent with the position of the first pixel in the third image. The positions in an image are the same; wherein the second direction is perpendicular to the first direction.
  2. 根据权利要求1所述的方法,其中,所述根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格,包括:The method of claim 1, wherein determining the target grid in the third image based on the reference grid in the first image includes:
    在所述第一图像中创建M*N个预设大小的参考网格;Create M*N reference grids of preset sizes in the first image;
    根据所述参考网格中K个所述参考位置对应像素的所述参考像素值,在所述第三图像中确定出与K个所述参考像素值满足所述预设条件的K个所述目标像素值;According to the reference pixel values of the K pixels corresponding to the reference positions in the reference grid, the K reference pixel values that satisfy the preset condition are determined in the third image. target pixel value;
    根据K个所述目标像素值,在所述第三图像中确定出与所述目标像素值对应的K个目标像素;According to the K target pixel values, K target pixels corresponding to the target pixel values are determined in the third image;
    根据K个所述目标像素确定所述目标网格;M、N和K都为正整数。The target grid is determined based on K target pixels; M, N and K are all positive integers.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, further comprising:
    确定预设区域内各个像素的第一平均像素值;其中,所述预设区域包括:以所述参考位置对应像素为中心,预设像素数量为半径的区域;Determine the first average pixel value of each pixel in the preset area; wherein the preset area includes: an area with the pixel corresponding to the reference position as the center and the preset number of pixels as the radius;
    将所述第一平均像素值确定为所述参考像素值。The first average pixel value is determined as the reference pixel value.
  4. 根据权利要求3所述的方法,其中,所述根据所述参考网格中K个所述参考位置对应像素的所述参考像素值,在所述第三图像中确定出与K个所述参考像素值满足所述预设条件的K个目标像素值,包括:The method according to claim 3, wherein, based on the reference pixel values of pixels corresponding to K reference positions in the reference grid, determining in the third image the values corresponding to the K reference positions. The K target pixel values whose pixel values meet the preset conditions include:
    在所述第三图像中确定出K个备选像素值;Determine K candidate pixel values in the third image;
    确定出备选区域内各个像素的第二平均像素值;其中,所述备选区域包括:以所述备选像素值对应像素为中心,所述预设像素数量为半径的区域;Determine the second average pixel value of each pixel in the candidate area; wherein the candidate area includes: an area with the pixel corresponding to the candidate pixel value as the center and the preset number of pixels as the radius;
    将与K个所述参考像素值满足所述预设条件的K个所述第二平均像素值分别对应的所述备选像素值,确定为所述目标像素值。The candidate pixel values corresponding to the K second average pixel values whose K reference pixel values satisfy the preset condition are determined as the target pixel values.
  5. 根据权利要求1至4任一项所述的方法,其中,所述参考网格至少包括:方形网格或三角形 网格;The method according to any one of claims 1 to 4, wherein the reference grid at least includes: a square grid or a triangular grid;
    所述参考位置至少包括:网格的角点或者网格的边线的中间点。The reference position at least includes: a corner point of the grid or a midpoint of an edge line of the grid.
  6. 根据权利要求1至4任一项所述的方法,其中,所述预设条件至少包括:所述参考像素值与所述目标像素值的差的绝对值之和小于目标阈值。The method according to any one of claims 1 to 4, wherein the preset condition at least includes: the sum of the absolute values of the differences between the reference pixel value and the target pixel value is less than a target threshold.
  7. 根据权利要求1所述的方法,其中,根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将所述第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同,包括:The method according to claim 1, wherein the position of the second pixel in the third image is adjusted in the second direction according to the position correspondence relationship between the reference grid and the target grid. to the same position as the first pixel in the first image, including:
    根据所述参考位置和目标位置,确定所述位置对应关系;所述位置对应关系包括:第二方向上的映射变换关系;The position correspondence relationship is determined according to the reference position and the target position; the position correspondence relationship includes: a mapping transformation relationship in the second direction;
    根据所述第二方向上的映射变换关系,在所述第二方向上,将位于所述目标网格内的所述第二像素在所述第三图像中位置,调整至与位于所述参考网格内的所述第一像素在所述第一图像中的位置相同。According to the mapping transformation relationship in the second direction, in the second direction, the position of the second pixel located in the target grid in the third image is adjusted to be the same as that located in the reference The first pixels within the grid are at the same position in the first image.
  8. 根据权利要求7所述的方法,其中,所述第二方向上的映射变换关系包括:第二方向上的单应变换矩阵。The method according to claim 7, wherein the mapping transformation relationship in the second direction includes: a homography transformation matrix in the second direction.
  9. 根据权利要求1所述的方法,其中,所述在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像,包括:The method according to claim 1, wherein in the first direction, the position of the second pixel in the target object in the second image is adjusted to be consistent with the position of the first pixel in the target object. The same position in the first image is obtained, and the third image is obtained, including:
    提取所述目标对象在所述第一图像中的第一特征点;Extract the first feature point of the target object in the first image;
    提取所述目标对象在所述第二图像中的第二特征点;其中,所述第一特征点和所述第二特征点为所述目标对象中同一位置的匹配特征点对;Extract the second feature point of the target object in the second image; wherein the first feature point and the second feature point are matching feature point pairs at the same position in the target object;
    根据所述第一特征点和所述第二特征点,确定第一方向上的映射变换关系;Determine a mapping transformation relationship in the first direction according to the first feature point and the second feature point;
    根据所述第一方向上的映射变换关系,在所述第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到所述第三图像。According to the mapping transformation relationship in the first direction, in the first direction, the position of the second pixel in the target object in the second image is adjusted to be in the same position as the first pixel in the target object. The positions in the first image are the same, and the third image is obtained.
  10. 根据权利要求9所述的方法,其中,所述第一方向上的映射变换关系包括:第一方向上的单应变换矩阵。The method according to claim 9, wherein the mapping transformation relationship in the first direction includes: a homography transformation matrix in the first direction.
  11. 一种图像处理装置,其中,所述装置包括:An image processing device, wherein the device includes:
    图像获取模块,用于获取第一图像和第二图像;其中,所述第一图像和所述第二图像中都包括同一目标对象;An image acquisition module, configured to acquire a first image and a second image; wherein both the first image and the second image include the same target object;
    第一处理模块,用于在第一方向上,将所述目标对象中第二像素在所述第二图像中位置,调整至与所述目标对象中第一像素在所述第一图像中的位置相同,得到第三图像;其中,所述第一像素和所述第二像素为所述目标对象中同一位置的像素;A first processing module configured to adjust the position of the second pixel in the target object in the second image in the first direction to the position of the first pixel in the target object in the first image. The positions are the same, and a third image is obtained; wherein the first pixel and the second pixel are pixels at the same position in the target object;
    目标网格确定模块,用于根据所述第一图像中的参考网格,确定出所述第三图像中的目标网格;其中,所述目标网格中包括:目标位置;所述目标位置对应像素的目标像素值,与所述参考网格中 参考位置对应像素的参考像素值满足预设条件;A target grid determination module, configured to determine the target grid in the third image according to the reference grid in the first image; wherein the target grid includes: a target position; the target position The target pixel value of the corresponding pixel satisfies the preset condition with the reference pixel value of the pixel corresponding to the reference position in the reference grid;
    第二处理模块,用于根据所述参考网格和所述目标网格的位置对应关系,在第二方向上,将第二像素在所述第三图像中位置,调整至与所述第一像素在所述第一图像中的位置相同;其中,所述第二方向垂直于所述第一方向。A second processing module configured to adjust the position of the second pixel in the third image in the second direction to be consistent with the first position according to the position correspondence between the reference grid and the target grid. The positions of the pixels in the first image are the same; wherein the second direction is perpendicular to the first direction.
  12. 一种电子设备,包括处理器、收发器、存储器及存储在存储器上并能够由所述处理器运行的可执行程序,其中,所述处理器运行所述可执行程序时执行如权利要求1至10任一项提供的方法。An electronic device, including a processor, a transceiver, a memory, and an executable program stored on the memory and capable of being run by the processor, wherein when the processor runs the executable program, it executes claims 1 to 10 any of the methods provided.
  13. 一种计算机存储介质,所述计算机存储介质存储有可执行程序;所述可执行程序被处理器执行后,能够实现如权利要求1至10任一项提供的方法。A computer storage medium stores an executable program; after the executable program is executed by a processor, the method as provided in any one of claims 1 to 10 can be implemented.
PCT/CN2022/090570 2022-04-29 2022-04-29 Image processing method and apparatus, electronic device and storage medium WO2023206475A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/090570 WO2023206475A1 (en) 2022-04-29 2022-04-29 Image processing method and apparatus, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/090570 WO2023206475A1 (en) 2022-04-29 2022-04-29 Image processing method and apparatus, electronic device and storage medium

Publications (1)

Publication Number Publication Date
WO2023206475A1 true WO2023206475A1 (en) 2023-11-02

Family

ID=88516817

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/090570 WO2023206475A1 (en) 2022-04-29 2022-04-29 Image processing method and apparatus, electronic device and storage medium

Country Status (1)

Country Link
WO (1) WO2023206475A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011070579A (en) * 2009-09-28 2011-04-07 Dainippon Printing Co Ltd Captured image display device
CN102065227A (en) * 2009-11-17 2011-05-18 新奥特(北京)视频技术有限公司 Method and device for horizontally and vertically aligning object in graph and image processing
CN106952630A (en) * 2017-03-23 2017-07-14 深圳市茁壮网络股份有限公司 Pixel region processing method, device and pixel region switching method and apparatus
CN109166077A (en) * 2018-08-17 2019-01-08 广州视源电子科技股份有限公司 Image alignment method, apparatus, readable storage medium storing program for executing and computer equipment
CN111815690A (en) * 2020-09-11 2020-10-23 湖南国科智瞳科技有限公司 Method, system and computer equipment for real-time splicing of microscopic images
CN113781369A (en) * 2020-06-09 2021-12-10 安讯士有限公司 Aligning digital images
CN114298902A (en) * 2021-12-02 2022-04-08 上海闻泰信息技术有限公司 Image alignment method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011070579A (en) * 2009-09-28 2011-04-07 Dainippon Printing Co Ltd Captured image display device
CN102065227A (en) * 2009-11-17 2011-05-18 新奥特(北京)视频技术有限公司 Method and device for horizontally and vertically aligning object in graph and image processing
CN106952630A (en) * 2017-03-23 2017-07-14 深圳市茁壮网络股份有限公司 Pixel region processing method, device and pixel region switching method and apparatus
CN109166077A (en) * 2018-08-17 2019-01-08 广州视源电子科技股份有限公司 Image alignment method, apparatus, readable storage medium storing program for executing and computer equipment
CN113781369A (en) * 2020-06-09 2021-12-10 安讯士有限公司 Aligning digital images
CN111815690A (en) * 2020-09-11 2020-10-23 湖南国科智瞳科技有限公司 Method, system and computer equipment for real-time splicing of microscopic images
CN114298902A (en) * 2021-12-02 2022-04-08 上海闻泰信息技术有限公司 Image alignment method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11403763B2 (en) Image segmentation method and apparatus, computer device, and storage medium
CN111541845B (en) Image processing method and device and electronic equipment
WO2019101021A1 (en) Image recognition method, apparatus, and electronic device
JP7058760B2 (en) Image processing methods and their devices, terminals and computer programs
JP5450739B2 (en) Image processing apparatus and image display apparatus
US11176687B2 (en) Method and apparatus for detecting moving target, and electronic equipment
US11301051B2 (en) Using natural movements of a hand-held device to manipulate digital content
US11030733B2 (en) Method, electronic device and storage medium for processing image
CN108470322B (en) Method and device for processing face image and readable storage medium
WO2016127671A1 (en) Image filter generating method and device
US11308692B2 (en) Method and device for processing image, and storage medium
CN111541907A (en) Article display method, apparatus, device and storage medium
CN109325908B (en) Image processing method and device, electronic equipment and storage medium
CN108776822B (en) Target area detection method, device, terminal and storage medium
WO2022121577A1 (en) Image processing method and apparatus
CN112738420B (en) Special effect implementation method, device, electronic equipment and storage medium
CN114529606A (en) Pose detection method and device, electronic equipment and storage medium
KR20210053121A (en) Method and apparatus for training image processing model, and storage medium
CN109934168B (en) Face image mapping method and device
WO2023206475A1 (en) Image processing method and apparatus, electronic device and storage medium
CN114390206A (en) Shooting method and device and electronic equipment
CN114241127A (en) Panoramic image generation method and device, electronic equipment and medium
CN110012208B (en) Photographing focusing method and device, storage medium and electronic equipment
CN113592874A (en) Image display method and device and computer equipment
WO2023240452A1 (en) Image processing method and apparatus, electronic device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22939322

Country of ref document: EP

Kind code of ref document: A1