[go: up one dir, main page]

CN116188348A - Crack detection method, device and equipment - Google Patents

Crack detection method, device and equipment Download PDF

Info

Publication number
CN116188348A
CN116188348A CN202111417479.5A CN202111417479A CN116188348A CN 116188348 A CN116188348 A CN 116188348A CN 202111417479 A CN202111417479 A CN 202111417479A CN 116188348 A CN116188348 A CN 116188348A
Authority
CN
China
Prior art keywords
image
camera
pixel
pixels
frames
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111417479.5A
Other languages
Chinese (zh)
Inventor
贾象阳
杨阳
冷继南
李阳
梁振宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202111417479.5A priority Critical patent/CN116188348A/en
Publication of CN116188348A publication Critical patent/CN116188348A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • 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
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

A crack detection method, apparatus and device are disclosed to reduce crack detection costs. The method comprises the following steps: the camera acquires N frames of first images, wherein the N frames of first images are obtained by shooting different areas of a target object through a preset operation, and the preset operation is to rotate a lens of the camera and adjust the focal length of the lens; the camera sends the N frames of first images to the computing device; the computing equipment splices part of each image in the N frames of first images to obtain a second image; the camera detects a crack of the target object based on the second image. The camera collects N frames of first images and then sends the N frames of first images to the computing equipment, and the computing equipment splices parts of each image in the N frames of first images to obtain a second image. The computing device detects a crack of the target object based on the second image. Therefore, manual detection is not needed, manpower and material resources can be saved, and the crack detection cost is reduced.

Description

裂缝检测方法、装置及设备Crack detection method, device and equipment

技术领域technical field

本申请涉及图像处理技术领域,具体涉及一种裂缝检测方法、装置及设备。The present application relates to the technical field of image processing, in particular to a crack detection method, device and equipment.

背景技术Background technique

道路或墙壁等建筑物上出现裂缝会影响建筑物的寿命,甚至会威胁到使用该建筑物的人员的人身安全。因此,需要对建筑物上的裂缝进行检测,从而对产生裂缝的建筑物进行维修,降低建筑物上的进一步损坏带来的风险。Cracks in buildings such as roads or walls will affect the life of the building, and even threaten the personal safety of the people who use the building. Therefore, it is necessary to detect the cracks on the buildings, so as to repair the buildings with cracks and reduce the risk of further damages on the buildings.

传统的裂缝检测主要依赖于人工巡检。近年来,随着科技手段不断加入,还可以采用道路检测车和无人机等智能设备进行裂缝检测。Traditional crack detection mainly relies on manual inspection. In recent years, with the continuous addition of scientific and technological means, intelligent equipment such as road inspection vehicles and drones can also be used for crack detection.

然而,无论是人工巡检还是借助智能设备进行裂缝检测,都需要投入人力物力,检测成本高。However, whether it is manual inspection or crack detection with the help of intelligent equipment, it needs to invest manpower and material resources, and the detection cost is high.

发明内容Contents of the invention

本申请提供了一种裂缝检测方法、装置及设备,以降低裂缝检测成本。The present application provides a crack detection method, device and equipment to reduce the cost of crack detection.

第一方面提供一种裂缝检测方法。该方法由相机和计算设备执行。相机与计算设备连接,相机用于采集第一图像,计算设备用于基于第一图像提取裂缝。具体地,该方法包括:相机采集N帧第一图像。N为大于或等于2的整数。N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的。其中,目标物体例如为道路、墙体等。预设操作为旋转相机的镜头和调节镜头的焦距。目标物体不同区域与相机的距离不同,区域与相机的距离与镜头的焦距呈正比。具体而言,通过旋转相机的镜头选中目标物体的区域,并且改变相机的镜头的焦距:对于与相机越远的区域,镜头的焦距越大;对于与相机越近的区域,镜头的焦距越小。从而使得不同的第一图像中的目标物体均能够清晰地呈现。相机采集到N帧第一图像后发送到计算设备,计算设备对N帧第一图像中每一图像的部分进行拼接获得第二图像。计算设备基于第二图像检测目标物体的裂缝。从而无需人工检测,能够节省人力物力,降低裂缝检测成本。The first aspect provides a crack detection method. The method is performed by a camera and a computing device. The camera is connected to a computing device, the camera is used to collect the first image, and the computing device is used to extract cracks based on the first image. Specifically, the method includes: the camera collects N frames of first images. N is an integer greater than or equal to 2. The N frames of first images are obtained by the camera shooting different areas of the target object through preset operations. Wherein, the target object is, for example, a road, a wall, and the like. The preset operation is to rotate the camera lens and adjust the focal length of the lens. Different regions of the target object have different distances from the camera, and the distance from the region to the camera is proportional to the focal length of the lens. Specifically, the area of the target object is selected by rotating the lens of the camera, and the focal length of the lens of the camera is changed: for the area farther from the camera, the focal length of the lens is larger; for the area closer to the camera, the focal length of the lens is smaller . Therefore, target objects in different first images can be clearly presented. The camera collects N frames of first images and sends them to the computing device, and the computing device stitches parts of each of the N frames of first images to obtain a second image. The computing device detects cracks in the target object based on the second image. Therefore, manual detection is not required, manpower and material resources can be saved, and the cost of crack detection can be reduced.

结合第一方面,在本申请的第一方面的第一种实现方式中,第二图像为无透视效果的图像。由于相机镜头的透视现象会造成相机拍摄到的目标物体有远小近大的效果,造成远处的目标物体细节丢失,无法准确检测出裂缝,将N帧第一图像拼接获得无透视效果的第二图像,则会使远处的目标物体的细节也能得到清晰呈现,基于第二图像进行裂缝检测也会更加准确。With reference to the first aspect, in a first implementation manner of the first aspect of the present application, the second image is an image without a perspective effect. Due to the perspective phenomenon of the camera lens, the target object captured by the camera has the effect of being far smaller and closer, resulting in the loss of details of the distant target object, and the crack cannot be accurately detected. The first image of N frames is stitched to obtain the first image without perspective effect. With the second image, the details of distant target objects can also be clearly presented, and crack detection based on the second image will also be more accurate.

结合第一方面或第一方面的第一种实现方式,在本申请的第一方面的第二种实现方式中,计算设备对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:计算设备分别截取N帧第一图像的M行像素,M为大于或等于1的整数。计算设备将N帧第一图像的M行像素拼接获得第二图像。从而能够快速地拼接得到第二图像。In combination with the first aspect or the first implementation of the first aspect, in the second implementation of the first aspect of the present application, the computing device stitches parts of each of the N frames of first images to obtain a second image The method includes: the computing device respectively intercepts M rows of pixels of the N frames of the first image, and M is an integer greater than or equal to 1. The computing device stitches the M rows of pixels of the N frames of the first image to obtain the second image. Therefore, the second image can be quickly spliced.

结合第一方面或第一方面的第一种实现方式,在本申请的第一方面的第三种实现方式中,计算设备对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:计算设备分别截取N帧第一图像中每一图像的部分像素,其中,每一图像被截取的像素数量不同。计算设备将N帧第一图像中每一图像的部分像素进行拼接获得第二图像。每一第一图像的部分像素对应于目标物体的一个子区域,第二图像中包括由N个子区域组成的完整的目标物体。由于每一第一图像对应的相机位姿和焦距不同,则每一第一图像中截取的像素数量可以不同。In combination with the first aspect or the first implementation of the first aspect, in the third implementation of the first aspect of the present application, the computing device stitches parts of each of the N frames of first images to obtain the second image The method includes: the computing device respectively intercepts partial pixels of each image in the N frames of first images, wherein the number of intercepted pixels of each image is different. The computing device splices some pixels of each of the N frames of first images to obtain a second image. Partial pixels of each first image correspond to a sub-region of the target object, and the second image includes a complete target object composed of N sub-regions. Since the camera poses and focal lengths corresponding to each first image are different, the number of pixels intercepted in each first image may be different.

结合第一方面或第一方面的第一种实现方式,在本申请的第一方面的第四种实现方式中,计算设备对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:计算设备分别截取N帧第一图像的P个像素,P为大于或等于1的整数。计算设备将N帧第一图像的P个像素拼接获得第二图像。从每一第一图像中截取相同数量的像素,能够快速地拼接得到第二图像。In combination with the first aspect or the first implementation of the first aspect, in the fourth implementation of the first aspect of the present application, the computing device stitches parts of each of the N frames of first images to obtain the second image The method includes: the computing device intercepts P pixels of the N frames of the first image respectively, and P is an integer greater than or equal to 1. The computing device stitches the P pixels of the N frames of the first image to obtain the second image. By intercepting the same number of pixels from each first image, the second image can be quickly spliced.

结合第一方面或第一方面的第一至第四任一种实现方式,在本申请的第一方面的第五种实现方式中,计算设备基于第二图像检测目标物体的裂缝包括:计算设备对第二图像进行预处理,得到J个第一图像块,第一图像块中包括目标物体的部分,J为大于或等于1的整数。计算设备对每一第一图像块进行处理,得到J个第二图像块,第二图像块中标记有裂缝的至少部分对应的目标像素。计算设备合并J个第二图像块,得到第三图像。计算设备提取第三图像中的目标像素,得到裂缝。通过将第二图像分块,并分别对图像块进行处理,能够降低外部环境对目标物体中裂缝的提取造成的影响,提高裂缝检测的准确性。In combination with the first aspect or any one of the first to fourth implementations of the first aspect, in the fifth implementation of the first aspect of the present application, the computing device detecting cracks of the target object based on the second image includes: computing device The second image is preprocessed to obtain J first image blocks, where the first image block includes a part of the target object, and J is an integer greater than or equal to 1. The computing device processes each first image block to obtain J second image blocks, where at least part of the second image blocks marked with cracks corresponds to target pixels. The computing device merges J second image blocks to obtain a third image. The computing device extracts the target pixels in the third image, resulting in cracks. By dividing the second image into blocks and processing the image blocks separately, the influence of the external environment on the extraction of cracks in the target object can be reduced, and the accuracy of crack detection can be improved.

结合第一方面的第五种实现方式,在本申请的第一方面的第六种实现方式中,计算设备对每一第一图像块进行处理,得到J个第二图像块包括:计算设备利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合,每一像素集合中包括至少一个像素,K为大于或等于1的整数。计算设备分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。计算设备确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。计算设备将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到第二图像块。其中,第一灰度值可以为0,第二灰度值可以为255。或者,第一灰度值为255,第二灰度值为0。将图像块中的裂缝对应的像素筛选出来,然后将其灰度值赋值为第一灰度值,从而完成图像块的二值化,即对裂缝对应的像素进行标记。In combination with the fifth implementation of the first aspect, in the sixth implementation of the first aspect of the present application, the computing device processes each first image block, and obtaining J second image blocks includes: using the computing device to The region growing algorithm classifies the pixels in the first image block to obtain K pixel sets, each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The computing device respectively acquires the average gray value of the K pixel sets, and the average gray value is an average value of the gray values of the pixels in the pixel set. The computing device determines that the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets is the gray threshold. The calculation device sets the gray value of the pixels in the pixel set whose average gray value is less than the gray threshold value as the first gray value, and sets the gray value of the pixels in the pixel set whose average gray value is greater than or equal to the gray threshold value Set as the second gray value to obtain the second image block. Wherein, the first grayscale value may be 0, and the second grayscale value may be 255. Alternatively, the first grayscale value is 255, and the second grayscale value is 0. The pixels corresponding to the cracks in the image block are screened out, and then their gray value is assigned as the first gray value, thereby completing the binarization of the image block, that is, marking the pixels corresponding to the cracks.

结合第一方面的第六种实现方式,在本申请的第一方面的第七种实现方式中,计算设备利用区域生长算法对图像块中的像素进行分类,得到K个像素集合包括:计算设备将图像块转换为三维点云。计算设备获取三维点云中每一三维点的邻域半径,邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点,L为大于或等于4的整数。计算设备获取三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。计算设备根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。每个图像块根据自身的三维点云的特征得到对应的搜索半径,从而能够更加准确地将该图像块中的三维点分类,将图像块中的裂缝对应的三维点分割出来。In combination with the sixth implementation of the first aspect, in the seventh implementation of the first aspect of the present application, the computing device uses a region growing algorithm to classify the pixels in the image block to obtain K pixel sets including: computing device Convert image patches to 3D point clouds. The computing device obtains the neighborhood radius of each 3D point in the 3D point cloud. The neighborhood radius is the average of the Euclidean distances between the target 3D point in the 3D point cloud and the L neighborhood 3D points. The L neighborhood 3D points is a 3D point corresponding to L pixels adjacent to the pixel corresponding to the target 3D point, where L is an integer greater than or equal to 4. The computing device acquires a search radius of the three-dimensional point cloud, where the search radius is an average value of neighborhood radii of all three-dimensional points in the three-dimensional point cloud. The computing device classifies the three-dimensional points in the three-dimensional point cloud according to the search radius, and obtains K pixel sets corresponding to the K three-dimensional point sets. Each image block obtains a corresponding search radius according to the characteristics of its own 3D point cloud, so that the 3D points in the image block can be classified more accurately, and the 3D points corresponding to the cracks in the image block can be segmented out.

