CN118014828A - Image stitching method, device and system for array camera - Google Patents

Image stitching method, device and system for array camera Download PDF

Info

Publication number
CN118014828A
CN118014828A CN202311746730.1A CN202311746730A CN118014828A CN 118014828 A CN118014828 A CN 118014828A CN 202311746730 A CN202311746730 A CN 202311746730A CN 118014828 A CN118014828 A CN 118014828A
Authority
CN
China
Prior art keywords
image
current
target
local
cropping
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311746730.1A
Other languages
Chinese (zh)
Other versions
CN118014828B (en
Inventor
赵月峰
王鹏
刘坤
张艳蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Yiji Intelligent Technology Co ltd
Original Assignee
Suzhou Yiji Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Yiji Intelligent Technology Co ltd filed Critical Suzhou Yiji Intelligent Technology Co ltd
Priority to CN202311746730.1A priority Critical patent/CN118014828B/en
Priority to CN202411096708.1A priority patent/CN118864242A/en
Publication of CN118014828A publication Critical patent/CN118014828A/en
Application granted granted Critical
Publication of CN118014828B publication Critical patent/CN118014828B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • 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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The present application relates to an image stitching method, apparatus, hundred million-level pixel computing imaging system, computer device, storage medium and computer program product for an array camera. The method comprises the following steps: establishing an initial image stitching model based on the local sample image shot by the array camera; adopting initial image transformation parameters and current clipping parameters of the local camera, and carrying out image transformation and clipping on blank contrast images corresponding to the local camera to obtain current images to be stitched; judging whether an invalid pixel area exists in each current image to be stitched, determining the current image to be stitched with the invalid pixel area as a target image to be stitched, and updating current cutting parameters according to global position information of a target inscribed rectangular area of the valid pixel area in the target image to be stitched; and obtaining a target image splicing model based on the updated clipping parameters. By adopting the method, the imaging quality of the fusion video can be improved, and development resources can be saved.

Description

用于阵列摄像机的图像拼接方法、装置和系统Image stitching method, device and system for array camera

技术领域Technical Field

本申请涉及图像处理技术领域,特别是涉及一种用于阵列摄像机的图像拼接方法、装置、亿级像素计算成像系统、计算机设备、存储介质和计算机程序产品。The present application relates to the field of image processing technology, and in particular to an image stitching method and device for array cameras, a billion-pixel computational imaging system, a computer device, a storage medium, and a computer program product.

背景技术Background technique

视频监控因具有可靠性高、及时性强、便于查看等优点,已广泛应用于安防领域。当监控范围较大时,为实现大场景的超高清视频监控,出现了基于阵列摄像机的亿级像素计算成像系统,通过阵列摄像机包含的多个长焦窄视野的局部相机对监控场景拍摄多路局部高清视频,进而将各局部视频拼接融合,得到大视野或宽视野的可达亿像素级别的超高清融合视频,适用于对机场、公路、园区、运动赛场、边关、海面等较大场景进行视频拍摄和安全监控。Video surveillance has been widely used in the security field due to its advantages of high reliability, strong timeliness, and easy viewing. When the monitoring range is large, in order to achieve ultra-high-definition video monitoring of large scenes, a billion-pixel computational imaging system based on array cameras has emerged. The array camera contains multiple local cameras with long focal lengths and narrow fields of view to shoot multiple local high-definition videos of the monitoring scene, and then the local videos are spliced and fused to obtain ultra-high-definition fused videos with large or wide fields of view up to billion pixels. It is suitable for video shooting and security monitoring of large scenes such as airports, highways, parks, sports stadiums, borders, and sea surfaces.

相关技术中,针对拍摄宽视野的直线型目标(如机场跑道)时、因镜头畸变等因素影响而出现的弧形成像问题,出现了结构优化的阵列摄像机,该阵列摄像机中各局部相机的图像传感器绕轴线旋转了一定角度,且局部相机的轴线与阵列摄像机全局中心轴线的水平夹角越大,其对应的旋转角度越大,从而可以改善直线型目标的弧形成像问题,优化直线型拍摄目标的成像质量。In the related art, in order to solve the arc imaging problem caused by factors such as lens distortion when shooting straight targets with a wide field of view (such as airport runways), a structurally optimized array camera has emerged. The image sensor of each local camera in the array camera is rotated around the axis by a certain angle, and the larger the horizontal angle between the axis of the local camera and the global center axis of the array camera, the larger the corresponding rotation angle, thereby improving the arc imaging problem of straight targets and optimizing the imaging quality of straight shooting targets.

然而,由于各局部相机的图像传感器旋转了一定角度,拍摄的有效画面发生改变,若基于未旋转的阵列摄像机使用的图像拼接模型构建方法,构建该旋转结构的阵列摄像机的图像拼接模型,用于拼接得到的融合视频图像中容易出现无效像素区域,如边界处或拼接处出现的黑色三角区域(通常无效像素区域采用像素值0,故为黑色),即得到的融合视频图像并非完整有效画面,导致融合视频的成像质量较差。However, since the image sensors of each local camera are rotated by a certain angle, the effective picture taken is changed. If the image stitching model construction method used for the array camera with the rotating structure is used to construct the image stitching model, invalid pixel areas are likely to appear in the fused video image obtained by stitching, such as the black triangular area at the boundary or the stitching (usually the invalid pixel area uses the pixel value 0, so it is black). That is, the obtained fused video image is not a complete and effective picture, resulting in poor imaging quality of the fused video.

发明内容Summary of the invention

基于此,有必要针对上述技术问题,提供一种用于阵列摄像机的图像拼接方法、装置、亿级像素计算成像系统、计算机设备、存储介质和计算机程序产品,能够提高融合视频的成像质量,且能节约开发资源、提升开发效率,尤其适用于旋转结构的阵列摄像机。Based on this, it is necessary to provide an image stitching method, device, billion-pixel computational imaging system, computer equipment, storage medium and computer program product for array cameras to address the above-mentioned technical problems, which can improve the imaging quality of fused video, save development resources and improve development efficiency, and is particularly suitable for array cameras with rotating structures.

第一方面,本申请提供了一种用于阵列摄像机的图像拼接方法。所述方法包括:In a first aspect, the present application provides an image stitching method for an array camera. The method comprises:

获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各所述局部样本图像,建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;Acquire local sample images taken by each local camera of the array camera, and establish an initial image stitching model based on each local sample image; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera;

将所述初始裁剪参数作为当前裁剪参数,针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;Using the initial cropping parameters as current cropping parameters, for each of the local cameras, using the initial image transformation parameters of the local camera and the current cropping parameters, performing image transformation and cropping on the blank control image corresponding to the local camera, to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel;

根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;According to the pixel value of each pixel point in each of the current images to be stitched, it is judged whether there is an invalid pixel area in each of the current images to be stitched, the current images to be stitched with the invalid pixel area are determined as the target images to be stitched, and the target inscribed rectangular area of the valid pixel area in the target images to be stitched is determined;

根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新;According to the global position information of the target inscribed rectangular area, the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera are updated;

基于更新后的裁剪参数得到目标图像拼接模型,所述目标图像拼接模型用于对所述阵列摄像机拍摄的各局部视频图像进行拼接融合处理。A target image stitching model is obtained based on the updated cropping parameters, and the target image stitching model is used to perform stitching and fusion processing on each local video image captured by the array camera.

在其中一个实施例中,所述关联局部相机包括同行局部相机;所述当前裁剪参数包括当前上边界裁剪参数和当前下边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域上边界纵坐标和区域下边界纵坐标;所述根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,包括:In one embodiment, the associated local camera includes a local camera in the same line; the current cropping parameter includes a current upper boundary cropping parameter and a current lower boundary cropping parameter; the global position information of the target inscribed rectangular area includes the upper boundary ordinate of the area and the lower boundary ordinate of the area; and updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the target inscribed rectangular area includes:

根据所述目标局部相机所在行中、各所述目标内接矩形区域的区域上边界纵坐标和区域下边界纵坐标,确定该行的最大区域上边界纵坐标和最小区域下边界纵坐标,并将该行的各所述局部相机的当前上边界裁剪参数和当前下边界裁剪参数,分别更新为所述最大区域上边界纵坐标和所述最小区域下边界纵坐标。According to the upper boundary ordinate and the lower boundary ordinate of each target inscribed rectangular area in the row where the target local camera is located, the maximum upper boundary ordinate and the minimum lower boundary ordinate of the row are determined, and the current upper boundary cropping parameters and the current lower boundary cropping parameters of each local camera in the row are updated to the maximum upper boundary ordinate and the minimum lower boundary ordinate, respectively.

在其中一个实施例中,所述关联局部相机包括左邻局部相机和右邻局部相机;所述当前裁剪参数包括当前左边界裁剪参数和当前右边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域左边界横坐标和区域右边界横坐标;所述根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,包括:In one embodiment, the associated local camera includes a left neighboring local camera and a right neighboring local camera; the current cropping parameters include current left boundary cropping parameters and current right boundary cropping parameters; the global position information of the target inscribed rectangular area includes the horizontal coordinate of the left boundary of the area and the horizontal coordinate of the right boundary of the area; and updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the target inscribed rectangular area includes:

针对每个所述目标局部相机,计算该目标局部相机的所述区域左边界横坐标与所述当前左边界裁剪参数的差值,得到当前左边界差值,并计算该目标局部相机的所述区域右边界横坐标与所述当前右边界裁剪参数的差值,得到当前右边界差值;For each of the target local cameras, the difference between the horizontal coordinate of the left boundary of the region of the target local camera and the current left boundary clipping parameter is calculated to obtain a current left boundary difference, and the difference between the horizontal coordinate of the right boundary of the region of the target local camera and the current right boundary clipping parameter is calculated to obtain a current right boundary difference;

在所述当前左边界差值大于预设阈值的情况下,将该目标局部相机的当前左边界裁剪参数、以及该目标局部相机的左邻局部相机的当前右边界裁剪参数,更新为该目标局部相机的所述区域左边界横坐标;When the current left boundary difference is greater than a preset threshold, the current left boundary clipping parameter of the target local camera and the current right boundary clipping parameter of the left neighboring local camera of the target local camera are updated to the horizontal coordinate of the left boundary of the region of the target local camera;

在所述当前右边界差值大于预设阈值的情况下,将该目标局部相机的当前右边界裁剪参数、以及该目标局部相机的右邻局部相机的当前左边界裁剪参数,更新为该目标局部相机的所述区域右边界横坐标。When the current right boundary difference is greater than a preset threshold, the current right boundary cropping parameter of the target local camera and the current left boundary cropping parameter of the local camera to the right of the target local camera are updated to the horizontal coordinate of the right boundary of the area of the target local camera.

在其中一个实施例中,所述基于更新后的裁剪参数得到目标图像拼接模型,包括:In one embodiment, obtaining a target image stitching model based on the updated cropping parameters includes:

将更新后的裁剪参数作为新的当前裁剪参数,返回执行针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪步骤;Using the updated cropping parameters as new current cropping parameters, returning to execute, for each of the local cameras, the steps of image transformation and cropping the blank control image corresponding to the local camera using the initial image transformation parameters and the current cropping parameters of the local camera;

所述根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域之后,所述方法还包括:After determining whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, the method further includes:

在各所述当前待缝合图像均不存在无效像素区域的情况下,将所述当前裁剪参数作为目标裁剪参数,得到目标图像拼接模型。In the case that there is no invalid pixel area in each of the current images to be stitched, the current cropping parameters are used as target cropping parameters to obtain a target image stitching model.

在其中一个实施例中,所述对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新之后,所述方法还包括:In one embodiment, after updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the local camera associated with the target local camera, the method further includes:

记录当前更新次数;Record the current update times;

所述根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域之后,所述方法还包括:After determining whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, the method further includes:

在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数小于预设值的情况下,执行将存在无效像素区域的当前待缝合图像确定为目标待缝合图像的步骤;In the case that at least one of the current images to be stitched has an invalid pixel region and the current update number is less than a preset value, performing a step of determining the current image to be stitched having the invalid pixel region as a target image to be stitched;

在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数大于或等于预设值的情况下,将存在无效像素区域的当前待缝合图像确定为待校正图像,其对应的局部相机为待校正局部相机;When at least one of the current images to be stitched has an invalid pixel region and the current update number is greater than or equal to a preset value, the current image to be stitched having the invalid pixel region is determined as the image to be corrected, and the local camera corresponding to the image is the local camera to be corrected;

根据所述待校正图像包含的无效像素点的全局位置信息,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正,将校正后的裁剪参数作为目标裁剪参数,得到目标图像拼接模型。According to the global position information of the invalid pixel points contained in the image to be corrected, the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row as the local camera to be corrected are corrected, and the corrected cropping parameters are used as target cropping parameters to obtain a target image stitching model.

在其中一个实施例中,所述根据所述待校正图像包含的无效像素点的全局位置信息,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正,包括:In one of the embodiments, the correcting of the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row of the local camera to be corrected according to the global position information of the invalid pixel points contained in the image to be corrected includes:

分别从上往下遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选上边界裁剪参数;Traverse the first column of pixels and the last column of pixels of the image to be corrected from top to bottom respectively. If the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the ordinate of the current pixel as a candidate upper boundary clipping parameter;

分别从下往上遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选下边界裁剪参数;Traverse the first column of pixels and the last column of pixels of the image to be corrected from bottom to top respectively, if the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the ordinate of the current pixel as a candidate lower boundary cropping parameter;

根据各所述候选上边界裁剪参数中的最大值和各所述候选下边界裁剪参数中的最小值,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和当前下边界裁剪参数进行校正。According to the maximum value of each candidate upper boundary cropping parameter and the minimum value of each candidate lower boundary cropping parameter, the current upper boundary cropping parameter and the current lower boundary cropping parameter of the local camera to be corrected and the local camera in the same row as the local camera to be corrected are corrected.

第二方面,本申请还提供了一种用于阵列摄像机的图像拼接装置。所述装置包括:In a second aspect, the present application also provides an image stitching device for an array camera. The device comprises:

建立模块,用于获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各所述局部样本图像,建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;Establishing a module for acquiring local sample images taken by each local camera of the array camera, and establishing an initial image stitching model based on each local sample image; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera;

裁剪模块,用于将所述初始裁剪参数作为当前裁剪参数,针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;A cropping module, configured to use the initial cropping parameters as current cropping parameters, and for each of the local cameras, use the initial image transformation parameters of the local camera and the current cropping parameters to perform image transformation and cropping on the blank control image corresponding to the local camera, so as to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel;

第一确定模块,用于根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;A first determination module is used to determine whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, determine the current image to be stitched with the invalid pixel area as the target image to be stitched, and determine a target inscribed rectangular area of a valid pixel area in the target image to be stitched;

更新模块,用于根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,并基于更新后的裁剪参数得到目标图像拼接模型,所述目标图像拼接模型用于对所述阵列摄像机拍摄的各局部视频图像进行拼接融合处理。An updating module is used to update the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the inscribed rectangular area of the target, and obtain a target image stitching model based on the updated cropping parameters, and the target image stitching model is used to perform stitching and fusion processing on the local video images taken by the array camera.

第三方面,本申请还提供了一种亿级像素计算成像系统。所述系统包括阵列摄像机和服务器,其中:In a third aspect, the present application also provides a billion-pixel computational imaging system. The system includes an array camera and a server, wherein:

所述阵列摄像机用于通过各局部相机拍摄局部样本图像,并将各所述局部样本图像发送给所述服务器;The array camera is used to capture local sample images through each local camera, and send each local sample image to the server;

所述服务器用于基于各所述局部样本图像建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;将所述初始裁剪参数作为当前裁剪参数;The server is used to establish an initial image stitching model based on each of the local sample images; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each of the local cameras; and the initial cropping parameters are used as current cropping parameters;

所述服务器还用于针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新;基于更新后的裁剪参数得到目标图像拼接模型;The server is also used for performing image transformation and cropping on the blank control image corresponding to each local camera using the initial image transformation parameters and the current cropping parameters of the local camera to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel; judging whether there is an invalid pixel area in each current image to be stitched according to the pixel value of each pixel in each current image to be stitched, determining the current image to be stitched with the invalid pixel area as the target image to be stitched, and determining the target inscribed rectangular area of the valid pixel area in the target image to be stitched; updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the target inscribed rectangular area; obtaining a target image stitching model based on the updated cropping parameters;

所述阵列摄像机还用于拍摄局部视频图像发送给所述服务器;The array camera is also used to capture local video images and send them to the server;

所述服务器还用于基于所述目标图像拼接模型对各所述局部视频图像进行拼接融合处理,得到融合视频图像,并将所述融合视频图像发送给显示终端。The server is also used to perform splicing and fusion processing on each of the local video images based on the target image splicing model to obtain a fused video image, and send the fused video image to a display terminal.

第四方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现第一方面所述的方法的步骤。In a fourth aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect are implemented.

第五方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现第一方面所述的方法的步骤。In a fifth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

第六方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现第一方面所述的方法的步骤。In a sixth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

上述用于阵列摄像机的图像拼接方法、装置、亿级像素计算成像系统、计算机设备、存储介质和计算机程序产品,采用已有的图像拼接模型构建方法,建立阵列摄像机的初始图像拼接模型,然后通过各局部相机的初始图像变换参数和初始裁剪参数,对空白参照图像进行图像变换和裁剪,得到待缝合图像。由于空白参照图像中每个像素点的像素值均与无效像素点的像素值不同,因而可以根据待缝合图像中各像素点的像素值,快速准确地确定出待缝合图像中的有效像素区域和无效像素区域,进而根据存在无效像素区域的目标待缝合图像中、有效像素区域的目标内接矩形的全局位置信息,对目标局部相机和其关联局部相机的裁剪参数进行更新。其中,目标内接矩形区域中的像素点均为有效像素点,基于该内接矩形区域进行裁剪参数更新,可以减小或消除融合视频图像中的无效像素区域,提高融合视频图像的画面完整性和成像质量。并且,本方法仅需简单更新图像拼接模型的参数,即可提高目标图像拼接模型的适配度,不需对图像拼接模型的构建算法进行复杂修改,提高了已有的图像拼接模型构建算法的复用性,有效节约了开发资源。The above-mentioned image stitching method, device, billion-pixel computational imaging system, computer equipment, storage medium and computer program product for array cameras adopt the existing image stitching model construction method to establish the initial image stitching model of the array camera, and then perform image transformation and cropping on the blank reference image through the initial image transformation parameters and initial cropping parameters of each local camera to obtain the image to be stitched. Since the pixel value of each pixel in the blank reference image is different from the pixel value of the invalid pixel, the valid pixel area and the invalid pixel area in the image to be stitched can be quickly and accurately determined according to the pixel value of each pixel in the image to be stitched, and then the cropping parameters of the target local camera and its associated local camera are updated according to the global position information of the target inscribed rectangle of the valid pixel area in the target image to be stitched where the invalid pixel area exists. Among them, the pixels in the target inscribed rectangle area are all valid pixels, and the cropping parameters are updated based on the inscribed rectangle area, which can reduce or eliminate the invalid pixel area in the fused video image and improve the picture integrity and imaging quality of the fused video image. Moreover, this method only needs to simply update the parameters of the image stitching model to improve the adaptability of the target image stitching model. There is no need to make complex modifications to the image stitching model construction algorithm, which improves the reusability of the existing image stitching model construction algorithm and effectively saves development resources.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为一个示例中亿级像素计算成像系统的示意图;FIG1 is a schematic diagram of a billion-pixel computational imaging system in an example;

图2为一个实施例中图像拼接方法的流程示意图;FIG2 is a schematic diagram of a flow chart of an image stitching method in one embodiment;

图3a为一个示例中阵列摄像机的正视图;FIG3 a is a front view of an array camera in one example;

图3b为图3a所示阵列摄像机内部主要结构的俯视图;FIG3b is a top view of the main internal structure of the array camera shown in FIG3a;

图3c为图3a所示阵列摄像机拍摄图像的位置示意图;FIG3c is a schematic diagram of the positions of the array camera shown in FIG3a for capturing images;

图4a为一个示例中空白对照图像对应的变换图像的示意图;FIG4a is a schematic diagram of a transformed image corresponding to a blank control image in an example;

图4b为一个示例中待缝合图像的示意图;FIG4 b is a schematic diagram of images to be stitched in an example;

图4c为一个示例中待缝合图像及目标内接矩形区域的示意图;FIG4c is a schematic diagram of an image to be stitched and a target inscribed rectangular area in an example;

图5为一个实施例中图像拼接装置的结构框图;FIG5 is a structural block diagram of an image stitching device in one embodiment;

图6为一个实施例中计算机设备的内部结构图;FIG6 is a diagram showing the internal structure of a computer device in one embodiment;

图7a为一个示例中基于初始图像拼接模型得到的融合图像;FIG7 a is a fused image obtained based on the initial image stitching model in an example;

图7b为一个示例中基于目标图像拼接模型得到的融合图像。FIG. 7 b is a fused image obtained based on a target image stitching model in an example.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

首先,在具体介绍本申请实施例的技术方案之前,先对本申请实施例基于的技术背景或者技术演进脉络进行介绍。为实现大场景、宽视野的超高清视频监控,出现了基于阵列摄像机的亿级像素计算成像系统。阵列摄像机通常包含多个拍摄角度不同的局部相机,通过局部相机拍摄目标场景的细节信息丰富的局部高清视频图像,进而将各局部高清视频图像拼接融合,得到大视场或宽视场的融合视频图像。为了提高融合视频的生成效率,通常在对目标场景进行视频拍摄前,可以先基于局部相机拍摄的局部样本图像构建图像拼接模型,从而在对目标场景进行视频拍摄时,可以采用该图像拼接模型将各局部相机拍摄的多路局部高清视频进行拼接融合,实时输出大视野或宽视野的可达亿像素级别的超高清融合视频,适用于对机场、公路、园区、运动赛场、边关、海面等较大场景进行视频拍摄和安全监控。First, before specifically introducing the technical solution of the embodiment of the present application, the technical background or technical evolution context on which the embodiment of the present application is based is introduced. In order to achieve ultra-high-definition video surveillance with large scenes and wide fields of view, a billion-pixel computational imaging system based on array cameras has emerged. The array camera usually includes multiple local cameras with different shooting angles, and the local cameras shoot local high-definition video images with rich detail information of the target scene, and then stitch and fuse the local high-definition video images to obtain a fused video image with a large field of view or a wide field of view. In order to improve the generation efficiency of the fused video, usually before shooting the video of the target scene, an image stitching model can be constructed based on the local sample images shot by the local camera, so that when shooting the video of the target scene, the image stitching model can be used to stitch and fuse the multiple local high-definition videos shot by each local camera, and output ultra-high-definition fused videos with a large field of view or a wide field of view in real time, which can reach the billion-pixel level, and are suitable for video shooting and security monitoring of large scenes such as airports, highways, parks, sports stadiums, borders, and sea surfaces.

其中,图像拼接模型的构建过程,可以是对各局部视频图像的重叠区域提取特征点,进而基于特征点进行图像配准,确定出各局部相机对应的图像变换参数(如单应性变换参数、旋转/平移/缩放/仿射变换参数等),以将各局部视频图像均变换至同一平面(统一视角、统一坐标)。如可以指定其中一个局部视频图像所在的平面为基准平面,基于各局部相机对应的图像变换参数,将各局部视频图像均变换至该基准平面。进而可以确定出缝合线位置和各局部相机的裁剪参数,裁剪参数可以指定在各局部视频图像的变换图像中进行裁剪的位置,将各裁剪后的变换图像(可称为待缝合图像)拼接融合或缝合,即可得到融合图像。Among them, the construction process of the image stitching model can be to extract feature points from the overlapping areas of each local video image, and then perform image registration based on the feature points to determine the image transformation parameters corresponding to each local camera (such as homography transformation parameters, rotation/translation/scaling/affine transformation parameters, etc.), so as to transform each local video image to the same plane (unified perspective, unified coordinates). For example, the plane where one of the local video images is located can be designated as the reference plane, and based on the image transformation parameters corresponding to each local camera, each local video image is transformed to the reference plane. Then, the stitching line position and the cropping parameters of each local camera can be determined. The cropping parameters can specify the position to be cropped in the transformed image of each local video image, and each cropped transformed image (which can be called the image to be stitched) is spliced, fused or stitched to obtain a fused image.

上述构建图像拼接模型的过程中涉及的特征点对提取、图像配准、裁剪参数确定等算法,需针对阵列摄像机进行设计和调试,以便构建的图像拼接模型与该阵列摄像机匹配度高,能用于拼接得到成像质量较高的融合视频图像。若对阵列摄像机的结构进行了优化或改进,之前设计好的图像拼接模型构建算法可能不再适用,导致图像拼接效果较差。The algorithms involved in the above-mentioned process of constructing the image stitching model, such as feature point pair extraction, image registration, and cropping parameter determination, need to be designed and debugged for the array camera so that the constructed image stitching model has a high degree of match with the array camera and can be used to stitch together a fused video image with high imaging quality. If the structure of the array camera is optimized or improved, the previously designed image stitching model construction algorithm may no longer be applicable, resulting in poor image stitching results.

例如,针对拍摄宽视野的直线型目标(如机场跑道)时、因镜头畸变等因素影响而出现的弧形成像问题,出现了结构改进的阵列摄像机(以下可称为旋转结构的阵列摄像机),该阵列摄像机中各局部相机的图像传感器绕轴线旋转了一定角度,且局部相机的轴线与阵列摄像机全局中心轴线的水平夹角越大,其对应的旋转角度越大,从而可以改善直线型目标的弧形成像问题,优化直线型拍摄目标的成像质量。由于各局部相机的图像传感器旋转了一定角度,拍摄的有效画面发生改变,基于此前针对未旋转的阵列摄像机(传统阵列摄像机)设计的图像拼接模型构建算法,构建得到的图像拼接模型的适配度较低,得到的融合视频图像中容易出现无效区域。如图7a所示,该融合图像的边界处出现黑边区域、拼接处出现黑色三角区域(通常非有效像素点的区域采用像素值0,故显示黑色),即得到的融合视频图像并非完整有效画面,导致融合视频的成像质量较差。For example, in order to solve the arc imaging problem caused by factors such as lens distortion when shooting a straight target with a wide field of view (such as an airport runway), an array camera with improved structure (hereinafter referred to as an array camera with a rotating structure) has been developed. The image sensor of each local camera in the array camera is rotated around the axis by a certain angle, and the larger the horizontal angle between the axis of the local camera and the global center axis of the array camera, the larger the corresponding rotation angle, thereby improving the arc imaging problem of the straight target and optimizing the imaging quality of the straight target. Since the image sensor of each local camera is rotated by a certain angle, the effective picture taken is changed. Based on the image stitching model construction algorithm designed for the non-rotated array camera (traditional array camera), the fitness of the constructed image stitching model is low, and invalid areas are likely to appear in the obtained fused video image. As shown in FIG7a, a black border area appears at the boundary of the fused image and a black triangle area appears at the splicing (usually the area of the non-effective pixel point adopts the pixel value 0, so it is displayed in black), that is, the obtained fused video image is not a complete and effective picture, resulting in poor imaging quality of the fused video.

然而,对图像拼接模型构建算法进行设计或更新的难度相对较高,若针对每款结构优化的阵列摄像机均重新设计或更新,需消耗较多的开发资源,且模型构建算法的版本越多,越容易导致配置失误。However, it is relatively difficult to design or update the image stitching model building algorithm. If each structurally optimized array camera is to be redesigned or updated, more development resources will be consumed, and the more versions of the model building algorithm there are, the more likely it is to cause configuration errors.

基于该背景,申请人通过长期的研发以及实验验证,提出本申请的用于阵列摄像机的图像拼接方法,通过在采用已有的图像拼接模型构建方法得到的初始图像拼接模型的基础上,进行简单的参数更新,即可提高图像拼接模型的适配度,进而提高融合视频的成像质量,特别适用于旋转结构的阵列摄像机的图像拼接,且本方法不需对图像拼接模型的构建算法进行复杂修改,提高了拼接模型构建算法的复用性,节约了开发资源。另外,需要说明的是,本申请技术问题的发现以及下述实施例介绍的技术方案,申请人均付出了大量的创造性劳动。Based on this background, the applicant has proposed the image stitching method for array cameras of this application through long-term research and development and experimental verification. By performing simple parameter updates on the basis of the initial image stitching model obtained by the existing image stitching model construction method, the adaptability of the image stitching model can be improved, thereby improving the imaging quality of the fused video. This method is particularly suitable for image stitching of array cameras with rotating structures. This method does not require complex modifications to the construction algorithm of the image stitching model, thereby improving the reusability of the stitching model construction algorithm and saving development resources. In addition, it should be noted that the applicant has made a lot of creative efforts in discovering the technical problem of this application and the technical solutions introduced in the following embodiments.

本申请实施例提供的图像拼接方法,可以应用于如图1所示的亿级像素计算成像系统。阵列摄像机102和显示终端106分别通过网络与服务器104进行通信。显示终端106可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、智能显示器、物联网设备、便携式可穿戴设备等具有显示单元的电子设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The image stitching method provided in the embodiment of the present application can be applied to the billion-pixel computational imaging system as shown in FIG1. The array camera 102 and the display terminal 106 communicate with the server 104 through the network respectively. The display terminal 106 can be, but is not limited to, various electronic devices with display units such as personal computers, laptops, smart phones, tablet computers, smart displays, Internet of Things devices, portable wearable devices, etc. The server 104 can be implemented as an independent server or a server cluster composed of multiple servers.

在一个实施例中,如图2所示,提供了一种图像拼接方法,该方法可以应用于图1中的服务器。本实施例中,该方法包括以下步骤:In one embodiment, as shown in FIG2 , an image stitching method is provided, which can be applied to the server in FIG1 . In this embodiment, the method includes the following steps:

步骤201,获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各局部样本图像,建立初始的图像拼接模型。Step 201 : obtaining local sample images taken by each local camera of the array camera, and establishing an initial image stitching model based on each local sample image.

其中,初始的图像拼接模型包括每个局部相机对应的初始图像变换参数和初始裁剪参数。The initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera.

在实施中,服务器可以采用现有的图像拼接模型构建算法构建图像拼接模型,通常包括局部样本图像(重叠区域)的特征点提取、图像配准、确定缝合线和裁剪位置等。特征点提取可以采用尺度不变特征转换(SIFT,Scale Invariant Feature Transform)、加速稳健特征(SURF,Speeded Up Robust Features)等方法实现。图像配准可以通过机器学习,基于提取的特征点找到相邻局部样本图像的映射关系,通常是找到最佳图像变换参数,使得相邻局部样本图像中相同特征点经变换后的位置差异最小。进而在变换后的图像中确定裁剪位置,以确定裁剪图像(对应以下的待缝合图像)的边界。其中,左右相邻的两张裁剪图像中,左侧图像的右边界和右侧图像的左边界相接,将裁剪图像进行拼接融合或缝合,即可得到大画幅的超高清融合图像。In implementation, the server can use the existing image stitching model construction algorithm to construct an image stitching model, which usually includes feature point extraction of local sample images (overlapping areas), image registration, determination of stitching lines and cropping positions, etc. Feature point extraction can be implemented using methods such as scale invariant feature transform (SIFT), accelerated robust features (SURF), etc. Image registration can be performed through machine learning to find the mapping relationship between adjacent local sample images based on the extracted feature points, usually by finding the optimal image transformation parameters so that the position difference of the same feature points in adjacent local sample images after transformation is minimized. Then, the cropping position is determined in the transformed image to determine the boundary of the cropped image (corresponding to the following image to be stitched). Among them, in the two adjacent cropped images on the left and right, the right boundary of the left image and the left boundary of the right image are connected, and the cropped images are spliced, fused or stitched to obtain a large-format ultra-high-definition fused image.

各裁剪图像通常为矩形状,裁剪参数可以指定该矩形区域的位置信息(为变换后的统一坐标系下的位置信息,可称为全局位置信息),如以该矩形区域的左上角像素点和右下角像素点的坐标表示(u0,v0,u1,v1)。其中u0为左上角像素点的横坐标(像素点所在的列数),可指定该矩形区域的左边界,可称为左边界裁剪参数;v0为左上角像素点的纵坐标(像素点所在的行数),可指定该矩形区域的上边界,可称为上边界裁剪参数。相应的,u1、v1为右下角像素点的横坐标和纵坐标,可分别称为右边界裁剪参数和下边界裁剪参数。Each cropped image is usually rectangular, and the cropping parameters can specify the position information of the rectangular area (position information in the transformed unified coordinate system, which can be called global position information), such as the coordinates of the upper left corner pixel and the lower right corner pixel of the rectangular area (u 0 ,v 0 ,u 1 ,v 1 ). Among them, u 0 is the horizontal coordinate of the upper left corner pixel (the number of columns where the pixel is located), which can specify the left boundary of the rectangular area, which can be called the left boundary cropping parameter; v 0 is the vertical coordinate of the upper left corner pixel (the number of rows where the pixel is located), which can specify the upper boundary of the rectangular area, which can be called the upper boundary cropping parameter. Correspondingly, u 1 and v 1 are the horizontal coordinate and vertical coordinate of the lower right corner pixel, which can be called the right boundary cropping parameter and the lower boundary cropping parameter respectively.

需说明的是,在实际应用中,基于裁剪参数(u0,v0,u1,v1)进行图像裁剪时遵循左闭右开原则,因而实际裁剪得到的图像中最后一列像素点的横坐标为(u1-1)。其右相邻的裁剪图像中第一列像素点的横坐标为u1。也即相邻的两个局部相机的裁剪参数中,左侧相机的右边界裁剪参数和右侧相机的左边界裁剪参数相同。在其它一些示例中,若初始的图像拼接模型中矩形裁剪区域采用该区域的左上角像素点和该矩形区域的宽(w)高(h)表示,如表示为(u0,v0,w,h),则可以将该参数转换为(u0,v0,u1,v1),作为初始裁剪参数,以便于后续处理。It should be noted that, in practical applications, when performing image cropping based on the cropping parameters (u 0 ,v 0 ,u 1 ,v 1 ), the principle of left closing and right opening is followed, so the horizontal coordinate of the last column of pixels in the image actually cropped is (u 1 -1). The horizontal coordinate of the first column of pixels in the right adjacent cropped image is u 1 . That is, in the cropping parameters of two adjacent local cameras, the right boundary cropping parameters of the left camera and the left boundary cropping parameters of the right camera are the same. In some other examples, if the rectangular cropping area in the initial image stitching model is represented by the upper left corner pixel of the area and the width (w) and height (h) of the rectangular area, such as (u 0 ,v 0 ,w,h), the parameter can be converted to (u 0 ,v 0 ,u 1 ,v 1 ) as the initial cropping parameter for subsequent processing.

该阵列摄像机的各局部相机的拍摄角度不同,各局部样本图像可以呈多行多列或单行多列排布。在一个示例中,阵列摄像机可以为旋转结构的阵列摄像机,即各局部相机的图像传感器绕本局部相机的轴线旋转了一定角度(安装图像传感器时即以该旋转角度安装),且旋转角度的大小与该局部相机的轴线水平角度正相关。如图3a和图3b所示的旋转结构阵列摄像机,其包含的10个局部相机(A1至A10)的水平拍摄角度不同,竖直拍摄角度相同或相近,因而拍摄的各局部样本图像呈一行排布(如图3c所示),相邻的局部样本图像存在重叠区域(为便于区别,相邻局部图像分别采用实线框和虚线框表示)。可以理解的,图3c仅用于展示各局部样本图像的相对位置关系,实际重叠区域的形状并非图中所示的矩形。The shooting angles of each local camera of the array camera are different, and each local sample image can be arranged in multiple rows and columns or in a single row and multiple columns. In one example, the array camera can be an array camera of a rotating structure, that is, the image sensor of each local camera is rotated around the axis of the local camera by a certain angle (the image sensor is installed at this rotation angle), and the size of the rotation angle is positively correlated with the horizontal angle of the axis of the local camera. As shown in Figures 3a and 3b, the rotating structure array camera includes 10 local cameras (A1 to A10) with different horizontal shooting angles and the same or similar vertical shooting angles, so the local sample images taken are arranged in a row (as shown in Figure 3c), and there are overlapping areas between adjacent local sample images (for ease of distinction, adjacent local images are represented by solid line frames and dotted line frames, respectively). It can be understood that Figure 3c is only used to show the relative position relationship of each local sample image, and the shape of the actual overlapping area is not the rectangle shown in the figure.

该阵列摄像机中,各局部相机的轴线水平角度指该局部相机的轴线(如图3b中示出的轴线A),与该阵列摄像机的全局中心轴线(如图3b中示出的轴线L)在水平方向的夹角(水平投影线的夹角)。In the array camera, the horizontal angle of the axis of each local camera refers to the angle in the horizontal direction (the angle of the horizontal projection line) between the axis of the local camera (such as the axis A shown in Figure 3b) and the global central axis of the array camera (such as the axis L shown in Figure 3b).

步骤202,将初始裁剪参数作为当前裁剪参数,针对每个局部相机,采用该局部相机的初始图像变换参数和当前裁剪参数,对该局部相机对应的空白对照图像进行图像变换和裁剪,得到当前待缝合图像。Step 202 , using the initial cropping parameters as current cropping parameters, for each local camera, using the initial image transformation parameters and current cropping parameters of the local camera, performing image transformation and cropping on the blank control image corresponding to the local camera, to obtain the current image to be stitched.

其中,空白对照图像与局部样本图像的尺寸相同,且空白对照图像中每个像素点的像素值均与无效像素点的像素值不同。空白对照图像可以为纯色图像(如像素值均为255),也可以为多色图像,各像素点的像素值与无效像素点的像素值(如为0)不同即可。The blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel. The blank control image can be a pure color image (such as a pixel value of 255) or a multi-color image, and the pixel value of each pixel is different from the pixel value of the invalid pixel (such as 0).

通常在图像拼接模型中即定义了无效像素点的像素值,即在矩形的变换图像中,除与局部样本图像中的各像素点对应的有效像素点之外,其它像素点(即为无效像素点)均采用统一的像素值补齐,一般设为0像素值,避免出现像素为空的情况。Usually, the pixel values of invalid pixels are defined in the image stitching model, that is, in the rectangular transformed image, except for the valid pixels corresponding to the pixels in the local sample image, the other pixels (that is, invalid pixels) are filled with a uniform pixel value, which is generally set to 0 pixel value to avoid empty pixels.

可以理解的,若构建图像拼接模型时是将其中一个局部相机拍摄的图像作为基准图像(即其它图像均变换至该基准图像所在平面),则该局部相机对应的空白对照图像经对应的图像变换参数进行变换后,与原图像一致,或不需进行变换处理,直接将该原图像作为变换图像,因而该变换图像中将不包含无效像素点。It can be understood that if the image taken by one of the local cameras is used as the reference image when constructing the image stitching model (that is, the other images are transformed to the plane where the reference image is located), then the blank control image corresponding to the local camera is transformed by the corresponding image transformation parameters and is consistent with the original image, or no transformation processing is required, and the original image is directly used as the transformed image, so that the transformed image will not contain invalid pixels.

步骤203,根据各当前待缝合图像中各像素点的像素值,判断各当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定目标待缝合图像中有效像素区域的目标内接矩形区域。Step 203, judging whether there is an invalid pixel area in each current image to be stitched according to the pixel value of each pixel point in each current image to be stitched, determining the current image to be stitched with the invalid pixel area as the target image to be stitched, and determining the target inscribed rectangular area of the valid pixel area in the target image to be stitched.

在实施中,由于空白对照图像中各像素点的像素值均与无效像素点的像素值不同,因此服务器可以遍历待缝合图像中的每个像素点,将其像素值与无效像素点的像素值进行比对,或与有效像素点的像素值(即空白对照图像中各像素点的像素值)进行比对,判断该像素点为有效像素点或无效像素点。若待缝合图像中存在一定数量的无效像素点,即无效像素点的总数量大于预设阈值(阈值可以为0,也可以大于0),或由无效像素点构成的连通域中,至少一个连通域的尺寸大于预设阈值(如连通域中无效像素点的个数大于预设阈值),则可以判断该待缝合图像中存在无效像素区域。In implementation, since the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel, the server can traverse each pixel in the image to be stitched, compare its pixel value with the pixel value of the invalid pixel, or compare it with the pixel value of the valid pixel (i.e., the pixel value of each pixel in the blank control image), and judge whether the pixel is a valid pixel or an invalid pixel. If there are a certain number of invalid pixels in the image to be stitched, that is, the total number of invalid pixels is greater than a preset threshold (the threshold can be 0 or greater than 0), or in the connected domain composed of invalid pixels, the size of at least one connected domain is greater than the preset threshold (such as the number of invalid pixels in the connected domain is greater than the preset threshold), it can be judged that there is an invalid pixel area in the image to be stitched.

若图像拼接模型的适配度较高,则对变换图像进行裁剪后,得到的待缝合图像中将不存在或仅少量的无效像素点,从而可以拼接得到完整有效画面的图像。然而,对于改进的旋转结构的阵列摄像机,其拍摄的有效画面发生改变,采用现有的未旋转结构的阵列摄像机使用的图像拼接模型构建方法,得到的初始图像拼接模型用于对该图像变换和裁剪后,得到的部分待缝合图像中将出现无效像素区域。If the fitness of the image stitching model is high, after the transformed image is cropped, there will be no or only a small number of invalid pixels in the image to be stitched, so that an image with a complete and valid picture can be stitched. However, for the improved rotating structure array camera, the effective picture taken by it changes. When the initial image stitching model obtained by the existing non-rotating structure array camera is used to transform and crop the image, invalid pixel areas will appear in the obtained part of the image to be stitched.

若有多个待缝合图像存在无效像素区域,服务器可以分别确定每个目标待缝合图像中有效像素区域的目标内接矩形区域。有效像素区域指由有效像素点组成的区域,通常为不规则多边形区域。目标内接矩形区域可以是最大水平内接矩形区域,或在各竖直边最长的水平内接矩形区域中、面积最大的内接矩形区域。If there are invalid pixel areas in multiple images to be stitched, the server can determine the target inscribed rectangular area of the valid pixel area in each target image to be stitched. The valid pixel area refers to the area composed of valid pixels, usually an irregular polygon area. The target inscribed rectangular area can be the largest horizontal inscribed rectangular area, or the largest inscribed rectangular area among the horizontal inscribed rectangular areas with the longest vertical sides.

如图4a展示了采用初始图像变换参数对空白对照图像进行图像变换后的图像(该示例中以6个局部相机A1至A6为例进行说明)。为了展示各变换图像的位置关系,将各变换图像统一绘制在统一坐标平面,相邻两个变换图像分别采用虚线边界和虚线边界,以便于区别。各变换图像中有效像素区域显示为白色(即空白对照图像中各像素点的像素值设为255),无效像素区域显示为黑色(无效像素值设为0)。进而采用各局部相机的初始裁剪参数对该变换图像进行裁剪,得到的待缝合图像如图4b所示。该示例中,局部相机A3、A4和A5的当前待缝合图像中存在无效像素区域。As shown in Figure 4a, the image after the blank control image is transformed using the initial image transformation parameters (in this example, six local cameras A1 to A6 are used as examples for explanation). In order to show the positional relationship of each transformed image, each transformed image is uniformly drawn on a unified coordinate plane, and two adjacent transformed images are respectively marked with dotted line boundaries and dotted line boundaries for easy distinction. The valid pixel area in each transformed image is displayed in white (that is, the pixel value of each pixel in the blank control image is set to 255), and the invalid pixel area is displayed in black (the invalid pixel value is set to 0). Then, the transformed image is cropped using the initial cropping parameters of each local camera, and the image to be stitched is shown in Figure 4b. In this example, there are invalid pixel areas in the current images to be stitched of local cameras A3, A4 and A5.

可以根据局部相机A3、A4和A5的当前待缝合图像中有效像素点所在的区域,计算该区域的最大内接矩形。如图4c所示,a3、b3、c3、d3为局部相机A3的最大内接矩形区域的四个顶点,服务器可以确定出左上角像素点a3和右下角像素点d3的全局位置信息(像素坐标),标识该最大内接矩形区域的边界。The maximum inscribed rectangle of the area can be calculated based on the area where the valid pixels in the current image to be stitched of the local cameras A3, A4 and A5 are located. As shown in Figure 4c, a3 , b3 , c3 , and d3 are the four vertices of the maximum inscribed rectangle area of the local camera A3. The server can determine the global position information (pixel coordinates) of the upper left pixel a3 and the lower right pixel d3 , and identify the boundary of the maximum inscribed rectangle area.

步骤204,根据目标内接矩形区域的全局位置信息,对目标待缝合图像对应的目标局部相机及目标局部相机的关联局部相机的当前裁剪参数进行更新。Step 204 , based on the global position information of the target inscribed rectangular area, the current cropping parameters of the target local camera corresponding to the target image to be stitched and the local camera associated with the target local camera are updated.

其中,关联局部相机是指,裁剪参数与目标局部相机的裁剪参数相关的其它局部相机,如同行局部相机和相邻局部相机。位于同一行的局部相机,上边界裁剪参数和下边界裁剪参数相同,若更新其中一个局部相机的裁剪参数,则该行的局部相机的裁剪参数均需更新,故互为关联相机。相邻的两个局部相机,若左侧相机更新了右边界,则右侧相机的左边界相应更新,因而互为关联相机。Among them, the associated local cameras refer to other local cameras whose cropping parameters are related to the cropping parameters of the target local camera, such as local cameras in the same row and adjacent local cameras. For local cameras in the same row, the upper boundary cropping parameters and the lower boundary cropping parameters are the same. If the cropping parameters of one of the local cameras are updated, the cropping parameters of the local cameras in the row must also be updated, so they are associated cameras. For two adjacent local cameras, if the left camera updates the right boundary, the left boundary of the right camera is updated accordingly, so they are associated cameras.

由于目标内接矩形区域内均为有效像素点,因而可以将该目标内接矩形区域的位置作为该目标相机的新的裁剪位置,得到新的裁剪参数。相应的,该局部相机的关联局部相机的裁剪参数需进行适应性更新。Since the target inscribed rectangular area is full of valid pixels, the position of the target inscribed rectangular area can be used as the new cropping position of the target camera to obtain new cropping parameters. Accordingly, the cropping parameters of the local camera associated with the local camera need to be adaptively updated.

步骤205,基于更新后的裁剪参数得到目标图像拼接模型。Step 205: obtaining a target image stitching model based on the updated cropping parameters.

在实施中,将初始图像拼接模型中的初始裁剪参数进行更新后,即得到目标图像拼接模型,用于对阵列摄像机拍摄的各局部视频图像进行拼接处理时,可以减小或消除融合视频图像中的无效像素区域,提高融合视频图像的画面完整性和成像质量。In implementation, after the initial cropping parameters in the initial image stitching model are updated, the target image stitching model is obtained, which is used to stitch the local video images taken by the array camera, thereby reducing or eliminating the invalid pixel area in the fused video image and improving the picture integrity and imaging quality of the fused video image.

上述图像拼接方法中,可以采用已有的图像拼接模型构建方法,建立阵列摄像机的初始图像拼接模型,然后通过各局部相机的初始图像变换参数和初始裁剪参数,对空白参照图像进行图像变换和裁剪,得到待缝合图像。由于空白参照图像中每个像素点的像素值均与无效像素点的像素值不同,因而可以根据待缝合图像中各像素点的像素值,快速准确地确定出各待缝合图像中的无效像素区域和有效像素区域,进而根据存在无效像素区域的目标待缝合图像中、有效像素区域的目标内接矩形的全局位置信息,对目标局部相机和其关联局部相机的裁剪参数进行更新。其中,目标内接矩形区域中的像素点均为有效像素点,基于该内接矩形区域进行裁剪参数更新,可以减小或消除融合视频图像中的无效像素区域,提高融合视频图像的画面完整性和成像质量。并且,本方法仅需简单更新图像拼接模型的参数,即可提高图像拼接模型的适配度,不需对图像拼接模型的构建算法进行复杂修改,提高了已有的图像拼接模型构建算法的复用性,有效节约了开发资源。In the above-mentioned image stitching method, an existing image stitching model construction method can be used to establish an initial image stitching model of an array camera, and then the blank reference image is transformed and cropped by the initial image transformation parameters and initial cropping parameters of each local camera to obtain an image to be stitched. Since the pixel value of each pixel in the blank reference image is different from the pixel value of the invalid pixel, the invalid pixel area and the valid pixel area in each image to be stitched can be quickly and accurately determined according to the pixel value of each pixel in the image to be stitched, and then the cropping parameters of the target local camera and its associated local camera are updated according to the global position information of the target inscribed rectangle of the valid pixel area in the target image to be stitched where the invalid pixel area exists. Among them, the pixels in the target inscribed rectangle area are all valid pixels, and the cropping parameters are updated based on the inscribed rectangle area, which can reduce or eliminate the invalid pixel area in the fused video image, and improve the picture integrity and imaging quality of the fused video image. Moreover, this method only needs to simply update the parameters of the image stitching model to improve the adaptability of the image stitching model, without the need for complex modifications to the image stitching model construction algorithm, thereby improving the reusability of the existing image stitching model construction algorithm and effectively saving development resources.

在一个实施例中,提供了上边界裁剪参数和下边界裁剪参数的更新过程具体实现方式。步骤204中更新当前裁剪参数的过程具体包括如下步骤:In one embodiment, a specific implementation of the updating process of the upper boundary clipping parameter and the lower boundary clipping parameter is provided. The process of updating the current clipping parameter in step 204 specifically includes the following steps:

步骤204a,根据所述目标局部相机所在行中、各所述目标内接矩形区域的区域上边界纵坐标和区域下边界纵坐标,确定该行的最大区域上边界纵坐标和最小区域下边界纵坐标,并将该行的各所述局部相机的当前上边界裁剪参数和当前下边界裁剪参数,分别更新为所述最大区域上边界纵坐标和所述最小区域下边界纵坐标。Step 204a, based on the upper boundary ordinate and the lower boundary ordinate of each target inscribed rectangular area in the row where the target local camera is located, determine the maximum upper boundary ordinate and the minimum lower boundary ordinate of the row, and update the current upper boundary cropping parameters and the current lower boundary cropping parameters of each local camera in the row to the maximum upper boundary ordinate and the minimum lower boundary ordinate, respectively.

在实施中,若阵列相机拍摄的图像为多行、且不止一行存在目标局部相机,则可以将每一行分别进行裁剪参数调整。该示例以一行拍摄图像为例进行说明。如图4c中,目标局部相机A3、A4和A5位于同一行,将该行内该3个目标内接矩形区域的区域上边界纵坐标和区域下边界纵坐标进行对比,找到最大区域上边界纵坐标和最小区域下边界纵坐标。本示例中,局部相机A5的区域上边界纵坐标(即像素点a5和b5的纵坐标va5)最大,三个目标局部相机的区域下边界纵坐标相同,因而将该行的各局部相机(A1至A6,以及未示出的其它局部相机)的上边界裁剪参数均更新为va5,下边界裁剪参数保持不变。In implementation, if the image captured by the array camera is multiple rows, and there are target local cameras in more than one row, the cropping parameters of each row can be adjusted separately. This example is explained by taking a row of captured images as an example. As shown in Figure 4c, the target local cameras A3, A4 and A5 are located in the same row. The upper boundary ordinates and the lower boundary ordinates of the three target inscribed rectangular areas in the row are compared to find the maximum upper boundary ordinate and the minimum lower boundary ordinate. In this example, the upper boundary ordinate of the local camera A5 (i.e., the ordinate v a5 of the pixel points a 5 and b 5 ) is the largest, and the lower boundary ordinates of the three target local cameras are the same, so the upper boundary cropping parameters of each local camera in the row (A1 to A6, and other local cameras not shown) are updated to v a5 , and the lower boundary cropping parameters remain unchanged.

在一个实施例中,提供了左边界裁剪参数和右边界裁剪参数的更新过程具体实现方式。步骤204中更新当前裁剪参数的过程具体包括如下步骤:In one embodiment, a specific implementation of the updating process of the left border cropping parameter and the right border cropping parameter is provided. The process of updating the current cropping parameter in step 204 specifically includes the following steps:

步骤204b,针对每个目标局部相机,计算该目标局部相机的区域左边界横坐标与当前左边界裁剪参数的差值,得到当前左边界差值,并计算该目标局部相机的区域右边界横坐标与当前右边界裁剪参数的差值,得到当前右边界差值。Step 204b, for each target local camera, calculate the difference between the horizontal coordinate of the left boundary of the area of the target local camera and the current left boundary cropping parameter to obtain the current left boundary difference, and calculate the difference between the horizontal coordinate of the right boundary of the area of the target local camera and the current right boundary cropping parameter to obtain the current right boundary difference.

步骤204c,在当前左边界差值大于预设阈值的情况下,将该目标局部相机的当前左边界裁剪参数、以及该目标局部相机的左邻局部相机的当前右边界裁剪参数,更新为该目标局部相机的区域左边界横坐标。Step 204c, when the current left boundary difference is greater than a preset threshold, the current left boundary cropping parameter of the target local camera and the current right boundary cropping parameter of the local camera to the left of the target local camera are updated to the horizontal coordinate of the left boundary of the target local camera.

步骤204d,在当前右边界差值大于预设阈值的情况下,将该目标局部相机的当前右边界裁剪参数、以及该目标局部相机的右邻局部相机的当前左边界裁剪参数,更新为该目标局部相机的区域右边界横坐标。Step 204d: when the current right boundary difference is greater than a preset threshold, the current right boundary cropping parameter of the target local camera and the current left boundary cropping parameter of the local camera to the right of the target local camera are updated to the horizontal coordinate of the right boundary of the target local camera.

例如,预设阈值可以设为0(也可以设为大于0的一个较小的数)。如图4c所示,对于目标局部相机A3,当前左边界差值为Δx1(大于预设阈值),当前右边界差值为0(等于预设阈值)。因而可以将目标局部相机A3的左边界裁剪参数更新为内接矩形区域的左边界横坐标(像素点a3的横坐标ua3),并将其左邻局部相机A2的右边界裁剪参数更新为ua3For example, the preset threshold value may be set to 0 (or a smaller number greater than 0). As shown in FIG4c , for the target local camera A3, the current left boundary difference is Δx1 (greater than the preset threshold value), and the current right boundary difference is 0 (equal to the preset threshold value). Therefore, the left boundary clipping parameter of the target local camera A3 may be updated to the left boundary abscissa of the inscribed rectangular area (the abscissa u a3 of the pixel point a 3 ), and the right boundary clipping parameter of its left neighbor local camera A2 may be updated to u a3 .

在一个实施例中,步骤205得到目标图像拼接模型的过程具体包括如下步骤:将更新后的裁剪参数作为新的当前裁剪参数,返回执行针对每个局部相机,采用该局部相机的初始图像变换参数和当前裁剪参数,对该局部相机对应的空白对照图像进行图像变换和裁剪步骤。相应的,根据各当前待缝合图像中各像素点的像素值,判断各当前待缝合图像中是否存在无效像素区域之后,该方法还包括如下步骤:在各当前待缝合图像均不存在无效像素区域的情况下,将当前裁剪参数作为目标裁剪参数,得到目标图像拼接模型。In one embodiment, the process of obtaining the target image stitching model in step 205 specifically includes the following steps: using the updated cropping parameters as new current cropping parameters, returning to execute the image transformation and cropping steps for each local camera, using the initial image transformation parameters and current cropping parameters of the local camera, and using the blank control image corresponding to the local camera. Correspondingly, after judging whether there is an invalid pixel area in each current image to be stitched according to the pixel value of each pixel point in each current image to be stitched, the method also includes the following steps: when there is no invalid pixel area in each current image to be stitched, using the current cropping parameters as the target cropping parameters to obtain the target image stitching model.

在实施中,基于步骤204对初始裁剪参数进行更新后(第一次更新),可以基于更新后的裁剪参数,对空白对照图像进行变换和裁剪,得到新的待缝合图像,并判断该新的待缝合图像中是否存在无效像素区域。若每个新的待缝合图像均不存在无效像素区域,则将该更新后的裁剪参数作为目标图像拼接模型中的裁剪参数。若新的待缝合图像仍存在无效像素区域,则继续执行步骤203中将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,根据目标内接矩形区域的全局位置信息对当前裁剪参数进行更新的步骤,即再次进行更新(第二次更新)。In implementation, after the initial cropping parameters are updated based on step 204 (first update), the blank control image can be transformed and cropped based on the updated cropping parameters to obtain a new image to be stitched, and it is determined whether there is an invalid pixel area in the new image to be stitched. If there is no invalid pixel area in each new image to be stitched, the updated cropping parameters are used as the cropping parameters in the target image stitching model. If there is still an invalid pixel area in the new image to be stitched, the current image to be stitched with the invalid pixel area is determined as the target image to be stitched in step 203, and the current cropping parameters are updated according to the global position information of the target inscribed rectangular area, that is, it is updated again (second update).

在一个实施例中,可以在对裁剪参数进行更新后,记录当前更新次数。如第一次更新后,当前更新次数记为1,每更新一次,次数加1。基于第一次更新后的裁剪参数对空白对照图像进行变换和裁剪,得到新的待缝合图像,若新的待缝合图像中存在无效像素区域,由于此时更新次数小于预设值(预设值可以设为2或3),则执行步骤203中确定目标待缝合图像步骤,对当前裁剪参数进行再次更新,更新次数记为2。然后再基于第二次更新后的裁剪参数对空白对照图像进行变换和裁剪,若新的待缝合图像中仍存在无效像素区域,由于此时的当前更新次数等于预设值(若设为2的情况),则将当前存在无效像素区域的待缝合图像确定为待校正图像,其对应的局部相机为待校正局部相机。并根据待校正图像包含的无效像素点的全局位置信息,对待校正局部相机及待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正。In one embodiment, after the cropping parameters are updated, the current update number can be recorded. For example, after the first update, the current update number is recorded as 1, and the number is increased by 1 for each update. Based on the cropping parameters after the first update, the blank control image is transformed and cropped to obtain a new image to be stitched. If there is an invalid pixel area in the new image to be stitched, since the update number is less than the preset value (the preset value can be set to 2 or 3) at this time, the step of determining the target image to be stitched in step 203 is executed, and the current cropping parameters are updated again, and the update number is recorded as 2. Then, based on the cropping parameters after the second update, the blank control image is transformed and cropped. If there is still an invalid pixel area in the new image to be stitched, since the current update number is equal to the preset value (if it is set to 2), the image to be stitched with the invalid pixel area is determined as the image to be corrected, and its corresponding local camera is the local camera to be corrected. And according to the global position information of the invalid pixel points contained in the image to be corrected, the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same line of the local camera to be corrected are corrected.

本实施例中,可以对裁剪参数进行迭代更新。在一些示例中,更新次数的预设值可以设为3次,第一次更新可以仅执行步骤204a,更新上下边界裁剪参数。若还需执行第二次更新,则从第二次更新开始,可以不执行步骤204a,仅执行步骤204b至204d,更新左右边界裁剪参数。也可以每次更新都执行步骤204a至步骤204d的全部步骤。若更新次数达到预设次数,则说明调整左右边界裁剪参数已无法完全消除无效像素区域,为了提高融合图像的成像质量,可以进一步校正上下边界裁剪参数,以减小或消除无效像素区域。In this embodiment, the cropping parameters can be iteratively updated. In some examples, the preset value of the number of updates can be set to 3 times, and the first update can only execute step 204a to update the upper and lower boundary cropping parameters. If a second update is required, starting from the second update, step 204a can be omitted, and only steps 204b to 204d can be executed to update the left and right boundary cropping parameters. All steps from step 204a to step 204d can also be executed each time the update is performed. If the number of updates reaches the preset number of times, it means that adjusting the left and right boundary cropping parameters can no longer completely eliminate the invalid pixel area. In order to improve the imaging quality of the fused image, the upper and lower boundary cropping parameters can be further corrected to reduce or eliminate the invalid pixel area.

在一个示例中,校正过程具体包括如下步骤:服务器可以分别从上往下遍历待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选上边界裁剪参数。以及,服务器可以分别从下往上遍历待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选下边界裁剪参数。然后,服务器可以根据各候选上边界裁剪参数中的最大值和各候选下边界裁剪参数中的最小值,对待校正局部相机及待校正局部相机的同行局部相机的当前上边界裁剪参数和当前下边界裁剪参数进行校正。In one example, the correction process specifically includes the following steps: the server can traverse the first column of pixels and the last column of pixels of the image to be corrected from top to bottom respectively. If the current pixel is an invalid pixel, the server will search for the next pixel until the current pixel is a valid pixel, stop traversing, and use the ordinate of the current pixel as a candidate upper boundary cropping parameter. Also, the server can traverse the first column of pixels and the last column of pixels of the image to be corrected from bottom to top respectively. If the current pixel is an invalid pixel, the server will search for the next pixel until the current pixel is a valid pixel, stop traversing, and use the ordinate of the current pixel as a candidate lower boundary cropping parameter. Then, the server can correct the current upper boundary cropping parameters and the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row as the local camera to be corrected according to the maximum value of each candidate upper boundary cropping parameter and the minimum value of each candidate lower boundary cropping parameter.

基于初始的图像拼接模型对图3a所示的阵列摄像机拍摄的各局部图像进行拼接融合,得到的融合图像如图7a所示。由于该阵列摄像机经过结构改进,各局部相机的图像传感器具有一定旋转角度(与轴线水平夹角的大小正相关),融合图像中出现了较多的无效像素区域,说明该初始图像拼接模型的适配度较低。通过本申请实施例提供的图像拼接方法对初始图像拼接模型的裁剪参数进行更新,基于更新后的目标图像拼接模型得到的融合图像如图7b所示,可见其中不存在明显的无效像素区域,融合图像的成像质量得到明显提高。Based on the initial image stitching model, each local image captured by the array camera shown in Figure 3a is stitched and fused, and the obtained fused image is shown in Figure 7a. Since the array camera has undergone structural improvements, the image sensor of each local camera has a certain rotation angle (positively correlated with the size of the horizontal angle of the axis), and more invalid pixel areas appear in the fused image, indicating that the adaptability of the initial image stitching model is low. The cropping parameters of the initial image stitching model are updated by the image stitching method provided in the embodiment of the present application, and the fused image obtained based on the updated target image stitching model is shown in Figure 7b. It can be seen that there is no obvious invalid pixel area, and the imaging quality of the fused image is significantly improved.

应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的图像拼接方法的图像拼接装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个图像拼接装置实施例中的具体限定可以参见上文中对于图像拼接方法的限定,在此不再赘述。Based on the same inventive concept, the embodiment of the present application also provides an image stitching device for implementing the above-mentioned image stitching method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations of one or more image stitching device embodiments provided below can refer to the above-mentioned limitations on the image stitching method, and will not be repeated here.

在一个实施例中,如图5所示,提供了一种用于阵列摄像机的图像拼接装置500,包括:建立模块501、裁剪模块502、第一确定模块503和更新模块504,其中:In one embodiment, as shown in FIG. 5 , an image stitching device 500 for an array camera is provided, comprising: a building module 501, a cropping module 502, a first determining module 503 and an updating module 504, wherein:

建立模块501,用于获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各所述局部样本图像,建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数。Establishing module 501, used for obtaining local sample images taken by each local camera of the array camera, and establishing an initial image stitching model based on each local sample image; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera.

裁剪模块502,用于将所述初始裁剪参数作为当前裁剪参数,针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同。The cropping module 502 is used to use the initial cropping parameters as current cropping parameters, and for each of the local cameras, use the initial image transformation parameters of the local camera and the current cropping parameters to perform image transformation and cropping on the blank control image corresponding to the local camera to obtain the current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel.

第一确定模块503,用于根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域。The first determination module 503 is used to determine whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, determine the current image to be stitched with the invalid pixel area as the target image to be stitched, and determine the target inscribed rectangular area of the valid pixel area in the target image to be stitched.

更新模块504,用于根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,并基于更新后的裁剪参数得到目标图像拼接模型,所述目标图像拼接模型用于对所述阵列摄像机拍摄的各局部视频图像进行拼接融合处理。The updating module 504 is used to update the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the inscribed rectangular area of the target, and obtain a target image stitching model based on the updated cropping parameters. The target image stitching model is used to perform stitching and fusion processing on the local video images taken by the array camera.

在其中一个实施例中,所述关联局部相机包括同行局部相机;所述当前裁剪参数包括当前上边界裁剪参数和当前下边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域上边界纵坐标和区域下边界纵坐标。所述更新模块504具体用于:根据所述目标局部相机所在行中、各所述目标内接矩形区域的区域上边界纵坐标和区域下边界纵坐标,确定该行的最大区域上边界纵坐标和最小区域下边界纵坐标,并将该行的各所述局部相机的当前上边界裁剪参数和当前下边界裁剪参数,分别更新为所述最大区域上边界纵坐标和所述最小区域下边界纵坐标。In one embodiment, the associated local camera includes a local camera in the same row; the current cropping parameters include a current upper boundary cropping parameter and a current lower boundary cropping parameter; the global position information of the target inscribed rectangular area includes the upper boundary ordinate of the area and the lower boundary ordinate of the area. The updating module 504 is specifically used to: determine the maximum upper boundary ordinate of the row and the minimum lower boundary ordinate of the area according to the upper boundary ordinate of the area and the lower boundary ordinate of the area of each target inscribed rectangular area in the row where the target local camera is located, and update the current upper boundary cropping parameter and the current lower boundary cropping parameter of each local camera in the row to the maximum upper boundary ordinate and the minimum lower boundary ordinate, respectively.

在其中一个实施例中,所述关联局部相机包括左邻局部相机和右邻局部相机;所述当前裁剪参数包括当前左边界裁剪参数和当前右边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域左边界横坐标和区域右边界横坐标。所述更新模块504具体用于:针对每个所述目标局部相机,计算该目标局部相机的所述区域左边界横坐标与所述当前左边界裁剪参数的差值,得到当前左边界差值,并计算该目标局部相机的所述区域右边界横坐标与所述当前右边界裁剪参数的差值,得到当前右边界差值;在所述当前左边界差值大于预设阈值的情况下,将该目标局部相机的当前左边界裁剪参数、以及该目标局部相机的左邻局部相机的当前右边界裁剪参数,更新为该目标局部相机的所述区域左边界横坐标;在所述当前右边界差值大于预设阈值的情况下,将该目标局部相机的当前右边界裁剪参数、以及该目标局部相机的右邻局部相机的当前左边界裁剪参数,更新为该目标局部相机的所述区域右边界横坐标。In one embodiment, the associated local camera includes a left neighboring local camera and a right neighboring local camera; the current cropping parameters include a current left boundary cropping parameter and a current right boundary cropping parameter; and the global position information of the target inscribed rectangular area includes a region left boundary horizontal coordinate and a region right boundary horizontal coordinate. The updating module 504 is specifically used to: for each of the target local cameras, calculate the difference between the region left boundary horizontal coordinate of the target local camera and the current left boundary cropping parameter to obtain the current left boundary difference, and calculate the difference between the region right boundary horizontal coordinate of the target local camera and the current right boundary cropping parameter to obtain the current right boundary difference; when the current left boundary difference is greater than a preset threshold, update the current left boundary cropping parameter of the target local camera and the current right boundary cropping parameter of the left neighboring local camera of the target local camera to the region left boundary horizontal coordinate of the target local camera; when the current right boundary difference is greater than a preset threshold, update the current right boundary cropping parameter of the target local camera and the current left boundary cropping parameter of the right neighboring local camera of the target local camera to the region right boundary horizontal coordinate of the target local camera.

在其中一个实施例中,所述更新模块504还用于将更新后的裁剪参数作为新的当前裁剪参数,返回执行针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪步骤。In one embodiment, the updating module 504 is further configured to use the updated cropping parameters as new current cropping parameters, and return to execute, for each of the local cameras, image transformation and cropping steps for the blank control image corresponding to the local camera using the initial image transformation parameters and the current cropping parameters of the local camera.

相应的,该装置还包括第二确定模块,用于在各所述当前待缝合图像均不存在无效像素区域的情况下,将所述当前裁剪参数作为目标裁剪参数,得到目标图像拼接模型。Correspondingly, the device further comprises a second determining module, which is used to use the current cropping parameters as target cropping parameters to obtain a target image stitching model when none of the current images to be stitched have invalid pixel regions.

在其中一个实施例中,所述更新模块504还用于记录当前更新次数。相应的,该装置还包括第三确定模块和校正模块,其中:In one embodiment, the updating module 504 is also used to record the current update times. Accordingly, the device further includes a third determining module and a correction module, wherein:

第三确定模块用于在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数小于预设值的情况下,执行所述将存在无效像素区域的当前待缝合图像确定为目标待缝合图像的步骤。The third determining module is used to perform the step of determining the current image to be stitched with the invalid pixel area as the target image to be stitched when at least one of the current images to be stitched has an invalid pixel area and the current update number is less than a preset value.

校正模块用于在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数大于或等于预设值的情况下,将存在无效像素区域的所述新的当前待缝合图像确定为待校正图像,其对应的局部相机为待校正局部相机;根据所述待校正图像包含的无效像素点的全局位置信息,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正,将校正后的裁剪参数作为目标裁剪参数,得到目标图像拼接模型。The correction module is used to determine the new current image to be stitched with the invalid pixel area as the image to be corrected, and its corresponding local camera is the local camera to be corrected, when at least one of the current images to be stitched has an invalid pixel area and the current update number is greater than or equal to a preset value; according to the global position information of the invalid pixel points contained in the image to be corrected, correct the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row of the local camera to be corrected, and use the corrected cropping parameters as the target cropping parameters to obtain the target image stitching model.

在其中一个实施例中,校正模块还用于:分别从上往下遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选上边界裁剪参数;分别从下往上遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,将当前像素点的纵坐标作为候选下边界裁剪参数;根据各所述候选上边界裁剪参数中的最大值和各所述候选下边界裁剪参数中的最小值,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和当前下边界裁剪参数进行校正。In one of the embodiments, the correction module is further used to: traverse the first column of pixels and the last column of pixels of the image to be corrected from top to bottom respectively, if the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the vertical coordinate of the current pixel as a candidate upper boundary cropping parameter; traverse the first column of pixels and the last column of pixels of the image to be corrected from bottom to top respectively, if the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the vertical coordinate of the current pixel as a candidate lower boundary cropping parameter; correct the current upper boundary cropping parameter and the current lower boundary cropping parameter of the local camera to be corrected and the local camera in the same row of the local camera to be corrected according to the maximum value of each of the candidate upper boundary cropping parameters and the minimum value of each of the candidate lower boundary cropping parameters.

上述用于阵列摄像机的图像拼接装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned image stitching device for array cameras can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图6所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储执行上述用于阵列摄像机的图像拼接方法所需的或产生的数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种用于阵列摄像机的图像拼接方法。In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data required or generated for executing the above-mentioned image stitching method for array cameras. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an image stitching method for array cameras is implemented.

本领域技术人员可以理解,图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

在一个实施例中,提供了一种亿级像素计算成像系统。所述系统包括阵列摄像机和服务器,其中:In one embodiment, a billion-pixel computational imaging system is provided. The system includes an array camera and a server, wherein:

所述阵列摄像机用于通过各局部相机拍摄局部样本图像,并将各所述局部样本图像发送给所述服务器;The array camera is used to capture local sample images through each local camera, and send each local sample image to the server;

所述服务器用于基于各所述局部样本图像建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;将所述初始裁剪参数作为当前裁剪参数;The server is used to establish an initial image stitching model based on each of the local sample images; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each of the local cameras; and the initial cropping parameters are used as current cropping parameters;

所述服务器还用于针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新;基于更新后的裁剪参数得到目标图像拼接模型;The server is also used for performing image transformation and cropping on the blank control image corresponding to each local camera using the initial image transformation parameters and the current cropping parameters of the local camera to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel; judging whether there is an invalid pixel area in each current image to be stitched according to the pixel value of each pixel in each current image to be stitched, determining the current image to be stitched with the invalid pixel area as the target image to be stitched, and determining the target inscribed rectangular area of the valid pixel area in the target image to be stitched; updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the target inscribed rectangular area; obtaining a target image stitching model based on the updated cropping parameters;

所述阵列摄像机还用于拍摄局部视频图像发送给所述服务器;The array camera is also used to capture local video images and send them to the server;

所述服务器还用于基于所述目标图像拼接模型对各所述局部视频图像进行拼接融合处理,得到融合视频图像,并将所述融合视频图像发送给显示终端。The server is also used to perform splicing and fusion processing on each of the local video images based on the target image splicing model to obtain a fused video image, and send the fused video image to a display terminal.

在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims (10)

1.一种用于阵列摄像机的图像拼接方法,其特征在于,所述方法包括:1. An image stitching method for an array camera, characterized in that the method comprises: 获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各所述局部样本图像,建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;Acquire local sample images taken by each local camera of the array camera, and establish an initial image stitching model based on each local sample image; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera; 将所述初始裁剪参数作为当前裁剪参数,针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;Using the initial cropping parameters as current cropping parameters, for each of the local cameras, using the initial image transformation parameters of the local camera and the current cropping parameters, performing image transformation and cropping on the blank control image corresponding to the local camera, to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel; 根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;According to the pixel value of each pixel point in each of the current images to be stitched, it is judged whether there is an invalid pixel area in each of the current images to be stitched, the current images to be stitched with the invalid pixel area are determined as the target images to be stitched, and the target inscribed rectangular area of the valid pixel area in the target images to be stitched is determined; 根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新;According to the global position information of the target inscribed rectangular area, the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera are updated; 基于更新后的裁剪参数得到目标图像拼接模型,所述目标图像拼接模型用于对所述阵列摄像机拍摄的各局部视频图像进行拼接融合处理。A target image stitching model is obtained based on the updated cropping parameters, and the target image stitching model is used to perform stitching and fusion processing on each local video image captured by the array camera. 2.根据权利要求1所述的方法,其特征在于,所述关联局部相机包括同行局部相机;所述当前裁剪参数包括当前上边界裁剪参数和当前下边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域上边界纵坐标和区域下边界纵坐标;所述根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,包括:2. The method according to claim 1, characterized in that the associated local camera includes a local camera in the same industry; the current cropping parameters include a current upper boundary cropping parameter and a current lower boundary cropping parameter; the global position information of the target inscribed rectangular area includes the upper boundary ordinate of the area and the lower boundary ordinate of the area; the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera are updated according to the global position information of the target inscribed rectangular area, comprising: 根据所述目标局部相机所在行中、各所述目标内接矩形区域的区域上边界纵坐标和区域下边界纵坐标,确定该行的最大区域上边界纵坐标和最小区域下边界纵坐标,并将该行的各所述局部相机的当前上边界裁剪参数和当前下边界裁剪参数,分别更新为所述最大区域上边界纵坐标和所述最小区域下边界纵坐标。According to the upper boundary ordinate and the lower boundary ordinate of each target inscribed rectangular area in the row where the target local camera is located, the maximum upper boundary ordinate and the minimum lower boundary ordinate of the row are determined, and the current upper boundary cropping parameters and the current lower boundary cropping parameters of each local camera in the row are updated to the maximum upper boundary ordinate and the minimum lower boundary ordinate, respectively. 3.根据权利要求1所述的方法,其特征在于,所述关联局部相机包括左邻局部相机和右邻局部相机;所述当前裁剪参数包括当前左边界裁剪参数和当前右边界裁剪参数;所述目标内接矩形区域的全局位置信息包括区域左边界横坐标和区域右边界横坐标;所述根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,包括:3. The method according to claim 1, characterized in that the associated local camera includes a left neighboring local camera and a right neighboring local camera; the current cropping parameters include a current left boundary cropping parameter and a current right boundary cropping parameter; the global position information of the target inscribed rectangular area includes a left boundary horizontal coordinate of the area and a right boundary horizontal coordinate of the area; and the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera are updated according to the global position information of the target inscribed rectangular area, comprising: 针对每个所述目标局部相机,计算该目标局部相机的所述区域左边界横坐标与所述当前左边界裁剪参数的差值,得到当前左边界差值,并计算该目标局部相机的所述区域右边界横坐标与所述当前右边界裁剪参数的差值,得到当前右边界差值;For each of the target local cameras, the difference between the horizontal coordinate of the left boundary of the region of the target local camera and the current left boundary clipping parameter is calculated to obtain a current left boundary difference, and the difference between the horizontal coordinate of the right boundary of the region of the target local camera and the current right boundary clipping parameter is calculated to obtain a current right boundary difference; 在所述当前左边界差值大于预设阈值的情况下,将该目标局部相机的当前左边界裁剪参数、以及该目标局部相机的左邻局部相机的当前右边界裁剪参数,更新为该目标局部相机的所述区域左边界横坐标;When the current left boundary difference is greater than a preset threshold, the current left boundary clipping parameter of the target local camera and the current right boundary clipping parameter of the left neighboring local camera of the target local camera are updated to the horizontal coordinate of the left boundary of the region of the target local camera; 在所述当前右边界差值大于预设阈值的情况下,将该目标局部相机的当前右边界裁剪参数、以及该目标局部相机的右邻局部相机的当前左边界裁剪参数,更新为该目标局部相机的所述区域右边界横坐标。When the current right boundary difference is greater than a preset threshold, the current right boundary cropping parameter of the target local camera and the current left boundary cropping parameter of the local camera to the right of the target local camera are updated to the horizontal coordinate of the right boundary of the area of the target local camera. 4.根据权利要求1所述的方法,其特征在于,所述基于更新后的裁剪参数得到目标图像拼接模型,包括:4. The method according to claim 1, characterized in that the step of obtaining a target image stitching model based on the updated cropping parameters comprises: 将更新后的裁剪参数作为新的当前裁剪参数,返回执行针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪步骤;Using the updated cropping parameters as new current cropping parameters, returning to execute, for each of the local cameras, the steps of image transformation and cropping the blank control image corresponding to the local camera using the initial image transformation parameters and the current cropping parameters of the local camera; 所述根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域之后,所述方法还包括:After determining whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, the method further includes: 在各所述当前待缝合图像均不存在无效像素区域的情况下,将所述当前裁剪参数作为目标裁剪参数,得到目标图像拼接模型。In the case that there is no invalid pixel area in each of the current images to be stitched, the current cropping parameters are used as target cropping parameters to obtain a target image stitching model. 5.根据权利要求4所述的方法,其特征在于,所述对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新之后,所述方法还包括:5. The method according to claim 4, characterized in that after the current cropping parameters of the target local camera corresponding to the target image to be stitched and the local camera associated with the target local camera are updated, the method further comprises: 记录当前更新次数;Record the current update times; 所述根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域之后,所述方法还包括:After determining whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, the method further includes: 在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数小于预设值的情况下,执行将存在无效像素区域的当前待缝合图像确定为目标待缝合图像的步骤;In the case that at least one of the current images to be stitched has an invalid pixel region and the current update number is less than a preset value, performing a step of determining the current image to be stitched having the invalid pixel region as a target image to be stitched; 在至少一个所述当前待缝合图像存在无效像素区域、且所述当前更新次数大于或等于预设值的情况下,将存在无效像素区域的所述当前待缝合图像确定为待校正图像,其对应的局部相机为待校正局部相机;In the case that at least one of the current images to be stitched has an invalid pixel region and the current update number is greater than or equal to a preset value, the current image to be stitched with the invalid pixel region is determined as the image to be corrected, and the local camera corresponding to the image is the local camera to be corrected; 根据所述待校正图像包含的无效像素点的全局位置信息,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正,将校正后的裁剪参数作为目标裁剪参数,得到目标图像拼接模型。According to the global position information of the invalid pixel points contained in the image to be corrected, the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row as the local camera to be corrected are corrected, and the corrected cropping parameters are used as target cropping parameters to obtain a target image stitching model. 6.根据权利要求5所述的方法,其特征在于,所述根据所述待校正图像包含的无效像素点的全局位置信息,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和/或当前下边界裁剪参数进行校正,包括:6. The method according to claim 5, characterized in that the step of correcting the current upper boundary cropping parameters and/or the current lower boundary cropping parameters of the local camera to be corrected and the local camera in the same row as the local camera to be corrected according to the global position information of the invalid pixel points contained in the image to be corrected comprises: 分别从上往下遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,并将当前像素点的纵坐标作为候选上边界裁剪参数;Traverse the first column of pixels and the last column of pixels of the image to be corrected from top to bottom respectively, if the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the ordinate of the current pixel as a candidate upper boundary clipping parameter; 分别从下往上遍历所述待校正图像的第一列像素点和最后一列像素点,若当前像素点为无效像素点,则查找下一个像素点,直到当前像素点为有效像素点,停止遍历,并将当前像素点的纵坐标作为候选下边界裁剪参数;Traverse the first column of pixels and the last column of pixels of the image to be corrected from bottom to top respectively, if the current pixel is an invalid pixel, search for the next pixel until the current pixel is a valid pixel, stop traversal, and use the ordinate of the current pixel as a candidate lower boundary cropping parameter; 根据各所述候选上边界裁剪参数中的最大值和各所述候选下边界裁剪参数中的最小值,对所述待校正局部相机及所述待校正局部相机的同行局部相机的当前上边界裁剪参数和当前下边界裁剪参数进行校正。According to the maximum value of each candidate upper boundary cropping parameter and the minimum value of each candidate lower boundary cropping parameter, the current upper boundary cropping parameter and the current lower boundary cropping parameter of the local camera to be corrected and the local camera in the same row as the local camera to be corrected are corrected. 7.一种用于阵列摄像机的图像拼接装置,其特征在于,所述装置包括:7. An image stitching device for an array camera, characterized in that the device comprises: 建立模块,用于获取阵列摄像机的各局部相机拍摄的局部样本图像,并基于各所述局部样本图像,建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;Establishing a module for acquiring local sample images taken by each local camera of the array camera, and establishing an initial image stitching model based on each local sample image; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each local camera; 裁剪模块,用于将所述初始裁剪参数作为当前裁剪参数,针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;A cropping module, configured to use the initial cropping parameters as current cropping parameters, and for each of the local cameras, use the initial image transformation parameters of the local camera and the current cropping parameters to perform image transformation and cropping on the blank control image corresponding to the local camera, so as to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel; 第一确定模块,用于根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;A first determination module is used to determine whether there is an invalid pixel area in each of the current images to be stitched according to the pixel value of each pixel point in each of the current images to be stitched, determine the current image to be stitched with the invalid pixel area as the target image to be stitched, and determine a target inscribed rectangular area of a valid pixel area in the target image to be stitched; 更新模块,用于根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新,并基于更新后的裁剪参数得到目标图像拼接模型,所述目标图像拼接模型用于对所述阵列摄像机拍摄的各局部视频图像进行拼接融合处理。An updating module is used to update the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the inscribed rectangular area of the target, and obtain a target image stitching model based on the updated cropping parameters, and the target image stitching model is used to perform stitching and fusion processing on the local video images taken by the array camera. 8.一种亿级像素计算成像系统,其特征在于,所述系统包括阵列摄像机和服务器,其中:8. A billion-pixel computational imaging system, characterized in that the system comprises an array camera and a server, wherein: 所述阵列摄像机用于通过各局部相机拍摄局部样本图像,并将各所述局部样本图像发送给所述服务器;The array camera is used to capture local sample images through each local camera, and send each local sample image to the server; 所述服务器用于基于各所述局部样本图像建立初始的图像拼接模型;所述初始的图像拼接模型包括每个所述局部相机对应的初始图像变换参数和初始裁剪参数;将所述初始裁剪参数作为当前裁剪参数;The server is used to establish an initial image stitching model based on each of the local sample images; the initial image stitching model includes initial image transformation parameters and initial cropping parameters corresponding to each of the local cameras; and the initial cropping parameters are used as current cropping parameters; 所述服务器还用于针对每个所述局部相机,采用该局部相机的所述初始图像变换参数和所述当前裁剪参数,对该局部相机对应的所述空白对照图像进行图像变换和裁剪,得到当前待缝合图像;其中,所述空白对照图像与所述局部样本图像的尺寸相同,且所述空白对照图像中每个像素点的像素值均与无效像素点的像素值不同;根据各所述当前待缝合图像中各像素点的像素值,判断各所述当前待缝合图像中是否存在无效像素区域,将存在无效像素区域的当前待缝合图像确定为目标待缝合图像,并确定所述目标待缝合图像中有效像素区域的目标内接矩形区域;根据所述目标内接矩形区域的全局位置信息,对所述目标待缝合图像对应的目标局部相机及所述目标局部相机的关联局部相机的所述当前裁剪参数进行更新;基于更新后的裁剪参数得到目标图像拼接模型;The server is also used for performing image transformation and cropping on the blank control image corresponding to each local camera using the initial image transformation parameters and the current cropping parameters of the local camera to obtain a current image to be stitched; wherein the blank control image has the same size as the local sample image, and the pixel value of each pixel in the blank control image is different from the pixel value of the invalid pixel; judging whether there is an invalid pixel area in each current image to be stitched according to the pixel value of each pixel in each current image to be stitched, determining the current image to be stitched with the invalid pixel area as the target image to be stitched, and determining the target inscribed rectangular area of the valid pixel area in the target image to be stitched; updating the current cropping parameters of the target local camera corresponding to the target image to be stitched and the associated local camera of the target local camera according to the global position information of the target inscribed rectangular area; obtaining a target image stitching model based on the updated cropping parameters; 所述阵列摄像机还用于拍摄局部视频图像发送给所述服务器;The array camera is also used to capture local video images and send them to the server; 所述服务器还用于基于所述目标图像拼接模型对各所述局部视频图像进行拼接融合处理,得到融合视频图像,并将所述融合视频图像发送给显示终端。The server is also used to perform splicing and fusion processing on each of the local video images based on the target image splicing model to obtain a fused video image, and send the fused video image to a display terminal. 9.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述的方法的步骤。9. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。10. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
CN202311746730.1A 2023-12-19 2023-12-19 Image stitching method, device and system for array camera Active CN118014828B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202311746730.1A CN118014828B (en) 2023-12-19 2023-12-19 Image stitching method, device and system for array camera
CN202411096708.1A CN118864242A (en) 2023-12-19 2023-12-19 Image stitching method for array cameras

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311746730.1A CN118014828B (en) 2023-12-19 2023-12-19 Image stitching method, device and system for array camera

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202411096708.1A Division CN118864242A (en) 2023-12-19 2023-12-19 Image stitching method for array cameras

Publications (2)

Publication Number Publication Date
CN118014828A true CN118014828A (en) 2024-05-10
CN118014828B CN118014828B (en) 2024-08-20

Family

ID=90946237

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202411096708.1A Pending CN118864242A (en) 2023-12-19 2023-12-19 Image stitching method for array cameras
CN202311746730.1A Active CN118014828B (en) 2023-12-19 2023-12-19 Image stitching method, device and system for array camera

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202411096708.1A Pending CN118864242A (en) 2023-12-19 2023-12-19 Image stitching method for array cameras

Country Status (1)

Country Link
CN (2) CN118864242A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113808059A (en) * 2021-09-16 2021-12-17 北京拙河科技有限公司 Array image fusion method, device, medium and equipment
CN114841862A (en) * 2022-06-07 2022-08-02 北京拙河科技有限公司 Image splicing method and system based on hundred million pixel array type camera
JP7158795B1 (en) * 2022-06-03 2022-10-24 株式会社Cybo Microscope system and data processing method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113808059A (en) * 2021-09-16 2021-12-17 北京拙河科技有限公司 Array image fusion method, device, medium and equipment
JP7158795B1 (en) * 2022-06-03 2022-10-24 株式会社Cybo Microscope system and data processing method
CN114841862A (en) * 2022-06-07 2022-08-02 北京拙河科技有限公司 Image splicing method and system based on hundred million pixel array type camera

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YANGJING LONG等: "Image based source camera identification using demosaicking", 《2006 IEEE WORKSHOP ON MULTIMEDIA SIGNAL PROCESSING (IEEE CAT. NO.06EX1454)》, 1 January 2006 (2006-01-01), pages 1 - 6 *

Also Published As

Publication number Publication date
CN118014828B (en) 2024-08-20
CN118864242A (en) 2024-10-29

Similar Documents

Publication Publication Date Title
WO2021227360A1 (en) Interactive video projection method and apparatus, device, and storage medium
CN110660023B (en) A Video Splicing Method Based on Image Semantic Segmentation
WO2021227359A1 (en) Unmanned aerial vehicle-based projection method and apparatus, device, and storage medium
US7424218B2 (en) Real-time preview for panoramic images
US9373187B2 (en) Method and apparatus for producing a cinemagraph
Chen et al. Capturing Intention‐based Full‐Frame Video Stabilization
Yuan et al. Multiscale gigapixel video: A cross resolution image matching and warping approach
WO2021258579A1 (en) Image splicing method and apparatus, computer device, and storage medium
WO2022160857A1 (en) Image processing method and apparatus, and computer-readable storage medium and electronic device
CN107333064B (en) Spherical panoramic video splicing method and system
WO2021017589A1 (en) Image fusion method based on gradient domain mapping
CN116760937B (en) Video stitching method, device, equipment and storage medium based on multiple machine positions
WO2018058476A1 (en) Image correction method and device
WO2022267939A1 (en) Image processing method and apparatus, and computer-readable storage medium
CN118014828B (en) Image stitching method, device and system for array camera
CN104104911B (en) Timestamp in panoramic picture generating process is eliminated and remapping method and system
CN116152121B (en) Curved surface screen generating method and correcting method based on distortion parameters
WO2023066143A1 (en) Image segmentation method and apparatus for panoramic image, and computer device and storage medium
Gao et al. A new image mosaics algorithm based on feature points matching
US11893704B2 (en) Image processing method and device therefor
Duisterhof et al. MASt3R-SfM: a Fully-Integrated Solution for Unconstrained Structure-from-Motion
CN114677439A (en) Camera pose determination method and device, electronic equipment and storage medium
CN114358173A (en) Image processing method, related model training method and related device
CN113723465B (en) An improved feature extraction method and image stitching method based on the method
CN115334245A (en) Image correction method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant