Edge image detection method, device and equipment in linear array image sensor
By performing noise reduction processing and first-order derivative calculation in the online array image sensor, the edge position is accurately determined, which solves the problem of low edge image detection and recognition accuracy in the prior art, and achieves higher accuracy.
Patent Information
- Application Number
- CN202410843787.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-06-27
AI Technical Summary
In the prior art, the recognition accuracy of edge image detection in line array image sensors is low.
By acquiring the original image captured by the linear array image sensor, performing noise reduction processing, determining the pixel value, traversing the pixel value to determine the highest and lowest values, determining the edge position based on the relationship between these values and the fluctuation threshold, constructing a pixel set, eliminating the false edges, and calculating the first derivative to accurately determine the edge position.
It effectively improves the accuracy of edge position recognition, and ensures that the final determined edge position is higher by estimating and removing false edges.
Smart Images

Figure CN118674742B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of edge position detection, and in particular to an edge image detection method, device and equipment in a linear array image sensor. Background Art
[0002] At present, edge detection image sensors that use parallel lasers as light sources recognize the position of the edge of an object. The edge pixel position of the object is identified through an algorithm, and then the position of the edge is determined based on the position of the camera.
[0003] However, the recognition accuracy of this type of edge detection is relatively low. Summary of the invention
[0004] The present invention provides a method, a device and equipment for detecting edge images in a linear array image sensor, so as to solve the defect of low edge image detection and recognition accuracy in the linear array image sensor in the prior art.
[0005] In a first aspect, the present invention provides an edge image detection method in a linear array image sensor, comprising:
[0006] Acquire the original image collected by the linear array image sensor;
[0007] Performing noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determining the pixel value of each pixel in the noise-reduced image;
[0008] Traversing the pixel values of each pixel point in the denoised image to determine the highest value and the lowest value;
[0009] Based on the relationship between the highest value, the lowest value and the fluctuation threshold, determining all edge positions in the denoised image;
[0010] Construct a pixel set by taking the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple;
[0011] Based on the arrangement relationship of pixels in the pixel set, false edges in the pixel set are eliminated to obtain an edge pixel set;
[0012] The first-order derivative of each pixel in the edge pixel set is obtained, and the position where the maximum value of the first-order derivative is located is determined as the edge position.
[0013] According to a method for edge image detection in a linear array image sensor provided by the present invention, determining all edge positions in the denoised image based on the relationship between the highest value, the lowest value and the fluctuation threshold comprises:
[0014] Respectively determining the pixel mean within the maximum value preset range and the pixel mean within the minimum value preset range to obtain the maximum pixel mean and the minimum pixel mean;
[0015] If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is greater than the fluctuation threshold, all edge positions in the denoised image are determined.
[0016] According to the present invention, a method for detecting edge images in a linear array image sensor further includes:
[0017] If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is less than or equal to the fluctuation threshold, a position without an edge in the denoised image is determined.
[0018] According to a method for edge image detection in a linear array image sensor provided by the present invention, before respectively determining the pixel mean within the maximum value preset range and the pixel mean within the minimum value preset range and obtaining the maximum pixel mean and the minimum pixel mean, the method further includes:
[0019] Determining the total number of pixels of the original image;
[0020] Determine a first pixel position corresponding to the highest value and a second pixel position corresponding to the lowest value;
[0021] Based on the relationship between the first pixel position, the second pixel position and the total number of pixels, a maximum value preset range and a minimum value preset range are determined.
[0022] According to a method for edge image detection in a linear array image sensor provided by the present invention, based on the arrangement relationship of pixels in a pixel set, false edges in the pixel set are eliminated to obtain an edge pixel set, including:
[0023] Arrange the pixels in the pixel set according to the pixel position sequence number, and if the number of consecutive pixels after arrangement is less than a preset number, determine it as a false edge;
[0024] In the pixel set, the false edge is removed to obtain an edge pixel set.
[0025] According to a method for edge image detection in a linear array image sensor provided by the present invention, the step of determining the pixel value of each pixel point in the noise reduction image comprises:
[0026] P Bi =(P i-(K-1) / 2 +P i-(K-1) / 2+1 +P i-(K-1) / 2+2 …P i-(K-1) / 2+K-1 ) / K;
[0027] Among them, P Birepresents the pixel value of pixel i in the denoised image, and K represents the filter width.
[0028] According to a method for edge image detection in a linear array image sensor provided by the present invention, before constructing the pixel set, the method further includes:
[0029] Based on a preset formula, determining the original image grayscale value mean of the original image;
[0030] The preset formula is:
[0031] M=(P1+P2+P3…P N ) / N;
[0032] Among them, M represents the mean gray value of the original image, P i Represents the grayscale value of pixel i, i=1 / 2…N, N represents the total number of pixels.
[0033] According to a method for edge image detection in a linear array image sensor provided by the present invention, obtaining the first-order derivative of each pixel in the edge pixel set includes:
[0034] P ci =P Bi- P B(i-1) ;
[0035] Among them, P ci represents the first-order derivative of the i-th pixel, P Bi Represents the pixel value of pixel i in the denoised image, P B(i-1) Represents the pixel value of pixel (i-1) in the denoised image.
[0036] In a second aspect, the present invention further provides an edge image detection device in a linear array image sensor, comprising:
[0037] An acquisition module, used for acquiring the original image collected by the linear array image sensor;
[0038] A determination module is used to perform noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determine the pixel value of each pixel in the noise-reduced image; traverse the pixel values of each pixel in the noise-reduced image to determine the highest value and the lowest value;
[0039] An estimation module, configured to determine all edge positions in the denoised image based on a relationship between the highest value, the lowest value and a fluctuation threshold;
[0040] A screening module is used to construct a pixel set by taking the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple; based on the arrangement relationship of the pixels in the pixel set, remove the false edges in the pixel set to obtain an edge pixel set; calculate the first-order derivative of each pixel in the edge pixel set, and determine the position where the maximum value of the first-order derivative is located as the edge position.
[0041] In a third aspect, the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an edge image detection method in a linear array image sensor as described above is implemented.
[0042] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for edge image detection in a linear array image sensor.
[0043] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the edge image detection method in the linear array image sensor as described in any one of the above-mentioned methods is implemented.
[0044] The edge image detection method, device and equipment in a linear array image sensor provided by the present invention include obtaining an original image collected by a linear array image sensor; performing noise reduction processing on pixel points in the original image to obtain a noise reduction image, and determining the pixel value of each pixel point in the noise reduction image; traversing the pixel values of each pixel point in the noise reduction image to determine the highest value and the lowest value; determining all edge positions in the noise reduction image based on the relationship between the highest value, the lowest value and the fluctuation threshold; constructing a pixel set for the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the gray value mean of the original image is less than or equal to a preset multiple; based on the arrangement relationship of pixels in the pixel set, eliminating false edges in the pixel set to obtain an edge pixel set; obtaining the first-order derivative of each pixel in the edge pixel set, and determining the position where the maximum value of the first-order derivative is located as the edge position. Since all edge positions are first estimated by pixel values and then the edge positions are accurately determined by first-order derivatives, the accuracy of edge position recognition is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 is a schematic flow chart of an edge image detection method in a linear array image sensor provided by an embodiment of the present invention;
[0047] Figure 2 is a schematic structural diagram of an edge image detection device in a linear array image sensor provided by an embodiment of the present invention;
[0048] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] Combine the following Figure 1-Figure 3 The invention describes a method, device and equipment for edge image detection in a linear array image sensor.
[0051] Figure 1 It is a schematic flow chart of an edge image detection method in a linear array image sensor provided by an embodiment of the present invention.
[0052] like Figure 1 As shown, the edge image detection method in the linear array image sensor provided by the embodiment of the present invention mainly includes the following steps:
[0053] 101. Obtain an original image captured by a linear array image sensor.
[0054] In a specific implementation process, the linear array image sensor is first set at the target position to ensure that the light and angle are appropriate, and then the image is captured by the linear array image sensor to obtain the original image. The image capture parameters such as light source, angle and distance can be adjusted according to the requirements for the original image.
[0055] 102. Perform noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determine the pixel value of each pixel in the noise-reduced image.
[0056] After obtaining the original image, the original image is processed to identify the edge position in the original image. First, the pixels in the original image are filtered and denoised, and the image composed of the pixels after the denoising process is used as the denoised image. Then, the pixel value of each pixel in the denoised image is determined by the pixel value of each pixel and the filter width.
[0057] Determine the pixel value of each pixel in the denoised image, as shown in formula (1):
[0058] P Bi =(P i-(K-1) / 2 +P i-(K-1) / 2+1 +P i-(K-1) / 2+2 …P i-(K-1) / 2+K-1 ) / K(1)
[0059] Among them, P Bi represents the pixel value of pixel i in the denoised image, and K represents the filter width.
[0060] 103. Traverse the pixel values of each pixel in the denoised image to determine the highest value and the lowest value.
[0061] After obtaining the pixel value of each pixel in the denoised image, all the pixels are traversed to determine the highest pixel value and the lowest pixel value among all the pixels.
[0062] 104. Based on the relationship between the highest value, the lowest value and the fluctuation threshold, determine all edge positions in the denoised image.
[0063] The highest value is the maximum value of the pixel in the denoised image, and the lowest value is the minimum value of the pixel in the denoised image. If the difference between the two is too large, it means that there is an edge in the denoised image. The fluctuation threshold is used to determine the difference between the highest value and the lowest value, and the fluctuation threshold can be determined based on historical statistical data.
[0064] When the existence of an edge position can be determined between the highest value, the lowest value and the fluctuation threshold, it is necessary to traverse all pixel values again and determine all edge positions by comparing the relationship between all pixel values and the lowest value, so that all suspected edge positions can be fully and accurately identified.
[0065] 105. Construct a pixel set by taking the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple.
[0066] After all edge positions are obtained through preliminary estimation, all edge positions need to be judged again. Therefore, the pixel value of each pixel in all edge positions is first determined, and then the grayscale value of the original image is determined, and the difference between the two is calculated. The absolute value of the difference is calculated. When the absolute value is less than or equal to 0.5 times the fluctuation threshold, it is determined that the current pixel point is within the pixel area covered by the edge, and then all the pixels within the edge covered pixels are constructed to obtain a pixel set. That is, the pixel points that satisfy formula (2) constitute a pixel set.
[0067] |PBi -M|<=T(2)
[0068] Among them, P Bi represents the pixel value of pixel point i at the edge position, M represents the mean grayscale value of the original image, and M is calculated as shown in formula (3):
[0069] M=(P1+P2+P3…P N ) / N(3)
[0070] Among them, M represents the mean gray value of the original image, P i Represents the grayscale value of pixel i, i=1 / 2…N, N represents the total number of pixels.
[0071] 106. Based on the arrangement relationship of pixels in the pixel set, remove the false edges in the pixel set to obtain an edge pixel set.
[0072] After obtaining the pixel set, check the size and position of each pixel in the pixel set, and then arrange the pixels in the pixel set according to the pixel position sequence number. If the number of consecutive pixels after arrangement is less than a preset number (for example, 5), it is determined to be a false edge; in the pixel set, remove the false edges to obtain an edge pixel set.
[0073] By effectively eliminating false edges in a pixel set, the accuracy of the edge position finally determined can be guaranteed to be higher.
[0074] 107. Obtain the first-order derivative of each pixel in the edge pixel set, and determine the position where the maximum value of the first-order derivative is located as the edge position.
[0075] After obtaining the edge pixel set, the first-order derivative of each pixel in the edge pixel set is calculated, as shown in formula (4):
[0076] P ci =P Bi- P B(i-1) (4)
[0077] Among them, P ci represents the first-order derivative of the i-th pixel, P Bi Represents the pixel value of pixel i in the denoised image, P B(i-1) Represents the pixel value of pixel (i-1) in the denoised image.
[0078] After obtaining the first-order derivative, the maximum first-order derivative of all pixels in the edge pixel set is determined. When the maximum first-order derivative is a unique value, the position of the pixel corresponding to the maximum first-order derivative is determined to be the edge position. Thus, the edge position can be accurately identified in the edge pixel set.
[0079] In this embodiment, all edge positions are first estimated by pixel values, and then false edge positions are eliminated from all edge positions. Finally, the edge position is accurately determined by first-order derivative, which effectively improves the accuracy of edge position recognition.
[0080] Further, based on the above embodiment, the present embodiment determines all edge positions in the denoised image based on the relationship between the highest value, the lowest value and the fluctuation threshold, including: determining the pixel mean within the preset range of the highest value and the pixel mean within the preset range of the lowest value, respectively, to obtain the highest pixel mean and the lowest pixel mean; if the absolute value of the difference between the highest pixel mean and the lowest pixel mean is greater than the fluctuation threshold, all edge positions in the denoised image are determined. If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is less than or equal to the fluctuation threshold, it is determined that there is no edge position in the denoised image.
[0081] Specifically, first determine the total number of pixels of the original image, then determine the first pixel position corresponding to the highest value and the second pixel position corresponding to the lowest value; based on the relationship between the first pixel position, the second pixel position and the total number of pixels, determine the maximum value preset range and the minimum value preset range, determine the rationality of the maximum value preset range and the minimum value preset range, and ensure that the calculated mean can better reflect the regional pixels.
[0082] After the preset range is determined, whether there is an edge position is determined by formula (5), as follows:
[0083] |P Mmax -P Mmin |<=Y(5)
[0084] Among them, P Mmax Indicates the average pixel value within the preset range of the highest value, P Mmin It represents the average pixel value within the preset range of the lowest value, and Y represents the fluctuation threshold.
[0085] When the above (5) is satisfied, the position without edge is determined, otherwise the position with edge is determined. After the position with edge is determined, it is necessary to calculate the absolute value of the difference between the pixel value of each pixel and the lowest pixel mean to calculate all edge positions.
[0086] By means of pixel values, all suspected edge positions can be completely screened, ensuring the accuracy of the final edge position determination.
[0087] Based on the same general inventive concept, the present invention also protects an edge image detection device in a linear array image sensor. The edge image detection device in the linear array image sensor provided by the present invention is described below. The edge image detection device in the linear array image sensor described below and the edge image detection method in the linear array image sensor described above can be referenced to each other.
[0088] Figure 2 It is a schematic structural diagram of an edge image detection device in a linear array image sensor provided by an embodiment of the present invention.
[0089] like Figure 2 As shown, this embodiment provides an edge image detection device in a linear array image sensor, comprising:
[0090] An acquisition module 201 is used to acquire an original image captured by a linear array image sensor;
[0091] The determination module 202 is used to perform noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determine the pixel value of each pixel in the noise-reduced image; traverse the pixel values of each pixel in the noise-reduced image to determine the highest value and the lowest value;
[0092] An estimation module 203 is used to determine all edge positions in the denoised image based on the relationship between the highest value, the lowest value and the fluctuation threshold;
[0093] The screening module 204 is used to construct a pixel set for the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple; based on the arrangement relationship of the pixels in the pixel set, the false edges in the pixel set are eliminated to obtain an edge pixel set; the first-order derivative of each pixel in the edge pixel set is calculated, and the position where the maximum value of the first-order derivative is located is determined as the edge position.
[0094] Furthermore, the estimation module 203 in this embodiment is specifically used for:
[0095] Respectively determining the pixel mean within the maximum value preset range and the pixel mean within the minimum value preset range to obtain the maximum pixel mean and the minimum pixel mean;
[0096] If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is greater than the fluctuation threshold, all edge positions in the denoised image are determined.
[0097] Furthermore, the estimation module 203 in this embodiment is also specifically used for:
[0098] If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is less than or equal to the fluctuation threshold, then a position without an edge in the denoised image is determined.
[0099] Furthermore, the estimation module 203 in this embodiment is also specifically used for:
[0100] Determining the total number of pixels of the original image;
[0101] Determine a first pixel position corresponding to the highest value and a second pixel position corresponding to the lowest value;
[0102] Based on the relationship between the first pixel position, the second pixel position and the total number of pixels, a maximum value preset range and a minimum value preset range are determined.
[0103] Furthermore, the screening module 204 in this embodiment is specifically used for:
[0104] Arrange the pixels in the pixel set according to the pixel position sequence number, and if the number of consecutive pixels after arrangement is less than a preset number, determine it as a false edge;
[0105] In the pixel set, the false edge is removed to obtain an edge pixel set.
[0106] Furthermore, the determination module 202 in this embodiment is specifically used for:
[0107] P Bi =(P i-(K-1) / 2 +P i-(K-1) / 2+1 +P i-(K-1) / 2+2 …P i-(K-1) / 2+K-1 ) / K
[0108] Among them, P Bi represents the pixel value of pixel i in the denoised image, and K represents the filter width.
[0109] Furthermore, in this embodiment, the determination module 202 is further configured to:
[0110] Based on a preset formula, determining the original image grayscale value mean of the original image;
[0111] The preset formula is:
[0112] M=(P1+P2+P3…P N ) / N
[0113] Among them, M represents the mean gray value of the original image, P i Represents the grayscale value of pixel i, i=1 / 2…N, N represents the total number of pixels.
[0114] Furthermore, the obtaining of the first-order derivative of each pixel in the edge pixel set in the screening module 204 in this embodiment is specifically used for:
[0115] Pci =P Bi- P B(i-1)
[0116] Among them, P ci represents the first-order derivative of the i-th pixel, P Bi Represents the pixel value of pixel i in the denoised image, P B(i-1) Represents the pixel value of pixel (i-1) in the denoised image.
[0117] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0118] like Figure 3 As shown, the electronic device may include: a processor (processor) 310, a communication interface (Communications Interface) 320, a memory (memory) 330 and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 can call the logic instructions in the memory 330 to execute the edge image detection method in the linear array image sensor, which includes: obtaining the original image collected by the linear array image sensor; performing noise reduction processing on the pixels in the original image to obtain a noise reduction image, and determining the pixel value of each pixel in the noise reduction image; traversing the pixel values of each pixel in the noise reduction image to determine the highest value and the lowest value; based on the relationship between the highest value, the lowest value and the fluctuation threshold, determining all edge positions in the noise reduction image; constructing a pixel set for the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple; based on the arrangement relationship of the pixels in the pixel set, eliminating the false edges in the pixel set to obtain an edge pixel set; calculating the first-order derivative of each pixel in the edge pixel set, and determining the position where the maximum value of the first-order derivative is located as the edge position.
[0119] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the 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 a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0120] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the edge image detection method in the linear array image sensor provided by the above methods, the method including: acquiring an original image captured by the linear array image sensor; performing denoising processing on the pixels in the original image to obtain a denoised image, and determining the pixel value of each pixel in the denoised image; traversing the pixel values of each pixel in the denoised image to determine the highest value and the lowest value; based on the relationship between the highest value, the lowest value and the fluctuation threshold, determining all edge positions in the denoised image; constructing a pixel set for the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel in all edge positions and the mean grayscale value of the original image is less than or equal to a preset multiple; based on the arrangement relationship of the pixels in the pixel set, eliminating the false edges in the pixel set to obtain an edge pixel set; obtaining the first-order derivative of each pixel in the edge pixel set, and determining the position where the maximum value of the first-order derivative is located as the edge position.
[0121] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the edge image detection method in the linear array image sensor provided by the above-mentioned methods, the method comprising: acquiring an original image captured by the linear array image sensor; performing denoising processing on the pixels in the original image to obtain a denoised image, and determining the pixel value of each pixel in the denoised image; traversing the pixel values of each pixel in the denoised image to determine the highest value and the lowest value; determining all edge positions in the denoised image based on the relationship between the highest value, the lowest value and the fluctuation threshold; constructing a pixel set from the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel in all edge positions and the mean grayscale value of the original image is less than or equal to a preset multiple; based on the arrangement relationship of the pixels in the pixel set, eliminating the false edges in the pixel set to obtain an edge pixel set; obtaining the first-order derivative of each pixel in the edge pixel set, and determining the position where the maximum value of the first-order derivative is located as the edge position.
[0122] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for edge image detection in a linear array image sensor, characterized in that: include: Acquire the original image collected by the linear array image sensor; Performing noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determining the pixel value of each pixel in the noise-reduced image; Traversing the pixel values of each pixel point in the denoised image to determine the highest value and the lowest value; Based on the relationship between the highest value, the lowest value and the fluctuation threshold, all edge positions in the denoised image are determined, including: determining the total number of pixels in the original image; determining a first pixel position corresponding to the highest value and a second pixel position corresponding to the lowest value; determining a highest value preset range and a lowest value preset range based on the relationship between the first pixel position, the second pixel position and the total number of pixels; respectively determining the pixel mean within the highest value preset range and the pixel mean within the lowest value preset range to obtain a highest pixel mean and a lowest pixel mean; if the absolute value of the difference between the highest pixel mean and the lowest pixel mean is greater than the fluctuation threshold, all edge positions in the denoised image are determined; if the absolute value of the difference between the highest pixel mean and the lowest pixel mean is less than or equal to the fluctuation threshold, determining that there is no edge position in the denoised image; Construct a pixel set by taking the pixel points corresponding to the fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple; Based on the arrangement relationship of pixels in the pixel set, false edges in the pixel set are eliminated to obtain an edge pixel set; The first-order derivative of each pixel in the edge pixel set is obtained, and the position where the maximum value of the first-order derivative is located is determined as the edge position.
2. The edge image detection method in a linear array image sensor according to claim 1, characterized in that: The removing of false edges in the pixel set based on the arrangement relationship of pixels in the pixel set to obtain an edge pixel set includes: Arrange the pixels in the pixel set according to the pixel position sequence number, and if the number of consecutive pixels after arrangement is less than a preset number, determine it as a false edge; In the pixel set, the false edge is removed to obtain an edge pixel set.
3. The edge image detection method in a linear array image sensor according to claim 1 or 2, characterized in that: Before constructing the pixel set, the method further includes: Based on a preset formula, determining the original image grayscale value mean of the original image; The preset formula is: M=(P1+P2+P3…P N ) / N; Among them, M represents the mean gray value of the original image, P i Represents the grayscale value of pixel i, i=1 / 2…N, N represents the total number of pixels.
4. The edge image detection method in a linear array image sensor according to claim 1 or 2, characterized in that: The obtaining of the first-order derivative of each pixel in the edge pixel set comprises: P ci =P Bi- P B(i-1) ; Among them, P ci represents the first-order derivative of the i-th pixel, P Bi Represents the pixel value of pixel i in the denoised image, P B(i-1) Represents the pixel value of pixel (i-1) in the denoised image.
5. An edge image detection device in a linear array image sensor, characterized in that: include: An acquisition module, used for acquiring the original image collected by the linear array image sensor; A determination module, configured to perform noise reduction processing on the pixels in the original image to obtain a noise-reduced image, and determine the pixel value of each pixel in the noise-reduced image; Traversing the pixel values of each pixel point in the denoised image to determine the highest value and the lowest value; An estimation module, used to determine all edge positions in the denoised image based on the relationship between the highest value, the lowest value and the fluctuation threshold; specifically used to: determine the total number of pixels in the original image; Determine a first pixel position corresponding to the highest value and a second pixel position corresponding to the lowest value; determine a highest value preset range and a lowest value preset range based on a relationship among the first pixel position, the second pixel position and the total number of pixels; respectively determine a pixel mean within the highest value preset range and a pixel mean within the lowest value preset range to obtain a highest pixel mean and a lowest pixel mean; If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is greater than the fluctuation threshold, determining all edge positions in the denoised image; If the absolute value of the difference between the highest pixel mean and the lowest pixel mean is less than or equal to the fluctuation threshold, determining a position without an edge in the denoised image; A screening module, for constructing a pixel set by selecting pixel points corresponding to a fluctuation threshold whose absolute value of the difference between the pixel value of each pixel point in all edge positions and the mean gray value of the original image is less than or equal to a preset multiple; Based on the arrangement relationship of pixels in a pixel set, false edges in the pixel set are eliminated to obtain an edge pixel set; the first-order derivative of each pixel in the edge pixel set is calculated, and the position where the maximum value of the first-order derivative is located is determined as the edge position.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the edge image detection method in the linear array image sensor according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Edge point extraction method, computer equipment and storage medium
CN113836479A
Image edge detection method and device, equipment and storage medium
CN115861354A