结合第一方面的第七种实现方式,在本申请的第一方面的第八种实现方式中,根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合包括:确定三维点云中未被分类的一个三维点为种子点。以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。确定所目标三维点集合中的一个未作为种子点的三维点为种子点,返回以种子点为中心,将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合的步骤。直至目标三维点集合中不存在三维点未作为种子点,返回确定三维点云中未被分类的一个三维点为种子点的步骤。In combination with the seventh implementation of the first aspect, in the eighth implementation of the first aspect of the present application, the three-dimensional points in the three-dimensional point cloud are classified according to the search radius, and K corresponding to the K three-dimensional point sets are obtained. The pixel collection includes: determining an unclassified three-dimensional point in the three-dimensional point cloud as a seed point. Taking the seed point as the center, classify the 3D points located within the search radius of the seed point into the target 3D point set where the seed point is located. Determine a 3D point that is not used as a seed point in the target 3D point set as the seed point, and return to the step of dividing the 3D points within the search radius of the seed point into the target 3D point set corresponding to the seed point with the seed point as the center . Until there is no 3D point in the target 3D point set that is not used as a seed point, return to the step of determining an unclassified 3D point in the 3D point cloud as a seed point.

第二方面提供一种裂缝检测方法。该方法应用于相机,该方法包括:相机采集N帧第一图像。N为大于或等于2的整数。N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的。其中,目标物体例如为道路、墙体等。预设操作为相机旋转相机的镜头和调节镜头的焦距。目标物体不同区域与相机的距离不同,区域与相机的距离与镜头的焦距呈正比。具体而言,通过旋转相机的镜头选中目标物体的区域,并且改变相机的镜头的焦距:对于与相机越远的区域,镜头的焦距越大;对于与相机越近的区域,镜头的焦距越小。从而使得不同的第一图像中的目标物体均能够清晰地呈现。相机对N帧第一图像中每一图像的部分进行拼接获得第二图像。相机基于第二图像检测目标物体的裂缝。从而无需人工检测,能够节省人力物力,降低裂缝检测成本。The second aspect provides a crack detection method. The method is applied to a camera, and the method includes: the camera collects N frames of first images. N is an integer greater than or equal to 2. The N frames of first images are obtained by the camera shooting different areas of the target object through preset operations. Wherein, the target object is, for example, a road, a wall, and the like. The default operation is to rotate the camera lens and adjust the focal length of the lens. Different regions of the target object have different distances from the camera, and the distance from the region to the camera is proportional to the focal length of the lens. Specifically, the area of the target object is selected by rotating the lens of the camera, and the focal length of the lens of the camera is changed: for the area farther from the camera, the focal length of the lens is larger; for the area closer to the camera, the focal length of the lens is smaller . Therefore, target objects in different first images can be clearly presented. The camera stitches parts of each of the N frames of first images to obtain a second image. The camera detects cracks in the target object based on the second image. Therefore, manual detection is not required, manpower and material resources can be saved, and the cost of crack detection can be reduced.

结合第二方面,在本申请的第二方面的第一种实现方式中,第二图像为无透视效果的图像。由于相机镜头的透视现象会造成相机拍摄到的目标物体有远小近大的效果,造成远处的目标物体细节丢失,无法准确检测出裂缝,将N帧第一图像拼接获得无透视效果的第二图像,则会使远处的目标物体的细节也能得到清晰呈现,基于第二图像进行裂缝检测也会更加准确。With reference to the second aspect, in the first implementation manner of the second aspect of the present application, the second image is an image without a perspective effect. Due to the perspective phenomenon of the camera lens, the target object captured by the camera has the effect of being far smaller and closer, resulting in the loss of details of the distant target object, and the crack cannot be accurately detected. The first image of N frames is stitched to obtain the first image without perspective effect. With the second image, the details of distant target objects can also be clearly presented, and crack detection based on the second image will also be more accurate.

结合第二方面或第二方面的第一种实现方式,在本申请的第二方面的第二种实现方式中,相机对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:相机分别截取N帧第一图像的M行像素,M为大于或等于1的整数。相机将N帧第一图像的M行像素拼接获得第二图像。从而能够快速地拼接得到第二图像。In combination with the second aspect or the first implementation of the second aspect, in the second implementation of the second aspect of the present application, the camera stitches parts of each of the N frames of first images to obtain the second image including : The camera intercepts M rows of pixels of the first image of N frames respectively, and M is an integer greater than or equal to 1. The camera stitches the M rows of pixels of the N frames of the first image to obtain the second image. Therefore, the second image can be quickly spliced.

结合第二方面或第二方面的第一种实现方式,在本申请的第二方面的第三种实现方式中,相机对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:相机分别截取N帧第一图像中每一图像的部分像素,其中,每一图像被截取的像素数量不同。相机将N帧第一图像中每一图像的部分像素进行拼接获得第二图像。每一第一图像的部分像素对应于目标物体的一个子区域,第二图像中包括由N个子区域组成的完整的目标物体。由于每一第一图像对应的相机位姿和焦距不同,则每一第一图像中截取的像素数量可以不同。In combination with the second aspect or the first implementation of the second aspect, in the third implementation of the second aspect of the present application, the camera stitches parts of each of the N frames of first images to obtain the second image including : The camera intercepts some pixels of each image in the first N frames of images respectively, where the number of pixels intercepted by each image is different. The camera splices some pixels of each of the N frames of first images to obtain a second image. Partial pixels of each first image correspond to a sub-region of the target object, and the second image includes a complete target object composed of N sub-regions. Since the camera poses and focal lengths corresponding to each first image are different, the number of pixels intercepted in each first image may be different.

结合第二方面或第二方面的第一种实现方式,在本申请的第二方面的第四种实现方式中,相机对N帧第一图像中每一图像的部分进行拼接获得第二图像包括:相机分别截取N帧第一图像的P个像素,P为大于或等于1的整数。相机将N帧第一图像的P个像素拼接获得第二图像。从每一第一图像中截取相同数量的像素,能够快速地拼接得到第二图像。In combination with the second aspect or the first implementation manner of the second aspect, in the fourth implementation manner of the second aspect of the present application, the camera stitches parts of each image in the N frames of first images to obtain the second image including : The camera intercepts P pixels of the first image of N frames respectively, and P is an integer greater than or equal to 1. The camera stitches P pixels of the N frames of the first image to obtain the second image. By intercepting the same number of pixels from each first image, the second image can be quickly spliced.

结合第二方面或第二方面的第一至第四任一种实现方式,在本申请的第二方面的第五种实现方式中,相机基于第二图像检测目标物体的裂缝包括:相机对第二图像进行预处理,得到J个第一图像块。第一图像块中包括目标物体的部分,J为大于或等于1的整数。其中,预处理可以是分块,也可以是滤波和分块。相机对每一第一图像块进行处理,得到J个第二图像块,第二图像块中标记有子裂缝对应的目标像素。子裂缝为裂缝的一部分。相机合并J个第二图像块,得到第三图像。相机提取第三图像中的目标像素,得到裂缝。通过将第二图像分块,并分别对图像块进行处理,能够降低外部环境对目标物体中裂缝的提取造成的影响,提高裂缝检测的准确性。In combination with the second aspect or any one of the first to fourth implementations of the second aspect, in the fifth implementation of the second aspect of the present application, the camera detecting cracks of the target object based on the second image includes: the camera detects the first The second image is preprocessed to obtain J first image blocks. The part of the target object included in the first image block, J is an integer greater than or equal to 1. Wherein, the preprocessing may be block, and may also be filtering and block. The camera processes each first image block to obtain J second image blocks, where target pixels corresponding to sub-cracks are marked. A sub-crack is a part of a crack. The camera combines J second image blocks to obtain a third image. The camera extracts the target pixels in the third image, resulting in cracks. By dividing the second image into blocks and processing the image blocks separately, the influence of the external environment on the extraction of cracks in the target object can be reduced, and the accuracy of crack detection can be improved.

结合第二方面的第五种实现方式,在本申请的第一方面的第六种实现方式中,目标像素为灰度值为第一灰度值的像素,相机对每一第一图像块进行处理,得到J个第二图像块包括:相机利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合。其中,每一像素集合中包括至少一个像素,K为大于或等于1的整数。相机分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。相机确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。相机将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到第二图像块。其中,第一灰度值可以为0,第二灰度值可以为255。或者,第一灰度值为255,第二灰度值为0。将图像块中的裂缝对应的像素筛选出来,然后将其灰度值赋值为第一灰度值,从而完成图像块的二值化,即对裂缝对应的像素进行标记。In combination with the fifth implementation of the second aspect, in the sixth implementation of the first aspect of the present application, the target pixel is a pixel with the first gray value, and the camera performs The processing to obtain the J second image blocks includes: the camera uses a region growing algorithm to classify the pixels in the first image block to obtain K pixel sets. Wherein, each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The camera obtains the average gray value of the K pixel sets respectively, and the average gray value is the average value of the gray values of the pixels in the pixel set. The camera determines that the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets is the gray threshold. The camera sets the gray value of the pixels in the pixel set whose average gray value is less than the gray threshold as the first gray value, and sets the gray value of the pixels in the pixel set whose average gray value is greater than or equal to the gray threshold as the first gray value. is the second gray value to obtain the second image block. Wherein, the first grayscale value may be 0, and the second grayscale value may be 255. Alternatively, the first grayscale value is 255, and the second grayscale value is 0. The pixels corresponding to the cracks in the image block are screened out, and then their gray value is assigned as the first gray value, thereby completing the binarization of the image block, that is, marking the pixels corresponding to the cracks.

结合第二方面的第六种实现方式,在本申请的第二方面的第七种实现方式中,相机利用区域生长算法对图像块中的像素进行分类,得到K个像素集合包括:相机将图像块转换为三维点云。相机获取三维点云中每一三维点的邻域半径。邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点。L为大于或等于4的整数。相机获取三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。相机根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。每个图像块根据自身的三维点云的特征得到对应的搜索半径,从而能够更加准确地将该图像块中的三维点分类,将图像块中的裂缝对应的三维点分割出来。In combination with the sixth implementation of the second aspect, in the seventh implementation of the second aspect of the present application, the camera uses the region growing algorithm to classify the pixels in the image block, and the K pixel sets obtained include: the camera divides the image Blocks are converted to 3D point clouds. The camera obtains the neighborhood radius of each 3D point in the 3D point cloud. The neighborhood radius is the average value of the Euclidean distance between the target 3D point in the 3D point cloud and the L neighborhood 3D points, and the L neighborhood 3D points are the 3D distances corresponding to the L pixels adjacent to the pixel corresponding to the target 3D point. point. L is an integer greater than or equal to 4. The camera obtains the search radius of the 3D point cloud, and the search radius is the average value of the neighborhood radii of all 3D points in the 3D point cloud. The camera classifies the 3D points in the 3D point cloud according to the search radius, and obtains K pixel sets corresponding to the K 3D point sets. Each image block obtains a corresponding search radius according to the characteristics of its own 3D point cloud, so that the 3D points in the image block can be classified more accurately, and the 3D points corresponding to the cracks in the image block can be segmented out.

结合第二方面的第七种实现方式,在本申请的第二方面的第八种实现方式中,根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合包括:确定三维点云中未被分类的一个三维点为种子点。以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。确定所目标三维点集合中的一个未作为种子点的三维点为种子点,返回以种子点为中心,将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合的步骤。直至目标三维点集合中不存在三维点未作为种子点,返回确定三维点云中未被分类的一个三维点为种子点的步骤。In combination with the seventh implementation of the second aspect, in the eighth implementation of the second aspect of the present application, the three-dimensional points in the three-dimensional point cloud are classified according to the search radius, and K corresponding to the K three-dimensional point sets are obtained. The pixel collection includes: determining an unclassified three-dimensional point in the three-dimensional point cloud as a seed point. Taking the seed point as the center, classify the 3D points located within the search radius of the seed point into the target 3D point set where the seed point is located. Determine a 3D point that is not used as a seed point in the target 3D point set as the seed point, and return to the step of dividing the 3D points within the search radius of the seed point into the target 3D point set corresponding to the seed point with the seed point as the center . Until there is no 3D point in the target 3D point set that is not used as a seed point, return to the step of determining an unclassified 3D point in the 3D point cloud as a seed point.

第三方面提供一种裂缝检测装置。该装置包括采集模块、拼接模块和检测模块。其中,采集模块用于采集N帧第一图像。N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的。预设操作为相机旋转相机的镜头和调节镜头的焦距,不同区域与相机的距离不同。N为大于或等于2的整数。拼接模块,用于对N帧第一图像中每一图像的部分进行拼接获得第二图像。检测模块,用于基于第二图像检测目标物体的裂缝。A third aspect provides a crack detection device. The device includes a collection module, a splicing module and a detection module. Wherein, the collection module is used to collect N frames of first images. The N frames of first images are obtained by the camera shooting different areas of the target object through preset operations. The default operation is that the camera rotates the camera lens and adjusts the focal length of the lens, and different areas have different distances from the camera. N is an integer greater than or equal to 2. The splicing module is configured to splice parts of each image in the N frames of first images to obtain a second image. A detection module, configured to detect cracks of the target object based on the second image.

结合第三方面,在本申请的第三方面的第一种实现方式中,第二图像为无透视效果的图像。由于相机镜头的透视现象会造成相机拍摄到的目标物体有远小近大的效果,造成远处的目标物体细节丢失,无法准确检测出裂缝,将N帧第一图像拼接获得无透视效果的第二图像,则会使远处的目标物体的细节也能得到清晰呈现,基于第二图像进行裂缝检测也会更加准确。With reference to the third aspect, in the first implementation manner of the third aspect of the present application, the second image is an image without a perspective effect. Due to the perspective phenomenon of the camera lens, the target object captured by the camera has the effect of being far smaller and closer, resulting in the loss of details of the distant target object, and the crack cannot be accurately detected. The first image of N frames is stitched to obtain the first image without perspective effect. With the second image, the details of distant target objects can also be clearly presented, and crack detection based on the second image will also be more accurate.

