A terahertz image diffraction fringe recognition and positioning method and system
By using a fast regional convolutional neural network and gradient retrieval method, diffraction fringes in terahertz images are identified and accurately located, solving the problem of diffraction fringes in imaging systems and improving image quality and system applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INST OF INTELLIGENT MFG GUANGDONG ACAD OF SCI
- Filing Date
- 2022-09-19
- Publication Date
- 2026-07-31
AI Technical Summary
In terahertz imaging systems, diffraction fringes caused by gaps, obstacles, or edges of the imaging object affect image quality, and existing methods, mainly through image processing or system structure improvements, are difficult to effectively eliminate.
Faster-RCNN (Faster-RCNN) is used to identify diffraction fringe regions in terahertz images. Gradient retrieval and fuzzy c-means clustering methods are used for precise localization. Combined with distance- and gradient-direction-based clustering algorithms, the positions of diffraction fringes are accurately located.
It achieves accurate positioning of diffraction fringes, provides accurate positional information for eliminating diffraction fringes, improves the recognition quality of terahertz images, and promotes the application of terahertz imaging systems.
Smart Images

Figure CN115439457B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of terahertz wave imaging technology, specifically to a method and system for identifying and locating diffraction fringes in terahertz images. Background Technology
[0002] Terahertz waves have a wavelength range of approximately 0.03 mm to 3 mm. In terahertz imaging systems, if gaps, obstacles, or edges of similar size to the terahertz wavelength exist in the object being imaged, alternating bright and dark diffraction fringes will form in the terahertz image of the object. This causes errors between the terahertz image and the actual object, affecting the identification and application of the image. Currently, research on diffraction fringes in terahertz images mainly focuses on pulsed terahertz diffraction effects and diffraction fringe suppression methods based on the structure of terahertz imaging systems.
[0003] Studies on pulsed terahertz diffraction effects have primarily employed vector diffraction theory to analyze terahertz circular aperture diffraction phenomena, but have not investigated how to eliminate the influence of diffraction fringes. Diffraction fringe suppression methods based on the structure of terahertz imaging systems mainly study the causes of diffraction fringe formation from the structural perspective of the terahertz imaging system and use image processing methods to eliminate the diffraction fringes generated by the imaging system. However, current research on methods for eliminating terahertz image diffraction fringes is limited to the formation mechanism of diffraction fringes and methods based on simple image processing. Summary of the Invention
[0004] In view of this, this invention addresses the problem of diffraction fringes generated when terahertz waves encounter imaging objects, proposing a method and system for identifying and locating diffraction fringes in terahertz images. First, diffraction fringes in terahertz images are identified using a fast-region-based convolutional neural network (Faster-RCNN). Then, the identified image regions containing diffraction fringes are precisely located using gradient retrieval, providing accurate targets for eliminating diffraction fringes.
[0005] The present invention solves the above problems through the following technical means:
[0006] In a first aspect, the present invention provides a method for identifying and locating diffraction fringes in terahertz images, comprising the following steps:
[0007] Step 1: Based on the terahertz wavelength and diffraction theorem in the terahertz imaging system, artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations, and curves of different curvatures. Artificially generate diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0008] Step 2: Train the Fast Region Convolutional Neural Network (FRNN) using the training dataset y, and then use the trained FNN to identify diffraction fringes in the terahertz image, locating N image regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N;
[0009] Step 3: Calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0010] Step 4: Initialize set S to be an empty set;
[0011] Step 5: Select E i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ij If there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For e ij The set of pixels at the reverse edge;
[0012] Step 6: For E i Repeat step 5 for each edge pixel to form set S;
[0013] Step 7: Perform clustering on all edge pixels in set S based on distance and gradient direction to obtain a subset of edge pixels that are close in distance and have similar gradient directions; for example, the k-th subset obtained is the set of pixels on one side of the k-th diffraction fringe, S. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0014] Preferably, the gradient direction is calculated as shown in formula (1):
[0015]
[0016] Among them G y (i,j) and G x (i,j) represents pixel e. ij The gradient values based on the Sobel operator along the y and x directions, respectively.
[0017] Preferably, in step 7, all edge pixels in set S are clustered based on distance and gradient direction, and the clustering adopts a density-based clustering algorithm with noise.
[0018] In a second aspect, the present invention provides a terahertz image diffraction fringe recognition and positioning system, comprising:
[0019] The training dataset generation module is used to artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations and curves of different curvatures, based on the terahertz wavelength and diffraction theorem in the terahertz imaging system. It also artificially generates diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0020] The diffraction fringe recognition module is used to train a fast region convolutional neural network (HRNN) on a training dataset y, and then uses the trained HRNN to recognize diffraction fringes in terahertz images, locating N image regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N;
[0021] Edge image calculation module, used to calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0022] Edge pixel retrieval module, used to select E i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ijIf there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For e ij The set of reverse edge pixels; retrieving edge image E i After identifying each edge pixel, a set S is formed;
[0023] The diffraction fringe localization module is used to cluster all edge pixels in set S based on distance and gradient direction, obtaining a subset of edge pixels that are close in distance and have similar gradient directions; for example, the k-th subset obtained is the single-sided pixel set S of the k-th diffraction fringe. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0024] Preferably, the gradient direction is calculated as shown in formula (1):
[0025]
[0026] Among them G y (i,j) and G x (i,j) represents pixel e. ij The gradient values based on the Sobel operator along the y and x directions, respectively.
[0027] Preferably, all edge pixels in set S are clustered based on distance and gradient direction, and the clustering uses a density-based clustering algorithm with noise.
[0028] Thirdly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the terahertz image diffraction fringe recognition and positioning method as described in the first aspect of the present invention.
[0029] Fourthly, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the terahertz image diffraction fringe recognition and positioning method as described in the first aspect of the present invention.
[0030] Compared with the prior art, the beneficial effects of the present invention include at least the following:
[0031] This invention only requires the identification and localization of diffraction fringes in terahertz images generated by a terahertz imaging system. Compared to current diffraction fringe elimination methods, it does not require model analysis of the terahertz imaging system, and is more flexible and universal. After the calculation of the diffraction fringe identification and localization method of this invention, the position of diffraction fringes can be accurately located, providing accurate positional information for diffraction fringe elimination. This provides an important method for eliminating terahertz image interference, provides high-quality images for applications such as terahertz image target recognition, and promotes the application of terahertz imaging systems. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a flowchart of the terahertz image diffraction fringe recognition and localization method of the present invention;
[0034] Figure 2 This is a schematic diagram of the terahertz image diffraction fringe recognition and system of the present invention;
[0035] Figure 3 This is a block diagram of the electronic device structure of the present invention. Detailed Implementation
[0036] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0037] Example 1
[0038] This invention consists of two main steps. First, the regions containing diffraction fringes in the terahertz image are identified to obtain multiple local images containing diffraction fringes. Then, the diffraction fringes in each local image are precisely located.
[0039] In the process of recognizing local images containing diffraction fringes, diffraction fringes with straight lines and curved edges are first artificially generated based on the terahertz wavelength and diffraction theorem in the terahertz imaging system. Diffraction fringes with rectangular and circular holes are also generated, forming a training dataset y. The training dataset y is then used to train Faster-RCNN. The trained Faster-RCNN is then used to locate regions containing diffraction fringes in the terahertz image x, identifying N regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N.
[0040] Then, fine-grained localization of diffraction fringes is performed on each local image region containing diffraction fringes. For the i-th region R containing diffraction fringes... i When performing fine positioning of diffraction fringes, R is first calculated. i The gradient plot is used to obtain R. i The gradient magnitude and direction of each pixel are determined, and fuzzy c-means clustering algorithm is used to analyze R. i Clustering is performed using the gradients to obtain R0. i Edge image E i Then, for the edge image E... i Gradient retrieval is performed on each edge pixel. The retrieval method is to select E... i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°. Here, α(i,j) is e ij The gradient direction is calculated as shown in formula (1).
[0041]
[0042] Among them G y (i,j) and G x (i,j) represents pixel e. ij The gradient values based on the Sobel operator along the y and x directions, respectively.
[0043] If there exist pixels whose gradient direction lies in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The M edge pixels retrieved are added to set S and recorded as (e ij ,F ij ),in For e ij The set of pixels representing the inverse edge. Retrieving the edge image E. i After each edge pixel, a set S is formed. For each edge pixel e in set S...ij Clustering based on distance and gradient orientation is performed using a density-based spatial clustering of applications with noise (DBSCAN) algorithm, yielding results related to e. ij The edge pixels that are close to each other and have similar gradient directions are used to obtain e. ij The set of single-sided pixels S of the k-th diffraction fringe k Meanwhile, for set S k The set of opposite edge pixels corresponding to each edge pixel in the matrix is combined to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between.
[0044] The above-mentioned process for identifying and locating diffraction fringes in terahertz images is as follows: Figure 1 As shown.
[0045] The specific steps of the terahertz image diffraction fringe recognition and localization method proposed in this invention are as follows:
[0046] Step 1: Based on the terahertz wavelength and diffraction theorem in the terahertz imaging system, artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations, and curves of different curvatures. Artificially generate diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0047] Step 2: Train Faster-RCNN using the training dataset y, and then use the trained Faster-RCNN network to identify diffraction fringes in terahertz images, locating N image regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N;
[0048] Step 3: Calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0049] Step 4: Initialize set S to be an empty set;
[0050] Step 5: Select the j-th edge pixel e in Ei ij At a distance of pixel eij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ij The gradient direction is calculated as shown in formula (1). If there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For e ij The set of pixels at the reverse edge.
[0051] Step 6: For E i Repeat step 5 for each edge pixel to form set S;
[0052] Step 7: Perform DBSCAN clustering on all edge pixels in set S based on distance and gradient direction to obtain a subset of edge pixels that are close in distance and have similar gradient directions. For example, the k-th subset obtained is the set of pixels on one side of the k-th diffraction fringe, S. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0053] Example 2
[0054] like Figure 2 As shown, the present invention provides a terahertz image diffraction fringe recognition and localization system, comprising a training dataset generation module, a diffraction fringe recognition module, an edge image calculation module, an edge pixel retrieval module, and a diffraction fringe localization module.
[0055] The training dataset generation module is used to artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations and curves of different curvatures, based on the terahertz wavelength and diffraction theorem in the terahertz imaging system. It also artificially generates diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0056] The diffraction fringe recognition module is used to train a fast region convolutional neural network (HRNNN) using a training dataset y, and then uses the trained HRNNN to recognize diffraction fringes in a terahertz image, locating N image regions containing diffraction fringes, denoted as R.i , i = 1, 2, ..., N;
[0057] The edge image calculation module is used to calculate R. i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0058] The edge pixel retrieval module is used to select E i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ij If there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For e ij The set of reverse edge pixels; retrieving edge image E i After identifying each edge pixel, a set S is formed;
[0059] The diffraction fringe localization module is used to cluster all edge pixels in set S based on distance and gradient direction, obtaining a subset of edge pixels that are close in distance and have similar gradient directions; for example, the k-th subset obtained is the single-sided pixel set S of the k-th diffraction fringe. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0060] Other features in this embodiment are the same as in Embodiment 1, so they will not be repeated here.
[0061] Example 3
[0062] Based on the same concept, the present invention also provides a schematic diagram of a physical structure, such as... Figure 3 As shown, the server may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840. The processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions stored in the memory 830 to execute the steps of the terahertz image diffraction fringe recognition and localization method. For example, these include:
[0063] Step 1: Based on the terahertz wavelength and diffraction theorem in the terahertz imaging system, artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations, and curves of different curvatures. Artificially generate diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0064] Step 2: Train Faster-RCNN using the training dataset y, and then use the trained Faster-RCNN network to identify diffraction fringes in terahertz images, locating N image regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N;
[0065] Step 3: Calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0066] Step 4: Initialize set S to be an empty set;
[0067] Step 5: Select the j-th edge pixel e in Ei ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ij The gradient direction is calculated as shown in formula (1). If there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For eij The set of pixels at the reverse edge.
[0068] Step 6: For E i Repeat step 5 for each edge pixel to form set S;
[0069] Step 7: Perform DBSCAN clustering on all edge pixels in set S based on distance and gradient direction to obtain a subset of edge pixels that are close in distance and have similar gradient directions. For example, the k-th subset obtained is the set of pixels on one side of the k-th diffraction fringe, S. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0070] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0071] Example 4
[0072] Based on the same concept, the present invention also provides a non-transitory computer-readable storage medium storing a computer program containing at least one piece of code executable by a master control device to control the master control device to implement the steps of the terahertz image diffraction fringe recognition and localization method. For example, it includes:
[0073] Step 1: Based on the terahertz wavelength and diffraction theorem in the terahertz imaging system, artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations, and curves of different curvatures. Artificially generate diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y.
[0074] Step 2: Train Faster-RCNN using the training dataset y, and then use the trained Faster-RCNN network to identify diffraction fringes in terahertz images, locating N image regions containing diffraction fringes, denoted as R. i , i = 1, 2, ..., N;
[0075] Step 3: Calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ;
[0076] Step 4: Initialize set S to be an empty set;
[0077] Step 5: Select the j-th edge pixel e in Ei ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, a search is performed along the direction α(i,j)+180°, where α(i,j) is e ij The gradient direction is calculated as shown in formula (1). If there exist edge pixels with gradient directions located in [α(i,j)+180°-α, α(i,j)+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij ,F ij ),in For e ij The set of pixels at the reverse edge.
[0078] Step 6: For E i Repeat step 5 for each edge pixel to form set S;
[0079] Step 7: Perform DBSCAN clustering on all edge pixels in set S based on distance and gradient direction to obtain a subset of edge pixels that are close in distance and have similar gradient directions. For example, the k-th subset obtained is the set of pixels on one side of the k-th diffraction fringe, S. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
[0080] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive).
[0081] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0082] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for identifying and locating diffraction fringes in terahertz images, characterized in that, Includes the following steps: Step 1: Based on the terahertz wavelength and diffraction theorem in the terahertz imaging system, artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations, and curves of different curvatures. Artificially generate diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y. Step 2: Train the Fast Region Convolutional Neural Network (FRNN) using the training dataset y, and then use the trained FNN to identify diffraction fringes in the terahertz image, locating N image regions containing diffraction fringes, denoted as R. i , i=1,2,...,N; Step 3: Calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ; Step 4: Initialize set S to be an empty set; Step 5: Select E i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, along Searching in the +180° direction, where For e ij The gradient direction, if there exists a gradient direction located at [ +180°-α, The edge pixels are [+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij , F ij ), where F ij = { }, for e ij The set of pixels at the reverse edge; Step 6: For E i Repeat step 5 for each edge pixel to form set S; Step 7: Perform clustering on all edge pixels in set S based on distance and gradient direction to obtain a subset of edge pixels that are close in distance and have similar gradient directions; the k-th subset obtained is the single-sided pixel set S of the k-th diffraction fringe. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
2. The method of claim 1, wherein, The gradient direction is calculated as shown in formula (1): (1) Among them G y (i, j) and G x (i, j) represents pixel e. ij The gradient values based on the Sobel operator along the y and x directions, respectively.
3. The method of claim 1, wherein, In step 7, all edge pixels in set S are clustered based on distance and gradient direction. The clustering uses a density-based clustering algorithm with noise.
4. A terahertz image diffraction fringe identification and localization system, characterized by, include: The training dataset generation module is used to artificially generate diffraction fringe images for the edges of straight lines of different sizes and inclinations and curves of different curvatures, based on the terahertz wavelength and diffraction theorem in the terahertz imaging system. It also artificially generates diffraction fringe images for rectangular and circular holes of different sizes. The generated diffraction fringe images are used as the training dataset y. The diffraction fringe recognition module is used to train a fast region convolutional neural network (HRNN) on a training dataset y, and then uses the trained HRNN to recognize diffraction fringes in terahertz images, locating N image regions containing diffraction fringes, denoted as R. i , i=1,2,...,N; Edge image calculation module, used to calculate R i The gradient plot based on the Sobel operator is used to obtain R. i The gradient magnitude and direction of each pixel are then analyzed using the fuzzy c-means clustering method on R. i The gradient magnitudes of each pixel are clustered into two classes (edges and background) to obtain R. i Edge image E i ; Edge pixel retrieval module, used to select E i The j-th edge pixel e ij At a distance of pixel e ij Among the neighboring pixels whose distance is less than d, along Searching in the +180° direction, where For e ij The gradient direction, if there exists a gradient direction located at [ +180°-α, The edge pixels are [+180°+α], and e ij If it is not in set S, then e ij The retrieved M edge pixels are added to set S and recorded as (e ij , F ij ), where F ij = { }, for e ij The set of reverse edge pixels; retrieving edge image E i After identifying each edge pixel, a set S is formed; The diffraction fringe localization module is used to cluster all edge pixels in set S based on distance and gradient direction, obtaining a subset of edge pixels that are close in distance and have similar gradient directions; the k-th subset obtained is the single-sided pixel set S of the k-th diffraction fringe. k Meanwhile, for set S k The union of the sets of inverse pixels corresponding to each edge pixel in the matrix is taken to obtain S. k Inverse stripe pixel set The region where the kth diffraction fringe is located is S. k and The area between them is used to accurately locate the diffraction fringe region.
5. The terahertz image diffraction fringe recognition and positioning system according to claim 4, characterized in that, The gradient direction is calculated as shown in formula (1): (1) Among them G y (i, j) and G x (i, j) represents pixel e. ij The gradient values based on the Sobel operator along the y and x directions, respectively.
6. The terahertz image diffraction fringe identification and localization system of claim 4, wherein, Clustering is performed on all edge pixels in set S based on distance and gradient direction. The clustering uses a density-based clustering algorithm with noise.
7. An electronic device, comprising: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the terahertz image diffraction fringe recognition and localization method as described in any one of claims 1-3.
8. A non-transitory computer-readable storage medium, comprising: It stores a computer program that, when executed by a processor, implements the steps of the terahertz image diffraction fringe recognition and positioning method as described in any one of claims 1-3.