WO2019134516A1 - Method and device for generating panoramic image, storage medium, and electronic apparatus - Google Patents

Method and device for generating panoramic image, storage medium, and electronic apparatus Download PDF

Info

Publication number
WO2019134516A1
WO2019134516A1 PCT/CN2018/122029 CN2018122029W WO2019134516A1 WO 2019134516 A1 WO2019134516 A1 WO 2019134516A1 CN 2018122029 W CN2018122029 W CN 2018122029W WO 2019134516 A1 WO2019134516 A1 WO 2019134516A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame image
image
key frame
feature points
panoramic
Prior art date
Application number
PCT/CN2018/122029
Other languages
French (fr)
Chinese (zh)
Inventor
陈岩
刘耀勇
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019134516A1 publication Critical patent/WO2019134516A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/698Control of cameras or camera modules for achieving an enlarged field of view, e.g. panoramic image capture
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a panoramic image generating method, apparatus, storage medium, and electronic device.
  • mobile terminals have become one of the necessary tools for people's daily life, which not only provides call and text messaging functions, but also has multimedia playback and camera functions.
  • panoramic shooting mode a series of small-view images with partially overlapping boundaries can be matched and aligned according to the characteristics of different images, thereby splicing into a wide viewing angle.
  • the panoramic image but the existing panoramic shooting technology can only be spliced for some relatively simple scene images, and it is difficult to adapt to complex scenes, such as close-up shooting of buildings, murals, etc., with limited limitations and poor stitching effect.
  • the embodiment of the present invention provides a method, a device, a storage medium, and an electronic device for generating a panoramic image, which can be adapted to various shooting scenes, and the stitching effect is good.
  • the embodiment of the present application provides a method for generating a panoramic image, including:
  • the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction;
  • a panoramic image is generated based on the partial image.
  • the embodiment of the present application further provides a panoramic image generating apparatus, which is applied to an electronic device, and includes:
  • An acquisition module configured to acquire a panoramic shooting instruction
  • a shooting module configured to start a camera for video shooting according to the panoramic shooting instruction, and display the shooting content in a preview frame;
  • a scanning module configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting process to obtain a plurality of sets of scanned images, where the first direction is perpendicular to the second direction ;
  • a first generating module configured to generate a corresponding partial image in the second direction according to each set of scanned images
  • a second generating module configured to generate a panoramic image according to the partial image.
  • the first generating module specifically includes:
  • a splicing sub-module configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
  • the splicing submodule is used to:
  • the corresponding key frame image group is spliced by the first global transformation matrix.
  • the splicing submodule is specifically configured to:
  • a first homography matrix is calculated based on the location information.
  • determining submodule is specifically configured to:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  • determining submodule is specifically configured to:
  • determining submodule is specifically configured to:
  • the second generating module is specifically configured to:
  • the partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  • the embodiment of the present application further provides a storage medium, where the storage medium stores a plurality of instructions, and the instructions are adapted to be loaded by a processor to execute any of the above-mentioned panoramic image generating methods.
  • the embodiment of the present application further provides an electronic device, including a processor and a memory, the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used in any one of the foregoing The steps in the panoramic image generation method described.
  • FIG. 1 is a schematic flowchart diagram of a method for generating a panoramic image according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a serpentine scan in a preview frame according to an embodiment of the present application.
  • FIG. 3 is another schematic flowchart of a method for generating a panoramic image according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of step 203 according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a panoramic image generating apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a first generation module according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the embodiment of the present application provides a method, an apparatus, a storage medium, and an electronic device for generating a panoramic image.
  • a panoramic image generating method is applied to an electronic device, comprising: acquiring a panoramic shooting instruction; starting a camera for video shooting according to the panoramic shooting instruction, and displaying the captured content in a preview frame; in the video shooting process, in the second direction Performing a serpentine scan on the preview frame at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction; generating a corresponding partial image in the second direction according to each set of scanned images Generating a panoramic image from the partial image.
  • the generating a corresponding partial image in the second direction according to each set of scanned images comprises:
  • the splicing the key frame image group according to the feature point comprises:
  • the corresponding key frame image group is spliced by the first global transformation matrix.
  • the calculating the corresponding first homography matrix according to the feature points of the adjacent two frame key frame images in the key frame image group includes:
  • a first homography matrix is calculated based on the location information.
  • the splicing the corresponding key frame image group by using the first global transformation matrix comprises:
  • each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
  • the determining the corresponding key frame image group according to each set of scanned images comprises:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  • determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image includes:
  • determining whether the target frame image satisfies a preset condition according to the number of the successfully matched feature points and the total number includes:
  • the generating the panoramic image according to the partial image comprises:
  • the partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  • FIG. 1 is a schematic flowchart of a method for generating a panoramic image according to an embodiment of the present application, which is applied to an electronic device, and the specific process may be as follows:
  • the electronic device may generate a panoramic shooting instruction.
  • the size of the preview frame may be manually set, or may be determined according to the size of the display screen of the electronic device, such as three-quarters of the size of the display screen.
  • the preview frame is subjected to a serpentine scan in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
  • the second direction and the first direction are usually set in advance, which may be the direction in which the preview frame length and width are located, or may be an artificially defined horizontal and vertical direction, and may of course be other settings. the way.
  • the first direction overlap ratio refers to a scan track overlap ratio in the first direction, which can be artificially set, such as not less than 50%. After each scan, a corresponding set of scanned images is generated.
  • the scan length of the serpentine scan can be a fixed value or a variable, and the scan trajectory overlap rate depends on the starting position of two adjacent serpentine scans, such as Referring to FIG. 2, for two adjacent serpentine scans with a fixed scan length, if the scan start points are a1 and a2, respectively, and the scan length is b, the scan trace overlap ratio is [b-(a2-a1)]/b. .
  • the partial image is formed by splicing in the second direction. Since each group of scanned images is not scanned for the entire preview frame, but a certain longitudinal or horizontal region of the preview frame is scanned, correspondingly formed
  • the stitched image is also not a panoramic image but a partial image.
  • the foregoing step 104 may specifically include:
  • the foregoing step 1-1 may specifically include:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied.
  • the operation of the preset condition is not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied.
  • the feature point refers to a point where the gray value of the image changes drastically or a point with a large curvature on the edge of the image (ie, the intersection of the two edges), and each feature point may include a texture.
  • Information such as features and color characteristics.
  • step "determining whether the target frame image satisfies a preset condition according to the feature point of the key frame image and the feature point of the target frame image” may specifically include:
  • Whether the target frame image satisfies a preset condition is determined according to the number of the feature points that are successfully matched and the total number.
  • the preset condition may be manually set.
  • the similarity between the key frame image and the target frame image may be within a certain range. Generally, the more the number of feature points that are successfully matched, the higher the similarity.
  • step "determining whether the target frame image satisfies the preset condition according to the number of the feature points and the total number of the matching successes" may specifically include:
  • the ratio between the number of feature points matching the success and the total number can be calculated, and the ratio is taken as the similarity.
  • the first preset threshold and the second preset threshold may be manually set.
  • the first preset threshold may be 70%
  • the second preset threshold may be 20.
  • steps 1-3 may specifically include:
  • step 1-3-1 may specifically include:
  • a first homography matrix is calculated based on the location information.
  • the homography matrix (the first homography matrix) is a conversion matrix from one image to another image mapping. Specifically, the two adjacent frames may be determined first. Which feature points are successfully matched in the frame image, and then a certain number of matching feature points are selected to calculate the corresponding homography matrix, so that the feature points in one frame of the key frame image are transformed by the homography matrix, It is in the same spatial coordinate system as the feature points in another frame of keyframe images.
  • the first homography matrix of the adjacent frame key frame image may be calculated in order, for example, for a certain key frame image group M1 Mn Mn, between M1 and M2, between M2 and M3, and M3 may be calculated.
  • the first homography matrix between M4 and Mn-1 and Mn, each homography matrix is equivalent to the local transformation matrix of the key frame image group, and finally, all the first homography matrices Uniform to the same coordinate system to obtain the first global transformation matrix.
  • each key frame image in the key frame image group can be projected into the same coordinate space system through the global transformation matrix, and the obtained image is a spliced partial image.
  • the foregoing step 105 may specifically include:
  • the partial image is spliced in the first direction by the second global transformation matrix to obtain a panoramic image.
  • the serpentine scan is an overlapping scan in the first direction, that is, the scan trajectories of the adjacent two scan operations partially overlap, when the scan image completes the splicing in the second direction, Further splicing in the first direction, that is, the partial image spliced by each column (row) of the scanned image is spliced again in the direction in which the row (column) is located, thereby realizing two-dimensional mesh splicing, which can carry the scanned image
  • the image information is fully utilized, the method is simple, the stitching effect is good, and the video image stitching suitable for various complicated scenes is strong, and the flexibility is strong.
  • the panoramic image generating method provided by the embodiment is applied to an electronic device, by acquiring a panoramic shooting instruction, and then, according to the panoramic shooting instruction, the camera is started to perform video shooting, and the captured content is displayed in the preview box, and During the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction, and according to each set of scanned images The corresponding partial image is generated in the second direction, and then the panoramic image is generated according to the partial image, so that the image mosaic of various complex scenes can be applied, the method is simple, the flexibility is high, and the stitching effect is good.
  • the description will be made from the perspective of the panoramic image generating device, and the detailed description will be made by taking the panoramic image generating device integrated in the electronic device as an example.
  • a method for generating a panoramic image is applied to an electronic device, and the specific process may be as follows:
  • the electronic device acquires a panoramic shooting instruction, and starts a camera to perform video shooting according to the panoramic shooting instruction, and then displays the captured content in a preview frame.
  • the panoramic shooting button of the shooting application can be clicked.
  • the electronic device starts the camera for video shooting, and displays the shooting content in the preview box in real time.
  • the electronic device scans the preview frame in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
  • the first direction may be a horizontal direction
  • the second direction may be a vertical direction, that is, the electronic device scans the content displayed in the preview frame in a longitudinal direction, as shown in FIG. 2, for two adjacent scan lengths.
  • the horizontal scan overlap ratio is [b-(a2-a1)]/b, for example, b/a may be not less than 50%.
  • the electronic device determines a corresponding key frame image group according to each group of scanned images.
  • the foregoing step 203 may specifically include:
  • the electronic device uses the first frame scanned image as a key frame image
  • the electronic device acquires a next frame scan image adjacent to the key frame image as a target frame image.
  • the electronic device determines, according to the feature point of the key frame image and the feature point of the target frame image, whether the target frame image satisfies a preset condition, and if yes, uses the target frame image as a key frame image, and returns to perform the above steps. 2032. If no, the next frame scan image adjacent to the target frame image is used as the target frame image, and the process returns to step 2033.
  • the above step 2033 can further include:
  • the second preset threshold such as 20 o'clock. It can be considered that the similarity between the two is not lower than the minimum.
  • the ratio of the number of matching feature points to the total number is less than the first preset threshold, such as 70%, the similarity between the two can be considered not higher than the maximum. Only the target frame image that satisfies both of these conditions can be considered as a key frame image if it is considered to satisfy the preset condition.
  • the electronic device extracts feature points of the key frame image in each key frame image group, and matches feature points of adjacent two frame key frame images in the key frame image group.
  • the electronic device acquires location information of the feature point that is successfully matched, and calculates a first homography matrix according to the location information.
  • the electronic device calculates a first global transformation matrix according to the first homography matrix, and splices the corresponding key frame image group by using the first global transformation matrix to obtain a partial image.
  • each key frame image group is obtained by a single vertical scan
  • the partial images of each key frame image group are corresponding to the vertical scan.
  • the image information included in the region may be calculated by first calculating the first homography matrix of the adjacent key frame image, and then normalizing all the first homography matrices to obtain a global transformation matrix, and using the global The transformation matrix projects each key frame image in the key frame image group into the same coordinate space, completing the vertical splicing of each key frame image group.
  • the electronic device calculates a corresponding second homography matrix according to the two adjacent partial images, and calculates a second global transformation matrix according to the second homography matrix, and then uses the second global transformation matrix to use the partial image. Splicing is performed in the first direction to obtain a panoramic image.
  • the serpentine scan has a certain lateral overlap ratio, that is, the same portion exists in two adjacent partial images
  • the partial image can be further spliced horizontally, and the splicing method can be second to two.
  • the homography matrix then normalizes the second homography matrix to obtain a second global transformation matrix, and then uses the second global transformation matrix to project all partial images into a coordinate space to complete the lateral direction of the partial image. splice.
  • the panoramic image generating method provided in this embodiment is applied to an electronic device, wherein the electronic device can acquire a panoramic shooting instruction, and start a camera to perform video shooting according to the panoramic shooting instruction, and then display the captured content in a preview box.
  • the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction, and then, according to each The group scan image determines a corresponding key frame image group, and then extracts feature points of the key frame image in each key frame image group, and matches feature points of adjacent two frame key frame images in the key frame image group, and then Obtaining location information of the matching feature point, and calculating a first homography matrix according to the location information, and then calculating a first global transformation matrix according to the first homography matrix, and using the first global transformation matrix pair
  • the corresponding key frame image group is spliced to obtain a partial image, and then, the pair is calculated according to two adjacent partial images.
  • the two-dimensional grid is used to generate a panoramic image, which is suitable for image mosaic of various complicated scenes, and has the advantages of simple method, high flexibility and good stitching effect.
  • the panoramic image generating device may be implemented as an independent entity or integrated in an electronic device, such as a terminal.
  • the terminal may include a mobile phone, a tablet computer, a personal computer, and the like.
  • the embodiment of the present application provides a panoramic image generating apparatus, which is applied to an electronic device, and includes:
  • An acquisition module configured to acquire a panoramic shooting instruction
  • a shooting module configured to start a camera for video shooting according to the panoramic shooting instruction, and display the shooting content in a preview frame;
  • a scanning module configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting process to obtain a plurality of sets of scanned images, where the first direction is perpendicular to the second direction ;
  • a first generating module configured to generate a corresponding partial image in the second direction according to each set of scanned images
  • a second generating module configured to generate a panoramic image according to the partial image.
  • the first generating module specifically includes:
  • a splicing sub-module configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
  • the splicing sub-module is used to:
  • the corresponding key frame image group is spliced by the first global transformation matrix.
  • the splicing sub-module is specifically configured to:
  • a first homography matrix is calculated based on the location information.
  • the splicing sub-module is specifically configured to:
  • each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
  • the determining sub-module is specifically configured to:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  • the determining sub-module is specifically configured to:
  • the determining sub-module is specifically configured to:
  • the second generating module is specifically configured to:
  • the partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  • FIG. 5 specifically describes a panoramic image generating apparatus according to an embodiment of the present application, which is applied to an electronic device, and the panoramic image generating apparatus may include: an acquiring module 10, a shooting module 20, a scanning module 30, and a first generating module. 40 and a second generation module 50, wherein:
  • the obtaining module 10 is configured to acquire a panoramic shooting instruction.
  • the electronic device may generate a panoramic shooting instruction.
  • the shooting module 20 is configured to start a camera for video shooting according to the panoramic shooting instruction, and display the captured content in a preview frame.
  • the size of the preview frame may be manually set, or may be determined according to the size of the display screen of the electronic device, such as three-quarters of the size of the display screen.
  • the scanning module 30 is configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
  • the second direction and the first direction are usually set in advance, which may be the direction in which the preview frame length and width are located, or may be an artificially defined horizontal and vertical direction, and may of course be other settings.
  • the first direction overlap ratio refers to a scan track overlap ratio in the first direction, which can be artificially set, such as not less than 50%. After each scan, a corresponding set of scanned images is generated.
  • the scan length of the serpentine scan can be a fixed value or a variable, and the scan trajectory overlap rate depends on the starting position of two adjacent serpentine scans, such as Referring to FIG. 2, for two adjacent serpentine scans with a fixed scan length, if the scan length is a and the overlap length in the first direction is b, the scan track overlap ratio is b/a.
  • the first generating module 40 is configured to generate a corresponding partial image in the second direction according to each set of scanned images.
  • the partial image is formed by splicing in the second direction. Since each group of scanned images is not scanned for the entire preview frame, but a certain longitudinal or horizontal region of the preview frame is scanned, correspondingly formed
  • the stitched image is also not a panoramic image but a partial image.
  • the first generating module 40 may specifically include a determining submodule 41, an extracting submodule 42 and a splicing submodule 43, where:
  • the determining sub-module 41 is configured to determine a corresponding key frame image group according to each set of scanned images.
  • the determining sub-module 41 can be specifically used to:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied.
  • the operation of the preset condition is not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied.
  • the feature point refers to a point where the gray value of the image changes drastically or a point with a large curvature on the edge of the image (ie, the intersection of the two edges), and each feature point may include a texture.
  • Information such as features and color characteristics.
  • the determining sub-module 41 can be specifically used to:
  • Whether the target frame image satisfies a preset condition is determined according to the number of the feature points that are successfully matched and the total number.
  • the preset condition may be manually set.
  • the similarity between the key frame image and the target frame image may be within a certain range. Generally, the more the number of feature points that are successfully matched, the higher the similarity.
  • determining sub-module 41 is specifically configured to:
  • the ratio between the number of feature points matching the success and the total number can be calculated, and the ratio is taken as the similarity.
  • the first preset threshold and the second preset threshold may be manually set.
  • the first preset threshold may be 70%
  • the second preset threshold may be 20.
  • the extraction sub-module 42 is configured to extract feature points of the key frame image in each key frame image group.
  • the splicing sub-module 43 is configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
  • the splicing submodule 43 can be specifically used to:
  • the splicing sub-module 43 can be specifically used to:
  • a first homography matrix is calculated based on the location information.
  • the homography matrix (the first homography matrix) is a conversion matrix from one image to another image mapping. Specifically, the two adjacent frames may be determined first. Which feature points are successfully matched in the frame image, and then a certain number of matching feature points are selected to calculate the corresponding homography matrix, so that the feature points in one frame of the key frame image are transformed by the homography matrix, It is in the same spatial coordinate system as the feature points in another frame of keyframe images.
  • the first homography matrix of the adjacent frame key frame image may be calculated in order, for example, for a certain key frame image group M1 Mn Mn, between M1 and M2, between M2 and M3, and M3 may be calculated.
  • the first homography matrix between M4 and Mn-1 and Mn, each homography matrix is equivalent to the local transformation matrix of the key frame image group, and finally, all the first homography matrices Uniform to the same coordinate system to obtain the first global transformation matrix.
  • each key frame image in the key frame image group can be projected into the same coordinate space system through the global transformation matrix, and the obtained image is a spliced partial image.
  • the second generating module 50 is configured to generate a panoramic image according to the partial image.
  • the second generating module 50 can be specifically configured to:
  • the partial image is spliced in the first direction by the second global transformation matrix to obtain a panoramic image.
  • the serpentine scan is an overlapping scan in the first direction, that is, the scan trajectories of the adjacent two scan operations partially overlap, when the scan image completes the splicing in the second direction, Further splicing in the first direction, that is, the partial image spliced by each column (row) of the scanned image is spliced again in the direction in which the row (column) is located, thereby realizing two-dimensional mesh splicing, which can carry the scanned image
  • the image information is fully utilized, the method is simple, the stitching effect is good, and the video image stitching suitable for various complicated scenes is strong, and the flexibility is strong.
  • the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same or a plurality of entities.
  • the foregoing method embodiments and details are not described herein.
  • the panoramic image generating method provided in this embodiment is applied to an electronic device, and the panoramic shooting instruction is acquired by the acquiring module 10. Then, the shooting module 20 starts the camera to perform video shooting according to the panoramic shooting instruction, and displays the captured content in the In the preview frame, during the video shooting process, the scanning module 30 performs a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second
  • the first generation module 40 generates a corresponding partial image in the second direction according to each set of scanned images, and then the second generation module 50 generates a panoramic image according to the partial image, so that the image mosaic can be applied to various complex scenes.
  • the method is simple, the flexibility is high, and the stitching effect is good.
  • the embodiment of the present application further provides an electronic device, which may be a device such as a smart phone or a tablet computer.
  • the electronic device 900 includes a processor 901, a memory 902, a display screen 903, and a control circuit 904.
  • the processor 901 is electrically connected to the memory 902, the display screen 903, and the control circuit 904, respectively.
  • the processor 901 is a control center of the electronic device 900, and connects various parts of the entire electronic device using various interfaces and lines, executes the electronic by running or loading an application stored in the memory 902, and calling data stored in the memory 902.
  • the various functions and processing data of the device enable overall monitoring of the electronic device.
  • the processor 901 in the electronic device 900 loads the instructions corresponding to the process of one or more applications into the memory 902 according to the following steps, and is stored in the memory 902 by the processor 901.
  • the application thus implementing various functions:
  • the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction;
  • a panoramic image is generated based on the partial image.
  • the generating a corresponding partial image in the second direction according to each set of scanned images comprises:
  • the splicing the key frame image group according to the feature point comprises:
  • the corresponding key frame image group is spliced by the first global transformation matrix.
  • the calculating the corresponding first homography matrix according to the feature points of the adjacent two frame key frame images in the key frame image group includes:
  • a first homography matrix is calculated based on the location information.
  • the splicing the corresponding key frame image group by using the first global transformation matrix comprises:
  • each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
  • the determining the corresponding key frame image group according to each set of scanned images comprises:
  • the first frame scanned image is used as a key frame image
  • the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  • determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image includes:
  • determining whether the target frame image satisfies a preset condition according to the number of the successfully matched feature points and the total number includes:
  • the generating the panoramic image according to the partial image comprises:
  • the partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  • Memory 902 can be used to store applications and data.
  • the application stored in the memory 902 contains instructions executable in the processor.
  • Applications can form various functional modules.
  • the processor 901 executes various functional applications and data processing by running an application stored in the memory 902.
  • the display screen 903 can be used to display information entered by the user or information provided to the user as well as various graphical user interfaces of the terminal, which can be composed of images, text, icons, video, and any combination thereof.
  • the control circuit 904 is electrically connected to the display screen 903 for controlling the display screen 903 to display information.
  • the electronic device 900 further includes a radio frequency circuit 905, an input unit 906, an audio circuit 907, a sensor 908, and a power source 909.
  • the processor 901 is electrically connected to the radio frequency circuit 905, the input unit 906, the audio circuit 907, the sensor 908, and the power source 909, respectively.
  • the radio frequency circuit 905 is used for transmitting and receiving radio frequency signals to establish wireless communication with network devices or other electronic devices through wireless communication, and to transmit and receive signals with network devices or other electronic devices.
  • the input unit 906 can be configured to receive input digits, character information, or user characteristic information (eg, fingerprints), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function controls.
  • the input unit 906 can include a fingerprint identification module.
  • the audio circuit 907 can provide an audio interface between the user and the terminal through a speaker and a microphone.
  • Electronic device 900 may also include at least one type of sensor 908, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may close the display panel and/or the backlight when the terminal moves to the ear.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • the terminal can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
  • Power source 909 is used to power various components of electronic device 900.
  • the power supply 909 can be logically coupled to the processor 901 through a power management system to enable functions such as managing charging, discharging, and power management through the power management system.
  • the electronic device 900 may further include a camera, a Bluetooth module, and the like, and details are not described herein.
  • an embodiment of the present invention provides a storage medium in which a plurality of instructions are stored, which can be loaded by a processor to perform the steps in any of the panoramic image generating methods provided by the embodiments of the present invention.
  • the storage medium may include: a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
  • ROM read only memory
  • RAM random access memory
  • magnetic disk a magnetic disk or an optical disk.
  • any embodiment of the present invention can be performed by using the instructions stored in the storage medium. Therefore, any method for generating a panoramic image provided by the embodiments of the present invention can be implemented.
  • any method for generating a panoramic image provided by the embodiments of the present invention can be implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