结合第三方面或第三方面的第一种实现方式,在本申请的第三方面的第二种实现方式中,拼接模块具体用于:分别截取N帧第一图像的M行像素,M为大于或等于1的整数。将N帧第一图像的M行像素拼接获得第二图像。In combination with the third aspect or the first implementation manner of the third aspect, in the second implementation manner of the third aspect of the present application, the splicing module is specifically used to: respectively intercept M rows of pixels of the N frames of the first image, and M is An integer greater than or equal to 1. The second image is obtained by splicing the M rows of pixels of the N frames of the first image.

结合第三方面或第三方面的第一种实现方式,在本申请的第三方面的第三种实现方式中,拼接模块具体用于:分别截取N帧第一图像中每一图像的部分像素,其中,每一图像被截取的像素数量不同。将N帧第一图像中每一图像的部分像素进行拼接获得第二图像。In combination with the third aspect or the first implementation manner of the third aspect, in the third implementation manner of the third aspect of the present application, the splicing module is specifically configured to: respectively intercept some pixels of each image in the N frames of the first image , where the number of pixels intercepted by each image is different. Partial pixels of each image in the N frames of first images are spliced to obtain a second image.

结合第三方面或第一方面的第一种实现方式,在本申请的第三方面的第四种实现方式中,拼接模块具体用于:分别截取N帧第一图像的P个像素,P为大于或等于1的整数。将N帧第一图像的P个像素拼接获得第二图像。In combination with the third aspect or the first implementation of the first aspect, in the fourth implementation of the third aspect of the present application, the splicing module is specifically used to: respectively intercept P pixels of the N frames of the first image, and P is An integer greater than or equal to 1. The P pixels of the N frames of the first image are spliced to obtain the second image.

结合第三方面或第三方面的第一至第四任一种实现方式,在本申请的第三方面的第五种实现方式中,检测模块具体用于:对第二图像进行预处理,得到J个第一图像块,第一图像块中包括目标物体的部分,J为大于或等于1的整数。对每一第一图像块进行处理,得到J个第二图像块,第二图像块中标记有裂缝的至少部分对应的目标像素。合并J个第二图像块,得到第三图像。提取第三图像中的目标像素,得到裂缝。In combination with the third aspect or any one of the first to fourth implementations of the third aspect, in the fifth implementation of the third aspect of the present application, the detection module is specifically configured to: preprocess the second image to obtain J first image blocks, where the first image block includes a part of the target object, and J is an integer greater than or equal to 1. Each first image block is processed to obtain J second image blocks, where at least part of the second image blocks marked with cracks correspond to target pixels. Merge J second image blocks to obtain a third image. Extract the target pixel in the third image to get the crack.

结合第三方面的第五种实现方式,在本申请的第三方面的第六种实现方式中,检测模块具体还用于:利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合,每一像素集合中包括至少一个像素,K为大于或等于1的整数。分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到第二图像块。In combination with the fifth implementation of the third aspect, in the sixth implementation of the third aspect of the present application, the detection module is further configured to: use the region growing algorithm to classify the pixels in the first image block to obtain K pixel sets, each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The average gray value of the K pixel sets is obtained respectively, and the average gray value is an average value of the gray values of the pixels in the pixel set. Determine the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets as the gray threshold. Set the gray value of the pixels in the pixel set whose average gray value is less than the gray threshold to the first gray value, and set the gray value of the pixels in the pixel set whose average gray value is greater than or equal to the gray threshold to be The second grayscale value is used to obtain the second image block.

结合第三方面的第六种实现方式,在本申请的第三方面的第七种实现方式中,检测模块具体还用于:将图像块转换为三维点云。获取三维点云中每一三维点的邻域半径,邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点,L为大于或等于4的整数。获取三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。With reference to the sixth implementation manner of the third aspect, in the seventh implementation manner of the third aspect of the present application, the detection module is further configured to: convert the image block into a three-dimensional point cloud. Obtain the neighborhood radius of each 3D point in the 3D point cloud. The neighborhood radius is the average of the Euclidean distances between the target 3D point in the 3D point cloud and the L neighborhood 3D points. The L neighborhood 3D points are the target The pixel corresponding to the 3D point corresponds to the 3D point corresponding to L pixels adjacent to each other, where L is an integer greater than or equal to 4. Get the search radius of the 3D point cloud, the search radius is the average of the neighborhood radii of all 3D points in the 3D point cloud. The 3D points in the 3D point cloud are classified according to the search radius, and K pixel sets corresponding to the K 3D point sets are obtained.

结合第三方面的第七种实现方式,在本申请的第三方面的第八种实现方式中,检测模块具体还用于:确定三维点云中未被分类的一个三维点为种子点。以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。确定所目标三维点集合中的一个未作为种子点的三维点为种子点,返回以种子点为中心,将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合的步骤。直至目标三维点集合中不存在三维点未作为种子点,返回确定三维点云中未被分类的一个三维点为种子点的步骤。With reference to the seventh implementation manner of the third aspect, in the eighth implementation manner of the third aspect of the present application, the detection module is further configured to: determine an unclassified 3D point in the 3D point cloud as a seed point. Taking the seed point as the center, classify the 3D points located within the search radius of the seed point into the target 3D point set where the seed point is located. Determine a 3D point that is not used as a seed point in the target 3D point set as the seed point, and return to the step of dividing the 3D points within the search radius of the seed point into the target 3D point set corresponding to the seed point with the seed point as the center . Until there is no 3D point in the target 3D point set that is not used as a seed point, return to the step of determining an unclassified 3D point in the 3D point cloud as a seed point.

第四方面提供一种裂缝检测设备。该裂缝检测设备包括处理器和存储器,处理器耦接存储器,处理器被配置为基于存储在存储器中的指令,执行上述的第一方面或其任一种实现方式的裂缝检测方法。A fourth aspect provides a crack detection device. The crack detection device includes a processor and a memory, the processor is coupled to the memory, and the processor is configured to execute the crack detection method in the above first aspect or any implementation manner thereof based on instructions stored in the memory.

第五方面提供一种计算机可读存储介质。该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行以实现上述第一方面或其任一实现方式的裂缝检测方法,或实现上述第二方面或其任一实现方式的裂缝检测方法。A fifth aspect provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to realize the crack detection method of the first aspect or any implementation thereof, or realize the crack of the second aspect or any implementation thereof Detection method.

附图说明Description of drawings

图1为本申请提供的裂缝检测方法第一实施例的流程示意图;FIG. 1 is a schematic flow chart of the first embodiment of the crack detection method provided by the present application;

图2为本申请提供的相机对目标物体进行拍摄的示意图;Fig. 2 is the schematic diagram that the camera provided by the present application shoots the target object;

图3为相邻两帧第一图像的关系的示意图;Fig. 3 is a schematic diagram of the relationship between two adjacent frames of first images;

图4为本申请提供的第二图像的示意图;FIG. 4 is a schematic diagram of a second image provided by the present application;

图5为本申请提供的裂缝检测方法第二实施例的流程示意图;Fig. 5 is a schematic flow chart of the second embodiment of the crack detection method provided by the present application;

图6为本申请提供的裂缝检测装置实施例的结构示意图;FIG. 6 is a schematic structural view of an embodiment of a crack detection device provided by the present application;

图7为本申请提供的裂缝检测系统实施例的结构示意图;FIG. 7 is a schematic structural diagram of an embodiment of a crack detection system provided by the present application;

图8为本申请提供的裂缝检测设备实施例的结构示意图。FIG. 8 is a schematic structural diagram of an embodiment of a crack detection device provided in the present application.

具体实施方式Detailed ways

本申请实施例提供了一种裂缝检测方法、装置及设备,以降低裂缝检测成本。Embodiments of the present application provide a crack detection method, device and equipment, so as to reduce the cost of crack detection.

下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。Embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention. The terms used in the embodiments of the present invention are only used to explain specific examples of the present invention, and are not intended to limit the present invention. Those of ordinary skill in the art know that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and not necessarily Used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

道路、桥梁、隧道和墙壁等建筑物体因施工工艺不当、超载和使用、温度变化、地基沉降或材料老化等因素的影响,会造成建筑物体表面形成裂缝。建筑物体出现裂缝会导致建筑物体承载能力下降、加速损坏,从而影响建筑物体的舒适性和安全性。因此,建筑物体上的裂缝需要及时检测排查。Buildings such as roads, bridges, tunnels and walls are affected by factors such as improper construction technology, overloading and use, temperature changes, foundation settlement or material aging, which will cause cracks to form on the surface of the building. Cracks in building objects will reduce the bearing capacity of building objects and accelerate damage, thus affecting the comfort and safety of building objects. Therefore, cracks on building objects need to be detected and checked in time.

鉴于目前建筑物体的裂缝检测手段较大程度的依赖人工,因此效率低且成本高。本申请提供如下实施例以低成本、高效率地完成建筑物体的裂缝检测。In view of the fact that the crack detection methods of building objects rely on manual work to a large extent, the efficiency is low and the cost is high. The present application provides the following embodiments to complete crack detection of building objects with low cost and high efficiency.

本申请的裂缝检测方法实施例可以由相机独立完成,也可以由相机和计算设备配合完成。以下对这两种情况分别进行描述。The embodiment of the crack detection method of the present application can be completed independently by the camera, or can be completed by the cooperation of the camera and the computing device. The two cases are described respectively below.

如图1所示,图1为本申请提供的裂缝检测方法第一实施例的流程示意图。本实施例的执行主体包括相机和计算设备。相机与计算设备连接,相机负责采集N帧第一图像,并将N帧第一图像发送给计算设备,计算设备接收到N帧第一图像后,基于N帧第一图像检测目标物体的裂缝。计算设备例如为云端服务器、电脑或智能终端等具有算力的设备。As shown in FIG. 1 , FIG. 1 is a schematic flowchart of a first embodiment of the crack detection method provided in the present application. The execution subject of this embodiment includes a camera and a computing device. The camera is connected to the computing device. The camera is responsible for collecting N frames of first images and sending the N frames of first images to the computing device. After receiving the N frames of first images, the computing device detects cracks of the target object based on the N frames of first images. The computing device is, for example, a device with computing power such as a cloud server, a computer, or a smart terminal.

具体地,本实施例包括如下步骤:Specifically, this embodiment includes the following steps:

S101:相机采集N帧第一图像,N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的,预设操作为相机旋转相机的镜头和调节镜头的焦距,不同区域与相机的距离不同。S101: The camera collects N frames of the first image. The N frames of the first image are obtained by the camera shooting different areas of the target object through a preset operation. The preset operation is that the camera rotates the camera lens and adjusts the focal length of the lens. Different areas and The distance of the camera is different.

本申请中,相机为具有云台控制功能和变焦功能的云台摄像机,例如为球型摄像机,具体例如为全方位移动及镜头变倍、变焦控制(pan/tilt/zoom,PTZ)相机。当然,相机也可以为枪型摄像机或筒型摄像机等,只要具备上述的云台控制和变焦功能即可,相机的具体形态本申请不做限制。In this application, the camera is a pan-tilt camera with a pan-tilt control function and a zoom function, such as a dome camera, specifically a pan/tilt/zoom (PTZ) camera with omnidirectional movement, lens zoom, and zoom control. Of course, the camera can also be a bullet camera or a barrel camera, as long as it has the above-mentioned pan/tilt control and zoom functions, and the specific form of the camera is not limited in this application.

相机包括云台和镜头,云台可以上下旋转和/或左右旋转,云台旋转可以带动镜头旋转。相机通过旋转云台,使得相机的镜头旋转从而能够对目标物体的不同区域进行拍摄。The camera includes a pan-tilt and a lens. The pan-tilt can rotate up and down and/or left and right, and the rotation of the pan-tilt can drive the lens to rotate. By rotating the pan-tilt, the camera rotates the lens of the camera so as to be able to shoot different areas of the target object.

其中,目标物体可以为相机可视范围内的道路、桥梁、墙壁或隧道等建筑物体,或可视范围内建筑物体的部分。例如,如图2所示,图2为本申请提供的相机对目标物体进行拍摄的一个场景示意图。图2中以目标物体是道路为例,相机一般悬吊等方式安装在道路的上方。由于相机的镜头焦距范围有限,以及镜头存在透视等原因,在道路中超出相机镜头最大焦距对应的距离以外的区域,相机拍摄得到的图像可能存在不清晰、细节缺失等问题,那么目标物体则是能够被相机清晰拍摄的范围内的那部分道路。Wherein, the target object may be a building object such as a road, a bridge, a wall or a tunnel within the visible range of the camera, or a part of the building object within the visible range. For example, as shown in FIG. 2 , FIG. 2 is a schematic diagram of a scene where a camera provided in the present application shoots a target object. In Fig. 2, the target object is a road as an example, and the camera is generally installed above the road by means of suspension or the like. Due to the limited focal length range of the camera lens and the perspective of the lens, the image captured by the camera may have problems such as unclearness and lack of detail in the area beyond the distance corresponding to the maximum focal length of the camera lens on the road, so the target object is That part of the road that can be clearly captured by the camera.

相机对目标物体拍摄前需要瞄准目标物体的至少部分区域。相机可以是自动识别出目标物体后,再瞄准目标物体的。例如相机通过训练好的神经网络识别出目标物体,并确定目标物体相对相机的相对位置,然后相机旋转云台使镜头对准目标物体。当然,目标物体是人工选中的,控制相机旋转云台使镜头对准目标物体。Before the camera shoots the target object, it needs to aim at at least a partial area of the target object. The camera can automatically identify the target object and then aim at the target object. For example, the camera recognizes the target object through the trained neural network, and determines the relative position of the target object relative to the camera, and then the camera rotates the gimbal so that the lens is aimed at the target object. Of course, the target object is manually selected, and the camera is controlled to rotate the gimbal so that the lens is aimed at the target object.

