CN111951323B - Method for sorting grids and calculating number of cracks and corresponding area of cracks - Google Patents

Method for sorting grids and calculating number of cracks and corresponding area of cracks Download PDF

Info

Publication number
CN111951323B
CN111951323B CN202010707424.7A CN202010707424A CN111951323B CN 111951323 B CN111951323 B CN 111951323B CN 202010707424 A CN202010707424 A CN 202010707424A CN 111951323 B CN111951323 B CN 111951323B
Authority
CN
China
Prior art keywords
image
black
cracks
white
value
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.)
Active
Application number
CN202010707424.7A
Other languages
Chinese (zh)
Other versions
CN111951323A (en
Inventor
李安
迪利普
宋海红
黄鹤
陈涌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shantou University
Original Assignee
Shantou University
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 Shantou University filed Critical Shantou University
Priority to CN202010707424.7A priority Critical patent/CN111951323B/en
Publication of CN111951323A publication Critical patent/CN111951323A/en
Application granted granted Critical
Publication of CN111951323B publication Critical patent/CN111951323B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/181Segmentation; Edge detection involving edge growing; involving edge linking
    • 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/10016Video; Image sequence
    • 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/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30242Counting objects in image

Abstract

The embodiment of the invention discloses a method for sorting grids and calculating the number of cracks and the corresponding area thereof, which comprises the following steps: extracting a frame from the digital video, smoothing the texture of the frame to reduce noise; a Gaussian filter is adopted on the duplicate frames; deleting the background through the difference value of the two frames; converting the image into a gray level image, and then performing binarization processing to adjust the gray level image into a black-and-white image; corroding the image and closing the image outline; sequencing the contours according to the positions, the areas and the sizes of the contours; creating a new image in the outline, converting the new image into a gray level image, and then performing binarization processing; closing the image and generating a contour by morphological operations; the contours are ordered according to area and their size and then counted. By adopting the method, the delay effect can be ignored, a large number of cracks and areas thereof can be calculated in real time, and the influence of the cracks outside the grid can be effectively reduced.

Description

Method for sorting grids and calculating number of cracks and corresponding area of cracks
Technical Field
The invention relates to the technical field of computer image processing, in particular to a method for sorting grids and calculating the number of cracks and the corresponding area of the cracks.
Background
In the traditional computer digital image processing, a mode of manually editing each image is adopted, and if the images are not subjected to smoothing processing or are not processed to a sufficient degree, more interference noise is easily generated. Such noise may be generated by the input device or throughout the image processing. Therefore, the defects of low instantaneity, poor noise resistance, insensitive image edge detection and the like exist in the digital image processing process, so that the error of an analysis result is overlarge, and the statistical accuracy is low.
Disclosure of Invention
The technical problem to be solved by the embodiment of the invention is to provide a method for sorting grids and calculating the number of cracks and the corresponding area of the cracks. The delay effect can be ignored, a large number of cracks and areas thereof can be calculated in real time, and the influence of the cracks outside the grid is effectively reduced.
In order to solve the above technical problems, the embodiment of the present invention provides a method for sorting grids and calculating the number of cracks and the corresponding area thereof, including the following steps:
s1: a frame is extracted from the digital video to obtain an original image in BGR format (fig. 2). In this image, each pixel value is encrypted with an eight bit R, B and G value, and the pyrmeanshiftfiltfiltering method is used to remove clutter. Among these, pyrMeanShift filtering is a module that segments images by mean shift. It includes two parameters, one is distance and the other is the maximum limit of chromatic aberration. After application of this module, an image can be acquired (fig. 3).
S2: a copy of the original frame is stored and gaussian blur is applied thereto. Gaussian blur is a low pass filter that reduces high pixel values. It may smooth the grid edges so that each pixel value of the frame is close to the soil pixel value. After application of this module, an image can be obtained (fig. 4).
S3: in this step, the two images in steps S1, S2 are subtracted to obtain a subtracted image (fig. 5). The first image is smoothed by the pyrimeanshiftfiltering process to reduce clutter noise. And the other image is subjected to Gaussian blur to obtain a blurred image. Subtracting the images to obtain a grid image is beneficial to grid separation.
S4: the image obtained in the previous step is converted into a gray scale image (fig. 6). During the gray level conversion, the light intensity information is retained, the digital image is converted into gray, and the crack color is dark (i.e., the gray value is less than 50). After converting the image into gray scale, a thresholding method is used. The threshold value comprises two parameters, namely a limit value and a final value. The gray pixel value ranges from 0 to 255. If the pixel value of the gray scale is above the limit value of the threshold value, the pixel is converted to a given final value and the remainder is converted to zero. After thresholding, a black-and-white image is obtained (fig. 7).
S5: morphological operations are applied to the thresholding image (fig. 7). Due to the non-uniformity of the grid boundaries derived from the threshold image, the image may be broken at some point. To this end, a kernel is created that can be sized and shaped. The black pixel point boundary of the image can be amplified according to the size of the kernel, and the grid is connected after the boundary is corroded by morphological operation. The contours were closed after morphological operations to obtain an image (fig. 8).
S6: contours are drawn in this image (fig. 8). The contour lines are easy to form a closed curve, i.e. connect white pixels, separating black pixels. Thus, the contours may be separated by their height, width, area and location.
S7: in the ordered contours, a new image is created (fig. 9) which contains only the soil parts with a white background in the meshes. These images are converted into gray scales (fig. 10), and then an image binarization process (fig. 11) is performed. This inversion threshold may highlight the crack, since the crack is a pixel value with black.
S8: in the black-and-white image, an image is obtained by morphological operations such as closing (fig. 12). Creating a circular inner core, and firstly expanding the edge of the circular inner core and then corroding the image to maintain the size of the crack. This operation helps to connect nearby cracks without causing significant changes to the area, thereby creating a crack profile on the image.
S9: the contours in step S8 are ordered by their area and size. The profile may be calculated and the corresponding area displayed as shown in fig. 13.
The embodiment of the invention has the following beneficial effects: compared with the traditional method for manually editing each image, the method can make the binarization of the images much easier, can find CIFs of a plurality of images in a short time, thereby greatly reducing the calculation time, can blur noise and carry out edge detection, is beneficial to identifying frames corresponding to cracked soil, can be used for analyzing unmanned aerial vehicles in a large-scale monitoring video, and identifies vulnerable areas needing maintenance.
Drawings
FIG. 1 is a schematic flow chart of the present invention;
FIG. 2 is an original schematic drawing extracted from a digital video;
FIG. 3 is a schematic diagram of the application of pyrMeanShift filtration treatment
FIG. 4 is a schematic representation of a copy of a blurred image after Gaussian filter processing;
FIG. 5 is a subtraction schematic of FIGS. 3 and 4;
FIG. 6 is a schematic diagram of the further gray scale process of FIG. 5;
FIG. 7 is a thresholded black white schematic based on FIG. 6;
FIG. 8 is a schematic view of the eroded treatment based on FIG. 7;
FIG. 9 is a schematic diagram after grid segmentation;
FIG. 10 is a schematic diagram of the further gray scale process of FIG. 9;
FIG. 11 is a thresholded black white schematic based on FIG. 10;
FIG. 12 is a schematic view of closure using morphological operations;
fig. 13 is a final schematic after processing.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings, for the purpose of making the objects, technical solutions and advantages of the present invention more apparent.
The embodiment of the invention is implemented according to a Python script, and the specific steps are as follows.
Step 1: the video capture module may capture a frame in the video from the video file. The module provides a total of two outputs, one of which is a frame and the other of which indicates whether the frame is true or false (i.e., whether it is present). The frame size is then reduced by half to reduce the computation time. Three cores of different sizes and shapes are created. The first core is a square core of 4 x 4, the second core is a square core of 11 x 11, and the third core is a round core of 11 x 11. A blank image was created as a grid image background and image background noise was removed and soil texture smoothed using pyrmeanshiftfiltfiltration. pyrMeanShift filtering takes two input values, one distance and the other maximum. One pixel is fetched from the frame. A neighborhood of size distance (input value) is created. Pixel values are obtained from the neighborhood, and the difference between the neighborhood pixel BGR value and the initial pixel BGR value is compared with a maximum limit (input value). If the difference is less than the maximum limit, the BGR pixel value is changed to the average BGR value in the neighborhood. If the difference is large, the maximum limit remains unchanged.
Step 2: and (3) creating a duplicate frame, adjusting the size of the frame, wherein the standard deviation of the function used by the Gaussian filter is 75, and the matrix is 75. By applying a gaussian filter, blurred images with almost invisible edges can be created, with a lower degree of blurring in the centre of the image compared to the corner points of the pixels, and with soil pixel values.
Step 3: subtraction of the two images is accomplished using a subtraction module. And processing by a subtraction module to obtain a grid image. Wherein the grid is a pixel with white color and the soil is a pixel value with brown color. The subtraction of the grid refers to the difference between the white pixel value and the brown pixel value. Since the pixel values are almost equal, the soil pixel value becomes zero, while the white pixel remains almost white after subtraction.
Step 4: the light intensity information of the image is retained and the image is converted to gray scale using a cvtColor module. Since the grid is white, the application of the inverse threshold to the image allows the desired area to be located inside the grid, resulting in a black and white image of the grid. The threshold has two variables, a limit value (50) and a final value (255) of the threshold. When the gray pixel value is greater than or equal to 50, the pixel value is converted to a final value 255 and the remaining values are converted to zero. After thresholding, a black-and-white image can be obtained.
Step 5: and adopting corrosion morphological operation on the black-and-white image. In the image erosion process, the black pixels near the edges are expanded according to the kernel size, i.e., by connecting the black pixels near. In some areas, due to the black pixel discontinuity, the etching operation may connect nearby pixels and assist them in forming a square with black edges. In this black square, the white outline covers a portion of the soil. For the first etching operation, a square core with dimensions of 4 x 4 was used. The contours are closed after morphological operations.
Step 6 and step 7: from the images of the above steps, white soil patches can be obtained. The BoundingRect module may order the contours, i.e., set vertex values of the contour boundaries in the BoundingRect function, and separate out white patches in the contour region module by logically reasoning about these vertex values. These white patches may be used as a mask to denoise the desired portion of the image and convert the remaining portion to white. The white background mentioned above helps to distinguish the crack from other parts of the surroundings, since the pixels of the crack and the white pixels are opposite and thus easier to separate. After the image has been separated, a gray scale process is applied and then an inverse threshold is applied to maintain the threshold at 60.
Step 8 and step 9: closed morphological operations are applied. By closing is meant that the same core is expanded and then subjected to an etching operation, the purpose of closing being achieved by using a circular core of size 11 a.11. Since the crack generation is random, a circular core is used instead of a square. In this way, nearby cracks can be joined together without any significant area increase. These fracture contours are ordered according to area and size. Since some contours are caused by noise, this classification helps to eliminate noise and enable counting of the remaining contours.
The above embodiments are merely for illustrating the technical concept and features of the present invention, and are not intended to limit the scope of the present invention to those skilled in the art to understand the present invention and implement the same. All modifications made according to the spirit of the main technical proposal of the invention should be covered in the protection scope of the invention.

Claims (6)

1. A method for ordering a grid and calculating the number of cracks and their corresponding areas, comprising the steps of:
s1: extracting a frame from the digital video, smoothing the texture of the frame to reduce background noise;
s2: creating a copy frame, and creating an image with soil pixel values by using a Gaussian filter;
s3: subtracting the duplicate frames from the frames in the step S1 to remove the background, so as to obtain an image only containing grids;
s4: converting the image obtained in the previous step into a gray image, and then converting the gray image into a black-and-white image through image binarization processing;
s5: creating a kernel with settable size and shape by connecting black pixels nearby through morphological operation, amplifying the boundary of black pixels of the black-and-white image according to the size of the kernel, connecting grids after corroding the boundary through morphological operation, and closing the outline;
s6: sorting the contours according to the positions, areas and sizes of the contours;
s7: creating a new image only contained in the outline, converting the new image into gray scale, and then binarizing the new image to generate a black-and-white image;
s8: applying morphological operations to the black and white image to close the nearby white pixels, thereby generating a contour on the black and white image;
s9: the contours are ordered according to the areas and the sizes of the contours obtained in the previous step, and then counted.
2. The method for grid ordering and calculating the number of cracks and their corresponding area according to claim 1, wherein step S1 further comprises the steps of:
removing clutter noise by using a pyrMeanShift filtering module;
creating a neighborhood with a distance, acquiring a pixel value from the neighborhood, comparing the difference between the BGR value of the neighborhood pixel and the BGR value of the initial pixel with a maximum limit, changing the BGR pixel value to an average BGR value in the neighborhood if the difference is smaller than the maximum limit, and keeping the maximum limit unchanged if the difference is larger than the maximum limit.
3. The method of claim 2, wherein step S2 further comprises storing a copy of the original frame and applying gaussian blur thereto.
4. A method for sorting grids and calculating the number of cracks and their corresponding areas according to claim 3, wherein in the step S4, the light intensity information is retained in the converted gray image, the digital image is converted to gray, the crack color is dark, the image is converted to gray, the pixels are converted to a given final value if the pixel value of the gray is higher than the threshold value limit value by thresholding, and the rest is converted to zero, and the image is adjusted to black-and-white image.
5. The method for sorting grids and calculating the number of cracks and their corresponding areas according to claim 4, wherein the new image in step S7 contains only the soil parts with white background in the grids, converts them to gray scale, and performs image binarization processing.
6. The method according to claim 5, wherein in step S8, the black-and-white image is subjected to a closed morphological operation, a circular kernel is first created, and the edges of the circular kernel are inflated to erode the image to maintain the size of the crack.
CN202010707424.7A 2020-07-21 2020-07-21 Method for sorting grids and calculating number of cracks and corresponding area of cracks Active CN111951323B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010707424.7A CN111951323B (en) 2020-07-21 2020-07-21 Method for sorting grids and calculating number of cracks and corresponding area of cracks

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010707424.7A CN111951323B (en) 2020-07-21 2020-07-21 Method for sorting grids and calculating number of cracks and corresponding area of cracks

Publications (2)

Publication Number Publication Date
CN111951323A CN111951323A (en) 2020-11-17
CN111951323B true CN111951323B (en) 2023-07-18

Family

ID=73340822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010707424.7A Active CN111951323B (en) 2020-07-21 2020-07-21 Method for sorting grids and calculating number of cracks and corresponding area of cracks

Country Status (1)

Country Link
CN (1) CN111951323B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104570457A (en) * 2014-12-23 2015-04-29 上海天马微电子有限公司 Color filter substrate and display device
CN106227420A (en) * 2012-08-15 2016-12-14 阿里巴巴集团控股有限公司 The method and apparatus that when sectional drawing, screenshot box is adjacent to the border of area-of-interest
CN107290347A (en) * 2017-07-12 2017-10-24 江苏阿瑞斯智能设备有限公司 Honeycomb substrate defect automated detection method
CN108765370A (en) * 2018-04-24 2018-11-06 汕头大学 A method of crack number in the quantitative unsaturated soil based on Python
CN109146860A (en) * 2018-08-03 2019-01-04 北京工商大学 Full-automatic mechanical equipment installs leakage detection method and device
CN110717888A (en) * 2019-09-06 2020-01-21 天津大学 Automatic identification method for intravascular Optical Coherence Tomography (OCT) vessel wall inner contour

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5941674B2 (en) * 2011-12-28 2016-06-29 オリンパス株式会社 Cell contour forming apparatus and method, and cell contour forming program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227420A (en) * 2012-08-15 2016-12-14 阿里巴巴集团控股有限公司 The method and apparatus that when sectional drawing, screenshot box is adjacent to the border of area-of-interest
CN104570457A (en) * 2014-12-23 2015-04-29 上海天马微电子有限公司 Color filter substrate and display device
CN107290347A (en) * 2017-07-12 2017-10-24 江苏阿瑞斯智能设备有限公司 Honeycomb substrate defect automated detection method
CN108765370A (en) * 2018-04-24 2018-11-06 汕头大学 A method of crack number in the quantitative unsaturated soil based on Python
CN109146860A (en) * 2018-08-03 2019-01-04 北京工商大学 Full-automatic mechanical equipment installs leakage detection method and device
CN110717888A (en) * 2019-09-06 2020-01-21 天津大学 Automatic identification method for intravascular Optical Coherence Tomography (OCT) vessel wall inner contour

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Optimized block-based connected components labeling with decision trees;Grana C等;《IEEE Transactions on Image Processing》;第19卷(第6期);1596-1609 *
图像处理技术在疲劳裂纹长度测量中的应用;张军峰等;《航空工程进展》(第4期);64-68 *
基于图像处理的连铸方坯低倍缺陷裂纹和缩孔的识别与评级;张静;《中国优秀硕士学位论文全文数据库 (工程科技Ⅰ辑)》(第6期);B023-184 *
爬壁机器人焊缝跟踪过程中的焊缝检测与识别研究;王志刚等;《热加工工艺》(第1期);218-221+227 *
裂缝性油藏非结构四边形网格数值模拟研究;刘勇等;《西南石油大学学报(自然科学版)》;第40卷(第4期);105-115 *

Also Published As

Publication number Publication date
CN111951323A (en) 2020-11-17

Similar Documents

Publication Publication Date Title
CN111260616A (en) Insulator crack detection method based on Canny operator two-dimensional threshold segmentation optimization
WO2020224458A1 (en) Method for detecting corona discharge employing image processing
CN106780486B (en) Steel plate surface defect image extraction method
CN110309806B (en) Gesture recognition system and method based on video image processing
CN115063430B (en) Electric pipeline crack detection method based on image processing
CN107490582B (en) Assembly line workpiece detection system
CN110648349A (en) Weld defect segmentation method based on background subtraction and connected region algorithm
US9438769B1 (en) Preserving smooth-boundaried objects of an image
CN110268442B (en) Computer-implemented method of detecting a foreign object on a background object in an image, device for detecting a foreign object on a background object in an image, and computer program product
JP7449507B2 (en) Method of generating a mask for a camera stream, computer program product and computer readable medium
CN110930321A (en) Blue/green screen digital image matting method capable of automatically selecting target area
CN115063421A (en) Pole piece region detection method, system and device, medium and defect detection method
CN111476758A (en) Defect detection method and device for AMO L ED display screen, computer equipment and storage medium
CN115100077B (en) Image enhancement method and device
CN109949294A (en) A kind of fracture apperance figure crack defect extracting method based on OpenCV
CN113780110A (en) Method and device for detecting weak and small targets in image sequence in real time
CN114037691A (en) Carbon fiber plate crack detection method based on image processing
CN107610132B (en) Method for removing stains from ancient book document image
CN112529853A (en) Method and device for detecting damage of netting of underwater aquaculture net cage
CN114792310A (en) Mura defect detection method for edge blurring in LCD screen
CN115294149A (en) Astronomical image background extraction method and system
CN111951323B (en) Method for sorting grids and calculating number of cracks and corresponding area of cracks
CN110930358A (en) Solar panel image processing method based on self-adaptive algorithm
Khan et al. Shadow removal from digital images using multi-channel binarization and shadow matting
CN115272362A (en) Method and device for segmenting effective area of digital pathology full-field image

Legal Events

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