A method and device for generating a panoramic image, a storage medium, and an electronic apparatus. The method comprises: acquiring a panorama capture instruction; activating, according to the panorama capture instruction, a camera to perform a video capture operation, and displaying a captured content in a preview box; in a video capture process, performing, using a preset first-direction overlapping ratio, serpentine scanning on the preview box in a second direction; generating corresponding partial images in the second direction on the basis of the respective scanned images; and generating a panoramic image on the basis of the partial images.

Description

全景图像生成方法、装置、存储介质及电子设备Panoramic image generation method, device, storage medium and electronic device
本申请要求于2018年1月5日提交中国专利局、申请号为201810011559.2、发明名称为“全景图像生成方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201810011559.2, entitled "Panoramic Image Generation Method, Apparatus, Storage Medium, and Electronic Apparatus", which is filed on January 5, 2018, the entire contents of which are incorporated by reference. Combined in this application.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种全景图像生成方法、装置、存储介质及电子设备。The present application relates to the field of computer technologies, and in particular, to a panoramic image generating method, apparatus, storage medium, and electronic device.
背景技术Background technique
随着移动通信技术的不断发展,移动终端已经成为人们日常生活的必备工具之一,其不仅可以提供通话和短信功能,还具有多媒体播放以及拍照功能。With the continuous development of mobile communication technology, mobile terminals have become one of the necessary tools for people's daily life, which not only provides call and text messaging functions, but also has multimedia playback and camera functions.
目前的移动终端大多具有全景拍摄模式,在全景拍摄模式下,可以将一系列有部分重叠边界的小视角图像,根据不同图像的特征运用不同的处理算法进行匹配对准,从而拼接成一幅宽视角的全景图像,但是现有的全景拍摄技术只能针对一些比较简单的场景图像进行拼接,难以适应复杂场景,比如近距离拍摄建筑物、壁画等,局限性大,拼接效果差。Most of the current mobile terminals have a panoramic shooting mode. In the panoramic shooting mode, a series of small-view images with partially overlapping boundaries can be matched and aligned according to the characteristics of different images, thereby splicing into a wide viewing angle. The panoramic image, but the existing panoramic shooting technology can only be spliced for some relatively simple scene images, and it is difficult to adapt to complex scenes, such as close-up shooting of buildings, murals, etc., with limited limitations and poor stitching effect.
发明内容Summary of the invention
本申请实施例提供一种全景图像生成方法、装置、存储介质及电子设备,能适应各种拍摄场景,拼接效果好。The embodiment of the present invention provides a method, a device, a storage medium, and an electronic device for generating a panoramic image, which can be adapted to various shooting scenes, and the stitching effect is good.
本申请实施例提供了一种全景图像生成方法,包括:The embodiment of the present application provides a method for generating a panoramic image, including:
获取全景拍摄指令;Obtain a panoramic shooting instruction;
根据所述全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;Activating a camera for video shooting according to the panoramic shooting instruction, and displaying the captured content in a preview frame;
在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对所述预览框进行蛇形扫描,得到多组扫描图像,所述第一方向垂直于第二方向;During the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction;
根据每组扫描图像在所述第二方向上生成对应的局部图像;Generating a corresponding partial image in the second direction according to each set of scanned images;
根据所述局部图像生成全景图像。A panoramic image is generated based on the partial image.
本申请实施例还提供了一种全景图像生成装置,应用于电子设备,包括:The embodiment of the present application further provides a panoramic image generating apparatus, which is applied to an electronic device, and includes:
获取模块,用于获取全景拍摄指令;An acquisition module, configured to acquire a panoramic shooting instruction;
拍摄模块,用于根据所述全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;a shooting module, configured to start a camera for video shooting according to the panoramic shooting instruction, and display the shooting content in a preview frame;
扫描模块,用于在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对所述预览框进行蛇形扫描,得到多组扫描图像,所述第一方向垂直于第二方向;a scanning module, configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting process to obtain a plurality of sets of scanned images, where the first direction is perpendicular to the second direction ;
第一生成模块,用于根据每组扫描图像在所述第二方向上生成对应的局部图像;a first generating module, configured to generate a corresponding partial image in the second direction according to each set of scanned images;
第二生成模块,用于根据所述局部图像生成全景图像。And a second generating module, configured to generate a panoramic image according to the partial image.
进一步地,所述第一生成模块具体包括:Further, the first generating module specifically includes:
确定子模块,用于根据每组扫描图像确定对应的关键帧图像组;Determining a sub-module for determining a corresponding key frame image group according to each set of scanned images;
提取子模块,用于提取每一关键帧图像组中关键帧图像的特征点;Extracting a sub-module for extracting feature points of key frame images in each key frame image group;
拼接子模块,用于根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And a splicing sub-module, configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
进一步地,所述拼接子模块用于:Further, the splicing submodule is used to:
根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
进一步地,所述拼接子模块具体用于:Further, the splicing submodule is specifically configured to:
将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
进一步地,所述确定子模块具体用于:Further, the determining submodule is specifically configured to:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
进一步地,所述确定子模块具体用于:Further, the determining submodule is specifically configured to:
将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
进一步地,所述确定子模块具体用于:Further, the determining submodule is specifically configured to:
根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
进一步地,所述第二生成模块具体用于:Further, the second generating module is specifically configured to:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
本申请实施例还提供了一种存储介质,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行上述任一项全景图像生成方法。The embodiment of the present application further provides a storage medium, where the storage medium stores a plurality of instructions, and the instructions are adapted to be loaded by a processor to execute any of the above-mentioned panoramic image generating methods.
本申请实施例还提供了一种电子设备,包括处理器和存储器,所述处理器与所述存储器电性连接,所述存储器用于存储指令和数据,所述处理器用于上述任一项所述的全景图像生成方法中的步骤。The embodiment of the present application further provides an electronic device, including a processor and a memory, the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used in any one of the foregoing The steps in the panoramic image generation method described.
附图说明DRAWINGS
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其它有益效果显而易见。The technical solutions and other advantageous effects of the present application will be apparent from the detailed description of the embodiments of the present application.
图1为本申请实施例提供的全景图像生成方法的流程示意图。FIG. 1 is a schematic flowchart diagram of a method for generating a panoramic image according to an embodiment of the present application.
图2为本申请实施例提供的预览框中蛇形扫描的示意图。FIG. 2 is a schematic diagram of a serpentine scan in a preview frame according to an embodiment of the present application.
图3为本申请实施例提供的全景图像生成方法的另一流程示意图。FIG. 3 is another schematic flowchart of a method for generating a panoramic image according to an embodiment of the present application.
图4为本申请实施例提供的步骤203的流程示意图。FIG. 4 is a schematic flowchart of step 203 according to an embodiment of the present application.
图5为本申请实施例提供的全景图像生成装置的结构示意图。FIG. 5 is a schematic structural diagram of a panoramic image generating apparatus according to an embodiment of the present application.
图6为本申请实施例提供的第一生成模块的结构示意图。FIG. 6 is a schematic structural diagram of a first generation module according to an embodiment of the present application.
图7为本申请实施例提供的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present application without creative efforts are within the scope of the present application.
本申请实施例提供一种全景图像生成方法、装置、存储介质及电子设备。The embodiment of the present application provides a method, an apparatus, a storage medium, and an electronic device for generating a panoramic image.
一种全景图像生成方法,应用于电子设备,包括:获取全景拍摄指令;根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向;根据每组扫描图像在该第二方向上生成对应的局部图像;根据该局部图像生成全景图像。A panoramic image generating method is applied to an electronic device, comprising: acquiring a panoramic shooting instruction; starting a camera for video shooting according to the panoramic shooting instruction, and displaying the captured content in a preview frame; in the video shooting process, in the second direction Performing a serpentine scan on the preview frame at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction; generating a corresponding partial image in the second direction according to each set of scanned images Generating a panoramic image from the partial image.
在一些实施例中,所述根据每组扫描图像在所述第二方向上生成对应的局部图像,包括:In some embodiments, the generating a corresponding partial image in the second direction according to each set of scanned images comprises:
根据每组扫描图像确定对应的关键帧图像组;Determining a corresponding key frame image group according to each set of scanned images;
提取每一关键帧图像组中关键帧图像的特征点;Extracting feature points of key frame images in each key frame image group;
根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
在一些实施例中,所述根据所述特征点对所述关键帧图像组进行拼接,包括:In some embodiments, the splicing the key frame image group according to the feature point comprises:
根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
在一些实施例中,所述根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵,包括:In some embodiments, the calculating the corresponding first homography matrix according to the feature points of the adjacent two frame key frame images in the key frame image group includes:
将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
在一些实施例中,所述利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接,包括:In some embodiments, the splicing the corresponding key frame image group by using the first global transformation matrix comprises:
通过所述第一全局变换矩阵,将所述关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,以对所述关键帧图像组进行拼接。And each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
在一些实施例中,所述根据每组扫描图像确定对应的关键帧图像组,包括:In some embodiments, the determining the corresponding key frame image group according to each set of scanned images comprises:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
在一些实施例中,所述根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件,包括:In some embodiments, determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image includes:
将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
在一些实施例中,所述根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件,包括:In some embodiments, determining whether the target frame image satisfies a preset condition according to the number of the successfully matched feature points and the total number includes:
根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
在一些实施例中,所述根据所述局部图像生成全景图像,包括:In some embodiments, the generating the panoramic image according to the partial image comprises:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
如图1所示,图1是本申请实施例提供的全景图像生成方法的流程示意图,其应用于电子设备,具体流程可以如下:As shown in FIG. 1 , FIG. 1 is a schematic flowchart of a method for generating a panoramic image according to an embodiment of the present application, which is applied to an electronic device, and the specific process may be as follows:
101、获取全景拍摄指令。101. Obtain a panoramic shooting instruction.
本实施例中,当用户点击拍照应用的某个按钮时,电子设备可以生成全景拍摄指令。In this embodiment, when the user clicks a certain button of the photographing application, the electronic device may generate a panoramic shooting instruction.
102、根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中。102. Start the camera for video shooting according to the panoramic shooting instruction, and display the shooting content in the preview box.
本实施例中,该预览框的大小可以人为设定,也可以根据电子设备显示屏的尺寸而定,比如是显示屏尺寸的四分之三。In this embodiment, the size of the preview frame may be manually set, or may be determined according to the size of the display screen of the electronic device, such as three-quarters of the size of the display screen.
103、在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向。103. During the video shooting process, the preview frame is subjected to a serpentine scan in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
本实施例中,该第二方向和第一方向通常是提前设定好的,其可以是预览框长和宽所在的方向,也可以是人为定义的横向和纵向,当然还可以是其他设定方式。该第一方向重叠率是指在第一方向上的扫描轨迹重叠率,其可以人为设定,比如不小于50%。每次扫描完毕,都会生成一组对应的扫描图像,该蛇形扫描的扫描长度可以是定值,也可以是变量,该扫描轨迹重叠率取决于相邻两次蛇形扫描的起点位置,比如请参见图2,对于扫描长度固定的相邻两次蛇形扫描,若扫描起点分别为a1和a2,扫描长度为b,则该扫描轨迹重叠率为[b-(a2-a1)]/b。In this embodiment, the second direction and the first direction are usually set in advance, which may be the direction in which the preview frame length and width are located, or may be an artificially defined horizontal and vertical direction, and may of course be other settings. the way. The first direction overlap ratio refers to a scan track overlap ratio in the first direction, which can be artificially set, such as not less than 50%. After each scan, a corresponding set of scanned images is generated. The scan length of the serpentine scan can be a fixed value or a variable, and the scan trajectory overlap rate depends on the starting position of two adjacent serpentine scans, such as Referring to FIG. 2, for two adjacent serpentine scans with a fixed scan length, if the scan start points are a1 and a2, respectively, and the scan length is b, the scan trace overlap ratio is [b-(a2-a1)]/b. .
104、根据每组扫描图像在该第二方向上生成对应的局部图像。104. Generate a corresponding partial image in the second direction according to each set of scanned images.
本实施例中,该局部图像是沿第二方向拼接形成的,由于每一组扫描图像并非针对整个预览框进行扫描,而是对预览框的某纵向区域或者横向区域进行扫描,故对应形成的拼接图像也并非全景图像,而是局部图像。In this embodiment, the partial image is formed by splicing in the second direction. Since each group of scanned images is not scanned for the entire preview frame, but a certain longitudinal or horizontal region of the preview frame is scanned, correspondingly formed The stitched image is also not a panoramic image but a partial image.
例如,上述步骤104具体可以包括:For example, the foregoing step 104 may specifically include:
1-1、根据每组扫描图像确定对应的关键帧图像组。1-1. Determine a corresponding key frame image group according to each set of scanned images.
例如,上述步骤1-1具体可以包括:For example, the foregoing step 1-1 may specifically include:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与该关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将该目标帧图像作为关键帧图像,并返回执行获取与该关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与该目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied. The operation of the preset condition.
本实施例中,图像处理中,特征点指的是图像灰度值发生剧烈变化的点或者在图像边 缘上曲率较大的点(即两个边缘的交点),每一特征点均可以包括纹理特征和颜色特征等信息。在对扫描图像进行拼接之前,需要先从扫描图像中过滤掉无需用于拼接的,比如对于相似度较高的图像只需取其一参与拼接,而对于相似度极低的图像则可以舍弃掉,等等,从而可以在保证图像信息完整的情况下,减少拼接图像的数量,提高拼接效率。In the embodiment, in the image processing, the feature point refers to a point where the gray value of the image changes drastically or a point with a large curvature on the edge of the image (ie, the intersection of the two edges), and each feature point may include a texture. Information such as features and color characteristics. Before the splicing of the scanned image, it is necessary to filter out the scanned image without splicing, for example, for the image with higher similarity, only one of the splicing is required, and for the image with very low similarity, the image can be discarded. , etc., so that the number of stitched images can be reduced and the stitching efficiency can be improved while ensuring the integrity of the image information.
进一步地,上述步骤“根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件”具体可以包括:Further, the above step "determining whether the target frame image satisfies a preset condition according to the feature point of the key frame image and the feature point of the target frame image" may specifically include:
将该关键帧图像的特征点与该目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计该关键帧图像中匹配成功的特征点的数量、以及该关键帧图像中特征点的总数量;Counting the number of feature points in the key frame image that match successfully, and the total number of feature points in the key frame image;
根据该匹配成功的特征点的数量、以及总数量判断该目标帧图像是否满足预设条件。Whether the target frame image satisfies a preset condition is determined according to the number of the feature points that are successfully matched and the total number.
本实施例中,该预设条件可以人为设定,比如可以是关键帧图像和目标帧图像彼此间的相似度在一定范围内,通常,匹配成功的特征点数量越多,相似度越高。In this embodiment, the preset condition may be manually set. For example, the similarity between the key frame image and the target frame image may be within a certain range. Generally, the more the number of feature points that are successfully matched, the higher the similarity.
进一步地,上述步骤“根据该匹配成功的特征点的数量、以及总数量判断该目标帧图像是否满足预设条件”具体可以包括:Further, the above step "determining whether the target frame image satisfies the preset condition according to the number of the feature points and the total number of the matching successes" may specifically include:
根据该该匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points and the total number of the matching successes;
当该相似度小于第一预设阈值,且该匹配成功的特征点的数量大于第二预设阈值时,判断该目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
本实施例中,可以计算匹配成功的特征点的数量与总数量之间的比值,将该比值作为相似度。该第一预设阈值和第二预设阈值可以人为设定,比如该第一预设阈值可以是70%,该第二预设阈值可以是20。In this embodiment, the ratio between the number of feature points matching the success and the total number can be calculated, and the ratio is taken as the similarity. The first preset threshold and the second preset threshold may be manually set. For example, the first preset threshold may be 70%, and the second preset threshold may be 20.
1-2、提取每一关键帧图像组中关键帧图像的特征点。1-2. Extract feature points of key frame images in each key frame image group.
1-3、根据该特征点对该关键帧图像组进行拼接,以在该第二方向上生成对应的局部图像。1-3. Splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
例如,上述步骤1-3具体可以包括:For example, the foregoing steps 1-3 may specifically include:
1-3-1、根据该关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵。1-3-1. Calculate a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group.
例如,上述步骤1-3-1具体可以包括:For example, the foregoing step 1-3-1 may specifically include:
将该关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据该位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
本实施例中,该单应性矩阵(Homography)(第一单应性矩阵)就是一个从一张图像到另一张图像映射关系的转换矩阵,具体的,可以先确定该相邻两帧关键帧图像中匹配成功的特征点是哪些,然后选取一定数量匹配成功的特征点来计算对应的单应性矩阵,使其中一帧关键帧图像中的特征点通过该单应性矩阵变换后,可以与另一帧关键帧图像中的特征点位于同一空间坐标系内。In this embodiment, the homography matrix (the first homography matrix) is a conversion matrix from one image to another image mapping. Specifically, the two adjacent frames may be determined first. Which feature points are successfully matched in the frame image, and then a certain number of matching feature points are selected to calculate the corresponding homography matrix, so that the feature points in one frame of the key frame image are transformed by the homography matrix, It is in the same spatial coordinate system as the feature points in another frame of keyframe images.
1-3-2、根据该第一单应性矩阵计算第一全局变换矩阵。1-3-2. Calculating a first global transformation matrix according to the first homography matrix.
本实施例中,可以按次序计算相邻帧关键帧图像的第一单应性矩阵,比如对于某个关键帧图像组M1~Mn,可以计算M1与M2之间、M2与M3之间、M3与M4之间、以及Mn-1与Mn之间的第一单应性矩阵,每一个单应性矩阵相当于该关键帧图像组的局部变换矩阵,最后,再将所有第一单应性矩阵统一到相同坐标系,得到第一全局变换矩阵。In this embodiment, the first homography matrix of the adjacent frame key frame image may be calculated in order, for example, for a certain key frame image group M1 Mn Mn, between M1 and M2, between M2 and M3, and M3 may be calculated. The first homography matrix between M4 and Mn-1 and Mn, each homography matrix is equivalent to the local transformation matrix of the key frame image group, and finally, all the first homography matrices Uniform to the same coordinate system to obtain the first global transformation matrix.
1-3-3、利用该第一全局变换矩阵对相应的关键帧图像组进行拼接。1-3-3. splicing the corresponding key frame image group by using the first global transformation matrix.
本实施例中,可以通过该全局变换矩阵将该关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,得到的图像即为拼接得到的局部图像。In this embodiment, each key frame image in the key frame image group can be projected into the same coordinate space system through the global transformation matrix, and the obtained image is a spliced partial image.
105、根据该局部图像生成全景图像。105. Generate a panoramic image according to the partial image.
例如,上述步骤105具体可以包括:For example, the foregoing step 105 may specifically include:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据该第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用该第二全局变换矩阵对该局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by the second global transformation matrix to obtain a panoramic image.
本实施例中,由于该蛇形扫描在第一方向上是重叠性扫描,也即相邻两次扫描操作的扫描轨迹部分重叠,故当扫描图像完成第二方向上的拼接时,还需在第一方向上进行进一步拼接,也即将每列(行)扫描图像拼接的局部图像沿行(列)所在的方向再一次拼接,实现二维网格拼接,这种拼接方式能将扫描图像所携带的图像信息充分利用起来,方法简单,拼接效果好,而且能适用于各种复杂场景的视频图像拼接,灵活性强。In this embodiment, since the serpentine scan is an overlapping scan in the first direction, that is, the scan trajectories of the adjacent two scan operations partially overlap, when the scan image completes the splicing in the second direction, Further splicing in the first direction, that is, the partial image spliced by each column (row) of the scanned image is spliced again in the direction in which the row (column) is located, thereby realizing two-dimensional mesh splicing, which can carry the scanned image The image information is fully utilized, the method is simple, the stitching effect is good, and the video image stitching suitable for various complicated scenes is strong, and the flexibility is strong.
由上述可知,本实施例提供的全景图像生成方法,应用于电子设备,通过获取全景拍摄指令,接着,根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中,而在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向,并根据每组扫描图像在该第二方向上生成对应的局部图像,之后根据该局部图像生成全景图像,从而能适用于各种复杂场景的图像拼接,方法简单,灵活性高,拼接效果好。It can be seen from the above that the panoramic image generating method provided by the embodiment is applied to an electronic device, by acquiring a panoramic shooting instruction, and then, according to the panoramic shooting instruction, the camera is started to perform video shooting, and the captured content is displayed in the preview box, and During the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction, and according to each set of scanned images The corresponding partial image is generated in the second direction, and then the panoramic image is generated according to the partial image, so that the image mosaic of various complex scenes can be applied, the method is simple, the flexibility is high, and the stitching effect is good.
在本实施例中,将从全景图像生成装置的角度进行描述,具体将以该全景图像生成装置集成在电子设备中为例进行详细说明。In the present embodiment, the description will be made from the perspective of the panoramic image generating device, and the detailed description will be made by taking the panoramic image generating device integrated in the electronic device as an example.
请参见图3,一种全景图像生成方法,应用于电子设备,具体流程可以如下:Referring to FIG. 3, a method for generating a panoramic image is applied to an electronic device, and the specific process may be as follows:
201、电子设备获取全景拍摄指令,并根据该全景拍摄指令启动摄像头进行视频拍摄,之后将拍摄内容显示在预览框中。201. The electronic device acquires a panoramic shooting instruction, and starts a camera to perform video shooting according to the panoramic shooting instruction, and then displays the captured content in a preview frame.
譬如,当电子设备进入拍摄界面时,可以点击该拍摄应用的全景拍摄按键,此时,电子设备会启动摄像头进行视频拍摄,并将拍摄内容实时显示在预览框中。For example, when the electronic device enters the shooting interface, the panoramic shooting button of the shooting application can be clicked. At this time, the electronic device starts the camera for video shooting, and displays the shooting content in the preview box in real time.
202、在视频拍摄过程中,电子设备沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向。202. During the video shooting process, the electronic device scans the preview frame in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
譬如,该第一方向可以为横向,该第二方向可以为纵向,也即电子设备会沿纵向对预览框中显示的内容进行蛇形扫描,请参见图2,对于扫描长度固定的相邻两次蛇形扫描,若扫描起点分别为a1和a2,扫描长度为b,则横向扫描重叠率为[b-(a2-a1)]/b,比如b/a可以不小于50%。For example, the first direction may be a horizontal direction, and the second direction may be a vertical direction, that is, the electronic device scans the content displayed in the preview frame in a longitudinal direction, as shown in FIG. 2, for two adjacent scan lengths. For a serpentine scan, if the scan start points are a1 and a2, respectively, and the scan length is b, the horizontal scan overlap ratio is [b-(a2-a1)]/b, for example, b/a may be not less than 50%.
203、电子设备根据每组扫描图像确定对应的关键帧图像组。203. The electronic device determines a corresponding key frame image group according to each group of scanned images.
例如,请参阅图4,上述步骤203具体可以包括:For example, referring to FIG. 4, the foregoing step 203 may specifically include:
2031、在每组扫描图像中,电子设备将第一帧扫描图像作为关键帧图像;2031. In each group of scanned images, the electronic device uses the first frame scanned image as a key frame image;
2032、电子设备获取与该关键帧图像相邻的下一帧扫描图像,作为目标帧图像;2032. The electronic device acquires a next frame scan image adjacent to the key frame image as a target frame image.
2033、电子设备根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件,若是,则将该目标帧图像作为关键帧图像,并返回执行上述步骤2032,若否,则将与该目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行上述步骤2033。The electronic device determines, according to the feature point of the key frame image and the feature point of the target frame image, whether the target frame image satisfies a preset condition, and if yes, uses the target frame image as a key frame image, and returns to perform the above steps. 2032. If no, the next frame scan image adjacent to the target frame image is used as the target frame image, and the process returns to step 2033.
本实施例中,在对扫描图像进行拼接之前,需要先从扫描图像中过滤掉无需用于拼接的,比如对于相似度较高的图像只需取其一参与拼接,而对于相似度极低的图像则可以舍弃掉,等等,从而可以在保证图像信息完整的情况下,减少拼接图像的数量,提高拼接效率,也即,上述步骤2033进一步可以包括:In this embodiment, before the splicing of the scanned image, it is necessary to filter out the scanned image without using for splicing, for example, for the image with higher similarity, only one of the splicing is required, and for the similarity is extremely low. The image can be discarded, and the like, so that the number of the spliced images can be reduced and the splicing efficiency can be improved, that is, the above step 2033 can further include:
将该关键帧图像的特征点与该目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计该关键帧图像中匹配成功的特征点的数量、以及该关键帧图像中特征点的总数量;Counting the number of feature points in the key frame image that match successfully, and the total number of feature points in the key frame image;
根据该该匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points and the total number of the matching successes;
当该相似度小于第一预设阈值,且该匹配成功的特征点的数量大于第二预设阈值时, 判断该目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
本实施例中,由于匹配成功的特征点越多,代表两者的相似度越高,反之则代表相似度越低,故当匹配成功的特征点的数量大于第二预设阈值,比如20时,可以认为两者的相似度不低于最低限度,当匹配成功的特征点数量与总数量的比值小于第一预设阈值,比如70%时,可以认为两者的相似度不高于最大限度,只有同时满足这两个条件的目标帧图像才能认为满足预设条件,才能作为关键帧图像。In this embodiment, the more the feature points are successfully matched, the higher the similarity between the two is represented, and the lower the similarity is, the lower the number of feature points that are successfully matched is greater than the second preset threshold, such as 20 o'clock. It can be considered that the similarity between the two is not lower than the minimum. When the ratio of the number of matching feature points to the total number is less than the first preset threshold, such as 70%, the similarity between the two can be considered not higher than the maximum. Only the target frame image that satisfies both of these conditions can be considered as a key frame image if it is considered to satisfy the preset condition.
204、电子设备提取每一关键帧图像组中关键帧图像的特征点,并将该关键帧图像组中相邻两帧关键帧图像的特征点进行匹配。204. The electronic device extracts feature points of the key frame image in each key frame image group, and matches feature points of adjacent two frame key frame images in the key frame image group.
205、电子设备获取匹配成功的特征点的位置信息,并根据该位置信息计算第一单应性矩阵。205. The electronic device acquires location information of the feature point that is successfully matched, and calculates a first homography matrix according to the location information.
206、电子设备根据该第一单应性矩阵计算第一全局变换矩阵,并利用该第一全局变换矩阵对相应的关键帧图像组进行拼接,得到局部图像。206. The electronic device calculates a first global transformation matrix according to the first homography matrix, and splices the corresponding key frame image group by using the first global transformation matrix to obtain a partial image.
譬如,由于每一关键帧图像组都是单次纵向扫描得到的,故当采用图像拼接的方式对关键帧图像组进行处理时,每一关键帧图像组拼接而成的局部图像都对应纵向扫描区域所包含的图像信息,具体拼接方法可以是先两两计算相邻关键帧图像的第一单应性矩阵,然后将所有第一单应性矩阵进行归一,得到全局变换矩阵,利用该全局变换矩阵将关键帧图像组中的每一关键帧图像都投射到相同的坐标空间中,完成每个关键帧图像组的纵向拼接。For example, since each key frame image group is obtained by a single vertical scan, when the key frame image group is processed by image stitching, the partial images of each key frame image group are corresponding to the vertical scan. The image information included in the region may be calculated by first calculating the first homography matrix of the adjacent key frame image, and then normalizing all the first homography matrices to obtain a global transformation matrix, and using the global The transformation matrix projects each key frame image in the key frame image group into the same coordinate space, completing the vertical splicing of each key frame image group.
207、电子设备根据相邻的两张局部图像计算对应的第二单应性矩阵,并根据该第二单应性矩阵计算第二全局变换矩阵,之后利用该第二全局变换矩阵对该局部图像在第一方向上进行拼接,得到全景图像。207. The electronic device calculates a corresponding second homography matrix according to the two adjacent partial images, and calculates a second global transformation matrix according to the second homography matrix, and then uses the second global transformation matrix to use the partial image. Splicing is performed in the first direction to obtain a panoramic image.
譬如,由于该蛇形扫描具有一定的横向重叠率,也即相邻两张局部图像中会存在相同的部分,故可以进一步对局部图像进行横向拼接,该拼接方式可以是先两两生成第二单应性矩阵,然后对第二单应性矩阵进行归一,得到第二全局变换矩阵,之后,利用该第二全局变换矩阵将所有局部图像都投射到一个坐标空间中,完成局部图像的横向拼接。For example, since the serpentine scan has a certain lateral overlap ratio, that is, the same portion exists in two adjacent partial images, the partial image can be further spliced horizontally, and the splicing method can be second to two. The homography matrix, then normalizes the second homography matrix to obtain a second global transformation matrix, and then uses the second global transformation matrix to project all partial images into a coordinate space to complete the lateral direction of the partial image. splice.
由上述可知,本实施例提供的全景图像生成方法,应用于电子设备,其中电子设备可以获取全景拍摄指令,并根据该全景拍摄指令启动摄像头进行视频拍摄,之后将拍摄内容显示在预览框中,接着,在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向,接着,根据每组扫描图像确定对应的关键帧图像组,接着,提取每一关键帧图像组中关键帧图像的特征点,并将该关键帧图像组中相邻两帧关键帧图像的特征点进行匹配,接着,获取匹配成功的特征点的位置信息,并根据该位置信息计算第一单应性矩阵,之后,根据该第一单应性矩阵计算第一全局变换矩阵,并利用该第一全局变换矩阵对相应的关键帧图像组进行拼接,得到局部图像,接着,根据相邻的两张局部图像计算对应的第二单应性矩阵,并根据该第二单应性矩阵计算第二全局变换矩阵,之后利用该第二全局变换矩阵对该局部图像在第一方向上进行拼接,得到全景图像,从而能采用二维网格的方式生成全景图,适用于各种复杂场景的图像拼接,方法简单,灵活性高,拼接效果好。It can be seen from the above that the panoramic image generating method provided in this embodiment is applied to an electronic device, wherein the electronic device can acquire a panoramic shooting instruction, and start a camera to perform video shooting according to the panoramic shooting instruction, and then display the captured content in a preview box. Then, during the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction, and then, according to each The group scan image determines a corresponding key frame image group, and then extracts feature points of the key frame image in each key frame image group, and matches feature points of adjacent two frame key frame images in the key frame image group, and then Obtaining location information of the matching feature point, and calculating a first homography matrix according to the location information, and then calculating a first global transformation matrix according to the first homography matrix, and using the first global transformation matrix pair The corresponding key frame image group is spliced to obtain a partial image, and then, the pair is calculated according to two adjacent partial images. a second homography matrix, and calculating a second global transformation matrix according to the second homography matrix, and then splicing the partial image in the first direction by using the second global transformation matrix to obtain a panoramic image, thereby enabling The two-dimensional grid is used to generate a panoramic image, which is suitable for image mosaic of various complicated scenes, and has the advantages of simple method, high flexibility and good stitching effect.
根据上述实施例所描述的方法,本实施例将从全景图像生成装置的角度进一步进行描述,该全景图像生成装置具体可以作为独立的实体来实现,也可以集成在电子设备,比如终端中来实现,该终端可以包括手机、平板电脑以及个人计算机等。According to the method described in the foregoing embodiment, the present embodiment will be further described from the perspective of the panoramic image generating device. The panoramic image generating device may be implemented as an independent entity or integrated in an electronic device, such as a terminal. The terminal may include a mobile phone, a tablet computer, a personal computer, and the like.
本申请实施例提供一种全景图像生成装置,应用于电子设备,其包括:The embodiment of the present application provides a panoramic image generating apparatus, which is applied to an electronic device, and includes:
获取模块,用于获取全景拍摄指令;An acquisition module, configured to acquire a panoramic shooting instruction;
拍摄模块,用于根据所述全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;a shooting module, configured to start a camera for video shooting according to the panoramic shooting instruction, and display the shooting content in a preview frame;
扫描模块,用于在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对所述预览框进行蛇形扫描,得到多组扫描图像,所述第一方向垂直于第二方向;a scanning module, configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting process to obtain a plurality of sets of scanned images, where the first direction is perpendicular to the second direction ;
第一生成模块,用于根据每组扫描图像在所述第二方向上生成对应的局部图像;a first generating module, configured to generate a corresponding partial image in the second direction according to each set of scanned images;
第二生成模块,用于根据所述局部图像生成全景图像。And a second generating module, configured to generate a panoramic image according to the partial image.
在一些实施例中,所述第一生成模块具体包括:In some embodiments, the first generating module specifically includes:
确定子模块,用于根据每组扫描图像确定对应的关键帧图像组;Determining a sub-module for determining a corresponding key frame image group according to each set of scanned images;
提取子模块,用于提取每一关键帧图像组中关键帧图像的特征点;Extracting a sub-module for extracting feature points of key frame images in each key frame image group;
拼接子模块,用于根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And a splicing sub-module, configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
在一些实施例中,所述拼接子模块用于:In some embodiments, the splicing sub-module is used to:
根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
在一些实施例中,所述拼接子模块具体用于:In some embodiments, the splicing sub-module is specifically configured to:
将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
在一些实施例中,所述拼接子模块具体用于:In some embodiments, the splicing sub-module is specifically configured to:
通过所述第一全局变换矩阵,将所述关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,以对所述关键帧图像组进行拼接。And each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
在一些实施例中,所述确定子模块具体用于:In some embodiments, the determining sub-module is specifically configured to:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
在一些实施例中,所述确定子模块具体用于:In some embodiments, the determining sub-module is specifically configured to:
将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
在一些实施例中,所述确定子模块具体用于:In some embodiments, the determining sub-module is specifically configured to:
根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
在一些实施例中,所述第二生成模块具体用于:In some embodiments, the second generating module is specifically configured to:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
请参阅图5,图5具体描述了本申请实施例提供的全景图像生成装置,应用于电子设备,该全景图像生成装置可以包括:获取模块10、拍摄模块20、扫描模块30、第一生成模块40和第二生成模块50,其中:Referring to FIG. 5 , FIG. 5 specifically describes a panoramic image generating apparatus according to an embodiment of the present application, which is applied to an electronic device, and the panoramic image generating apparatus may include: an acquiring module 10, a shooting module 20, a scanning module 30, and a first generating module. 40 and a second generation module 50, wherein:
(1)获取模块10(1) Acquisition module 10
获取模块10,用于获取全景拍摄指令。The obtaining module 10 is configured to acquire a panoramic shooting instruction.
本实施例中,当用户点击拍照应用的某个按钮时,电子设备可以生成全景拍摄指令。In this embodiment, when the user clicks a certain button of the photographing application, the electronic device may generate a panoramic shooting instruction.
(2)拍摄模块20(2) shooting module 20
拍摄模块20,用于根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中。The shooting module 20 is configured to start a camera for video shooting according to the panoramic shooting instruction, and display the captured content in a preview frame.
本实施例中,该预览框的大小可以人为设定,也可以根据电子设备显示屏的尺寸而定,比如是显示屏尺寸的四分之三。In this embodiment, the size of the preview frame may be manually set, or may be determined according to the size of the display screen of the electronic device, such as three-quarters of the size of the display screen.
(3)扫描模块30(3) Scanning module 30
扫描模块30,用于在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向。The scanning module 30 is configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction.
本实施例中,该第二方向和第一方向通常是提前设定好的,其可以是预览框长和宽所在的方向,也可以是人为定义的横向和纵向,当然还可以是其他设定方式。该第一方向重叠率是指在第一方向上的扫描轨迹重叠率,其可以人为设定,比如不小于50%。每次扫描完毕,都会生成一组对应的扫描图像,该蛇形扫描的扫描长度可以是定值,也可以是变量,该扫描轨迹重叠率取决于相邻两次蛇形扫描的起点位置,比如请参见图2,对于扫描长度固定的相邻两次蛇形扫描,若扫描长度为a,在第一方向上的重叠长度为b,则该扫描轨迹重叠率为b/a。In this embodiment, the second direction and the first direction are usually set in advance, which may be the direction in which the preview frame length and width are located, or may be an artificially defined horizontal and vertical direction, and may of course be other settings. the way. The first direction overlap ratio refers to a scan track overlap ratio in the first direction, which can be artificially set, such as not less than 50%. After each scan, a corresponding set of scanned images is generated. The scan length of the serpentine scan can be a fixed value or a variable, and the scan trajectory overlap rate depends on the starting position of two adjacent serpentine scans, such as Referring to FIG. 2, for two adjacent serpentine scans with a fixed scan length, if the scan length is a and the overlap length in the first direction is b, the scan track overlap ratio is b/a.
(4)第一生成模块40(4) First generation module 40
第一生成模块40,用于根据每组扫描图像在该第二方向上生成对应的局部图像。The first generating module 40 is configured to generate a corresponding partial image in the second direction according to each set of scanned images.
本实施例中,该局部图像是沿第二方向拼接形成的,由于每一组扫描图像并非针对整个预览框进行扫描,而是对预览框的某纵向区域或者横向区域进行扫描,故对应形成的拼接图像也并非全景图像,而是局部图像。In this embodiment, the partial image is formed by splicing in the second direction. Since each group of scanned images is not scanned for the entire preview frame, but a certain longitudinal or horizontal region of the preview frame is scanned, correspondingly formed The stitched image is also not a panoramic image but a partial image.
例如,请参见图6,该第一生成模块40具体可以包括确定子模块41、提取子模块42和拼接子模块43,其中:For example, referring to FIG. 6, the first generating module 40 may specifically include a determining submodule 41, an extracting submodule 42 and a splicing submodule 43, where:
确定子模块41,用于根据每组扫描图像确定对应的关键帧图像组。The determining sub-module 41 is configured to determine a corresponding key frame image group according to each set of scanned images.
例如,该确定子模块41具体可以用于:For example, the determining sub-module 41 can be specifically used to:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与该关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将该目标帧图像作为关键帧图像,并返回执行获取与该关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与该目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据该关键帧图像的特征点、以及该目标帧图像的特征点判断该目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to perform the feature point according to the key frame image and the feature point of the target frame image to determine whether the target frame image is satisfied. The operation of the preset condition.
本实施例中,图像处理中,特征点指的是图像灰度值发生剧烈变化的点或者在图像边缘上曲率较大的点(即两个边缘的交点),每一特征点均可以包括纹理特征和颜色特征等信息。在对扫描图像进行拼接之前,需要先从扫描图像中过滤掉无需用于拼接的,比如对于相似度较高的图像只需取其一参与拼接,而对于相似度极低的图像则可以舍弃掉,等等,从而可以在保证图像信息完整的情况下,减少拼接图像的数量,提高拼接效率。In the embodiment, in the image processing, the feature point refers to a point where the gray value of the image changes drastically or a point with a large curvature on the edge of the image (ie, the intersection of the two edges), and each feature point may include a texture. Information such as features and color characteristics. Before the splicing of the scanned image, it is necessary to filter out the scanned image without splicing, for example, for the image with higher similarity, only one of the splicing is required, and for the image with very low similarity, the image can be discarded. , etc., so that the number of stitched images can be reduced and the stitching efficiency can be improved while ensuring the integrity of the image information.
例如,该确定子模块41具体可以用于:For example, the determining sub-module 41 can be specifically used to:
将该关键帧图像的特征点与该目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计该关键帧图像中匹配成功的特征点的数量、以及该关键帧图像中特征点的总数量;Counting the number of feature points in the key frame image that match successfully, and the total number of feature points in the key frame image;
根据该匹配成功的特征点的数量、以及总数量判断该目标帧图像是否满足预设条件。Whether the target frame image satisfies a preset condition is determined according to the number of the feature points that are successfully matched and the total number.
本实施例中,该预设条件可以人为设定,比如可以是关键帧图像和目标帧图像彼此间的相似度在一定范围内,通常,匹配成功的特征点数量越多,相似度越高。In this embodiment, the preset condition may be manually set. For example, the similarity between the key frame image and the target frame image may be within a certain range. Generally, the more the number of feature points that are successfully matched, the higher the similarity.
进一步地,该确定子模块41具体用于:Further, the determining sub-module 41 is specifically configured to:
根据该该匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points and the total number of the matching successes;
当该相似度小于第一预设阈值,且该匹配成功的特征点的数量大于第二预设阈值时,判断该目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
本实施例中,可以计算匹配成功的特征点的数量与总数量之间的比值,将该比值作为相似度。该第一预设阈值和第二预设阈值可以人为设定,比如该第一预设阈值可以是70%,该第二预设阈值可以是20。In this embodiment, the ratio between the number of feature points matching the success and the total number can be calculated, and the ratio is taken as the similarity. The first preset threshold and the second preset threshold may be manually set. For example, the first preset threshold may be 70%, and the second preset threshold may be 20.
提取子模块42,用于提取每一关键帧图像组中关键帧图像的特征点。The extraction sub-module 42 is configured to extract feature points of the key frame image in each key frame image group.
拼接子模块43,用于根据该特征点对该关键帧图像组进行拼接,以在该第二方向上生成对应的局部图像。The splicing sub-module 43 is configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
例如,该拼接子模块43具体可以用于:For example, the splicing submodule 43 can be specifically used to:
1-3-1、根据该关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵。1-3-1. Calculate a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group.
此时,该拼接子模块43具体可以用于:At this time, the splicing sub-module 43 can be specifically used to:
将该关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据该位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
本实施例中,该单应性矩阵(Homography)(第一单应性矩阵)就是一个从一张图像到另一张图像映射关系的转换矩阵,具体的,可以先确定该相邻两帧关键帧图像中匹配成功的特征点是哪些,然后选取一定数量匹配成功的特征点来计算对应的单应性矩阵,使其中一帧关键帧图像中的特征点通过该单应性矩阵变换后,可以与另一帧关键帧图像中的特征点位于同一空间坐标系内。In this embodiment, the homography matrix (the first homography matrix) is a conversion matrix from one image to another image mapping. Specifically, the two adjacent frames may be determined first. Which feature points are successfully matched in the frame image, and then a certain number of matching feature points are selected to calculate the corresponding homography matrix, so that the feature points in one frame of the key frame image are transformed by the homography matrix, It is in the same spatial coordinate system as the feature points in another frame of keyframe images.
1-3-2、根据该第一单应性矩阵计算第一全局变换矩阵。1-3-2. Calculating a first global transformation matrix according to the first homography matrix.
本实施例中,可以按次序计算相邻帧关键帧图像的第一单应性矩阵,比如对于某个关键帧图像组M1~Mn,可以计算M1与M2之间、M2与M3之间、M3与M4之间、以及Mn-1与Mn之间的第一单应性矩阵,每一个单应性矩阵相当于该关键帧图像组的局部变换矩阵,最后,再将所有第一单应性矩阵统一到相同坐标系,得到第一全局变换矩阵。In this embodiment, the first homography matrix of the adjacent frame key frame image may be calculated in order, for example, for a certain key frame image group M1 Mn Mn, between M1 and M2, between M2 and M3, and M3 may be calculated. The first homography matrix between M4 and Mn-1 and Mn, each homography matrix is equivalent to the local transformation matrix of the key frame image group, and finally, all the first homography matrices Uniform to the same coordinate system to obtain the first global transformation matrix.
1-3-3、利用该第一全局变换矩阵对相应的关键帧图像组进行拼接。1-3-3. splicing the corresponding key frame image group by using the first global transformation matrix.
本实施例中,可以通过该全局变换矩阵将该关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,得到的图像即为拼接得到的局部图像。In this embodiment, each key frame image in the key frame image group can be projected into the same coordinate space system through the global transformation matrix, and the obtained image is a spliced partial image.
(5)第二生成模块50(5) Second generation module 50
第二生成模块50,用于根据该局部图像生成全景图像。The second generating module 50 is configured to generate a panoramic image according to the partial image.
例如,该第二生成模块50具体可以用于:For example, the second generating module 50 can be specifically configured to:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据该第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用该第二全局变换矩阵对该局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by the second global transformation matrix to obtain a panoramic image.
本实施例中,由于该蛇形扫描在第一方向上是重叠性扫描,也即相邻两次扫描操作的扫描轨迹部分重叠,故当扫描图像完成第二方向上的拼接时,还需在第一方向上进行进一 步拼接,也即将每列(行)扫描图像拼接的局部图像沿行(列)所在的方向再一次拼接,实现二维网格拼接,这种拼接方式能将扫描图像所携带的图像信息充分利用起来,方法简单,拼接效果好,而且能适用于各种复杂场景的视频图像拼接,灵活性强。In this embodiment, since the serpentine scan is an overlapping scan in the first direction, that is, the scan trajectories of the adjacent two scan operations partially overlap, when the scan image completes the splicing in the second direction, Further splicing in the first direction, that is, the partial image spliced by each column (row) of the scanned image is spliced again in the direction in which the row (column) is located, thereby realizing two-dimensional mesh splicing, which can carry the scanned image The image information is fully utilized, the method is simple, the stitching effect is good, and the video image stitching suitable for various complicated scenes is strong, and the flexibility is strong.
具体实施时,以上各个单元可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元的具体实施可参见前面的方法实施例,在此不再赘述。In the specific implementation, the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same or a plurality of entities. For the specific implementation of the foregoing, refer to the foregoing method embodiments, and details are not described herein.
由上述可知,本实施例提供的全景图像生成方法,应用于电子设备,通过获取模块10获取全景拍摄指令,接着,拍摄模块20根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中,而在视频拍摄过程中,扫描模块30沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向,第一生成模块40根据每组扫描图像在该第二方向上生成对应的局部图像,之后第二生成模块50根据该局部图像生成全景图像,从而能适用于各种复杂场景的图像拼接,方法简单,灵活性高,拼接效果好。It can be seen from the above that the panoramic image generating method provided in this embodiment is applied to an electronic device, and the panoramic shooting instruction is acquired by the acquiring module 10. Then, the shooting module 20 starts the camera to perform video shooting according to the panoramic shooting instruction, and displays the captured content in the In the preview frame, during the video shooting process, the scanning module 30 performs a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second The first generation module 40 generates a corresponding partial image in the second direction according to each set of scanned images, and then the second generation module 50 generates a panoramic image according to the partial image, so that the image mosaic can be applied to various complex scenes. The method is simple, the flexibility is high, and the stitching effect is good.
另外,本申请实施例还提供了一种电子设备,该电子设备可以是智能手机、平板电脑等设备。图7所示,电子设备900包括处理器901、存储器902、显示屏903以及控制电路904。其中,处理器901分别与存储器902、显示屏903、控制电路904电性连接。In addition, the embodiment of the present application further provides an electronic device, which may be a device such as a smart phone or a tablet computer. As shown in FIG. 7, the electronic device 900 includes a processor 901, a memory 902, a display screen 903, and a control circuit 904. The processor 901 is electrically connected to the memory 902, the display screen 903, and the control circuit 904, respectively.
处理器901是电子设备900的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或加载存储在存储器902内的应用程序,以及调用存储在存储器902内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 901 is a control center of the electronic device 900, and connects various parts of the entire electronic device using various interfaces and lines, executes the electronic by running or loading an application stored in the memory 902, and calling data stored in the memory 902. The various functions and processing data of the device enable overall monitoring of the electronic device.
在本实施例中,电子设备900中的处理器901会按照如下的步骤,将一个或一个以上的应用程序的进程对应的指令加载到存储器902中,并由处理器901来运行存储在存储器902中的应用程序,从而实现各种功能:In this embodiment, the processor 901 in the electronic device 900 loads the instructions corresponding to the process of one or more applications into the memory 902 according to the following steps, and is stored in the memory 902 by the processor 901. In the application, thus implementing various functions:
获取全景拍摄指令;Obtain a panoramic shooting instruction;
根据该全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;Starting the camera to perform video shooting according to the panoramic shooting instruction, and displaying the shooting content in the preview box;
在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对该预览框进行蛇形扫描,得到多组扫描图像,该第一方向垂直于第二方向;During the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction;
根据每组扫描图像在该第二方向上生成对应的局部图像;Generating a corresponding partial image in the second direction according to each set of scanned images;
根据该局部图像生成全景图像。A panoramic image is generated based on the partial image.
在一些实施例中,所述根据每组扫描图像在所述第二方向上生成对应的局部图像,包括:In some embodiments, the generating a corresponding partial image in the second direction according to each set of scanned images comprises:
根据每组扫描图像确定对应的关键帧图像组;Determining a corresponding key frame image group according to each set of scanned images;
提取每一关键帧图像组中关键帧图像的特征点;Extracting feature points of key frame images in each key frame image group;
根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
在一些实施例中,所述根据所述特征点对所述关键帧图像组进行拼接,包括:In some embodiments, the splicing the key frame image group according to the feature point comprises:
根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
在一些实施例中,所述根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵,包括:In some embodiments, the calculating the corresponding first homography matrix according to the feature points of the adjacent two frame key frame images in the key frame image group includes:
将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
在一些实施例中,所述利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接,包括:In some embodiments, the splicing the corresponding key frame image group by using the first global transformation matrix comprises:
通过所述第一全局变换矩阵,将所述关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,以对所述关键帧图像组进行拼接。And each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
在一些实施例中,所述根据每组扫描图像确定对应的关键帧图像组,包括:In some embodiments, the determining the corresponding key frame image group according to each set of scanned images comprises:
在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
在一些实施例中,所述根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件,包括:In some embodiments, determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image includes:
将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
在一些实施例中,所述根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件,包括:In some embodiments, determining whether the target frame image satisfies a preset condition according to the number of the successfully matched feature points and the total number includes:
根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
在一些实施例中,所述根据所述局部图像生成全景图像,包括:In some embodiments, the generating the panoramic image according to the partial image comprises:
根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
存储器902可用于存储应用程序和数据。存储器902存储的应用程序中包含有可在处理器中执行的指令。应用程序可以组成各种功能模块。处理器901通过运行存储在存储器902的应用程序,从而执行各种功能应用以及数据处理。 Memory 902 can be used to store applications and data. The application stored in the memory 902 contains instructions executable in the processor. Applications can form various functional modules. The processor 901 executes various functional applications and data processing by running an application stored in the memory 902.
显示屏903可用于显示由用户输入的信息或提供给用户的信息以及终端的各种图形用户接口,这些图形用户接口可以由图像、文本、图标、视频和其任意组合来构成。The display screen 903 can be used to display information entered by the user or information provided to the user as well as various graphical user interfaces of the terminal, which can be composed of images, text, icons, video, and any combination thereof.
控制电路904与显示屏903电性连接,用于控制显示屏903显示信息。The control circuit 904 is electrically connected to the display screen 903 for controlling the display screen 903 to display information.
在一些实施例中,如图7所示,电子设备900还包括:射频电路905、输入单元906、音频电路907、传感器908以及电源909。其中,处理器901分别与射频电路905、输入单元906、音频电路907、传感器908以及电源909电性连接。In some embodiments, as shown in FIG. 7, the electronic device 900 further includes a radio frequency circuit 905, an input unit 906, an audio circuit 907, a sensor 908, and a power source 909. The processor 901 is electrically connected to the radio frequency circuit 905, the input unit 906, the audio circuit 907, the sensor 908, and the power source 909, respectively.
射频电路905用于收发射频信号,以通过无线通信与网络设备或其他电子设备建立无线通讯,与网络设备或其他电子设备之间收发信号。The radio frequency circuit 905 is used for transmitting and receiving radio frequency signals to establish wireless communication with network devices or other electronic devices through wireless communication, and to transmit and receive signals with network devices or other electronic devices.
输入单元906可用于接收输入的数字、字符信息或用户特征信息(例如指纹),以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。其中,输入单元906可以包括指纹识别模组。The input unit 906 can be configured to receive input digits, character information, or user characteristic information (eg, fingerprints), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function controls. The input unit 906 can include a fingerprint identification module.
音频电路907可通过扬声器、传声器提供用户与终端之间的音频接口。The audio circuit 907 can provide an audio interface between the user and the terminal through a speaker and a microphone.
电子设备900还可以包括至少一种传感器908,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板的亮度,接近传感器可在终端移动到耳边时,关闭显示面板和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于终端还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。 Electronic device 900 may also include at least one type of sensor 908, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may close the display panel and/or the backlight when the terminal moves to the ear. . As a kind of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the terminal can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, no longer Narration.
电源909用于给电子设备900的各个部件供电。在一些实施例中,电源909可以通过电源管理系统与处理器901逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。 Power source 909 is used to power various components of electronic device 900. In some embodiments, the power supply 909 can be logically coupled to the processor 901 through a power management system to enable functions such as managing charging, discharging, and power management through the power management system.
尽管图7中未示出,电子设备900还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown in FIG. 7, the electronic device 900 may further include a camera, a Bluetooth module, and the like, and details are not described herein.
本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过指令来完成,或通过指令控制相关的硬件来完成,该指令可以存储于一计算机可读存储介质中,并由处理器进行加载和执行。为此,本发明实施例提供一种存储介质,其中存储有多条指令,该指令能够被处理器进行加载,以执行本发明实施例所提供的任一种全景图像生成方法中的步骤。It will be understood by those skilled in the art that all or part of the steps of the various methods in the above embodiments may be completed by instructions or controlled by related hardware, which may be stored in a computer readable storage medium. And loaded and executed by the processor. To this end, an embodiment of the present invention provides a storage medium in which a plurality of instructions are stored, which can be loaded by a processor to perform the steps in any of the panoramic image generating methods provided by the embodiments of the present invention.
其中,该存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。The storage medium may include: a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
由于该存储介质中所存储的指令,可以执行本发明实施例所提供的任一种全景图像生成方法中的步骤,因此,可以实现本发明实施例所提供的任一种全景图像生成方法所能实现的有益效果,详见前面的实施例,在此不再赘述。The steps in the method for generating a panoramic image according to any embodiment of the present invention can be performed by using the instructions stored in the storage medium. Therefore, any method for generating a panoramic image provided by the embodiments of the present invention can be implemented. For the beneficial effects of the implementation, please refer to the previous embodiments, and details are not described herein again.
以上各个操作的具体实施可参见前面的实施例,在此不再赘述。For the specific implementation of the foregoing operations, refer to the foregoing embodiments, and details are not described herein again.
综上所述,虽然本申请已以优选实施例揭露如上,但上述优选实施例并非用以限制本申请,本领域的普通技术人员,在不脱离本申请的精神和范围内,均可作各种更动与润饰,因此本申请的保护范围以权利要求界定的范围为准。In the above, although the present application has been disclosed in the above preferred embodiments, the preferred embodiments are not intended to limit the application, and those skilled in the art can make various modifications without departing from the spirit and scope of the application. The invention is modified and retouched, and the scope of protection of the present application is determined by the scope defined by the claims.