目标物体的不同区域与相机之间的距离不同。可以理解,不同区域间可以存在重合的部分。目标物体的区域与相机的距离可以是相机镜头的光轴与目标物体的交点到相机之间的距离。本实施例中,相机对目标物体不同的区域采用不同的焦距进行拍摄从而得到目标物体的N帧第一图像,并且不同区域与相机之间的距离与相机的镜头的焦距成正比。即,目标物体与相机越远的区域,焦距越大;目标物体与相机越近的区域,焦距越小。从而,目标物体中离相机较远的区域在第一图像中也能够得到清晰、细节的呈现。Different regions of the target object have different distances from the camera. It can be understood that there may be overlapping parts between different regions. The distance between the area of the target object and the camera may be the distance from the intersection point of the optical axis of the camera lens and the target object to the camera. In this embodiment, the camera shoots different areas of the target object with different focal lengths to obtain N frames of first images of the target object, and the distance between different areas and the camera is proportional to the focal length of the camera lens. That is, the farther the target object is from the camera, the larger the focal length is; the closer the target object is to the camera, the smaller the focal length is. Therefore, the region of the target object that is far away from the camera can also be presented clearly and in detail in the first image.

本实施例中,相机可以采用线阵式扫描的方式对目标物体进行拍摄。具体地,相机沿着一个固定的方向旋转镜头,使镜头由远及近或由近及远地拍摄目标物体的不同区域,在镜头旋转的同时或旋转后调整焦距,基于不同的相机位姿和焦距拍摄得到N帧第一图像。相机可以只沿一个方向旋转,例如只进行上或下旋转,或只进行左或右旋转,具体与目标物体相对相机的位置和延伸方向有关。例如,如图2所示,以相机由近及远地拍摄目标物体为例进行说明,道路位于相机的下前方,相机通过向上旋转镜头(即增加镜头的俯仰角),改变了镜头的拍摄角度,使镜头的拍摄范围落在了目标物体更远的区域,同时镜头增大焦距,然后进行拍摄,直至完成道路的拍摄。In this embodiment, the camera may shoot the target object in a linear scanning manner. Specifically, the camera rotates the lens along a fixed direction, so that the lens shoots different areas of the target object from far to near or from near to far, and adjusts the focal length while the lens is rotating or after rotating, based on different camera poses and N frames of first images are obtained by focal length shooting. The camera can be rotated in only one direction, such as only up or down, or only left or right, depending on the position and extension of the target object relative to the camera. For example, as shown in Figure 2, take the camera shooting the target object from near to far as an example, the road is located in front of the camera, and the camera changes the shooting angle of the lens by rotating the lens upward (that is, increasing the pitch angle of the lens) , so that the shooting range of the lens falls on the farther area of the target object, and at the same time, the lens increases the focal length, and then shoots until the shooting of the road is completed.

对于同一目标物体,相机每次旋转的幅度越大,采集到的第一图像的数量N就越小,后续每一第一图像中用于拼接第二图像的像素越多,每一第一图像中用于拼接第二图像的像素对应的目标物体的面积越大,受透视效果的影响也就越大;相反地,相机每次旋转的幅度越小,采集到的第一图像的数量N就越大,后续每一第一图像中用于拼接第二图像的像素越少,每一第一图像中用于拼接第二图像的像素对应的目标物体的面积越小,受透视效果的影响也就越小。因此,本实施例中,相机每次旋转可以是小幅度地旋转,相应地,焦距也是小幅度地调整,使得目标物体能够被更加精确地记录于N帧第一图像中。具体地,For the same target object, the larger the range of each rotation of the camera is, the smaller the number N of first images collected is, and the more pixels are used for splicing the second image in each subsequent first image, the more each first image The larger the area of the target object corresponding to the pixels used to stitch the second image, the greater the impact of the perspective effect; on the contrary, the smaller the rotation of the camera each time, the number N of the first images collected is The larger the , the fewer pixels are used to stitch the second image in each subsequent first image, and the smaller the area of the target object corresponding to the pixels used to stitch the second image in each first image, and it is also affected by the perspective effect. smaller. Therefore, in this embodiment, each rotation of the camera may be rotated in a small range, and correspondingly, the focal length may also be adjusted in a small range, so that the target object can be more accurately recorded in the N frames of the first image. specifically,

相邻两帧第一图像是指在相机沿固定方向旋转镜头采集第一图像时,基于相机某一位姿px和焦距fx拍摄得到的第一图像ax,与直接变化到位姿px和焦距fx的上一位姿px-1和上一焦距fx-1拍摄得到的第一图像ax-1,或者与基于位姿px和焦距fx直接变化到下一位姿px+1和下一焦距fx+1拍摄得到的第一图像ax+1。第一图像ax-1为第一图像ax的上一帧图像,第一图像ax为第一图像ax+1的上一帧图像,第一图像ax+1为第一图像ax的下一帧图像,第一图像ax与第一图像ax-1为相邻两帧第一图像,第一图像ax与第一图像ax+1为相邻两帧第一图像。The first images of two adjacent frames refer to the first image a x captured based on a certain pose p x of the camera and the focal length f x when the camera rotates the lens in a fixed direction to capture the first image , which is directly changed to the pose p x The first image a x -1 obtained by taking the previous pose p x- 1 with the focal length f x and the previous focal length f x-1 , or directly changing to the next pose based on the pose p x and the focal length f x The first image a x+1 obtained by shooting p x+1 and the next focal length f x+ 1 . The first image a x-1 is the previous frame image of the first image a x , the first image a x is the previous frame image of the first image a x+1 , and the first image a x+1 is the first image a The next frame image of x , the first image a x and the first image a x-1 are two adjacent frames of the first image, the first image a x and the first image a x+1 are the two adjacent frames of the first image .

由于相机镜头存在畸变,使第一图像越靠近边缘的区域畸变越明显,而第一图像的中心位置受镜头畸变影响最小。可选地,为了进一步降低镜头畸变的影响,相机每次旋转,能够使相机采集的上一帧第一图像的中间M行/列像素的相所对应的区域,与下一帧第一图像的中间M行/列像素对应的区域为相邻区域。从而降低相机镜头畸变导致第一图像边缘失真的影响,以保证后续基于N帧第一图像拼接而成的第二图像完整和准确。Due to the distortion of the camera lens, the closer to the edge of the first image, the more obvious the distortion, and the center of the first image is least affected by the lens distortion. Optionally, in order to further reduce the influence of lens distortion, each time the camera rotates, the area corresponding to the middle M rows/columns of the first image of the previous frame captured by the camera can be compared with the area corresponding to the pixel phase of the first image of the next frame. The area corresponding to the pixels in the middle M rows/columns is an adjacent area. Therefore, the influence of the edge distortion of the first image caused by the camera lens distortion is reduced, so as to ensure the integrity and accuracy of the subsequent second image stitched based on the N frames of the first images.

举例说明,如图3所示,图3为相邻两帧第一图像的关系的示意图,以M等于1为例进行说明。相机基于第一俯仰角和第一焦距对第一区域拍摄得到第k帧第一图像,然后相机旋转到第二俯仰角,焦距调整到第二焦距(第二焦距大于第一焦距),基于第二俯仰角和第二焦距调整后拍摄得到第k+1帧第一图像。第一子区域和第二子区域为道路上相邻的两个子区域。在第k帧第一图像中,道路的第一子区域位于第k帧第一图像的中间行,第二子区域位于第k帧第一图像的中间行的上一行。在第k+1帧第一图像中,第二子区域位于第k+1帧第一图像的中间行,第二子区域位于第k+1帧第一图像的中间行的下一行。For example, as shown in FIG. 3 , FIG. 3 is a schematic diagram of the relationship between two adjacent frames of first images, and M=1 is taken as an example for illustration. The camera shoots the first area based on the first pitch angle and the first focal length to obtain the kth frame of the first image, then the camera rotates to the second pitch angle, and the focal length is adjusted to the second focal length (the second focal length is greater than the first focal length), based on the first After adjusting the second pitch angle and the second focal length, the k+1th frame of the first image is obtained. The first sub-area and the second sub-area are two adjacent sub-areas on the road. In the k-th frame of the first image, the first sub-area of the road is located in the middle row of the k-th frame of the first image, and the second sub-area is located in the upper row of the k-th frame of the first image. In the first image of the k+1th frame, the second subregion is located in the middle row of the first image in the k+1th frame, and the second subregion is located in the next row of the middle row of the first image in the k+1th frame.

当然相机每次旋转,也可以是能够使相机采集的上一帧第一图像的最下/上方的M行/列像素的相所对应的区域,与下一帧第一图像的最下/上方的M行/列像素对应的区域为相邻区域,本申请对此不做限制。Of course, each time the camera rotates, it can also be the area corresponding to the M row/column pixels at the bottom/top of the first frame of the previous frame captured by the camera, and the bottom/top of the first image of the next frame. The area corresponding to the M rows/columns of pixels is an adjacent area, which is not limited in the present application.

其中,M可以是1、3、5、8或10等正整数。M的值可根据实际情况而定,例如目标物体越长,或者检测效率的需求越大时,M的值可以适当调大,对此本申请不做限制。Wherein, M may be a positive integer such as 1, 3, 5, 8 or 10. The value of M can be determined according to the actual situation. For example, when the target object is longer or the detection efficiency is higher, the value of M can be appropriately increased, which is not limited in this application.

N帧第一图像可以为世界坐标系下的图像。具体地,相机在拍摄目标物体前,已经进行了相机标定,即相机的内参矩阵和外参矩阵已知。相机在拍摄每一第一图像时,记录拍摄对应的第一图像的镜头相对于上一位姿的旋转量和以及镜头的焦距。旋转量作为外参代入外参矩阵,焦距作为内参代入内参矩阵,可以得到世界坐标系下的第一图像。将相机基于不同的姿态和焦距拍摄得到的照片同一到一个绝对坐标系(即世界坐标系)下,便于后续基于N帧第一图像进行处理。第一图像还可以是进行畸变校正后的图像。具体地,在对相机标定的过程中,还可以获得畸变参数,将畸变参数代入到畸变校正公式中,使用畸变校正公式对相机采集到原始图像进行运算,可输出畸变校正后的第一图像。The N frames of first images may be images in the world coordinate system. Specifically, before the camera shoots the target object, the camera has been calibrated, that is, the internal parameter matrix and the external parameter matrix of the camera are known. When the camera captures each first image, it records the rotation amount of the lens that captures the corresponding first image relative to the previous posture and the focal length of the lens. The rotation amount is substituted into the external parameter matrix as an external parameter, and the focal length is substituted into the internal parameter matrix as an internal parameter, so that the first image in the world coordinate system can be obtained. Unify the photos taken by the camera based on different postures and focal lengths into one absolute coordinate system (ie, the world coordinate system), so as to facilitate subsequent processing based on the first image of N frames. The first image may also be a distortion-corrected image. Specifically, in the process of camera calibration, distortion parameters can also be obtained, and the distortion parameters can be substituted into the distortion correction formula, and the original image collected by the camera can be calculated using the distortion correction formula to output the first distortion-corrected image.

一般地,交通道路、建筑集群等公共场所均已覆盖此类球形摄像机,本申请利用这些在已部署的球形摄像机采集道路、墙壁等建筑物体进行,以降低投入的物力成本。Generally, public places such as traffic roads and building clusters have been covered with such spherical cameras. This application uses these deployed spherical cameras to collect roads, walls and other building objects to reduce the material cost of input.

S102:相机向计算设备发送N帧第一图像。S102: The camera sends N frames of first images to the computing device.

相机采集到N帧第一图像后,向计算设备发送N帧第一图像。或相机采集N帧第一图像的过程中,边采集边向计算设备发送第一图像,如此能够提高计算设备获取第一图像的效率,降低相机的存储要求。After collecting N frames of first images, the camera sends N frames of first images to the computing device. Or the camera sends the first images to the computing device while collecting N frames of the first image, which can improve the efficiency of the computing device in acquiring the first images and reduce the storage requirements of the camera.

S103:计算设备对N帧第一图像中每一图像的部分进行拼接获得第二图像。S103: The computing device stitches parts of each of the N frames of first images to obtain a second image.

由于相机镜头的畸变会导致第一图像边缘区域失真,因此相机采集N帧第一图像后,计算设备分别截取N帧第一图像的部分像素,将N帧第一图像中每一图像的部分像素拼接获得第二图像。每一第一图像中截取的部分像素对应的目标物体的区域,与相邻的第一图像截取的部分像素对应的目标物体的区域也相邻。因而可以保证拼接获得的第二图像中的目标物体是完整的物体。Since the distortion of the camera lens will cause the edge area of the first image to be distorted, after the camera collects N frames of the first image, the computing device respectively intercepts some pixels of the N frames of the first image, and takes part of the pixels of each image in the N frames of the first image Stitching to obtain the second image. The area of the target object corresponding to the partial pixels intercepted in each first image is also adjacent to the area of the target object corresponding to the partial pixels intercepted in the adjacent first image. Therefore, it can be guaranteed that the target object in the second image obtained by splicing is a complete object.

在一些实施方式中,部分像素可以是第一图像的M行像素。从每一第一图像中截取的M行像素能够保证拼接后的第二图像中目标物体完整即可,对于从第一图像中M行像素的位置可以不做限制。In some implementations, some of the pixels may be M rows of pixels in the first image. It is sufficient that the M rows of pixels intercepted from each first image can ensure the integrity of the target object in the spliced second image, and there is no restriction on the position of the M rows of pixels from the first image.

为了进一步提高第二图像的精准度,以及提高第二图像的拼接效率,可以截取每一第一图像的中间M行像素,并将其拼接为第二图像。无论第一图像是否经过畸变校正,相机畸变对第一图像中的中间M行像素的影响均是最小的,因而由每一第一图像的中间M行像素拼接获得的第二图像更加精准。并且,从每一第一图像的固定位置截取固定数量的像素,截取像素也更加有效率。In order to further improve the accuracy of the second image and improve the splicing efficiency of the second image, M rows of pixels in the middle of each first image may be intercepted and spliced into a second image. No matter whether the first image has undergone distortion correction or not, the impact of camera distortion on the middle M rows of pixels in the first image is minimal, so the second image obtained by mosaicing the middle M rows of pixels of each first image is more accurate. Moreover, it is more efficient to capture a fixed number of pixels from a fixed position of each first image, and to capture pixels.

在另一些实施方式中,还可以通过在每一第一图像中截取相同面积的目标物体对应的像素拼接获得第二图像。例如,目标物体为5米宽100米长的道路,第一图像的数量为200张,那么可以截取每一第一图像中5米*0.5米的道路对应的像素,将200张第一图像中的5米*0.5米的道路对应的像素拼接获得第二图像。由于从每一第一图像中截取由于每一第一图像是基于不同的相机位姿和焦距采集的,即使是相同面积的目标物体的部分区域,在不同的第一图像中所占用的像素数量可能不同,或者不完全相同,因而,从每一第一图像中截取的像素数量可能不同,或者不完全相同。In some other implementation manners, the second image may also be obtained by stitching pixels corresponding to the target object of the same area captured in each first image. For example, if the target object is a road with a width of 5 meters and a length of 100 meters, and the number of the first images is 200, then the pixels corresponding to the road of 5 meters*0.5 meters in each first image can be intercepted, and the pixels in the 200 first images can be intercepted. The second image is obtained by splicing pixels corresponding to the 5m*0.5m road. Since each first image is intercepted from each first image because each first image is collected based on different camera poses and focal lengths, even if it is a partial area of the target object with the same area, the number of pixels occupied in different first images may be different or not completely the same, therefore, the number of pixels intercepted from each first image may be different or not completely the same.

在又一些实施方式中,还可以通过在每一第一图像中截取P个像素拼接获得第二图像。从每一第一图像中截取的P个像素能够保证拼接后的第二图像中目标物体完整即可,对于从第一图像中P个像素的位置可以不做限制。P为大于或等于1的整数。In some other implementation manners, the second image may also be obtained by cutting P pixels in each first image and stitching them together. It is enough that the P pixels intercepted from each first image can ensure the integrity of the target object in the spliced second image, and there is no restriction on the position of the P pixels from the first image. P is an integer greater than or equal to 1.

由于第一图像为世界坐标系下的图像,基于第一图像拼接而成的第二图像也是世界坐标系下的图像。并且,由于目标物体的不同区域无论与相机距离远近,随着焦距的调整,都被清晰地记录在至少一帧第一图像中,因此第二图像为一帧高清、无畸变/畸变极小以及无透视效果的图像。Since the first image is an image in the world coordinate system, the second image stitched based on the first image is also an image in the world coordinate system. Moreover, since different regions of the target object are clearly recorded in at least one frame of the first image as the focal length is adjusted, regardless of the distance from the camera, the second image is a frame of high-definition, no distortion/minimal distortion and Image without perspective.

如图4所示,图4为本申请提供的第二图像的示意图。图4中以目标物体为道路为例。可见,通过基于不同位姿和焦距拍摄得到N帧第一图像,并将N帧第一图像中每一图像的部分像素拼接获得的第二图像为无透视效果和畸变的图像。As shown in FIG. 4, FIG. 4 is a schematic diagram of the second image provided by the present application. In Fig. 4, the target object is a road as an example. It can be seen that N frames of first images are obtained by shooting based on different poses and focal lengths, and the second image obtained by splicing partial pixels of each of the N frames of first images is an image without perspective effect and distortion.

S104:计算设备基于第二图像检测目标物体的裂缝。S104: The computing device detects cracks of the target object based on the second image.

将N帧第一图像拼接为高清、无畸变/畸变极小以及无透视效果的第二图像后,计算设备基于第二图像能够准确地检测目标物体是否存在裂缝。After stitching the N frames of first images into a second image with high definition, no/minimal distortion, and no perspective effect, the computing device can accurately detect whether there is a crack in the target object based on the second image.

具体地,为了提高裂缝检测的准确度和提高检测效率,计算设备可以对第二图像进行预处理。Specifically, in order to improve the accuracy of crack detection and improve detection efficiency, the computing device may perform preprocessing on the second image.

一般地,道路和墙壁等建筑物体的内部或周围可能会存在绿化带或其他建筑物体,这些绿化带和目标物体以外的建筑物体会被一同拍摄进第一图像中,同样也会被拼接到第二图像中。在进行裂缝检测时若图像中存在目标物体以外的物体,会降低检测效率,干扰目标物体的裂缝检测。因此,可以仅对第二图像中的目标物体所在的区域进行检测,从而提高裂缝检测效率和检测精度。预处理则可以包括提取第二图像中的目标物体,得到仅包含目标物体的目标图像。提取第二图像中的目标物体可以是计算设备通过训练好的神经网络识别出目标物体并提取的,也可以是根据人工选取的感兴趣区域(目标物体对应的区域)从第二图像中提取的。当然,预处理也可以不包括从第二图像中提取目标物体得到目标图像的处理,为了描述方便,以下以预处理包括提取目标图像为例进行说明。Generally, there may be green belts or other building objects inside or around building objects such as roads and walls. These green belts and buildings other than the target object will be captured together in the first image, and will also be spliced into the second image. in the second image. If there are objects other than the target object in the image during crack detection, the detection efficiency will be reduced and the crack detection of the target object will be interfered. Therefore, only the area where the target object in the second image is located can be detected, thereby improving crack detection efficiency and detection accuracy. The preprocessing may include extracting the target object in the second image to obtain a target image containing only the target object. The target object in the second image can be extracted by the computing device through the trained neural network to identify and extract the target object, or it can be extracted from the second image based on the artificially selected region of interest (the region corresponding to the target object) . Of course, the preprocessing may also not include the processing of extracting the target object from the second image to obtain the target image. For the convenience of description, the preprocessing includes extracting the target image as an example for description below.

可选地,由于建筑物体材质、光照变化和老化程度差异,预处理还可以包括对目标图像进行降噪处理,以减弱材质和光照差异以及磨损老化导致目标物体在目标图像中的亮度差异引入的误差。降噪处理具体例如是中位值滤波处理或高斯滤波处理等。Optionally, due to differences in building materials, illumination changes, and aging degrees, the preprocessing may also include performing noise reduction processing on the target image to reduce the differences in material and illumination, as well as the brightness difference of the target object in the target image caused by wear and aging. error. Specifically, the noise reduction process is, for example, a median filter process, a Gaussian filter process, or the like.

预处理还可以包括对目标图像进行分块处理,得到J个第一图像块。J可以为大于或等于1的整数。当J等于1时,第一图像块即为目标图像。当J大于或等于2时,目标图像被分割为多个第一图像块,能够进一步降低目标图像中无标物体亮度不均带来的影响。以下以J大于或等于2为例进行说明。The preprocessing may also include performing block processing on the target image to obtain J first image blocks. J may be an integer greater than or equal to 1. When J is equal to 1, the first image block is the target image. When J is greater than or equal to 2, the target image is divided into a plurality of first image blocks, which can further reduce the influence of uneven brightness of unmarked objects in the target image. The following takes J greater than or equal to 2 as an example for illustration.

对目标图像进行分块处理具体可以是计算设备根据预设尺寸和目标图像的尺寸将目标图像分块。预设尺寸例如为64像素*64像素,128像素*64像素,128像素*128像素,128像素*256像素,256像素*256像素,或512像素*512像素等。对此本申请不做限制。以预设尺寸为64像素*64像素,目标图像尺寸为3200像素*6400像素为例进行说明,目标图像可以被分割为5000个第一图像块。Performing block processing on the target image may specifically be that the computing device divides the target image into blocks according to a preset size and the size of the target image. The preset size is, for example, 64 pixels*64 pixels, 128 pixels*64 pixels, 128 pixels*128 pixels, 128 pixels*256 pixels, 256 pixels*256 pixels, or 512 pixels*512 pixels. This application is not limited to this. Taking the preset size as 64 pixels*64 pixels and the target image size as 3200 pixels*6400 pixels as an example for illustration, the target image may be divided into 5000 first image blocks.

计算设备分别对每一图像块进行分类、二值化等处理,得到J个第二图像块。当某一第二图像块中存在子裂缝时,子裂缝在该第二图像块中的目标像素会被标记出来。其中,由于裂缝较为细长,而第二图像块尺寸较小,因此第二图像块中的子裂缝为裂缝的一部分。目标像素例如为灰度值为第一灰度值的像素,第二图像块中目标像素以外的像素的灰度值为第二灰度值,第一灰度值与第二灰度值不同。例如,第一灰度值可以为0,第二灰度值可以为255。或者,第一灰度值为255,第二灰度值为0。The computing device performs processing such as classification and binarization on each image block to obtain J second image blocks. When a sub-crack exists in a certain second image block, the target pixel of the sub-crack in the second image block will be marked. Wherein, since the cracks are relatively slender and the size of the second image block is small, the sub-cracks in the second image block are part of the cracks. The target pixel is, for example, a pixel whose grayscale value is a first grayscale value, and pixels other than the target pixel in the second image block have grayscale values that are a second grayscale value, and the first grayscale value is different from the second grayscale value. For example, the first grayscale value may be 0, and the second grayscale value may be 255. Alternatively, the first grayscale value is 255, and the second grayscale value is 0.

具体地,计算设备利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合。每一像素集合中包括至少一个像素,K为大于或等于1的整数。区域生长算法可以将有相似特征的像素合并到一个集合中,例如当某一第一图像块中存在子裂缝,也存在不是裂缝的目标物体表面时,那么第一图像块中有些像素与子裂缝对应,有些像素与目标物体表面对应,区域生长算法大致能够将这两类像素分类到至少两个像素集合中,其中一个像素集合表征子裂缝,一个像素集合表征目标物体表面。Specifically, the computing device uses a region growing algorithm to classify the pixels in the first image block to obtain K pixel sets. Each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The region growing algorithm can combine pixels with similar characteristics into a set. For example, when there are sub-cracks in a certain first image block, and there are target object surfaces that are not cracks, then some pixels in the first image block are similar to sub-cracks. Correspondingly, some pixels correspond to the surface of the target object, and the region growing algorithm can roughly classify these two types of pixels into at least two pixel sets, one of which represents sub-cracks, and one pixel set represents the surface of the target object.

计算设备将第一图像块转换为三维点云。三维点云的坐标轴的XY轴平面为第一图像块的像素坐标,Z轴为像素的灰度值。为了计算方便,像素的灰度值归一化到[0,1],作为像素的Z轴坐标。计算设备遍历三位点云,获取三维点云中每一三维点的邻域半径。其中,邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点。L为大于或等于4的整数,具体例如为4、8、10或12等。计算设备根据每一三位点的领域半径计算三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。每一第一图像块根据其自身特征确定其搜索半径,使得搜索后续利用搜索半径对三维点云分类时,能够更加准确地将三维点分类。The computing device converts the first image patch into a three-dimensional point cloud. The XY axis plane of the coordinate axis of the 3D point cloud is the pixel coordinate of the first image block, and the Z axis is the gray value of the pixel. For the convenience of calculation, the gray value of the pixel is normalized to [0,1], which is used as the Z-axis coordinate of the pixel. The computing device traverses the three-dimensional point cloud to obtain the neighborhood radius of each three-dimensional point in the three-dimensional point cloud. Among them, the neighborhood radius is the average value of the Euclidean distance between the target 3D point in the 3D point cloud and the L neighborhood 3D points, and the L neighborhood 3D points are the L pixels adjacent to the pixel corresponding to the target 3D point. 3D point. L is an integer greater than or equal to 4, specifically 4, 8, 10 or 12, etc. The computing device calculates the search radius of the three-dimensional point cloud according to the radius of the area of each three-position point, and the search radius is an average value of the neighborhood radii of all three-dimensional points in the three-dimensional point cloud. Each first image block determines its search radius according to its own characteristics, so that the three-dimensional points can be classified more accurately when the search radius is used to classify the three-dimensional point cloud.

计算设备根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。具体地,确定三维点云中未被分类的一个三维点为种子点。以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。确定目标三维点集合中的一个未作为种子点的三维点为种子点,以该种子点为中心,将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合。直至目标三维点集合中不存在三维点未作为种子点,则重新确定三维点云中未被分类的一个三维点为种子点,该种子点及基于该种子点生长的三维点分类到新的目标三维点集合中。直至三维点云中不存在未被分类的三维点时,完成三维点云的分类。The computing device classifies the three-dimensional points in the three-dimensional point cloud according to the search radius, and obtains K pixel sets corresponding to the K three-dimensional point sets. Specifically, an unclassified 3D point in the 3D point cloud is determined as a seed point. Taking the seed point as the center, classify the 3D points located within the search radius of the seed point into the target 3D point set where the seed point is located. Determine a 3D point that is not used as a seed point in the target 3D point set as a seed point, and use the seed point as the center to divide the 3D points within the search radius of the seed point into the target 3D point set corresponding to the seed point. Until there is no 3D point in the target 3D point set that is not used as a seed point, then a 3D point that has not been classified in the 3D point cloud is re-determined as a seed point, and the seed point and the 3D point grown based on the seed point are classified into a new target 3D point collection. The classification of the 3D point cloud is completed until there is no unclassified 3D point in the 3D point cloud.