Claims (20)

  1. 一种全景图像生成方法,应用于电子设备,其包括:A panoramic image generating method is applied to an electronic device, including:
    获取全景拍摄指令;Obtain a panoramic shooting instruction;
    根据所述全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;Activating a camera for video shooting according to the panoramic shooting instruction, and displaying the captured content in a preview frame;
    在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对所述预览框进行蛇形扫描,得到多组扫描图像,所述第一方向垂直于第二方向;During the video shooting, the preview frame is subjected to a serpentine scan at a preset first direction overlap ratio in the second direction to obtain a plurality of sets of scanned images, the first direction being perpendicular to the second direction;
    根据每组扫描图像在所述第二方向上生成对应的局部图像;Generating a corresponding partial image in the second direction according to each set of scanned images;
    根据所述局部图像生成全景图像。A panoramic image is generated based on the partial image.
  2. 根据权利要求1所述的全景图像生成方法,其中,所述根据每组扫描图像在所述第二方向上生成对应的局部图像,包括:The panoramic image generating method according to claim 1, wherein the generating a corresponding partial image in the second direction according to each set of scanned images comprises:
    根据每组扫描图像确定对应的关键帧图像组;Determining a corresponding key frame image group according to each set of scanned images;
    提取每一关键帧图像组中关键帧图像的特征点;Extracting feature points of key frame images in each key frame image group;
    根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
  3. 根据权利要求2所述的全景图像生成方法,其中,所述根据所述特征点对所述关键帧图像组进行拼接,包括:The method of generating a panoramic image according to claim 2, wherein the splicing the key frame image group according to the feature point comprises:
    根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
    根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
    利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
  4. 根据权利要求3所述的全景图像生成方法,其中,所述根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵,包括:The method for generating a panoramic image according to claim 3, wherein the calculating the corresponding first homography matrix according to the feature points of the adjacent two frame key frame images in the key frame image group comprises:
    将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
    获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
    根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
  5. 根据权利要求3所述的全景图像生成方法,其中,所述利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接,包括:The method of generating a panoramic image according to claim 3, wherein the splicing the corresponding key frame image group by using the first global transformation matrix comprises:
    通过所述第一全局变换矩阵,将所述关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,以对所述关键帧图像组进行拼接。And each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
  6. 根据权利要求2所述的全景图像生成方法,其中,所述根据每组扫描图像确定对应的关键帧图像组,包括:The panoramic image generating method according to claim 2, wherein the determining the corresponding key frame image group according to each set of scanned images comprises:
    在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
    获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
    根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
    若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
    若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  7. 根据权利要求6所述的全景图像生成方法,其中,所述根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件,包括:The panoramic image generating method according to claim 6, wherein the determining whether the target frame image satisfies a preset condition according to the feature point of the key frame image and the feature point of the target frame image comprises:
    将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
    统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
    根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
  8. 根据权利要求7所述的全景图像生成方法,其中,所述根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件,包括:The panoramic image generating method according to claim 7, wherein the determining whether the target frame image satisfies a preset condition according to the number of the feature points and the total number of the matching successful points includes:
    根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
    当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
  9. 根据权利要求1所述的全景图像生成方法,其中,所述根据所述局部图像生成全景图像,包括:The panoramic image generating method according to claim 1, wherein the generating the panoramic image according to the partial image comprises:
    根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
    根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
    利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  10. 一种全景图像生成装置,应用于电子设备,其包括:A panoramic image generating device is applied to an electronic device, including:
    获取模块,用于获取全景拍摄指令;An acquisition module, configured to acquire a panoramic shooting instruction;
    拍摄模块,用于根据所述全景拍摄指令启动摄像头进行视频拍摄,并将拍摄内容显示在预览框中;a shooting module, configured to start a camera for video shooting according to the panoramic shooting instruction, and display the shooting content in a preview frame;
    扫描模块,用于在视频拍摄过程中,沿第二方向以预设的第一方向重叠率对所述预览框进行蛇形扫描,得到多组扫描图像,所述第一方向垂直于第二方向;a scanning module, configured to perform a serpentine scan on the preview frame in a second direction at a preset first direction overlap ratio during the video shooting process to obtain a plurality of sets of scanned images, where the first direction is perpendicular to the second direction ;
    第一生成模块,用于根据每组扫描图像在所述第二方向上生成对应的局部图像;a first generating module, configured to generate a corresponding partial image in the second direction according to each set of scanned images;
    第二生成模块,用于根据所述局部图像生成全景图像。And a second generating module, configured to generate a panoramic image according to the partial image.
  11. 根据权利要求10所述的全景图像生成装置,其中,所述第一生成模块具体包括:The panoramic image generating apparatus according to claim 10, wherein the first generating module specifically comprises:
    确定子模块,用于根据每组扫描图像确定对应的关键帧图像组;Determining a sub-module for determining a corresponding key frame image group according to each set of scanned images;
    提取子模块,用于提取每一关键帧图像组中关键帧图像的特征点;Extracting a sub-module for extracting feature points of key frame images in each key frame image group;
    拼接子模块,用于根据所述特征点对所述关键帧图像组进行拼接,以在所述第二方向上生成对应的局部图像。And a splicing sub-module, configured to splicing the key frame image group according to the feature point to generate a corresponding partial image in the second direction.
  12. 根据权利要求11所述的全景图像生成装置,其中,所述拼接子模块用于:The panoramic image generating apparatus according to claim 11, wherein said splicing sub-module is used to:
    根据所述关键帧图像组中相邻两帧关键帧图像的特征点计算对应的第一单应性矩阵;Calculating a corresponding first homography matrix according to feature points of adjacent two frame key frame images in the key frame image group;
    根据所述第一单应性矩阵计算第一全局变换矩阵;Calculating a first global transformation matrix according to the first homography matrix;
    利用所述第一全局变换矩阵对相应的关键帧图像组进行拼接。The corresponding key frame image group is spliced by the first global transformation matrix.
  13. 根据权利要求12所述的全景图像生成装置,其中,所述拼接子模块具体用于:The panoramic image generating apparatus according to claim 12, wherein the splicing sub-module is specifically configured to:
    将所述关键帧图像组中相邻两帧关键帧图像的特征点进行匹配;Matching feature points of adjacent two frame key frame images in the key frame image group;
    获取匹配成功的特征点的位置信息;Obtaining location information of the feature points that match the success;
    根据所述位置信息计算第一单应性矩阵。A first homography matrix is calculated based on the location information.
  14. 根据权利要求12所述的全景图像生成装置,其中,所述拼接子模块具体用于:The panoramic image generating apparatus according to claim 12, wherein the splicing sub-module is specifically configured to:
    通过所述第一全局变换矩阵,将所述关键帧图像组中的每一张关键帧图像都投射到同一坐标空间系中,以对所述关键帧图像组进行拼接。And each key frame image in the key frame image group is projected into the same coordinate space system by the first global transformation matrix to splicing the key frame image group.
  15. 根据权利要求11所述的全景图像生成装置,其中,所述确定子模块具体用于:The panoramic image generating apparatus according to claim 11, wherein the determining submodule is specifically configured to:
    在每组扫描图像中,将第一帧扫描图像作为关键帧图像;In each set of scanned images, the first frame scanned image is used as a key frame image;
    获取与所述关键帧图像相邻的下一帧扫描图像,作为目标帧图像;Obtaining a next frame scan image adjacent to the key frame image as a target frame image;
    根据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件;Determining whether the target frame image satisfies a preset condition according to a feature point of the key frame image and a feature point of the target frame image;
    若是,则将所述目标帧图像作为关键帧图像,并返回执行获取与所述关键帧图像相邻的下一帧扫描图像的操作;If yes, using the target frame image as a key frame image, and returning to perform an operation of acquiring a next frame scan image adjacent to the key frame image;
    若否,则将与所述目标帧图像相邻的下一帧扫描图像作为目标帧图像,并返回执行根 据所述关键帧图像的特征点、以及所述目标帧图像的特征点判断所述目标帧图像是否满足预设条件的操作。If not, the next frame scan image adjacent to the target frame image is used as the target frame image, and returning to performing the feature point according to the key frame image and the feature point of the target frame image to determine the target Whether the frame image satisfies the preset condition.
  16. 根据权利要求15所述的全景图像生成装置,其中,所述确定子模块具体用于:The panoramic image generating apparatus according to claim 15, wherein the determining submodule is specifically configured to:
    将所述关键帧图像的特征点与所述目标帧图像的特征点进行匹配;Matching feature points of the key frame image with feature points of the target frame image;
    统计所述关键帧图像中匹配成功的特征点的数量、以及所述关键帧图像中特征点的总数量;Counting the number of feature points that are successfully matched in the key frame image, and the total number of feature points in the key frame image;
    根据所述匹配成功的特征点的数量、以及总数量判断所述目标帧图像是否满足预设条件。Determining whether the target frame image satisfies a preset condition according to the number of feature points that are successfully matched, and the total number.
  17. 根据权利要求16所述的全景图像生成装置,其中,所述确定子模块具体用于:The panoramic image generating apparatus according to claim 16, wherein the determining submodule is specifically configured to:
    根据所述匹配成功的特征点的数量以及总数量计算相似度;Calculating the similarity according to the number of the feature points that are successfully matched and the total number;
    当所述相似度小于第一预设阈值,且所述匹配成功的特征点的数量大于第二预设阈值时,判断所述目标帧图像满足预设条件。When the similarity is less than the first preset threshold, and the number of the successfully matched feature points is greater than the second preset threshold, determining that the target frame image satisfies the preset condition.
  18. 根据权利要求10所述的全景图像生成装置,其中,所述第二生成模块具体用于:The panoramic image generating apparatus according to claim 10, wherein the second generating module is specifically configured to:
    根据相邻的两张局部图像计算对应的第二单应性矩阵;Calculating a corresponding second homography matrix according to two adjacent partial images;
    根据所述第二单应性矩阵计算第二全局变换矩阵;Calculating a second global transformation matrix according to the second homography matrix;
    利用所述第二全局变换矩阵对所述局部图像在第一方向上进行拼接,得到全景图像。The partial image is spliced in the first direction by using the second global transformation matrix to obtain a panoramic image.
  19. 一种存储介质,其中,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行权利要求1所述的全景图像生成方法。A storage medium, wherein the storage medium stores a plurality of instructions adapted to be loaded by a processor to perform the panoramic image generating method of claim 1.
  20. 一种电子设备,其包括处理器和存储器,所述处理器与所述存储器电性连接,所述存储器用于存储指令和数据,所述处理器用于执行权利要求1所述的全景图像生成方法中的步骤。An electronic device comprising a processor and a memory, the processor being electrically connected to the memory, the memory for storing instructions and data, the processor for performing the panoramic image generating method of claim 1. The steps in .
PCT/CN2018/122029 2018-01-05 2018-12-19 Method and device for generating panoramic image, storage medium, and electronic apparatus WO2019134516A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810011559.2A CN110012209B (en) 2018-01-05 2018-01-05 Panoramic image generation method and device, storage medium and electronic equipment
CN201810011559.2 2018-01-05

Publications (1)

Publication Number Publication Date
WO2019134516A1 true WO2019134516A1 (en) 2019-07-11

Family

ID=67143617

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/122029 WO2019134516A1 (en) 2018-01-05 2018-12-19 Method and device for generating panoramic image, storage medium, and electronic apparatus

Country Status (2)

Country Link
CN (1) CN110012209B (en)
WO (1) WO2019134516A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110648363A (en) * 2019-09-16 2020-01-03 腾讯科技(深圳)有限公司 Camera posture determining method and device, storage medium and electronic equipment
CN112257595A (en) * 2020-10-22 2021-01-22 广州市百果园网络科技有限公司 Video matching method, device, equipment and storage medium
CN112991180A (en) * 2021-03-25 2021-06-18 北京百度网讯科技有限公司 Image splicing method, device, equipment and storage medium
CN113269671A (en) * 2021-04-09 2021-08-17 浙江省交通运输科学研究院 Bridge apparent panorama generation method based on local and global features
CN113542625A (en) * 2021-05-28 2021-10-22 北京迈格威科技有限公司 Image processing method, device, equipment and storage medium
CN113609316A (en) * 2021-07-27 2021-11-05 支付宝(杭州)信息技术有限公司 Method and device for detecting similarity of media contents
CN116248992A (en) * 2023-02-09 2023-06-09 广州市玄武无线科技股份有限公司 Dynamically configurable shelf image processing method and device, electronic equipment and storage medium

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110675420B (en) * 2019-08-22 2023-03-24 华为技术有限公司 Image processing method and electronic equipment
CN111340707B (en) * 2020-02-27 2023-07-14 创新奇智(重庆)科技有限公司 Image splicing system and method based on key frames
CN113747044B (en) * 2020-05-29 2023-05-02 华为技术有限公司 Panoramic shooting method and equipment
CN111970537B (en) * 2020-08-04 2023-02-28 威海精讯畅通电子科技有限公司 Root system scanning image processing method and system
CN111935408B (en) * 2020-09-02 2022-01-18 Oppo广东移动通信有限公司 Panoramic image shooting method and system, electronic device and readable storage medium
CN113240582B (en) * 2021-04-13 2023-12-12 浙江大华技术股份有限公司 Image stitching method and device
CN113450254B (en) * 2021-05-20 2022-06-17 北京城市网邻信息技术有限公司 Image processing method, image processing device, electronic equipment and computer readable storage medium
CN113362227B (en) * 2021-06-22 2023-07-21 北京百度网讯科技有限公司 Image processing method, device, electronic equipment and storage medium
CN114007017A (en) * 2021-11-18 2022-02-01 浙江博采传媒有限公司 Video generation method and device and storage medium
CN114520879B (en) * 2022-04-21 2022-09-06 浙江宇视科技有限公司 Radar vision cooperative video acquisition method, device and system and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1875618A (en) * 2003-10-28 2006-12-06 皇家飞利浦电子股份有限公司 Digital camera with panorama or mosaic functionality
CN101474076A (en) * 2008-10-15 2009-07-08 北京汇影互联科技有限公司 Method and equipment for obtaining full-field ultrasound scan image data
CN101984463A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for synthesizing panoramic image
CN102201115A (en) * 2011-04-07 2011-09-28 湖南天幕智能科技有限公司 Real-time panoramic image stitching method of aerial videos shot by unmanned plane
US20120154639A1 (en) * 2000-03-06 2012-06-21 Fisher Clay H System And Method For Creating Composite Images By Utilizing An Imaging Device
CN103139479A (en) * 2013-02-25 2013-06-05 广东欧珀移动通信有限公司 Method and device for finishing panorama preview scanning

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420898A (en) * 2011-09-27 2012-04-18 惠州Tcl移动通信有限公司 Mobile phone-based panoramic photographing realization method and mobile phone
US10681304B2 (en) * 2012-06-08 2020-06-09 Apple, Inc. Capturing a panoramic image using a graphical user interface having a scan guidance indicator
JP6672082B2 (en) * 2016-06-08 2020-03-25 キヤノン株式会社 Imaging device, imaging method, and program
CN107094236A (en) * 2017-05-19 2017-08-25 努比亚技术有限公司 Panorama shooting method, mobile terminal and computer-readable recording medium
CN107395971B (en) * 2017-07-31 2020-06-12 上海新眼光医疗器械股份有限公司 Image acquisition method, image acquisition equipment and computer-readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120154639A1 (en) * 2000-03-06 2012-06-21 Fisher Clay H System And Method For Creating Composite Images By Utilizing An Imaging Device
CN1875618A (en) * 2003-10-28 2006-12-06 皇家飞利浦电子股份有限公司 Digital camera with panorama or mosaic functionality
CN101474076A (en) * 2008-10-15 2009-07-08 北京汇影互联科技有限公司 Method and equipment for obtaining full-field ultrasound scan image data
CN101984463A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for synthesizing panoramic image
CN102201115A (en) * 2011-04-07 2011-09-28 湖南天幕智能科技有限公司 Real-time panoramic image stitching method of aerial videos shot by unmanned plane
CN103139479A (en) * 2013-02-25 2013-06-05 广东欧珀移动通信有限公司 Method and device for finishing panorama preview scanning

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110648363A (en) * 2019-09-16 2020-01-03 腾讯科技(深圳)有限公司 Camera posture determining method and device, storage medium and electronic equipment
CN112257595A (en) * 2020-10-22 2021-01-22 广州市百果园网络科技有限公司 Video matching method, device, equipment and storage medium
CN112991180A (en) * 2021-03-25 2021-06-18 北京百度网讯科技有限公司 Image splicing method, device, equipment and storage medium
CN112991180B (en) * 2021-03-25 2023-10-31 北京百度网讯科技有限公司 Image stitching method, device, equipment and storage medium
CN113269671A (en) * 2021-04-09 2021-08-17 浙江省交通运输科学研究院 Bridge apparent panorama generation method based on local and global features
CN113269671B (en) * 2021-04-09 2024-02-23 浙江省交通运输科学研究院 Bridge apparent panorama generating method based on local and global features
CN113542625A (en) * 2021-05-28 2021-10-22 北京迈格威科技有限公司 Image processing method, device, equipment and storage medium
CN113609316A (en) * 2021-07-27 2021-11-05 支付宝(杭州)信息技术有限公司 Method and device for detecting similarity of media contents
CN116248992A (en) * 2023-02-09 2023-06-09 广州市玄武无线科技股份有限公司 Dynamically configurable shelf image processing method and device, electronic equipment and storage medium
CN116248992B (en) * 2023-02-09 2024-01-16 广州市玄武无线科技股份有限公司 Dynamically configurable shelf image processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110012209A (en) 2019-07-12
CN110012209B (en) 2020-08-14