分类得到K个像素集合后,计算设备分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。计算设备确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。一般地,建筑物体表面出现的裂缝只是占整个建筑物体表面很小的部分,建筑物体非裂缝的表面面积远远大于裂缝的面积。那么在第一图像块中,面积越大则像素数量越多,那么目标物体表面对应的像素的数量要大于裂缝对应的像素的数量。K个像素集合中像素数量最多的像素集合则可以确定其为目标物体表面对应的像素的集合。由于裂缝深度较目标物体表面深,而且形状细窄,进入其中的光线少,因而裂缝较目标物体表面要黑。那么在第一图像块中,子裂缝对应的像素的灰度值要低于目标物体表面对应的像素的灰度值。根据这一特征,可以将第一图像块中的裂缝对应的像素和目标物体表面对应的像素区分开来。具体地,计算设备将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到二值化的第二图像块。After the K pixel sets are obtained by classification, the computing device obtains the average gray value of the K pixel sets respectively, and the average gray value is the average value of the gray values of the pixels in the pixel set. The computing device determines that the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets is the gray threshold. Generally, cracks appearing on the surface of building objects only occupy a very small part of the entire building body surface, and the non-cracked surface area of building objects is much larger than the area of cracks. Then, in the first image block, the larger the area, the more the number of pixels, and the number of pixels corresponding to the surface of the target object is greater than the number of pixels corresponding to the crack. The pixel set with the largest number of pixels among the K pixel sets may be determined to be the set of pixels corresponding to the surface of the target object. Because the depth of the crack is deeper than the surface of the target object, and the shape is thin and narrow, less light enters it, so the crack is darker than the surface of the target object. Then in the first image block, the gray value of the pixel corresponding to the sub-crack is lower than the gray value of the pixel corresponding to the surface of the target object. According to this feature, the pixels corresponding to the cracks in the first image block can be distinguished from the pixels corresponding to the surface of the target object. Specifically, the computing device sets the grayscale value of the pixels in the pixel set whose average grayscale value is smaller than the grayscale threshold value as the first grayscale value, and sets the grayscale value of the pixels in the pixel set whose average grayscale value is greater than or equal to the grayscale threshold value The gray value is set as the second gray value to obtain a binarized second image block.

得到J个第二图像块后,计算设备合并J个第二图像块,得到第三图像。第三图像则为二值化处理后的目标图像。计算设备提取第三图像中的目标像素,以提取第三图像中的裂缝。After obtaining the J second image blocks, the computing device merges the J second image blocks to obtain a third image. The third image is the target image after binarization processing. The computing device extracts target pixels in the third image to extract cracks in the third image.

为了使第三图像块中的子裂缝能够合并为连续的裂缝,提取第三图像中的裂缝前还可以对第三图像进行闭运算。闭运算可以将第三图像块中存在细微连接关系的目标像素融合在一起,即将一些非目标像素转换为目标像素,从而使分布在不同第二图像块中的子裂缝能够连接形成完整的裂缝轮廓。In order to enable the sub-cracks in the third image block to be merged into continuous cracks, a closing operation may be performed on the third image before extracting the cracks in the third image. The closing operation can fuse the target pixels with subtle connections in the third image block, that is, convert some non-target pixels into target pixels, so that the sub-cracks distributed in different second image blocks can be connected to form a complete crack profile .

可选地,为了降低裂缝的误检率,计算设备在提取到裂缝后,进一步计算裂缝在第三图像中的长度,单位为像素。然后比较裂缝与长度阈值,低于长度阈值的裂缝确定为误检不上报,大于或等于长度阈值的裂缝则确定为真的裂缝。Optionally, in order to reduce the false detection rate of cracks, after extracting the cracks, the computing device further calculates the length of the cracks in the third image, and the unit is pixel. Then compare the cracks with the length threshold, the cracks below the length threshold are determined to be false detections and not reported, and the cracks greater than or equal to the length threshold are determined to be true cracks.

可选地,在检测到第三图像中的裂缝后,还可以获取裂缝在真实世界中的地理位置信息。具体地,计算设备获取携带地理位置信息的参考图像,参考图像同样为世界坐标系下的图像,参考图像中的像素与真实世界中的地理位置信息具有映射关系。参考图像例如为数字孪生城市系统或智慧城市系统中的高精城市地图。其中,数字孪生城市是指构建一个与物理世界相匹配的数字孪生城市,原样复刻城市的建筑地理构造,既包含道路、建筑等重要设施的高度、坐标等地理数据。由于第三图像是基于第二图像进行二值化转换而来,因此第三图像也是世界坐标系下的图像,第三图像中的像素与参考图像中的像素存在一一对应关系,计算设备根据参考图像获取目标像素的目标地理位置信息,以获取裂缝的地理位置信息。从而使工作人员能够准确获知裂缝所在的位置,进而能够快速确认及进行维修维护。Optionally, after detecting the crack in the third image, the geographic location information of the crack in the real world may also be acquired. Specifically, the computing device acquires a reference image carrying geographic location information, the reference image is also an image in a world coordinate system, and pixels in the reference image have a mapping relationship with geographic location information in the real world. The reference image is, for example, a high-precision city map in a digital twin city system or a smart city system. Among them, the digital twin city refers to the construction of a digital twin city that matches the physical world, and reproduces the architectural geographical structure of the city as it is, including geographical data such as the height and coordinates of important facilities such as roads and buildings. Since the third image is obtained through binarization conversion based on the second image, the third image is also an image in the world coordinate system, and there is a one-to-one correspondence between the pixels in the third image and the pixels in the reference image. The reference image is used to obtain the target geographic location information of the target pixel to obtain the geographic location information of the crack. In this way, the staff can accurately know the location of the crack, and then can quickly confirm and carry out repair and maintenance.

本实施例中,通过利用已经部署在建筑物体周围的相机对建筑物体拍摄图片,并基于图片检测建筑物体的裂缝,无需人工检测,也无需投入额外的物力,能够降低裂缝检测成本。并且,相机能够随时被调用用于拍摄目标物体,计算设备也能够随时进行检测,从而能够及时获取建筑物体的现状,有裂缝出现也能够被及时发现。可以同时调用多个相机对多个建筑物体进行裂缝采集第一图像,再由计算设备基于第一图像进行拼接检测,从而提高检测效率。In this embodiment, by using the cameras that have been deployed around the building to take pictures of the building and detect the cracks of the building based on the pictures, no manual inspection or additional material resources are required, and the cost of crack detection can be reduced. Moreover, the camera can be called at any time to shoot the target object, and the computing device can also perform detection at any time, so that the current status of the building object can be obtained in time, and cracks can also be found in time. Multiple cameras can be called at the same time to collect first images of cracks in multiple building objects, and then the computing device can perform splicing detection based on the first images, thereby improving detection efficiency.

有计算设备完成图像拼接和目标物体的裂缝检测,能够降低对相机的算力要求,从而更多的相机能被利用来测量建筑物体的裂缝,降低裂缝检测成本。Computing equipment to complete image stitching and crack detection of target objects can reduce the computing power requirements for cameras, so that more cameras can be used to measure cracks in building objects, reducing the cost of crack detection.

以上实施例是由相机和计算设备配合完成裂缝的检测,在一些其他的实施方式中,还可以是由相机独立完成裂缝的检测。In the above embodiments, the camera and the computing device cooperate to complete the detection of cracks. In some other implementation manners, the camera can also independently complete the detection of cracks.

如图5所示,图5为本申请提供的裂缝检测方法第二实施例的流程示意图。本实施例包括如下步骤:As shown in FIG. 5 , FIG. 5 is a schematic flowchart of a second embodiment of the crack detection method provided by the present application. This embodiment includes the following steps:

S501:相机采集N帧第一图像,N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的,预设操作为相机旋转相机的镜头和调节镜头的焦距,不同区域与相机的距离不同。S501: The camera collects N frames of the first image. The N frames of the first image are obtained by the camera shooting different areas of the target object through a preset operation. The preset operation is that the camera rotates the camera lens and adjusts the focal length of the lens. Different areas and The distance of the camera is different.

本步骤与S101类似,故在此不再赘述。This step is similar to S101, so it will not be repeated here.

S502:相机对N帧第一图像中每一图像的部分像素进行拼接获得第二图像。S502: The camera stitches some pixels of each of the N frames of first images to obtain a second image.

本步骤与S102类似,不同的是执行主体为相机,但具体拼接方法一致,故在此不再赘述。This step is similar to S102, the difference is that the execution subject is a camera, but the specific splicing method is the same, so it will not be repeated here.

S503:相机基于第二图像检测目标物体的裂缝。S503: The camera detects cracks of the target object based on the second image.

本步骤与S103类似,不同的是执行主体为相机,但具体检测方法一致,故在此不再赘述。This step is similar to S103, except that the execution subject is a camera, but the specific detection method is the same, so it will not be repeated here.

以上裂缝检测方法第一实施例由裂缝检测装置实现。如图6所示,图6为本申请提供的裂缝检测装置实施例的结构示意图。裂缝检测装置600包括采集模块601、拼接模块602和检测模块603。The above first embodiment of the crack detection method is implemented by a crack detection device. As shown in FIG. 6 , FIG. 6 is a schematic structural diagram of an embodiment of a crack detection device provided in the present application. The crack detection device 600 includes a collection module 601 , a splicing module 602 and a detection module 603 .

采集模块601,用于采集N帧第一图像,N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的,预设操作为相机旋转相机的镜头和调节镜头的焦距,不同区域与相机的距离不同,N为大于或等于2的整数。The acquisition module 601 is configured to acquire N frames of the first image, and the N frames of the first image are obtained by the camera shooting different regions of the target object through a preset operation. The preset operation is to rotate the camera lens of the camera and adjust the focal length of the lens, Different regions have different distances from the camera, and N is an integer greater than or equal to 2.

拼接模块602,用于对N帧第一图像中每一图像的部分进行拼接获得第二图像。A splicing module 602, configured to splice parts of each image in the N frames of first images to obtain a second image.

检测模块603,用于基于第二图像检测目标物体的裂缝。A detection module 603, configured to detect cracks of the target object based on the second image.

在一些可能实现的方式中,第二图像为无透视效果的图像。由于相机镜头的透视现象会造成相机拍摄到的目标物体有远小近大的效果,造成远处的目标物体细节丢失,无法准确检测出裂缝,将N帧第一图像拼接获得无透视效果的第二图像,则会使远处的目标物体的细节也能得到清晰呈现,基于第二图像进行裂缝检测也会更加准确。In some possible implementation manners, the second image is an image without a perspective effect. Due to the perspective phenomenon of the camera lens, the target object captured by the camera has the effect of being far smaller and closer, resulting in the loss of details of the distant target object, and the crack cannot be accurately detected. The first image of N frames is stitched to obtain the first image without perspective effect. With the second image, the details of distant target objects can also be clearly presented, and crack detection based on the second image will also be more accurate.

在一些可能实现的方式中,拼接模块602具体用于:分别截取N帧第一图像的M行像素,M为大于或等于1的整数。将N帧第一图像的M行像素拼接获得第二图像。In some possible implementation manners, the splicing module 602 is specifically configured to: respectively intercept M rows of pixels of the N frames of the first image, where M is an integer greater than or equal to 1. The second image is obtained by splicing the M rows of pixels of the N frames of the first image.

在一些可能实现的方式中,拼接模块602具体用于:分别截取N帧第一图像中每一图像的部分像素,其中,每一图像被截取的像素数量不同。将N帧第一图像中每一图像的部分像素进行拼接获得第二图像。In some possible implementation manners, the splicing module 602 is specifically configured to: respectively capture partial pixels of each image in the N frames of first images, wherein the number of pixels to be captured in each image is different. Partial pixels of each image in the N frames of first images are spliced to obtain a second image.

在一些可能实现的方式中,拼接模块602具体用于:分别截取N帧第一图像的P个像素,P为大于或等于1的整数。将N帧第一图像的P个像素拼接获得第二图像。In some possible implementation manners, the splicing module 602 is specifically configured to: respectively intercept P pixels of the N frames of the first image, where P is an integer greater than or equal to 1. The P pixels of the N frames of the first image are spliced to obtain the second image.

在一些可能的实现方式中,检测模块603具体用于:对第二图像进行预处理,得到J个第一图像块。第一图像块中包括目标物体的部分,J为大于或等于1的整数。其中,预处理可以是分块,也可以是滤波和分块。检测模块603对每一第一图像块进行处理,得到J个第二图像块,第二图像块中标记有子裂缝对应的目标像素。子裂缝为裂缝的一部分。相机合并J个第二图像块,得到第三图像。检测模块603提取第三图像中的目标像素,得到裂缝。通过将第二图像分块,并分别对图像块进行处理,能够降低外部环境对目标物体中裂缝的提取造成的影响,提高裂缝检测的准确性。In some possible implementation manners, the detection module 603 is specifically configured to: perform preprocessing on the second image to obtain J first image blocks. The part of the target object included in the first image block, J is an integer greater than or equal to 1. Wherein, the preprocessing may be block, and may also be filtering and block. The detection module 603 processes each first image block to obtain J second image blocks, in which target pixels corresponding to sub-cracks are marked. A sub-crack is a part of a crack. The camera combines J second image blocks to obtain a third image. The detection module 603 extracts target pixels in the third image to obtain cracks. By dividing the second image into blocks and processing the image blocks separately, the influence of the external environment on the extraction of cracks in the target object can be reduced, and the accuracy of crack detection can be improved.

在一种可能的实现方式中,目标像素为灰度值为第一灰度值的像素,检测模块603具体用于利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合。其中,每一像素集合中包括至少一个像素,K为大于或等于1的整数。检测模块603分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。检测模块603确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。检测模块603将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到第二图像块。其中,第一灰度值可以为0,第二灰度值可以为266。或者,第一灰度值为266,第二灰度值为0。将图像块中的裂缝对应的像素筛选出来,然后将其灰度值赋值为第一灰度值,从而完成图像块的二值化,即对裂缝对应的像素进行标记。In a possible implementation, the target pixel is a pixel with a gray value of the first gray value, and the detection module 603 is specifically configured to classify the pixels in the first image block using the region growing algorithm to obtain K pixel sets . Wherein, each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The detection module 603 respectively obtains the average gray value of the K pixel sets, and the average gray value is the average value of the gray values of the pixels in the pixel set. The detection module 603 determines that the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets is the gray threshold. The detection module 603 sets the grayscale value of the pixels in the pixel set whose average grayscale value is less than the grayscale threshold value as the first grayscale value, and sets the grayscale value of the pixels in the pixel set whose average grayscale value is greater than or equal to the grayscale threshold value The value is set to the second grayscale value to obtain the second image block. Wherein, the first grayscale value may be 0, and the second grayscale value may be 266. Alternatively, the first grayscale value is 266, and the second grayscale value is 0. The pixels corresponding to the cracks in the image block are screened out, and then their gray value is assigned as the first gray value, thereby completing the binarization of the image block, that is, marking the pixels corresponding to the cracks.

在一种可能的实现方式中,检测模块603具体还用于将图像块转换为三维点云。检测模块603获取三维点云中每一三维点的邻域半径。邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点。L为大于或等于4的整数。检测模块603获取三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。检测模块603根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。每个图像块根据自身的三维点云的特征得到对应的搜索半径,从而能够更加准确地将该图像块中的三维点分类,将图像块中的裂缝对应的三维点分割出来。In a possible implementation manner, the detection module 603 is further configured to convert the image block into a three-dimensional point cloud. The detection module 603 acquires the neighborhood radius of each 3D point in the 3D point cloud. The neighborhood radius is the average value of the Euclidean distance between the target 3D point in the 3D point cloud and the L neighborhood 3D points, and the L neighborhood 3D points are the 3D distances corresponding to the L pixels adjacent to the pixel corresponding to the target 3D point. point. L is an integer greater than or equal to 4. The detection module 603 acquires the search radius of the 3D point cloud, and the search radius is the average value of the neighborhood radii of all 3D points in the 3D point cloud. The detection module 603 classifies the 3D points in the 3D point cloud according to the search radius, and obtains K pixel sets corresponding to the K 3D point sets. Each image block obtains a corresponding search radius according to the characteristics of its own 3D point cloud, so that the 3D points in the image block can be classified more accurately, and the 3D points corresponding to the cracks in the image block can be segmented out.

在一种可能的实现方式中,检测模块603具体还用于确定三维点云中未被分类的一个三维点为种子点。检测模块603以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。检测模块603确定目标三维点集合中的一个未作为种子点的三维点为种子点,返回以种子点为中心,检测模块603将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合的步骤。直至目标三维点集合中不存在三维点未作为种子点,检测模块603返回确定三维点云中未被分类的一个三维点为种子点的步骤。直至三维点云中的三维点均被分类。In a possible implementation manner, the detection module 603 is specifically further configured to determine an unclassified three-dimensional point in the three-dimensional point cloud as a seed point. The detection module 603 takes the seed point as the center, and classifies the 3D points located within the search radius of the seed point into the target 3D point set where the seed point is located. The detection module 603 determines that a 3D point that is not used as a seed point in the set of target 3D points is the seed point, and returns to the center of the seed point, and the detection module 603 divides the 3D point located within the search radius of the seed point into the target corresponding to the seed point Steps for a collection of 3D points. Until there is no 3D point in the target 3D point set that is not used as a seed point, the detection module 603 returns to the step of determining an unclassified 3D point in the 3D point cloud as a seed point. Up to 3D points in the 3D point cloud are classified.

在一种可能的实现方式中,第三图像中的像素与参考图像中的像素具有映射关系,参考图像中的像素携带地理位置信息。裂缝检测装置600还包括获取模块604。获取模块604根据参考图像获取目标像素的目标地理位置信息,以获取裂缝的地理位置信息。检测出裂缝后,进一步获取裂缝的地理位置信息,以定位裂缝。In a possible implementation manner, the pixels in the third image have a mapping relationship with the pixels in the reference image, and the pixels in the reference image carry geographic location information. The crack detection device 600 also includes an acquisition module 604 . The obtaining module 604 obtains the target geographic location information of the target pixel according to the reference image, so as to obtain the geographic location information of the fracture. After the crack is detected, the geographic location information of the crack is further obtained to locate the crack.

裂缝检测装置600可以为相机,具体为具备云台和变焦镜头的相机,例如球型相机等。或者,采集模块601属于相机,拼接模块602和检测模块603属于计算设备。The crack detection device 600 may be a camera, specifically a camera with a pan/tilt and a zoom lens, such as a spherical camera. Alternatively, the acquisition module 601 belongs to the camera, and the stitching module 602 and the detection module 603 belong to the computing device.

以上裂缝检测方法第二实施例由裂缝检测系统实现。如图7所示,图7为本申请提供的裂缝检测系统实施例的结构示意图。该裂缝检测系统700包括相机701和计算设备702,相机701和计算设备702连接。The above second embodiment of the crack detection method is implemented by a crack detection system. As shown in FIG. 7 , FIG. 7 is a schematic structural diagram of an embodiment of a crack detection system provided by the present application. The crack detection system 700 includes a camera 701 and a computing device 702, and the camera 701 and the computing device 702 are connected.

相机701,用于采集N帧第一图像,N帧第一图像是相机通过预设操作对目标物体的不同区域进行拍摄得到的,预设操作为相机旋转相机的镜头和调节镜头的焦距,不同区域与相机的距离不同,N为大于或等于2的整数。The camera 701 is used to collect N frames of the first image. The N frames of the first image are obtained by the camera shooting different areas of the target object through a preset operation. The preset operation is that the camera rotates the camera lens and adjusts the focal length of the lens. The distance between the area and the camera is different, and N is an integer greater than or equal to 2.

相机701,还用于将N帧第一图像发送给计算设备702。The camera 701 is further configured to send N frames of the first image to the computing device 702 .

计算设备702,用于对N帧第一图像中每一图像的部分进行拼接获得第二图像。The computing device 702 is configured to stitch parts of each of the N frames of first images to obtain a second image.

计算设备702,还用于基于第二图像检测目标物体的裂缝。The computing device 702 is further configured to detect cracks of the target object based on the second image.

在一些可能实现的方式中,计算设备702具体用于:分别截取N帧第一图像的M行像素,M为大于或等于1的整数。将N帧第一图像的M行像素拼接为第二图像。In some possible implementation manners, the computing device 702 is specifically configured to: respectively intercept M rows of pixels of the N frames of the first image, where M is an integer greater than or equal to 1. M rows of pixels of N frames of the first image are spliced into a second image.

在一些可能的实现方式中,计算设备702具体用于:对第二图像进行预处理,得到J个第一图像块。第一图像块中包括目标物体的部分,J为大于或等于1的整数。其中,预处理可以是分块,也可以是滤波和分块。计算设备702对每一第一图像块进行处理,得到J个第二图像块,第二图像块中标记有子裂缝对应的目标像素。子裂缝为裂缝的一部分。相机合并J个第二图像块,得到第三图像。计算设备702提取第三图像中的目标像素,得到裂缝。通过将第二图像分块,并分别对图像块进行处理,能够降低外部环境对目标物体中裂缝的提取造成的影响,提高裂缝检测的准确性。In some possible implementation manners, the computing device 702 is specifically configured to: perform preprocessing on the second image to obtain J first image blocks. The part of the target object included in the first image block, J is an integer greater than or equal to 1. Wherein, the preprocessing may be block, and may also be filtering and block. The computing device 702 processes each first image block to obtain J second image blocks, where target pixels corresponding to sub-cracks are marked. A sub-crack is a part of a crack. The camera combines J second image blocks to obtain a third image. The computing device 702 extracts the target pixels in the third image to obtain cracks. By dividing the second image into blocks and processing the image blocks separately, the influence of the external environment on the extraction of cracks in the target object can be reduced, and the accuracy of crack detection can be improved.

在一种可能的实现方式中,目标像素为灰度值为第一灰度值的像素,计算设备702具体用于利用区域生长算法对第一图像块中的像素进行分类,得到K个像素集合。其中,每一像素集合中包括至少一个像素,K为大于或等于1的整数。计算设备702分别获取K个像素集合的平均灰度值,平均灰度值为像素集合中像素的灰度值的平均值。计算设备702确定K个像素集合中像素数量最多的像素集合对应的平均灰度值为灰度阈值。计算设备702将平均灰度值小于灰度阈值的像素集合中的像素的灰度值设为第一灰度值,将平均灰度值大于或等于灰度阈值的像素集合中的像素的灰度值设为第二灰度值,得到第二图像块。其中,第一灰度值可以为0,第二灰度值可以为255。或者,第一灰度值为255,第二灰度值为0。将图像块中的裂缝对应的像素筛选出来,然后将其灰度值赋值为第一灰度值,从而完成图像块的二值化,即对裂缝对应的像素进行标记。In a possible implementation, the target pixel is a pixel with a gray value of the first gray value, and the computing device 702 is specifically configured to classify the pixels in the first image block using a region growing algorithm to obtain K pixel sets . Wherein, each pixel set includes at least one pixel, and K is an integer greater than or equal to 1. The calculation device 702 respectively acquires the average gray value of the K pixel sets, and the average gray value is an average value of the gray values of the pixels in the pixel set. The computing device 702 determines the average gray value corresponding to the pixel set with the largest number of pixels among the K pixel sets to be the gray threshold. The calculation device 702 sets the grayscale value of the pixels in the pixel set whose average grayscale value is smaller than the grayscale threshold value as the first grayscale value, and sets the grayscale value of the pixels in the pixel set whose average grayscale value is greater than or equal to the grayscale threshold value The value is set to the second grayscale value to obtain the second image block. Wherein, the first grayscale value may be 0, and the second grayscale value may be 255. Alternatively, the first grayscale value is 255, and the second grayscale value is 0. The pixels corresponding to the cracks in the image block are screened out, and then their gray value is assigned as the first gray value, thereby completing the binarization of the image block, that is, marking the pixels corresponding to the cracks.

在一种可能的实现方式中,计算设备702具体还用于将图像块转换为三维点云。计算设备702获取三维点云中每一三维点的邻域半径。邻域半径为三维点云中的目标三维点与L个邻域三维点之间的欧式距离的平均值,L个邻域三维点为目标三维点对应的像素相邻的L个像素对应的三维点。L为大于或等于4的整数。计算设备702获取三维点云的搜索半径,搜索半径为三维点云中所有三维点的邻域半径的平均值。计算设备702根据搜索半径对三维点云中的三维点进行分类,得到K个三维点集合对应的K个像素集合。每个图像块根据自身的三维点云的特征得到对应的搜索半径,从而能够更加准确地将该图像块中的三维点分类,将图像块中的裂缝对应的三维点分割出来。In a possible implementation manner, the computing device 702 is further configured to convert the image block into a three-dimensional point cloud. The computing device 702 obtains the neighborhood radius of each 3D point in the 3D point cloud. The neighborhood radius is the average value of the Euclidean distance between the target 3D point in the 3D point cloud and the L neighborhood 3D points, and the L neighborhood 3D points are the 3D distances corresponding to the L pixels adjacent to the pixel corresponding to the target 3D point. point. L is an integer greater than or equal to 4. The computing device 702 acquires a search radius of the three-dimensional point cloud, where the search radius is an average value of neighborhood radii of all three-dimensional points in the three-dimensional point cloud. The computing device 702 classifies the three-dimensional points in the three-dimensional point cloud according to the search radius, and obtains K pixel sets corresponding to the K three-dimensional point sets. Each image block obtains a corresponding search radius according to the characteristics of its own 3D point cloud, so that the 3D points in the image block can be classified more accurately, and the 3D points corresponding to the cracks in the image block can be segmented out.

在一种可能的实现方式中,计算设备702具体还用于确定三维点云中未被分类的一个三维点为种子点。计算设备702以种子点为中心,将位于种子点的搜索半径内的三维点分类到种子点所在的目标三维点集合。计算设备702确定所目标三维点集合中的一个未作为种子点的三维点为种子点,返回以种子点为中心,计算设备702将位于种子点的搜索半径内的三维点划入种子点对应的目标三维点集合的步骤。直至目标三维点集合中不存在三维点未作为种子点,计算设备702返回确定三维点云中未被分类的一个三维点为种子点的步骤。直至三维点云中的三维点均被分类。In a possible implementation manner, the computing device 702 is specifically further configured to determine an unclassified three-dimensional point in the three-dimensional point cloud as a seed point. The computing device 702 centers on the seed point, and classifies the three-dimensional points located within the search radius of the seed point into the target three-dimensional point set where the seed point is located. The computing device 702 determines that a 3D point that is not used as a seed point in the target 3D point set is the seed point, returns the seed point as the center, and the computing device 702 divides the 3D point located within the search radius of the seed point into the corresponding 3D point of the seed point. Steps to target a set of 3D points. Until there is no 3D point in the target 3D point set that is not used as a seed point, the computing device 702 returns to the step of determining an unclassified 3D point in the 3D point cloud as a seed point. Up to 3D points in the 3D point cloud are classified.

在一种可能的实现方式中,第三图像中的像素与参考图像中的像素具有映射关系,参考图像中的像素携带地理位置信息。计算设备702还根据参考图像获取目标像素的目标地理位置信息,以获取裂缝的地理位置信息。检测出裂缝后,进一步获取裂缝的地理位置信息,以定位裂缝。In a possible implementation manner, the pixels in the third image have a mapping relationship with the pixels in the reference image, and the pixels in the reference image carry geographic location information. The computing device 702 also obtains the target geographic location information of the target pixel according to the reference image, so as to obtain the geographic location information of the fracture. After the crack is detected, the geographic location information of the crack is further obtained to locate the crack.