Similar Documents

Publication Publication Date Title
WO2019134516A1 (en) Method and device for generating panoramic image, storage medium, and electronic apparatus
CN110555883B (en) Repositioning method and device for camera attitude tracking process and storage medium
CN108495032B (en) Image processing method, image processing device, storage medium and electronic equipment
CN110650379B (en) Video abstract generation method and device, electronic equipment and storage medium
CN108776822B (en) Target area detection method, device, terminal and storage medium
CN108632543B (en) Image display method, image display device, storage medium and electronic equipment
CN112036331A (en) Training method, device and equipment of living body detection model and storage medium
CN113840070B (en) Shooting method, shooting device, electronic equipment and medium
CN110290426B (en) Method, device and equipment for displaying resources and storage medium
CN105427369A (en) Mobile terminal and method for generating three-dimensional image of mobile terminal
WO2022121577A1 (en) Image processing method and apparatus
CN112532882B (en) Image display method and device
CN110807769B (en) Image display control method and device
CN110086998B (en) Shooting method and terminal
CN109981989B (en) Method and device for rendering image, electronic equipment and computer readable storage medium
CN112788244B (en) Shooting method, shooting device and electronic equipment
CN112511743B (en) Video shooting method and device
WO2024061134A1 (en) Photographing method and apparatus, electronic device, and medium
CN114785957A (en) Shooting method and device thereof
CN114390206A (en) Shooting method and device and electronic equipment
CN114241127A (en) Panoramic image generation method and device, electronic equipment and medium
CN114245017A (en) Shooting method and device and electronic equipment
CN114140839A (en) Image sending method, device and equipment for face recognition and storage medium
CN114092323A (en) Image processing method, image processing device, storage medium and electronic equipment
CN111353929A (en) Image processing method and device and electronic equipment

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: 18898624

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18898624

Country of ref document: EP

Kind code of ref document: A1