如图8所示,图8为本申请提供的裂缝检测设备一实施例的结构示意图。本实施例中裂缝检测设备800包括处理器801和存储器802。处理器801耦接存储器802,处理器801被配置为基于存储在存储器802中的指令,执行上述裂缝检测方法第一实施例或第二实施例。As shown in FIG. 8 , FIG. 8 is a schematic structural diagram of an embodiment of a crack detection device provided in the present application. The crack detection device 800 in this embodiment includes a processor 801 and a memory 802 . The processor 801 is coupled to the memory 802, and the processor 801 is configured to execute the first embodiment or the second embodiment of the above crack detection method based on instructions stored in the memory 802.

本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现上述任一方法实施例的裂缝检测方法流程。The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a computer, the flow of the crack detection method in any one of the above method embodiments is implemented.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,read-onlymemory)、随机存取存储器(RAM,random access memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), magnetic disk or optical disk, and other media that can store program codes.

Claims (17)

1. A method of crack detection, the method comprising:
the method comprises the steps that a camera collects N frames of first images, wherein the N frames of first images are obtained by shooting different areas of a target object through a preset operation, the preset operation is to rotate a lens of the camera and adjust the focal length of the lens, the distances between the different areas and the camera are different, and N is an integer greater than or equal to 2;
The camera sending the N frames of first images to a computing device;
the computing equipment splices part of each image in the N frames of first images to obtain a second image;
the computing device detects a crack of the target object based on the second image.
2. The method of claim 1, wherein the computing device stitching portions of each of the N frames of first images to obtain a second image comprises:
the computing equipment intercepts M rows of pixels of the N frames of first images respectively, wherein M is an integer greater than or equal to 1;
the computing device stitch together M rows of pixels of the N frames of first images to obtain the second image.
3. The method of any of claims 1 or 2, wherein the computing device detecting a crack of the target object based on the second image comprises:
the computing equipment pre-processes the second image to obtain J first image blocks, wherein the first image blocks comprise parts of the target object, and J is an integer greater than or equal to 1;
the computing equipment processes each first image block to obtain J second image blocks, target pixels corresponding to sub-cracks are marked in the second image blocks, and the sub-cracks are part of the cracks;
The computing equipment merges the J second image blocks to obtain a third image;
the computing device extracts the target pixel in the third image, resulting in the crack.
4. A method according to claim 3, wherein the target pixel is a pixel having a gray value of a first gray value, and wherein the computing device processing each of the first image blocks to obtain J second image blocks comprises:
the computing equipment classifies pixels in the first image block by utilizing a region growing algorithm to obtain K pixel sets, wherein each pixel set comprises at least one pixel, and K is an integer greater than or equal to 1;
the computing equipment respectively acquires average gray values of the K pixel sets, wherein the average gray values are average values of gray values of pixels in the pixel sets;
the computing equipment determines the average gray value corresponding to the pixel set with the largest number of pixels in the K pixel sets as a gray threshold value;
the computing device sets the gray value of the pixel in the pixel set with the average gray value smaller than the gray threshold value as a first gray value, and sets the gray value of the pixel in the pixel set with the average gray value larger than or equal to the gray threshold value as a second gray value, so that the second image block is obtained.
5. The method of claim 4, wherein the computing device classifying pixels in the image block using the region growing algorithm to obtain K sets of pixels comprises:
the computing device converting the image block into a three-dimensional point cloud;
the computing equipment acquires a neighborhood radius of each three-dimensional point in the three-dimensional point cloud, wherein the neighborhood radius is an average value of Euclidean distances between a target three-dimensional point in the three-dimensional point cloud and L neighborhood three-dimensional points, the L neighborhood three-dimensional points are three-dimensional points corresponding to L pixels adjacent to the pixel corresponding to the target three-dimensional point, and L is an integer greater than or equal to 4;
the computing equipment acquires a search radius of the three-dimensional point cloud, wherein the search radius is an average value of the neighborhood radiuses of all three-dimensional points in the three-dimensional point cloud;
and classifying the three-dimensional points in the three-dimensional point cloud according to the search radius by the computing equipment to obtain K pixel sets corresponding to the K three-dimensional point sets.
6. A method of crack detection, the method comprising:
the method comprises the steps that a camera collects N frames of first images, wherein the N frames of first images are obtained by shooting different areas of a target object through a preset operation, the preset operation is to rotate a lens of the camera and adjust the focal length of the lens, the distances between the different areas and the camera are different, and N is an integer greater than or equal to 2;
The camera splices the part of each image in the N frames of first images to obtain a second image;
the camera detects a crack of the target object based on the second image.
7. The method of claim 6, wherein the stitching the portion of each of the N frames of first images into a second image by the camera comprises:
the camera intercepts M rows of pixels of the N frames of first images respectively, wherein M is an integer greater than or equal to 1;
and the camera splices M rows of pixels of the N frames of first images to obtain the second image.
8. The method of claim 6 or 7, wherein the camera detecting a crack of the target object based on the second image comprises:
the camera pre-processes the second image to obtain J first image blocks, wherein the first image blocks comprise parts of the target object, and J is an integer greater than or equal to 1;
the camera processes each first image block to obtain J second image blocks, target pixels corresponding to sub-cracks are marked in the second image blocks, and the sub-cracks are part of the cracks;
the camera merges the J second image blocks to obtain a third image;
And the camera extracts the target pixel in the third image to obtain the crack.
9. The method of claim 8, wherein the target pixel is a pixel having a gray value of a first gray value, and wherein the processing each of the first image blocks by the camera to obtain J second image blocks comprises:
the camera classifies pixels in the first image block by using a region growing algorithm to obtain K pixel sets, wherein each pixel set comprises at least one pixel, and K is an integer greater than or equal to 1;
the camera respectively acquires average gray values of the K pixel sets, wherein the average gray values are average values of gray values of pixels in the pixel sets;
the camera determines the average gray value corresponding to the pixel set with the largest number of pixels in the K pixel sets as a gray threshold value;
and the camera sets the gray value of the pixel in the pixel set with the average gray value smaller than the gray threshold value as the first gray value, and sets the gray value of the pixel in the pixel set with the average gray value larger than or equal to the gray threshold value as the second gray value, so as to obtain the second image block.
10. The method of claim 9, wherein the camera classifying pixels in the image block using the region growing algorithm to obtain K sets of pixels comprises:
the camera converts the first image block into a three-dimensional point cloud;
the camera acquires a neighborhood radius of each three-dimensional point in the three-dimensional point cloud, wherein the neighborhood radius is an average value of Euclidean distances between a target three-dimensional point in the three-dimensional point cloud and L neighborhood three-dimensional points, the L neighborhood three-dimensional points are three-dimensional points corresponding to L pixels adjacent to the pixel corresponding to the target three-dimensional point, and L is an integer greater than or equal to 4;
the camera acquires the searching radius of the three-dimensional point cloud, wherein the searching radius is the average value of the neighborhood radiuses of all three-dimensional points in the three-dimensional point cloud;
and classifying the three-dimensional points in the three-dimensional point cloud by the camera according to the search radius to obtain K pixel sets corresponding to the K three-dimensional point sets.
11. A crack detection device, the device comprising:
the acquisition module is used for acquiring N frames of first images, wherein the N frames of first images are obtained by shooting different areas of a target object through a preset operation, the preset operation is to rotate a lens of the camera and adjust the focal length of the lens, the distances between the different areas and the camera are different, and N is an integer greater than or equal to 2;
The splicing module is used for splicing the part of each image in the N frames of first images to obtain a second image;
and the detection module is used for detecting the crack of the target object based on the second image.
12. The apparatus of claim 11, wherein the stitching module is specifically configured to:
respectively intercepting M rows of pixels of the N frames of first images, wherein M is an integer greater than or equal to 1;
and splicing M rows of pixels of the N frames of first images to obtain the second image.
13. The apparatus according to claim 11 or 12, wherein the detection module is specifically configured to:
preprocessing the second image to obtain J first image blocks, wherein the first image blocks comprise parts of the target object, and J is an integer greater than or equal to 1;
processing each first image block to obtain J second image blocks, wherein target pixels corresponding to sub-cracks are marked in the second image blocks, and the sub-cracks are part of the cracks;
combining the J second image blocks to obtain a third image;
and extracting the target pixel in the third image to obtain the crack.
14. The apparatus of claim 13, wherein the detection module is further specifically configured to:
Classifying pixels in the first image block by using a region growing algorithm to obtain K pixel sets, wherein each pixel set comprises at least one pixel, and K is an integer greater than or equal to 1;
respectively obtaining average gray values of the K pixel sets, wherein the average gray values are average values of gray values of pixels in the pixel sets;
determining the average gray value corresponding to the pixel set with the largest number of pixels in the K pixel sets as a gray threshold value;
and setting the gray value of the pixel in the pixel set with the average gray value smaller than the gray threshold value as the first gray value, and setting the gray value of the pixel in the pixel set with the average gray value larger than or equal to the gray threshold value as a second gray value, so as to obtain the second image block.
15. The apparatus of claim 14, wherein the detection module is further specifically configured to:
converting the first image block into a three-dimensional point cloud;
obtaining a neighborhood radius of each three-dimensional point in the three-dimensional point cloud, wherein the neighborhood radius is an average value of Euclidean distances between a target three-dimensional point in the three-dimensional point cloud and L neighborhood three-dimensional points, the L neighborhood three-dimensional points are three-dimensional points corresponding to L adjacent pixels corresponding to the pixel corresponding to the target three-dimensional point, and L is an integer greater than or equal to 4;
Acquiring a search radius of the three-dimensional point cloud, wherein the search radius is an average value of the neighborhood radiuses of all three-dimensional points in the three-dimensional point cloud;
and classifying the three-dimensional points in the three-dimensional point cloud according to the search radius to obtain K pixel sets corresponding to the K three-dimensional point sets.
16. A crack detection device, characterized in that the device comprises a processor and a memory, the processor being coupled to the memory, the processor being configured to perform the crack detection method according to any of claims 1-5 based on instructions stored in the memory.
17. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program that is executed by a processor to implement the crack detection method of any one of claims 1 to 10.
CN202111417479.5A 2021-11-25 2021-11-25 Crack detection method, device and equipment Pending CN116188348A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111417479.5A CN116188348A (en) 2021-11-25 2021-11-25 Crack detection method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111417479.5A CN116188348A (en) 2021-11-25 2021-11-25 Crack detection method, device and equipment

Publications (1)

Publication Number Publication Date
CN116188348A true CN116188348A (en) 2023-05-30

Family

ID=86433127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111417479.5A Pending CN116188348A (en) 2021-11-25 2021-11-25 Crack detection method, device and equipment

Country Status (1)

Country Link
CN (1) CN116188348A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117115665A (en) * 2023-10-17 2023-11-24 深圳市城市交通规划设计研究中心股份有限公司 Static influence parameter analysis method based on pavement crack analysis method
CN119418066A (en) * 2025-01-07 2025-02-11 西安奥华电子仪器股份有限公司 Crack contour extraction method for well logging graph

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117115665A (en) * 2023-10-17 2023-11-24 深圳市城市交通规划设计研究中心股份有限公司 Static influence parameter analysis method based on pavement crack analysis method
CN117115665B (en) * 2023-10-17 2024-02-27 深圳市城市交通规划设计研究中心股份有限公司 Static influence parameter analysis method based on pavement crack analysis method
CN119418066A (en) * 2025-01-07 2025-02-11 西安奥华电子仪器股份有限公司 Crack contour extraction method for well logging graph

Similar Documents

Publication Publication Date Title
CN104951775B (en) Railway highway level crossing signal region security intelligent identification Method based on video technique
US20110267491A1 (en) Color correction device, color correction method, dynamic camera color correction device, and video search device using the same
CN109859171A (en) A kind of flooring defect automatic testing method based on computer vision and deep learning
CN109410207A (en) A kind of unmanned plane line walking image transmission line faultlocating method based on NCC feature
CN117036641A (en) Road scene three-dimensional reconstruction and defect detection method based on binocular vision
CN106485655A (en) A kind of taken photo by plane map generation system and method based on quadrotor
CN114973028B (en) Aerial video image real-time change detection method and system
CN108038883A (en) A kind of Crack Detection and recognition methods applied to highway pavement video image
KR101558467B1 (en) System for revising coordinate in the numerical map according to gps receiver
CN116188348A (en) Crack detection method, device and equipment
CN110390256B (en) Asphalt pavement crack extraction method
CN110414341A (en) A measurement and statistics method of open-pit mine explosion pile based on unmanned aerial vehicle technology
CN110245566B (en) A long-distance tracking method for infrared targets based on background features
CN110634138A (en) Bridge deformation monitoring method, device and equipment based on visual perception
CN108564787A (en) Traffic observation procedure, system and equipment based on Floating Car method
CN110826364A (en) Stock position identification method and device
CN115619623A (en) A Method for Stitching Images of Parallel Fisheye Cameras Based on Moving Least Square Transformation
CN110120012B (en) Video stitching method based on binocular camera synchronization key frame extraction
CN103900498B (en) A kind of cotton field automatic detection method of the growth of cereal crop seedlings and detection device thereof
CN109635679A (en) A kind of real-time target sheet positioning and loop wire recognition methods
Joachim et al. Evaluation of the quality of real-time mapping with crane cameras and visual slam algorithms
CN110430400B (en) Ground plane area detection method of binocular movable camera
CN104751455A (en) Crop image dense matching method and system
CN109902607B (en) Urban automatic optimization modeling system based on oblique camera
WO2020153264A1 (en) Calibration method and calibration device

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