WO2021174506A1 - Image edge detection method and apparatus, and image signal processor - Google Patents

Image edge detection method and apparatus, and image signal processor Download PDF

Info

Publication number
WO2021174506A1
WO2021174506A1 PCT/CN2020/078066 CN2020078066W WO2021174506A1 WO 2021174506 A1 WO2021174506 A1 WO 2021174506A1 CN 2020078066 W CN2020078066 W CN 2020078066W WO 2021174506 A1 WO2021174506 A1 WO 2021174506A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
identifier
edge
target image
image
Prior art date
Application number
PCT/CN2020/078066
Other languages
French (fr)
Chinese (zh)
Inventor
赵文扬
高明明
张�林
任靖晔
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/078066 priority Critical patent/WO2021174506A1/en
Publication of WO2021174506A1 publication Critical patent/WO2021174506A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Definitions

  • This application relates to the field of image processing, and in particular to an image edge detection method, device, and image signal processor.
  • Edge refers to a collection of pixels with sharp changes in the gray levels of surrounding pixels in an image, and is the most basic feature of an image. Edge detection plays an important role in many computer vision tasks, and can be widely used in areas such as feature extraction, image recognition, image segmentation, image matching, and image classification. The quality of image edge detection determines the effect of subsequent image processing to a large extent. A good edge detection method can provide better guarantee for subsequent image processing.
  • one of the objectives of the embodiments of the present application is to provide an image edge detection method, device, and image signal processor.
  • an image edge detection method including:
  • each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
  • the edge image of the target image is determined.
  • an image edge detection device including an image rotation module and a scanning module
  • the image rotation module is used to rotate the target image by a specified angle; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
  • the scanning module is configured to scan pixels in the rotated target image along a designated scanning direction, and determine a new edge identifier for each pixel;
  • the device is further configured to determine the edge image of the target image according to the new edge identifier of each pixel.
  • an image signal processor including the device according to any one of the second aspects, and the image signal processor is configured to process image signals collected by an image sensor.
  • Fig. 1A is a schematic diagram showing a target image according to an exemplary embodiment of the present application.
  • Fig. 1B is a schematic diagram of an edge image obtained by scanning in a related technology according to an exemplary embodiment of the present application.
  • Fig. 2 is a flowchart of a first image edge detection method according to an exemplary embodiment of the present application.
  • Fig. 3A is a flow chart showing a second method for image edge detection according to an exemplary embodiment of the present application.
  • Fig. 3B is a flowchart of a third image edge detection method according to an exemplary embodiment of the present application.
  • Fig. 4A is a schematic diagram obtained by rotating Fig. 1A clockwise by 90° according to an exemplary embodiment of the present application.
  • Fig. 4B is a schematic diagram of an edge image obtained after scanning Fig. 4A according to an exemplary embodiment of the present application.
  • Fig. 4C is a schematic diagram obtained by rotating Fig. 4B clockwise by 90° according to an exemplary embodiment of the present application.
  • Fig. 4D is a schematic diagram of an edge image obtained after scanning Fig. 4C according to an exemplary embodiment of the present application.
  • Fig. 4E is a schematic diagram obtained by rotating Fig. 4D clockwise by 90° according to an exemplary embodiment of the present application.
  • Fig. 4F is a schematic diagram of an edge image obtained after scanning Fig. 4E according to an exemplary embodiment of the present application.
  • Fig. 4G is a schematic diagram obtained by rotating Fig. 4F clockwise by 90° according to an exemplary embodiment of the present application.
  • Fig. 5 is a schematic diagram showing a pixel Q and its 3 ⁇ 3 neighboring pixels according to an exemplary embodiment of the present application.
  • Fig. 6 is a schematic diagram showing a pulsation unit according to an exemplary embodiment of the present application.
  • Fig. 7A is a schematic diagram of a single pulsation unit in cascade-connected pulsation units according to an exemplary embodiment of the present application.
  • Fig. 7B is a schematic diagram showing a cascaded pulsation unit according to an exemplary embodiment of the present application.
  • Fig. 8 is a structural diagram of an image edge detection device according to an exemplary embodiment of the present application.
  • Edge refers to a collection of pixels with sharp changes in the gray levels of surrounding pixels in an image, and is the most basic feature of an image. Edge detection plays an important role in many computer vision tasks, and can be widely used in areas such as feature extraction, image recognition, image segmentation, image matching, and image classification. The quality of image edge detection determines the effect of subsequent image processing to a large extent. A good edge detection method can provide better guarantee for subsequent image processing.
  • the canny edge detection algorithm firstly performs Gaussian smoothing on the image, and then calculates the gradient intensity and gradient direction of each pixel in the image, and preliminarily determines the edge nature of the pixel through the non-maximum value suppression step and the double threshold detection step , Divide all pixels into 3 categories, namely strong edge pixels, weak edge pixels and non-edge pixels. Finally, edge detection is completed by suppressing isolated weak edges; the so-called "suppression of isolated weak edges" means that if weak If an edge pixel is connected to a strong edge pixel, the weak edge pixel is considered to be a strong edge pixel and retained, otherwise, the weak edge pixel is considered to be a non-edge pixel and discarded.
  • the forward single scan method is usually used to extend in a single direction, and only the edge information in one direction can be traversed at a time.
  • Figure 1A In the original image of the "suppression of isolated weak edges" process, suppose that the black grid in Figure 1A represents pixels with strong edges, the gray grid represents pixels with weak edges, and the white grid represents pixels with non-edges.
  • the forward single scan method Single direction (assuming that the scanning direction is from left to right and top to bottom) to extend, first scan from the first pixel in the upper left corner of the image, first scan the first row of pixels from left to right, then scan After finishing the first row of pixels, select the second row from top to bottom, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned, because the scanning direction cannot be changed , Only the scanning result shown in Fig. 1B can be obtained, complete edge information cannot be detected, and the edge connectivity of the detection result is poor.
  • FIG. 2 is a flowchart of an image edge detection method according to an exemplary embodiment of the present application.
  • the image edge detection method of the embodiment of the present application rotates the target image, so that the target image can be scanned from different directions and dimensions of the target image using a forward single scan method to obtain complete edge information. , which helps to ensure the accuracy of the scan results.
  • the image edge detection method of the embodiments of the present application can be applied to electronic devices that require image processing, such as smart phones, computers, tablets, image capture devices (such as cameras), and movable devices (such as unmanned aerial vehicles, unmanned vehicles). , Unmanned boats or mobile robots), etc.
  • the method includes:
  • step S101 a target image is acquired; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel.
  • step S102 after the target image is rotated by a specified angle, the pixels in the rotated target image are scanned along the specified scanning direction to determine a new edge identifier for each pixel.
  • step S103 the edge image of the target image is determined according to the new edge identifier of each pixel.
  • the initial edge identifier of the pixel may be determined in the following manner: Use a Gaussian filter to process the target image to filter out noise in the target image, and obtain a processed target image , And then calculate the gradient value and gradient direction of each pixel in the processed target image, and finally determine the initial edge identifier of the pixel based on the gradient direction and gradient value of the pixel, and the initial edge identifier Used to describe the edge information contained in the pixel.
  • the edge information contained in the pixel can be represented by the gradient value of the pixel, according to the order of the strength of the edge information contained in each pixel in the target image from strong to weak (gradient value from In order of large to small), the edge identifiers are sequentially divided into a first identifier, a second identifier, and a third identifier. It should be noted that the first identifier, the second identifier, and the third identifier are mutually exclusive. Are not the same. In an example, the first identifier indicates that the pixel is a strong edge pixel, the second identifier indicates that the pixel is a weak edge pixel, and the third identifier indicates that the pixel is a non-edge pixel.
  • the target image is rotated by a specified angle along a specified rotation direction, and then pixels in the rotated target image are scanned along the specified scanning direction to determine a new information about each pixel.
  • the edge identification, and finally the edge image of the target image can be determined according to the new edge identification of each pixel; in this embodiment, the target image is rotated and then scanned to achieve different directions and dimensions. The scanning process ensures that complete and accurate edge information of the target image is obtained.
  • the specified scanning direction includes, but is not limited to, a top-down direction, a bottom-up direction, a left-to-right direction or a right-to-left direction, or at least two of the above directions.
  • the target image is rotated by a specified angle along a specified rotation direction, and then each pixel in the rotated target image is detected along the specified scanning direction.
  • the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel (according to the designated scanning direction, if the neighboring pixel corresponding to the pixel is in the pixel It has been scanned before, the current edge identifier of the neighboring pixel is the new edge identifier, if the neighboring pixel corresponding to the pixel has not been scanned before the pixel, the current edge identifier of the neighboring pixel Is the initial edge identification) that meets the second specified condition, then the edge identification of the pixel is changed to obtain the new edge identification of the pixel; wherein, the first specified condition includes the initial edge of the pixel The identifier is the second identifier, and the second designated condition includes that the current edge identifier of any neighboring pixel
  • the neighboring pixels of the pixel include all pixels in the 3 ⁇ 3 neighborhood of the pixel.
  • the scanning operation performed on the entire target image is a forward single scan.
  • the scanning direction is left-to-right and top-down scanning.
  • Figure 1A First scan from the first pixel in the upper left corner of the image, and scan the first row of pixels from left to right. After scanning the first row of pixels, select the second row of pixels from top to bottom, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned, it is visible, positive
  • the single scan process includes multiple line scans. Taking into account the problem that the single scan direction of the forward single scan algorithm leads to incomplete edge information of the acquired target image, in this embodiment, the target image is rotated by a specified angle to realize scanning of the rotated target image from different directions and dimensions.
  • the target image is rotated at least twice.
  • the target image needs to be scanned in a forward direction at least twice. For example, after the target image is rotated by a specified angle, the entire rotated target image is scanned once from left to right and from top to bottom. If after scanning the entire rotated target image at one time, the number of pixels in the rotated target image whose initial edge identification has been changed is 0, there is no need to perform the operations of rotating the target image and scanning the target image, and the end The edge detection process of the target image obtains the edge image of the target image based on the new edge identifier of each pixel in the target image.
  • FIG. 3A provides a schematic flowchart of a second image edge detection method according to an exemplary embodiment of the present application, and the method includes:
  • step S201 a target image is acquired.
  • step S202 the target image is rotated by a specified angle along a specified rotation direction.
  • each pixel in the rotated target image is sequentially detected along a designated scanning direction, and if the initial edge identifier of the pixel is detected as the second identifier, and the pixel corresponds to The current edge identifier of any neighboring pixel is the first identifier, the initial edge identifier of the pixel is changed from the second identifier to the first identifier, and the new edge identifier of the pixel is determined.
  • step S204 it is determined whether the number of pixels of the initial edge identifier changed in the target image scan is 0; if not, skip to step S202, if yes, skip to step S205.
  • the target image after the previous rotation is rotated by the specified angle along the specified rotation direction.
  • step S205 the edge image of the target image is determined according to the new edge identifier of each pixel.
  • the target image is repeatedly rotated by the designated angle in a designated rotation direction until the target image is changed from the second identification to the first identification.
  • the number of pixels is 0.
  • the pixels in the rotated target image are scanned along the specified scanning direction to determine the new edge identifier of each pixel;
  • After scanning the second target image determine the number of pixels in the target image whose initial edge identifier has been changed, that is, the number of pixels changed from the second identifier to the first identifier.
  • step S202 and step S203 If the number is 0, it means If the edge information of the target image has been completely obtained, there is no need to repeat the operations of step S202 and step S203, but jump to step S205, and determine the target image according to the new edge identifier of each pixel. Edge image, otherwise, repeat the operations of step S202 and step S203; this embodiment ensures that after multiple rotations and scans of the target image, complete edge information of the target image can be obtained.
  • FIG. 3B provides a third image according to an exemplary embodiment of this application
  • a schematic flow chart of an edge detection method the method includes:
  • step S301 a target image is acquired.
  • step S302 the target image is rotated by a specified angle along a specified rotation direction.
  • each pixel in the rotated target image is sequentially detected along a designated scanning direction, and if the initial edge identifier of the pixel is detected as the second identifier, and the pixel corresponds to The current edge identifier of any neighboring pixel is the first identifier, the initial edge identifier of the pixel is changed from the second identifier to the first identifier, and the new edge identifier of the pixel is determined.
  • step S304 it is determined whether the target image has been rotated at least one circle from the initial position and the number of pixels of the initial edge identifier is 0 during the target image scanning; if not, skip to step S302, if yes , Jump to step S305.
  • the target image after the previous rotation is rotated by the specified angle along the specified rotation direction.
  • step S305 the edge image of the target image is determined according to the new edge identifier of each pixel.
  • the target image may be repeatedly rotated by the specified angle in a specified rotation direction, until the target image is rotated at least one circle from the initial position and the target image is changed Since the number of pixels of the first identification is 0, each time the target image is rotated by a specified angle along the specified rotation direction, the pixels in the rotated target image are scanned along the specified scanning direction to determine each pixel A new edge identifier; after each scan, determine whether the number of pixels in the target image whose initial edge identifier has been changed is 0, that is, the target image is changed from the second identifier to the first Whether the number of identified pixels is 0 and whether the target image has been rotated at least one circle (360°) from the initial position, the number of which is 0, indicating that the edge information of the target image has been completely obtained, and there is no need to repeat the steps
  • the embodiment of the present application does not impose any restrictions on the specified rotation direction and the specified angle, and can be specifically set according to actual application scenarios;
  • the specified rotation direction may be clockwise or counterclockwise, and
  • the specified angle may be any value between 0° and 360°, where the specified angle may be 90°.
  • the specified rotation direction is clockwise, the specified angle is 90°, and the specified rotation direction is from top to bottom and from left to right, and it needs to satisfy that the target image is from the initial position
  • the first rotation and scanning process Rotate the target image in Figure 1A by 90° in a clockwise direction to obtain the image shown in Figure 4A.
  • Comparing the image shown in Figure 4A from top to bottom and from left to right Scan the pixels in the image line by line one by one (first scan from the first pixel in the upper left corner of the image, first scan the first line of pixels from left to right, and then scan the first line of pixels from top to bottom Select the second row of pixels in the direction, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned), if the initial edge identifier of the pixel meets the first specified condition (the The first designated condition includes that the initial edge identifier of the pixel is the second identifier), and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second designated condition (the second designated condition includes the The current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier), the initial edge identifier of the pixel is
  • the second rotation and scanning process Rotate the target image in Figure 4B by 90° in a clockwise direction to obtain the image shown in Figure 4C. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG.
  • the third rotation and scanning process Rotate the target image in Figure 4D along a clockwise direction by 90° to obtain the image shown in Figure 4E, and compare the image shown in Figure 4E from top to bottom and from left to right. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG.
  • the fourth rotation and scanning process Rotate the target image in Figure 4F by 90° in a clockwise direction to obtain the image shown in Figure 4G, and compare the image shown in Figure 4G from top to bottom and from left to right. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG.
  • the image rotation and scanning process can be implemented by hardware.
  • the information of pixels in the rotated target image is sequentially read along the specified scanning direction, and the pixel information includes the initial edge of the pixel.
  • the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
  • the target neighborhood pixel may be an n ⁇ n neighborhood corresponding to the pixel.
  • n is an odd number.
  • the target neighborhood pixel may be one or more pixels in the 3 ⁇ 3 neighborhood of the pixel; further, in order to improve scanning efficiency, the target neighborhood pixel may be all neighbors corresponding to the pixel. The scanned part of the pixel in the domain, so that it can be quickly determined whether the pixel meets the condition based on the target neighbor pixel.
  • the number of pixels read each time can be determined according to the bit width of the data bus. The larger the bit width of the data bus, the more pixels are read each time, which is beneficial to increase the scanning speed.
  • the edge identifier is expressed in binary form, and the number of pixels read each time can be determined according to the number of bits of the edge identifier and the bit width of the data bus; at the position of the edge identifier In the case of fixed, the occupied bit width is also fixed. If the bit width of the data bus is larger, the number of pixels read each time is larger; when the bit width of the data bus is fixed, The smaller the representation position of the edge identifier, the smaller the bit width it occupies, and the greater the number of pixels read each time; in one example, the representation of the edge identifier is 2 bits, which occupies 2 bits of Bit width, the bit width of the data bus is 128 bits, and the number of pixels that can be read at a time is 64 bits.
  • the number of the pulsating units can be determined based on the number of pixels.
  • the pixels can be processed in parallel by multiple pulsating units, which is beneficial to Increase the scanning speed of the target image.
  • the pulsating units can be connected in a cascade manner, which is beneficial to increase the scanning speed.
  • the target image is used to perform a single forward scan
  • the specified scan direction is from top to bottom and from left to right
  • the target neighborhood pixel is the 3 ⁇ 3 neighborhood corresponding to the pixel.
  • the scanned part of all the neighboring pixels in the domain is taken as an example for description: read the information of the pixels in the rotated target image in the top-down and left-to-right directions, and the information of the pixels in the The information includes the initial edge identification of the pixel and the current edge identification of the target neighborhood pixel of the pixel.
  • FIG. 5 is a schematic diagram of pixel Q and all neighborhood pixels (a to h) in its 3 ⁇ 3 neighborhood.
  • the target neighborhood pixels are pixel a, pixel b, pixel c, and pixel d, and the initial edge identification of pixel Q and pixel a,
  • the current edge identifiers of the pixel b, the pixel c, and the pixel d are input into the pulsation unit, processed by the pulsation unit, and a new edge identifier of the pixel Q is output.
  • the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
  • the target neighboring pixels are all neighboring pixels in the 3 ⁇ 3 neighborhood corresponding to the pixel that have been scanned
  • the information of the pixels includes the initial edge identifier of the pixel and the current edge identifier of the target neighboring pixel of the pixel.
  • FIG. 5 is A schematic diagram of pixel Q and all neighboring pixels (a ⁇ h) in its 3 ⁇ 3 neighborhood. Since the designated scanning direction is from top to bottom and from left to right, the target neighborhood pixel is pixel a, pixel b. Pixel c and pixel d.
  • each pixel represents the edge identifier in binary form
  • 00 represents the third identifier
  • 01 represents the second identifier
  • 11 and 10 represent the first identifier
  • the 0th bit is denoted as pixel [0]
  • the first bit is denoted as pixel [ 1]
  • the edge identifier of the pixel is marked as "pixel [1] pixel [0]”
  • the edge identifier of the pixel Q in Figure 5
  • the 0th bit is marked as Q[0]
  • the first bit is marked as Q[ 1]
  • the edge identifier of pixel Q is marked as "Q[1]Q[0]”
  • the binary representation of the edge identifier of its neighboring pixels is the same, for example, the edge identifier of pixel a is marked as "a[1]a[0 ]", the edge identifier of pixel b is marked as "b[1]b[0]", the edge identifier of pixel c is marked as "c[1]c[
  • FIG. 6 is a schematic diagram of a single pulsation unit.
  • Q in [1]), Q out [0] Q in [0]" determines the pixel Q new edge identification Q out [1] Q out [0].
  • FIG. 7A is an example diagram of a single pulsation unit connected in cascade mode.
  • Figure 7B is a cascade connection of multiple pulsation units. Schematic diagram of the connection. The pulsation unit shown in FIG.
  • the input to the pulsation unit includes: a[1], b[1], c[1], d[1], Q in [1] Q in [0], where Q in [1] Q in [0] represents the initial pixel identifier of the pixel Q, processed by the pulsating unit, and outputting the new edge identifier of the pixel Q from the pulsating unit Q out [1] Q out [0] and the carry output pixel Q Q out [1], the Q out [1] is used as identification information of the edge pixel in a neighborhood of pixels.
  • the first detected pixel is pixel Q1, and its target neighboring pixels are a1, b1, c1, d1; the second detected pixel is Q2, and its target The neighboring pixels are a2, b2, c2, Q1; and so on, the Nth (N greater than 0) detected pixel is Qn, and the target neighboring pixels are an, bn, cn, Q(n-1) Give an example.
  • the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
  • an embodiment of the present application also provides an image edge detection device.
  • the device includes an image rotation module 41 and a scanning module 42.
  • the image rotation module 41 is configured to rotate the target image by a specified angle; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel.
  • the scanning module 42 is configured to scan pixels in the rotated target image along a designated scanning direction, and determine a new edge identifier for each pixel.
  • the device is further configured to determine the edge image of the target image according to the new edge identifier of each pixel.
  • the scanning module 42 is specifically configured to: sequentially detect each pixel in the rotated target image along the specified scanning direction; if the initial edge identifier of the pixel is detected If the first specified condition is met, and the current edge identification of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identification of the pixel is changed.
  • the image rotation module 41 is specifically configured to: repeatedly rotate the target image along the specified rotation direction by the specified angle until the number of pixels of the initial edge identification is changed in the target image scan Up to 0.
  • the image rotation module 41 is specifically configured to: repeatedly rotate the target image by a specified angle along a specified rotation direction, until the target image is rotated at least one circle from the initial position and is changed during scanning of the target image.
  • the number of pixels of the initial edge identification is zero.
  • the edge identifiers are sequentially divided into a first identifier, a second identifier, and a third identifier; The first identifier, the second identifier and the third identifier are different from each other.
  • the first specified condition includes: the initial edge identifier of the pixel is the second identifier.
  • the second specified condition includes: the current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier.
  • the edge information contained in the pixel is represented by the gradient value of the pixel.
  • the first identifier indicates that the gradient value of the pixel is greater than a first threshold.
  • the second identifier represents that the gradient value of the pixel is between the first threshold and the second threshold; the second threshold is less than the first threshold.
  • the third identifier indicates that the gradient value of the pixel is smaller than the second threshold.
  • the scanning module includes a pulsation unit.
  • the scanning module is specifically configured to: sequentially read the pixel information in the rotated target image along the designated scanning direction; the pixel information includes the initial edge identifier of the pixel and the pixel information The current edge identifier of the target neighboring pixel; the information of the pixel is input into the pulsation unit, processed by the pulsation unit, and the new edge identifier of the pixel is output.
  • the target neighboring pixel is a scanned part of all neighboring pixels corresponding to the pixel.
  • the number of pixels read by the scanning module each time is determined according to the bit width of the data bus.
  • the edge identifier is represented in a binary form.
  • the number of pixels read by the scanning module each time is determined according to the number of bits represented by the edge identifier and the bit width of the data bus.
  • the number of the pulsating units is determined based on the number of pixels.
  • the pulsation units are connected in a cascade manner.
  • the designated scanning direction includes at least a left-to-right direction, a right-to-left direction, a top-down direction, or a bottom-up direction.
  • the device further includes an initial edge identification determination module.
  • the initial edge identification determination module is used to process the target image by using a Gaussian filter to obtain the processed target image; calculate the gradient value and gradient direction of each pixel in the processed target image; The gradient direction and gradient value of the pixel determine the initial edge identifier of the pixel.
  • the device embodiments described above are merely illustrative.
  • 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 it can be distributed to multiple network units.
  • Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments. Ordinary technicians in this neighborhood can understand and implement without creative work.
  • an embodiment of the present application also provides an image signal processor, which includes any one of the above-mentioned devices, and the image signal processor is used to process image signals collected by an image sensor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

Embodiments of the present application provide an image edge detection method and apparatus, and an image signal processor. After a target image is obtained, the target image is rotated a specified angle along a specified rotation direction; then, pixels in the rotated target image are scanned along a specified scanning direction to determine a new edge identifier for each pixel; finally, an edge image of the target image can be determined according to the new edge identifier of each pixel. In the embodiments, the target image is rotated and scanned to implement a scanning process from different direction dimensions, thereby ensuring that complete and accurate edge information of the target image is obtained.

Description

图像边缘检测方法、装置以及图像信号处理器Image edge detection method, device and image signal processor 技术领域Technical field
本申请涉及图像处理领域,尤其涉及一种图像边缘检测方法、装置以及图像信号处理器。This application relates to the field of image processing, and in particular to an image edge detection method, device, and image signal processor.
背景技术Background technique
边缘是指在图像中周围像素灰度急剧变化的像素集合,是图像的最基本的特征。边缘检测在众多计算机视觉任务中起着重要的作用,可以广泛应用于特征提取、图像识别、图像分割、图像匹配、图像分类等领域。图像边缘检测的质量在很大程度上决定了后续图像处理的效果,一个良好的边缘检测方法能够为后续图像处理提供更好的保障。Edge refers to a collection of pixels with sharp changes in the gray levels of surrounding pixels in an image, and is the most basic feature of an image. Edge detection plays an important role in many computer vision tasks, and can be widely used in areas such as feature extraction, image recognition, image segmentation, image matching, and image classification. The quality of image edge detection determines the effect of subsequent image processing to a large extent. A good edge detection method can provide better guarantee for subsequent image processing.
发明内容Summary of the invention
有鉴于此,本申请实施例的目的之一是提供一种图像边缘检测方法、装置以及图像信号处理器。In view of this, one of the objectives of the embodiments of the present application is to provide an image edge detection method, device, and image signal processor.
首先,根据本申请实施例的第一方面,提供一种图像边缘检测方法,所述方法包括:First, according to the first aspect of the embodiments of the present application, an image edge detection method is provided, the method including:
获取目标图像;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息;Acquiring a target image; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
在将所述目标图像旋转指定角度之后,沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识;After rotating the target image by a specified angle, scan the pixels in the rotated target image along the specified scanning direction to determine a new edge identifier for each pixel;
根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。According to the new edge identifier of each pixel, the edge image of the target image is determined.
根据本申请实施例的第二方面,提供一种图像边缘检测装置,所述装置包括图像旋转模块和扫描模块;According to a second aspect of the embodiments of the present application, there is provided an image edge detection device, the device including an image rotation module and a scanning module;
所述图像旋转模块用于将目标图像旋转指定角度;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息;The image rotation module is used to rotate the target image by a specified angle; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
所述扫描模块用于沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识;The scanning module is configured to scan pixels in the rotated target image along a designated scanning direction, and determine a new edge identifier for each pixel;
所述装置还用于根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。The device is further configured to determine the edge image of the target image according to the new edge identifier of each pixel.
根据本申请实施例的第三方面,提供一种图像信号处理器,包括第二方面任意一项所述的装置,所述图像信号处理器用于对图像传感器采集的图像信号进行处理。According to a third aspect of the embodiments of the present application, an image signal processor is provided, including the device according to any one of the second aspects, and the image signal processor is configured to process image signals collected by an image sensor.
本申请实施例具有如下有益效果:The embodiments of the present application have the following beneficial effects:
本实施例中,可获取到所述目标图像完整和准确的边缘信息。In this embodiment, complete and accurate edge information of the target image can be obtained.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the application.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained from these drawings without creative labor.
图1A是本申请根据一示例性实施例示出的目标图像的示意图。Fig. 1A is a schematic diagram showing a target image according to an exemplary embodiment of the present application.
图1B是本申请根据一示例性实施例示出的相关技术扫描得到的边缘图像的示意图。Fig. 1B is a schematic diagram of an edge image obtained by scanning in a related technology according to an exemplary embodiment of the present application.
图2是本申请根据一示例性实施例示出的第一种图像边缘检测方法的流程图。Fig. 2 is a flowchart of a first image edge detection method according to an exemplary embodiment of the present application.
图3A是本申请根据一示例性实施例示出的第二种图像边缘检测方法的流程图。Fig. 3A is a flow chart showing a second method for image edge detection according to an exemplary embodiment of the present application.
图3B是为本申请根据一示例性实施例示出的第三种图像边缘检测方法的流程图。Fig. 3B is a flowchart of a third image edge detection method according to an exemplary embodiment of the present application.
图4A是本申请根据一示例性实施例示出的将图1A顺时针旋转90°后得到的示意图。Fig. 4A is a schematic diagram obtained by rotating Fig. 1A clockwise by 90° according to an exemplary embodiment of the present application.
图4B是本申请根据一示例性实施例示出的对图4A进行扫描后得到的边缘图像的示意图。Fig. 4B is a schematic diagram of an edge image obtained after scanning Fig. 4A according to an exemplary embodiment of the present application.
图4C是本申请根据一示例性实施例示出的将图4B顺时针旋转90°后得到的示意图。Fig. 4C is a schematic diagram obtained by rotating Fig. 4B clockwise by 90° according to an exemplary embodiment of the present application.
图4D是本申请根据一示例性实施例示出的对图4C进行扫描后得到的边缘图像的示意图。Fig. 4D is a schematic diagram of an edge image obtained after scanning Fig. 4C according to an exemplary embodiment of the present application.
图4E是本申请根据一示例性实施例示出的将图4D顺时针旋转90°后得到的示意图。Fig. 4E is a schematic diagram obtained by rotating Fig. 4D clockwise by 90° according to an exemplary embodiment of the present application.
图4F是本申请根据一示例性实施例示出的对图4E进行扫描后得到的边缘图像的示意图。Fig. 4F is a schematic diagram of an edge image obtained after scanning Fig. 4E according to an exemplary embodiment of the present application.
图4G是本申请根据一示例性实施例示出的将图4F顺时针旋转90°后得到的示意图。Fig. 4G is a schematic diagram obtained by rotating Fig. 4F clockwise by 90° according to an exemplary embodiment of the present application.
图5是本申请根据一示例性实施例示出的像素Q及其3×3邻域像素的示意图。Fig. 5 is a schematic diagram showing a pixel Q and its 3×3 neighboring pixels according to an exemplary embodiment of the present application.
图6是本申请根据一示例性实施例示出的一种脉动单元的示意图。Fig. 6 is a schematic diagram showing a pulsation unit according to an exemplary embodiment of the present application.
图7A是本申请根据一示例性实施例示出的级联连接的脉动单元中单个脉动单元的示意图。Fig. 7A is a schematic diagram of a single pulsation unit in cascade-connected pulsation units according to an exemplary embodiment of the present application.
图7B是本申请根据一示例性实施例示出的级联连接的脉动单元的 示意图。Fig. 7B is a schematic diagram showing a cascaded pulsation unit according to an exemplary embodiment of the present application.
图8是本申请根据一示例性实施例示出的一种图像边缘检测装置的结构图。Fig. 8 is a structural diagram of an image edge detection device according to an exemplary embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
边缘是指在图像中周围像素灰度急剧变化的像素集合,是图像的最基本的特征。边缘检测在众多计算机视觉任务中起着重要的作用,可以广泛应用于特征提取、图像识别、图像分割、图像匹配、图像分类等领域。图像边缘检测的质量在很大程度上决定了后续图像处理的效果,一个良好的边缘检测方法能够为后续图像处理提供更好的保障。Edge refers to a collection of pixels with sharp changes in the gray levels of surrounding pixels in an image, and is the most basic feature of an image. Edge detection plays an important role in many computer vision tasks, and can be widely used in areas such as feature extraction, image recognition, image segmentation, image matching, and image classification. The quality of image edge detection determines the effect of subsequent image processing to a large extent. A good edge detection method can provide better guarantee for subsequent image processing.
相关技术中,其中canny边缘检测算法通过先对图像进行高斯平滑,然后计算图像中每个像素的梯度强度和梯度方向,通过非极大值抑制步骤和双阈值检测步骤初步确定该像素的边缘性质,将所有的像素分为3类,分别为强边缘像素点、弱边缘像素点和非边缘像素点,最后通过抑制孤立的弱边缘完成边缘检测;所谓“抑制孤立的弱边缘”是指如果弱边缘像素点有与强边缘像素点连通,则该弱边缘像素点被认为是强边缘像素点保留,否则,该弱边缘像素点被认为是非边缘像素点丢弃。In related technologies, the canny edge detection algorithm firstly performs Gaussian smoothing on the image, and then calculates the gradient intensity and gradient direction of each pixel in the image, and preliminarily determines the edge nature of the pixel through the non-maximum value suppression step and the double threshold detection step , Divide all pixels into 3 categories, namely strong edge pixels, weak edge pixels and non-edge pixels. Finally, edge detection is completed by suppressing isolated weak edges; the so-called "suppression of isolated weak edges" means that if weak If an edge pixel is connected to a strong edge pixel, the weak edge pixel is considered to be a strong edge pixel and retained, otherwise, the weak edge pixel is considered to be a non-edge pixel and discarded.
在抑制孤立的弱边缘的过程中,通常采用正向单次扫描法,单方向进行延伸,一次只能遍历一个方向上的边缘信息,在一个例子中,请参阅图1A,图1A为待进行“抑制孤立的弱边缘”过程的原始图像,假设图1A 中的黑色格子表征强边缘的像素,灰色格子表征弱边缘的像素,白色格子表征非边缘的像素,如果采用正向单次扫描法,单方向(假设扫描的方向为自左向右且自上而下方向)进行延伸,首先从图像左上角的第一个像素开始扫描,先从左到右进行第一行像素的扫描,在扫描完第一行像素之后,再沿自上而下方向选择第二行,然后再从左到右扫描第二行的像素,依次类推,直到扫描完最后一行的像素,由于其扫描的方向无法改变,则只能得到如图1B所示的扫描结果,不能检测出完整的边缘信息,检测结果边缘连通性较差。In the process of suppressing isolated weak edges, the forward single scan method is usually used to extend in a single direction, and only the edge information in one direction can be traversed at a time. In an example, please refer to Figure 1A. In the original image of the "suppression of isolated weak edges" process, suppose that the black grid in Figure 1A represents pixels with strong edges, the gray grid represents pixels with weak edges, and the white grid represents pixels with non-edges. If the forward single scan method is used, Single direction (assuming that the scanning direction is from left to right and top to bottom) to extend, first scan from the first pixel in the upper left corner of the image, first scan the first row of pixels from left to right, then scan After finishing the first row of pixels, select the second row from top to bottom, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned, because the scanning direction cannot be changed , Only the scanning result shown in Fig. 1B can be obtained, complete edge information cannot be detected, and the edge connectivity of the detection result is poor.
基于上述问题,请参阅图2,本申请实施例提供了一种图像边缘检测方法,图2为本申请根据一示例性实施例示出的一种图像边缘检测方法的流程图。本申请实施例的所述图像边缘检测方法,通过对目标图像进行旋转,从而可以从目标图像的不同方向维度对所述目标图像采用正向单次扫描法进行扫描,进而获取到完整的边缘信息,有利于保证扫描结果的准确性。本申请实施例的图像边缘检测方法可以应用于需要进行图像处理的电子设备上,例如智能手机、电脑、平板、图像拍摄设备(如摄像机)以及可移动设备(如无人飞行器、无人驾驶车辆、无人驾驶船只或者移动机器人)等。Based on the above problems, please refer to FIG. 2. An embodiment of the present application provides an image edge detection method. FIG. 2 is a flowchart of an image edge detection method according to an exemplary embodiment of the present application. The image edge detection method of the embodiment of the present application rotates the target image, so that the target image can be scanned from different directions and dimensions of the target image using a forward single scan method to obtain complete edge information. , Which helps to ensure the accuracy of the scan results. The image edge detection method of the embodiments of the present application can be applied to electronic devices that require image processing, such as smart phones, computers, tablets, image capture devices (such as cameras), and movable devices (such as unmanned aerial vehicles, unmanned vehicles). , Unmanned boats or mobile robots), etc.
图2所示的实施例中,所述方法包括:In the embodiment shown in FIG. 2, the method includes:
在步骤S101中,获取目标图像;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息。In step S101, a target image is acquired; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel.
在步骤S102中,在将所述目标图像旋转指定角度之后,沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识。In step S102, after the target image is rotated by a specified angle, the pixels in the rotated target image are scanned along the specified scanning direction to determine a new edge identifier for each pixel.
在步骤S103中,根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。In step S103, the edge image of the target image is determined according to the new edge identifier of each pixel.
在一实施例中,所述像素的所述初始的边缘标识可以通过以下方式 确定:使用高斯滤波器对所述目标图像进行处理,实现对目标图像中噪声的滤除,获取处理后的目标图像,然后计算所述处理后的目标图像中每个像素的梯度值和梯度方向,最后基于所述像素的梯度方向和梯度值确定所述像素的所述初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息。In an embodiment, the initial edge identifier of the pixel may be determined in the following manner: Use a Gaussian filter to process the target image to filter out noise in the target image, and obtain a processed target image , And then calculate the gradient value and gradient direction of each pixel in the processed target image, and finally determine the initial edge identifier of the pixel based on the gradient direction and gradient value of the pixel, and the initial edge identifier Used to describe the edge information contained in the pixel.
作为其中一种实现方式,首先判断所述像素的梯度值在其梯度方向上是否为局部最大值,如果不是,则所述像素的所述初始的边缘标识被记为第三标识;进一步地,如果所述像素的梯度值大于第一阈值,则所述像素初始的边缘标识被记为第一标识;如果所述像素的梯度值在所述第一阈值与第二阈值之间,则所述像素的所述初始的边缘标识被记为第二标识,所述第二阈值小于所述第一阈值;如果所述像素的梯度值小于所述第二阈值,则所述像素的所述初始的边缘标识被记为第三标识。可以理解的是,本申请实施例对于所述第一阈值和所述第二阈值的具体取值不作任何限制,可依据实际应用场景进行具体设置。As one of the implementation manners, first determine whether the gradient value of the pixel is a local maximum in its gradient direction, if not, the initial edge identifier of the pixel is recorded as a third identifier; further, If the gradient value of the pixel is greater than the first threshold, the initial edge identifier of the pixel is recorded as the first identifier; if the gradient value of the pixel is between the first threshold and the second threshold, the The initial edge identifier of the pixel is recorded as a second identifier, and the second threshold is less than the first threshold; if the gradient value of the pixel is less than the second threshold, the initial edge of the pixel is The edge mark is recorded as the third mark. It is understandable that the embodiment of the present application does not impose any restrictions on the specific values of the first threshold and the second threshold, and specific settings can be made according to actual application scenarios.
可以看出,所述像素所包含的边缘信息可以通过所述像素的梯度值表示,按照所述目标图像中每个像素所包含的边缘信息的强弱程度从强到弱的顺序(梯度值从大到小的顺序),所述边缘标识依次被划分为第一标识、第二标识和第三标识,需要说明的是,所述第一标识,所述第二标识和所述第三标识互不相同。在一个例子中,所述第一标识表征所述像素为强边缘像素,所述第二标识表征所述像素为弱边缘像素,所述第三标识表征所述像素为非边缘像素。It can be seen that the edge information contained in the pixel can be represented by the gradient value of the pixel, according to the order of the strength of the edge information contained in each pixel in the target image from strong to weak (gradient value from In order of large to small), the edge identifiers are sequentially divided into a first identifier, a second identifier, and a third identifier. It should be noted that the first identifier, the second identifier, and the third identifier are mutually exclusive. Are not the same. In an example, the first identifier indicates that the pixel is a strong edge pixel, the second identifier indicates that the pixel is a weak edge pixel, and the third identifier indicates that the pixel is a non-edge pixel.
在一实施例中,在获取目标图像之后,将所述目标图像沿指定旋转方向旋转指定角度,然后沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识,最后可以根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像;本实施例中将所述目标图像进行旋转后对其进行扫描,实现从不同方向维度进行的扫描过程,确保获取到所述目标图像完整和准确的边缘信息。In one embodiment, after the target image is acquired, the target image is rotated by a specified angle along a specified rotation direction, and then pixels in the rotated target image are scanned along the specified scanning direction to determine a new information about each pixel. The edge identification, and finally the edge image of the target image can be determined according to the new edge identification of each pixel; in this embodiment, the target image is rotated and then scanned to achieve different directions and dimensions. The scanning process ensures that complete and accurate edge information of the target image is obtained.
其中,所述指定扫描方向包括但不限于自上而下方向、自下而上方向、自左而右方向或者自右而左方向,或者是以上至少两种方向。Wherein, the specified scanning direction includes, but is not limited to, a top-down direction, a bottom-up direction, a left-to-right direction or a right-to-left direction, or at least two of the above directions.
在一种可能的实现方式中,在获取目标图像之后,将所述目标图像沿指定旋转方向旋转指定角度,然后沿指定扫描方向对旋转后的目标图像中的每个像素进行检测,若检测到所述像素的所述初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识(按照指定扫描方向,如果所述像素对应的邻域像素在所述像素之前已经被扫描过了,则该邻域像素当前的边缘标识为新的边缘标识,如果所述像素对应的邻域像素在所述像素之前未被扫描过,则该邻域像素当前的边缘标识为所述初始的边缘标识)符合第二指定条件,则更改所述像素的边缘标识,获得所述像素新的边缘标识;其中,所述第一指定条件包括所述像素的所述初始的边缘标识为所述第二标识,所述第二指定条件包括所述像素对应的任一邻域像素当前的边缘标识为所述第一标识;本实施例通过第一指定条件和第二指定条件的判断,确定初始的边缘标识为第二标识的像素是否与当前的边缘标识为第一标识的像素连通,若是,表明初始的边缘标识为第二标识的像素包含有效的边缘信息,因此将所述像素的第二标识更改为第一标识,实现对所述像素进行准确地检测,保留有效的边缘信息。In a possible implementation, after the target image is acquired, the target image is rotated by a specified angle along a specified rotation direction, and then each pixel in the rotated target image is detected along the specified scanning direction. The initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel (according to the designated scanning direction, if the neighboring pixel corresponding to the pixel is in the pixel It has been scanned before, the current edge identifier of the neighboring pixel is the new edge identifier, if the neighboring pixel corresponding to the pixel has not been scanned before the pixel, the current edge identifier of the neighboring pixel Is the initial edge identification) that meets the second specified condition, then the edge identification of the pixel is changed to obtain the new edge identification of the pixel; wherein, the first specified condition includes the initial edge of the pixel The identifier is the second identifier, and the second designated condition includes that the current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier; this embodiment passes the first designated condition and the second designated condition Judging, it is determined whether the pixel with the initial edge identification as the second identification is connected with the pixel with the current edge identification as the first identification. The second identification of the pixel is changed to the first identification, so that the pixel can be accurately detected and effective edge information is retained.
其中,所述像素的邻域像素包括该像素3×3邻域内的所有像素。Wherein, the neighboring pixels of the pixel include all pixels in the 3×3 neighborhood of the pixel.
在一个实施方式中,对整个目标图像进行的扫描操作为正向单次扫描。例如,扫描方向为自左向右、自上而下的扫描方式,请参阅图1A,首先从图像左上角的第一个像素开始扫描,先从左到右进行第一行像素的扫描,在扫描完第一行像素之后,再沿自上而下方向选择第二行像素,然后再沿从左到右方向扫描第二行的像素,依次类推,直到扫描完最后一行的像素,可见,正向单次扫描过程包括多次行扫描。考虑到正向单次扫描算法的扫描方向单一导致获取的目标图像的边缘信息不完整的问题,本实施例中将目标图像旋转指定角度,实现从不同的方向维度对旋转后的目标图像进行扫描,并且为了保证获取的目标图像边缘信息的完整性,所述目标 图像被旋转至少两次。也就是说,所述目标图像要至少进行两次正向单次扫描。例如,在将目标图像旋转指定角度之后,自左向右、自上而下对旋转后的整个目标图像进行一次扫描。若在一次对整个旋转后的目标图像进行扫描之后所述旋转后的目标图像中被更改初始的边缘标识的像素数量为0,则无需再进行旋转所述目标图像以及扫描目标图像的操作,结束所述目标图像的边缘检测过程,基于所述目标图像中每个像素的所述新的边缘标识得到所述目标图像的边缘图像。In one embodiment, the scanning operation performed on the entire target image is a forward single scan. For example, the scanning direction is left-to-right and top-down scanning. Please refer to Figure 1A. First scan from the first pixel in the upper left corner of the image, and scan the first row of pixels from left to right. After scanning the first row of pixels, select the second row of pixels from top to bottom, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned, it is visible, positive The single scan process includes multiple line scans. Taking into account the problem that the single scan direction of the forward single scan algorithm leads to incomplete edge information of the acquired target image, in this embodiment, the target image is rotated by a specified angle to realize scanning of the rotated target image from different directions and dimensions. And in order to ensure the integrity of the acquired edge information of the target image, the target image is rotated at least twice. In other words, the target image needs to be scanned in a forward direction at least twice. For example, after the target image is rotated by a specified angle, the entire rotated target image is scanned once from left to right and from top to bottom. If after scanning the entire rotated target image at one time, the number of pixels in the rotated target image whose initial edge identification has been changed is 0, there is no need to perform the operations of rotating the target image and scanning the target image, and the end The edge detection process of the target image obtains the edge image of the target image based on the new edge identifier of each pixel in the target image.
相应地,请参阅图3A,为本申请根据一示例性实施例提供了第二种图像边缘检测方法的流程示意图,所述方法包括:Correspondingly, please refer to FIG. 3A, which provides a schematic flowchart of a second image edge detection method according to an exemplary embodiment of the present application, and the method includes:
在步骤S201中,获取目标图像。In step S201, a target image is acquired.
在步骤S202中,将所述目标图像沿指定旋转方向旋转指定角度。In step S202, the target image is rotated by a specified angle along a specified rotation direction.
在步骤S203中,沿指定扫描方向对所述旋转后的目标图像中每个像素依次进行检测,若检测到所述像素的所述初始的边缘标识为所述第二标识,且所述像素对应的任一邻域像素当前的边缘标识为所述第一标识,将所述像素的所述初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识。In step S203, each pixel in the rotated target image is sequentially detected along a designated scanning direction, and if the initial edge identifier of the pixel is detected as the second identifier, and the pixel corresponds to The current edge identifier of any neighboring pixel is the first identifier, the initial edge identifier of the pixel is changed from the second identifier to the first identifier, and the new edge identifier of the pixel is determined.
在步骤S204中,判断在目标图像扫描中被更改所述初始的边缘标识的像素数量是否为0;若否,跳转到步骤S202,若是,跳转到步骤S205。In step S204, it is determined whether the number of pixels of the initial edge identifier changed in the target image scan is 0; if not, skip to step S202, if yes, skip to step S205.
需要说明的是,在非首次对所述目标图像进行旋转,是对上一次旋转后的目标图像再沿所述指定旋转方向旋转所述指定角度。It should be noted that, when the target image is not rotated for the first time, the target image after the previous rotation is rotated by the specified angle along the specified rotation direction.
在步骤S205中,根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。In step S205, the edge image of the target image is determined according to the new edge identifier of each pixel.
在一实施例中,在获取所述目标图像之后,将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到所述目标图像中从所述第二标识更改为所述第一标识的像素的数量为0,在每次将所述目标图像沿指定旋转方向旋转指定角度之后,沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定每个像素新的边缘标识;在每次目标图像扫描之后,确定所 述目标图像中被更改所述初始的边缘标识的像素数量,即从所述第二标识更改为所述第一标识的像素的数量,若其数量为0,表明已完整获取所述目标图像的边缘信息,则无需再重复进行步骤S202和步骤S203的操作,而是跳转到步骤S205,根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像,否则,重复进行步骤S202和步骤S203的操作;本实施例保证经过多次目标图像旋转以及扫描之后,能够获取到所述目标图像完整的边缘信息。In an embodiment, after the target image is acquired, the target image is repeatedly rotated by the designated angle in a designated rotation direction until the target image is changed from the second identification to the first identification. The number of pixels is 0. Each time the target image is rotated by a specified angle along the specified rotation direction, the pixels in the rotated target image are scanned along the specified scanning direction to determine the new edge identifier of each pixel; After scanning the second target image, determine the number of pixels in the target image whose initial edge identifier has been changed, that is, the number of pixels changed from the second identifier to the first identifier. If the number is 0, it means If the edge information of the target image has been completely obtained, there is no need to repeat the operations of step S202 and step S203, but jump to step S205, and determine the target image according to the new edge identifier of each pixel. Edge image, otherwise, repeat the operations of step S202 and step S203; this embodiment ensures that after multiple rotations and scans of the target image, complete edge information of the target image can be obtained.
进一步地,为了保证所述目标图像在经过边缘检测之后,所述目标图像中每个像素的位置保持不变,在确保检测到完整的边缘信息的基础上(在目标图像扫描中被更改所述初始的边缘标识的像素数量为0),则还需要保证所述目标图像自初始位置被旋转至少一周,相应地,请参阅图3B,为本申请根据一示例性实施例提供了第三种图像边缘检测方法的流程示意图,所述方法包括:Further, in order to ensure that after the edge detection of the target image, the position of each pixel in the target image remains unchanged, on the basis of ensuring that complete edge information is detected (the target image is changed during scanning of the target image). The number of pixels of the initial edge identification is 0), it is also necessary to ensure that the target image is rotated at least one circle from the initial position. Accordingly, please refer to FIG. 3B, which provides a third image according to an exemplary embodiment of this application A schematic flow chart of an edge detection method, the method includes:
在步骤S301中,获取目标图像。In step S301, a target image is acquired.
在步骤S302中,将所述目标图像沿指定旋转方向旋转指定角度。In step S302, the target image is rotated by a specified angle along a specified rotation direction.
在步骤S303中,沿指定扫描方向对所述旋转后的目标图像中每个像素依次进行检测,若检测到所述像素的所述初始的边缘标识为所述第二标识,且所述像素对应的任一邻域像素当前的边缘标识为所述第一标识,将所述像素的所述初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识。In step S303, each pixel in the rotated target image is sequentially detected along a designated scanning direction, and if the initial edge identifier of the pixel is detected as the second identifier, and the pixel corresponds to The current edge identifier of any neighboring pixel is the first identifier, the initial edge identifier of the pixel is changed from the second identifier to the first identifier, and the new edge identifier of the pixel is determined.
在步骤S304中,判断所述目标图像是否自初始位置被旋转至少一周且在目标图像扫描中被更改所述初始的边缘标识的像素的数量是否为0;若否,跳转到步骤S302,若是,跳转到步骤S305。In step S304, it is determined whether the target image has been rotated at least one circle from the initial position and the number of pixels of the initial edge identifier is 0 during the target image scanning; if not, skip to step S302, if yes , Jump to step S305.
需要说明的是,在非首次对所述目标图像进行旋转,是对上一次旋转后的目标图像再沿所述指定旋转方向旋转所述指定角度。It should be noted that, when the target image is not rotated for the first time, the target image after the previous rotation is rotated by the specified angle along the specified rotation direction.
在步骤S305中,根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。In step S305, the edge image of the target image is determined according to the new edge identifier of each pixel.
在一实施例中,在获取所述目标图像之后,可以将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到所述目标图像自初始位置被旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0,在每次将所述目标图像沿指定旋转方向旋转指定角度之后,沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定每个像素新的边缘标识;在每次扫描之后,确定所述目标图像中被更改所述初始的边缘标识的像素数量是否为0,即所述目标图像中从所述第二标识更改为所述第一标识的像素的数量是否为0以及所述目标图像是否自初始位置被旋转了至少一周(360°),其数量为0,表明已完整获取所述目标图像的边缘信息,则无需再重复进行步骤S302和步骤S303的操作,而是跳转到步骤S305,根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像,否则,重复进行步骤S302和步骤S303的操作;本实施例在获取完整的边缘信息的同时,保证在经过边缘检测后所述目标图像中每个像素的位置保持不变,以便于后续的图像处理操作。In an embodiment, after the target image is acquired, the target image may be repeatedly rotated by the specified angle in a specified rotation direction, until the target image is rotated at least one circle from the initial position and the target image is changed Since the number of pixels of the first identification is 0, each time the target image is rotated by a specified angle along the specified rotation direction, the pixels in the rotated target image are scanned along the specified scanning direction to determine each pixel A new edge identifier; after each scan, determine whether the number of pixels in the target image whose initial edge identifier has been changed is 0, that is, the target image is changed from the second identifier to the first Whether the number of identified pixels is 0 and whether the target image has been rotated at least one circle (360°) from the initial position, the number of which is 0, indicating that the edge information of the target image has been completely obtained, and there is no need to repeat the steps The operations of S302 and S303, but jump to step S305, determine the edge image of the target image according to the new edge identifier of each pixel, otherwise, repeat the operations of step S302 and step S303; this embodiment For example, while obtaining complete edge information, it is ensured that the position of each pixel in the target image remains unchanged after edge detection, so as to facilitate subsequent image processing operations.
可以理解的是,本申请实施例对于所述指定旋转方向和所述指定角度不作任何限制,可依据实际应用场景进行具体设置;所述指定旋转方向可以是顺时针方向或者逆时针方向,所述指定角度可以是0°~360°之间的任意取值,其中,所述指定角度可以是90°。It is understandable that the embodiment of the present application does not impose any restrictions on the specified rotation direction and the specified angle, and can be specifically set according to actual application scenarios; the specified rotation direction may be clockwise or counterclockwise, and The specified angle may be any value between 0° and 360°, where the specified angle may be 90°.
在一个例子中,以所述指定旋转方向为顺时针方向,所述指定角度为90°,所述指定旋转方向为自上而下且自左向右方向,需要满足所述目标图像自初始位置旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0两个条件为例进行说明:In an example, the specified rotation direction is clockwise, the specified angle is 90°, and the specified rotation direction is from top to bottom and from left to right, and it needs to satisfy that the target image is from the initial position Take at least one rotation and the number of pixels changed to the first identifier in the target image is 0 as an example for description:
第一次旋转及扫描过程:将图1A中的目标图像沿顺时针方针旋转90°,得到如图4A所示的图像,沿自上而下且自左向右方向对图4A所示的图像中的像素逐行逐个进行扫描(首先从图像左上角的第一个像素开始扫描,先从左到右进行第一行像素的扫描,在扫描完第一行像素之后,再沿自上而下方向选择第二行像素,然后再沿从左到右方向扫描第二行的像 素,依次类推,直到扫描完最后一行的像素),若所述像素初始的边缘标识符合第一指定条件(所述第一指定条件包括所述像素初始的边缘标识为所述第二标识),且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件(所述第二指定条件包括所述像素对应的任一邻域像素当前的边缘标识为所述第一标识),将所述像素初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识为第一标识,从而得到如图4B所示的扫描图像,其中,更改为第一标识的像素的数量为7,自初始位置旋转90°,不满足所述目标图像自初始位置旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0,继续第二次旋转及扫描过程。The first rotation and scanning process: Rotate the target image in Figure 1A by 90° in a clockwise direction to obtain the image shown in Figure 4A. Comparing the image shown in Figure 4A from top to bottom and from left to right Scan the pixels in the image line by line one by one (first scan from the first pixel in the upper left corner of the image, first scan the first line of pixels from left to right, and then scan the first line of pixels from top to bottom Select the second row of pixels in the direction, and then scan the second row of pixels from left to right, and so on, until the last row of pixels is scanned), if the initial edge identifier of the pixel meets the first specified condition (the The first designated condition includes that the initial edge identifier of the pixel is the second identifier), and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second designated condition (the second designated condition includes the The current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier), the initial edge identifier of the pixel is changed from the second identifier to the first identifier, and the new edge identifier of the pixel is determined to be the first identifier , So as to obtain the scanned image as shown in Figure 4B, where the number of pixels changed to the first identification is 7, and the rotation of 90° from the initial position does not satisfy the requirement that the target image has rotated at least one circle from the initial position and the target image The number of pixels changed to the first mark in the middle is 0, and the second rotation and scanning process is continued.
第二次旋转及扫描过程:将图4B中的目标图像沿顺时针方针旋转90°,得到如图4C所示的图像,沿自上而下且自左向右方向对图4C所示的图像中的像素进行扫描,若所述像素初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,将所述像素初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识为第一标识,从而得到如图4D所示的扫描图像,其中,更改为第一标识的像素的数量为6,自初始位置旋转180°,不满足所述目标图像自初始位置旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0,继续第三次旋转及扫描过程。The second rotation and scanning process: Rotate the target image in Figure 4B by 90° in a clockwise direction to obtain the image shown in Figure 4C. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG. 4D, where the number of pixels changed to the first mark is 6, which is Rotating 180° does not satisfy that the target image has rotated at least one circle from the initial position and the number of pixels changed to the first identifier in the target image is 0, and the third rotation and scanning process is continued.
第三次旋转及扫描过程:将图4D中的目标图像沿顺时针方针旋转90°,得到如图4E所示的图像,沿自上而下且自左向右方向对图4E所示的图像中的像素进行扫描,若所述像素初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,将所述像素初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识为第一标识,从而得到如图4F所示的扫描图像,其中,更改为第一标识的像素的数量为1,自初始位置旋转270°,不满足所述目标图像自初始位置旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0,继续第四次旋转及扫描过程。The third rotation and scanning process: Rotate the target image in Figure 4D along a clockwise direction by 90° to obtain the image shown in Figure 4E, and compare the image shown in Figure 4E from top to bottom and from left to right. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG. 4F, where the number of pixels changed to the first mark is 1, starting from the initial position The rotation of 270° does not satisfy that the target image has rotated at least one circle from the initial position and the number of pixels changed to the first identifier in the target image is 0, and the fourth rotation and scanning process is continued.
第四次旋转及扫描过程:将图4F中的目标图像沿顺时针方针旋转90°,得到如图4G所示的图像,沿自上而下且自左向右方向对图4G所示的图像中的像素进行扫描,若所述像素初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,将所述像素初始的边缘标识从第二标识更改为第一标识,确定所述像素新的边缘标识为第一标识,从而得到如图4G所示的扫描图像,其中,更改为第一标识的像素的数量为0,自初始位置旋转460°(一周),满足所述目标图像自初始位置旋转至少一周且所述目标图像中更改为所述第一标识的像素的数量为0,结束图像旋转及扫描过程。The fourth rotation and scanning process: Rotate the target image in Figure 4F by 90° in a clockwise direction to obtain the image shown in Figure 4G, and compare the image shown in Figure 4G from top to bottom and from left to right. If the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed from The second mark is changed to the first mark, and the new edge mark of the pixel is determined to be the first mark, thereby obtaining a scanned image as shown in FIG. 4G, where the number of pixels changed to the first mark is 0, starting from the initial position Rotate 460° (one round) to satisfy the requirement that the target image has rotated at least one round from the initial position and the number of pixels changed to the first identifier in the target image is 0, and the image rotation and scanning process is ended.
本实施例中,通过4次旋转及扫描过程,保证了所述目标图像在经过边缘检测之后,目标图像中的像素的位置保持不变,且实现准确获取到完整的边缘信息,扫描方式简单且易于实现。In this embodiment, through 4 rotations and scanning processes, it is ensured that after the edge detection of the target image, the position of the pixels in the target image remains unchanged, and complete edge information is accurately obtained. The scanning method is simple and Easy to implement.
在另一种可能的实现方式中,考虑到本申请的图像旋转及扫描的过程的复杂度较低,为了提高边缘检测速度,可以通过硬件方式实现图像旋转及扫描过程。在每次将所述目标图像沿指定旋转方向旋转指定角度之后,沿所述指定扫描方向依次读取所述旋转后的目标图像中像素的信息,所述像素的信息包括所述像素初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识,将所述像素的信息输入脉动单元中,通过所述脉动单元进行处理,输出所述像素新的边缘标识。本实施例通过脉动单元对所述像素进行扫描检测,有利于提高扫描速度。In another possible implementation manner, considering the low complexity of the image rotation and scanning process of the present application, in order to improve the edge detection speed, the image rotation and scanning process can be implemented by hardware. Each time the target image is rotated by a specified angle along a specified rotation direction, the information of pixels in the rotated target image is sequentially read along the specified scanning direction, and the pixel information includes the initial edge of the pixel The identification and the current edge identification of the target neighboring pixel of the pixel, the information of the pixel is input into the pulsation unit, and the pulsation unit is processed to output the new edge identification of the pixel. In this embodiment, the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
其中,所述目标邻域像素可以是所述像素对应的n×n邻域。其中,n为奇数。例如,所述目标邻域像素可以是所述像素的3×3邻域中的一个或多个像素;进一步地,为了提高扫描效率,所述目标邻域像素可以是所述像素对应的所有邻域像素中已被扫描过的部分,从而可以基于所述目标邻域像素快速确定出所述像素是否符合条件。Wherein, the target neighborhood pixel may be an n×n neighborhood corresponding to the pixel. Among them, n is an odd number. For example, the target neighborhood pixel may be one or more pixels in the 3×3 neighborhood of the pixel; further, in order to improve scanning efficiency, the target neighborhood pixel may be all neighbors corresponding to the pixel. The scanned part of the pixel in the domain, so that it can be quickly determined whether the pixel meets the condition based on the target neighbor pixel.
在一实施例中,每次读取的像素数量可以根据数据总线的位宽确定,所述数据总线的位宽越大,每次读取到的像素数量越多,有利于提高扫描 速度。In an embodiment, the number of pixels read each time can be determined according to the bit width of the data bus. The larger the bit width of the data bus, the more pixels are read each time, which is beneficial to increase the scanning speed.
在另一实施例中,所述边缘标识以二进制形式表示,每次读取的像素数量可以根据所述边缘标识的表示位数和数据总线的位宽所确定;在所述边缘标识的表示位置固定的情况下,其占用的位宽也是固定的,则如果所述数据总线的位宽越大,每次读取到的像素数量越多;在所述数据总线的位宽固定的情况下,所述边缘标识的表示位置越少,其占用的位宽越小,每次读取到的像素数量越多;在一个例子中,所述边缘标识的表示位数为2位,其占用2bit的位宽,数据总线的位宽为128bit,则每次能够读取的像素数量为64位。In another embodiment, the edge identifier is expressed in binary form, and the number of pixels read each time can be determined according to the number of bits of the edge identifier and the bit width of the data bus; at the position of the edge identifier In the case of fixed, the occupied bit width is also fixed. If the bit width of the data bus is larger, the number of pixels read each time is larger; when the bit width of the data bus is fixed, The smaller the representation position of the edge identifier, the smaller the bit width it occupies, and the greater the number of pixels read each time; in one example, the representation of the edge identifier is 2 bits, which occupies 2 bits of Bit width, the bit width of the data bus is 128 bits, and the number of pixels that can be read at a time is 64 bits.
在一实施例中,所述脉动单元的数量可以基于所述像素数量所确定,通过设置与能够读取的像素数量相同的脉冲单元,实现通过多个脉动单元并行处理所述像素,从而有利于提高目标图像的扫描速度,当存在多个脉动单元时,由于上一个像素为下一个像素的邻域像素,则所述脉动单元可以通过级联方式进行连接,从而有利于提高扫描速度。In an embodiment, the number of the pulsating units can be determined based on the number of pixels. By setting the same number of pulsating units as the number of pixels that can be read, the pixels can be processed in parallel by multiple pulsating units, which is beneficial to Increase the scanning speed of the target image. When there are multiple pulsating units, since the previous pixel is a neighboring pixel of the next pixel, the pulsating units can be connected in a cascade manner, which is beneficial to increase the scanning speed.
在一个例子中,以所述目标图像进行正向单次扫描,所述指定扫描方向为自上而下且自左向右方向,所述目标邻域像素为所述像素对应的3×3邻域的所有邻域像素中已被扫描过的部分为例进行说明:沿所述自上而下且自左向右方向依次读取所述旋转后的目标图像中像素的信息,所述像素的信息包括所述像素初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识,请参阅图5,为像素Q及其3×3邻域的所有邻域像素(a~h)的示意图,由于指定扫描方向是自上而下且自左向右方向,则所述目标邻域像素为像素a、像素b、像素c和像素d,将所述像素Q初始的边缘标识和像素a、像素b、像素c和像素d当前的边缘标识输入所述脉动单元中,通过所述脉动单元进行处理,输出所述像素Q新的边缘标识。本实施例通过脉动单元对所述像素进行扫描检测,有利于提高扫描速度。In an example, the target image is used to perform a single forward scan, the specified scan direction is from top to bottom and from left to right, and the target neighborhood pixel is the 3×3 neighborhood corresponding to the pixel. The scanned part of all the neighboring pixels in the domain is taken as an example for description: read the information of the pixels in the rotated target image in the top-down and left-to-right directions, and the information of the pixels in the The information includes the initial edge identification of the pixel and the current edge identification of the target neighborhood pixel of the pixel. Please refer to FIG. 5, which is a schematic diagram of pixel Q and all neighborhood pixels (a to h) in its 3×3 neighborhood. , Since the designated scan direction is from top to bottom and from left to right, the target neighborhood pixels are pixel a, pixel b, pixel c, and pixel d, and the initial edge identification of pixel Q and pixel a, The current edge identifiers of the pixel b, the pixel c, and the pixel d are input into the pulsation unit, processed by the pulsation unit, and a new edge identifier of the pixel Q is output. In this embodiment, the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
在另一个例子中,以所述指定扫描方向为自上而下且自左向右方向,所述目标邻域像素为所述像素对应的3×3邻域的所有邻域像素中已被扫 描过的部分,所述像素的边缘标识以二进制形式表示(其中,00表示第三标识,01表示第二标识,11和10表示第一标识),数据总线位宽为128bit,且脉动单元的数量为64个(64=128÷2)为例进行说明:In another example, assuming that the specified scanning direction is from top to bottom and from left to right, the target neighboring pixels are all neighboring pixels in the 3×3 neighborhood corresponding to the pixel that have been scanned In the past part, the edge identification of the pixel is expressed in binary form (where 00 indicates the third identification, 01 indicates the second identification, and 11 and 10 indicate the first identification), the data bus bit width is 128bit, and the number of pulsation units Take 64 (64=128÷2) as an example to illustrate:
沿所述自上而下且自左向右方向依次读取所述旋转后的目标图像中像素的信息,所述像素的边缘标识的表示位数为2位,占据2bit的位宽,则一次能够读取到64(64=128÷2)个像素的信息,所述像素的信息包括所述像素初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识,请参阅图5,为像素Q及其3×3邻域的所有邻域像素(a~h)的示意图,由于指定扫描方向是自上而下且自左向右方向,则所述目标邻域像素为像素a、像素b、像素c和像素d。Read the information of the pixels in the rotated target image sequentially along the top-down and left-to-right directions. The edge identifier of the pixel has 2 bits, which occupy a bit width of 2bit, then once The information of 64 (64=128÷2) pixels can be read. The information of the pixels includes the initial edge identifier of the pixel and the current edge identifier of the target neighboring pixel of the pixel. Please refer to FIG. 5, which is A schematic diagram of pixel Q and all neighboring pixels (a~h) in its 3×3 neighborhood. Since the designated scanning direction is from top to bottom and from left to right, the target neighborhood pixel is pixel a, pixel b. Pixel c and pixel d.
其中,每个像素以二进制形式表示边缘标识,以00表示第三标识,01表示第二标识,11和10表示第一标识,第0位记为像素[0],第1位记为像素[1],即所述像素的边缘标识记为“像素[1]像素[0]”,则图5中像素Q的边缘标识,第0位记为Q[0],第1位记为Q[1],像素Q的边缘标识记为“Q[1]Q[0]”,其邻域像素的边缘标识的二进制表示方式相同,比如像素a的边缘标识记为“a[1]a[0]”、像素b的边缘标识记为“b[1]b[0]”、像素c的边缘标识记为“c[1]c[0]”以及像素d的边缘标识记为“d[1]d[0]”;则像素Q的边缘标识从第二标识更改为第一标识的条件为:所述像素Q初始的边缘标识为第二标识且像素a、像素b、像素c和像素d中存在第一标识,则有:Qout[1]=Qin[0]&(a[1]|b[1]|c[1]|d[1]|Qin[1]),Qout[0]=Q in[0],其中,Q in[1]Q in[0]表示所述像素Q初始的像素标识,Q out[1]Q out[0]表示所述像素Q新的像素标识,当满足Q in[1]Q in[0]=01,且a[1]a[0]、b[1]b[0]、c[1]c[0]以及d[1]d[0]中其中一个为11或10,基于上述赋值式可以将像素Q的边缘标识从01更改为11。 Among them, each pixel represents the edge identifier in binary form, 00 represents the third identifier, 01 represents the second identifier, 11 and 10 represent the first identifier, the 0th bit is denoted as pixel [0], and the first bit is denoted as pixel [ 1], that is, the edge identifier of the pixel is marked as "pixel [1] pixel [0]", then the edge identifier of the pixel Q in Figure 5, the 0th bit is marked as Q[0], and the first bit is marked as Q[ 1], the edge identifier of pixel Q is marked as "Q[1]Q[0]", and the binary representation of the edge identifier of its neighboring pixels is the same, for example, the edge identifier of pixel a is marked as "a[1]a[0 ]", the edge identifier of pixel b is marked as "b[1]b[0]", the edge identifier of pixel c is marked as "c[1]c[0]", and the edge identifier of pixel d is marked as "d[1 ]d[0]”; the condition for changing the edge identification of the pixel Q from the second identification to the first identification is: the initial edge identification of the pixel Q is the second identification and the pixel a, the pixel b, the pixel c, and the pixel d There is the first identifier in Qout[1]=Qin[0]&(a[1]|b[1]|c[1]|d[1]|Qin[1]), Qout[0] =Q in [0], where Q in [1] Q in [0] represents the initial pixel identifier of the pixel Q, Q out [1] Q out [0] represents the new pixel identifier of the pixel Q, when Q in [1] Q in [0] = 01, and a[1]a[0], b[1]b[0], c[1]c[0] and d[1]d[0] One of them is 11 or 10. Based on the above assignment formula, the edge identifier of pixel Q can be changed from 01 to 11.
请参阅图6,为单个脉动单元的示意图,当通过脉动单元对搜书像素Q进行处理时,输入所述脉动单元的包括:a[1]、b[1]、c[1]、d[1]、Q in[1]Q in[0],其中,Q in[1]Q in[0]表示所述像素Q初始的像素标识,然后所 述脉动单元基于“Q out[1]=Q in[0]&(a[1]|b[1]|c[1]|d[1]|Q in[1]),Q out[0]=Q in[0]”确定出所述像素Q新的边缘标识Q out[1]Q out[0]。 Refer to Figure 6, which is a schematic diagram of a single pulsation unit. When the book search pixel Q is processed by the pulsation unit, the input to the pulsation unit includes: a[1], b[1], c[1], d[ 1], Q in [1] Q in [0], where Q in [1] Q in [0] represents the initial pixel identification of the pixel Q, and then the pulsating unit is based on "Q out [1]=Q in [0]&(a[1]|b[1]|c[1]|d[1]|Q in [1]), Q out [0]=Q in [0]" determines the pixel Q new edge identification Q out [1] Q out [0].
当存在多个脉动单元时,多个脉动单元可以通过级联方式连接,请参阅图7A,为通过级联方式连接的单个脉动单元的示例图,请参阅图7B,为多个脉动单元级联连接的示意图。图7A所示的脉动单元,输入所述脉动单元的包括:a[1]、b[1]、c[1]、d[1]、Q in[1]Q in[0],其中,Q in[1]Q in[0]表示所述像素Q初始的像素标识,经所述脉动单元处理,从所述脉动单元中输出像素Q新的边缘标识Q out[1]Q out[0]以及像素Q的进位输出Q out[1],所述Q out[1]作为下一个像素的邻域像素的边缘标识的信息使用。图7B所示的级联连接的脉动单元,以第一个被检测的像素为像素Q1,其目标邻域像素为a1、b1、c1、d1;第二个被检测的像素为Q2,其目标邻域像素为a2、b2、c2、Q1;以此类推,第N(N大于0)个被检测的像素为Qn,其目标邻域像素的为an、bn、cn、Q(n-1)进行举例说明。本实施例通过脉动单元对所述像素进行扫描检测,有利于提高扫描速度。 When there are multiple pulsation units, multiple pulsation units can be connected in cascade mode. Please refer to Figure 7A, which is an example diagram of a single pulsation unit connected in cascade mode. Please refer to Figure 7B, which is a cascade connection of multiple pulsation units. Schematic diagram of the connection. The pulsation unit shown in FIG. 7A, the input to the pulsation unit includes: a[1], b[1], c[1], d[1], Q in [1] Q in [0], where Q in [1] Q in [0] represents the initial pixel identifier of the pixel Q, processed by the pulsating unit, and outputting the new edge identifier of the pixel Q from the pulsating unit Q out [1] Q out [0] and the carry output pixel Q Q out [1], the Q out [1] is used as identification information of the edge pixel in a neighborhood of pixels. In the cascaded pulsating unit shown in Figure 7B, the first detected pixel is pixel Q1, and its target neighboring pixels are a1, b1, c1, d1; the second detected pixel is Q2, and its target The neighboring pixels are a2, b2, c2, Q1; and so on, the Nth (N greater than 0) detected pixel is Qn, and the target neighboring pixels are an, bn, cn, Q(n-1) Give an example. In this embodiment, the pulsation unit is used to scan and detect the pixels, which is beneficial to increase the scanning speed.
相应地,请参阅图8,本申请实施例还提供了一种图像边缘检测装置,所述装置包括图像旋转模块41和扫描模块42。Correspondingly, referring to FIG. 8, an embodiment of the present application also provides an image edge detection device. The device includes an image rotation module 41 and a scanning module 42.
所述图像旋转模块41用于将目标图像旋转指定角度;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息。The image rotation module 41 is configured to rotate the target image by a specified angle; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel.
所述扫描模块42用于沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识。The scanning module 42 is configured to scan pixels in the rotated target image along a designated scanning direction, and determine a new edge identifier for each pixel.
所述装置还用于根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。The device is further configured to determine the edge image of the target image according to the new edge identifier of each pixel.
在一实施例中,所述扫描模块42具体用于:沿所述指定扫描方向对所述旋转后的目标图像中每个像素依次进行检测;若检测到所述像素的所述初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,更改所述像素的所述初始的边缘标识。In an embodiment, the scanning module 42 is specifically configured to: sequentially detect each pixel in the rotated target image along the specified scanning direction; if the initial edge identifier of the pixel is detected If the first specified condition is met, and the current edge identification of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identification of the pixel is changed.
在一实施例中,所述图像旋转模块41具体用于:将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。In an embodiment, the image rotation module 41 is specifically configured to: repeatedly rotate the target image along the specified rotation direction by the specified angle until the number of pixels of the initial edge identification is changed in the target image scan Up to 0.
在一实施例中,所述图像旋转模块41具体用于:将所述目标图像沿指定旋转方向重复旋转指定角度,直到所述目标图像自初始位置旋转至少一周且在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。In an embodiment, the image rotation module 41 is specifically configured to: repeatedly rotate the target image by a specified angle along a specified rotation direction, until the target image is rotated at least one circle from the initial position and is changed during scanning of the target image. The number of pixels of the initial edge identification is zero.
在一实施例中,按照每个像素所包括包含的边缘信息的强弱程度从强到弱的顺序,所述边缘标识依次被划分为第一标识、第二标识和第三标识;其中,所述第一标识,所述第二标识和所述第三标识互不相同。In an embodiment, according to the order of the strength of the edge information included in each pixel from strong to weak, the edge identifiers are sequentially divided into a first identifier, a second identifier, and a third identifier; The first identifier, the second identifier and the third identifier are different from each other.
所述第一指定条件包括:所述像素的所述初始的边缘标识为所述第二标识。The first specified condition includes: the initial edge identifier of the pixel is the second identifier.
所述第二指定条件包括:所述像素对应的任一邻域像素当前的边缘标识为所述第一标识。The second specified condition includes: the current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier.
在一实施例中,所述像素所包含的边缘信息通过所述像素的梯度值表示。In an embodiment, the edge information contained in the pixel is represented by the gradient value of the pixel.
所述第一标识表征所述像素的梯度值大于第一阈值。The first identifier indicates that the gradient value of the pixel is greater than a first threshold.
所述第二标识表征所述像素的梯度值在所述第一阈值与第二阈值之间;所述第二阈值小于所述第一阈值。The second identifier represents that the gradient value of the pixel is between the first threshold and the second threshold; the second threshold is less than the first threshold.
所述第三标识表征所述像素的梯度值小于所述第二阈值。The third identifier indicates that the gradient value of the pixel is smaller than the second threshold.
在一实施例中,所述扫描模块包括脉动单元。In an embodiment, the scanning module includes a pulsation unit.
所述扫描模块具体用于:沿所述指定扫描方向依次读取所述旋转后的目标图像中像素的信息;所述像素的信息包括所述像素的所述初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识;将所述像素的信息输入脉动单元中,通过所述脉动单元进行处理,输出所述像素的新的边缘标识。The scanning module is specifically configured to: sequentially read the pixel information in the rotated target image along the designated scanning direction; the pixel information includes the initial edge identifier of the pixel and the pixel information The current edge identifier of the target neighboring pixel; the information of the pixel is input into the pulsation unit, processed by the pulsation unit, and the new edge identifier of the pixel is output.
在一实施例中,所述目标邻域像素为所述像素对应的所有邻域像素中已被扫描过的部分。In an embodiment, the target neighboring pixel is a scanned part of all neighboring pixels corresponding to the pixel.
在一实施例中,所述扫描模块每次读取的像素数量根据数据总线的位宽确定。In an embodiment, the number of pixels read by the scanning module each time is determined according to the bit width of the data bus.
在一实施例中,所述边缘标识以二进制形式表示。In an embodiment, the edge identifier is represented in a binary form.
所述扫描模块每次读取的像素数量根据所述边缘标识的表示位数和数据总线的位宽所确定。The number of pixels read by the scanning module each time is determined according to the number of bits represented by the edge identifier and the bit width of the data bus.
在一实施例中,所述脉动单元的数量基于所述像素数量所确定。In an embodiment, the number of the pulsating units is determined based on the number of pixels.
在一实施例中,所述脉动单元以级联方式连接。In an embodiment, the pulsation units are connected in a cascade manner.
在一实施例中,所述指定扫描方向至少包括自左而右方向、自右向左方向、自上而下方向或者自下而上方向。In an embodiment, the designated scanning direction includes at least a left-to-right direction, a right-to-left direction, a top-down direction, or a bottom-up direction.
在一实施例中,所述装置还包括初始边缘标识确定模块。In an embodiment, the device further includes an initial edge identification determination module.
所述初始边缘标识确定模块用于:使用高斯滤波器对所述目标图像进行处理,获取处理后的目标图像;计算所述处理后的目标图像中每个像素的梯度值和梯度方向;基于所述像素的梯度方向和梯度值确定所述像素的所述初始的边缘标识。The initial edge identification determination module is used to process the target image by using a Gaussian filter to obtain the processed target image; calculate the gradient value and gradient direction of each pixel in the processed target image; The gradient direction and gradient value of the pixel determine the initial edge identifier of the pixel.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本邻域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。The device embodiments described above are merely illustrative. 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 it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments. Ordinary technicians in this neighborhood can understand and implement without creative work.
相应地,本申请实施例还提供了一种图像信号处理器,其包括上述任意一项所述的装置,所述图像信号处理器用于对图像传感器采集的图像信号进行处理。Correspondingly, an embodiment of the present application also provides an image signal processor, which includes any one of the above-mentioned devices, and the image signal processor is used to process image signals collected by an image sensor.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包 括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply one of these entities or operations. There is any such actual relationship or order between. The terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements that are not explicitly listed. Elements, or also include elements inherent to such processes, methods, articles, or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.
以上对本发明实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本邻域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The methods and devices provided by the embodiments of the present invention are described in detail above. Specific examples are used in this article to illustrate the principles and implementations of the present invention. The descriptions of the above embodiments are only used to help understand the methods and methods of the present invention. The core idea; at the same time, for ordinary technicians in this neighborhood, according to the idea of the present invention, there will be changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a reference to the present invention. limit.

Claims (29)

  1. 一种图像边缘检测方法,其特征在于,包括:An image edge detection method, characterized in that it comprises:
    获取目标图像;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息;Acquiring a target image; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
    在将所述目标图像旋转指定角度之后,沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识;After rotating the target image by a specified angle, scan the pixels in the rotated target image along the specified scanning direction to determine a new edge identifier for each pixel;
    根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。According to the new edge identifier of each pixel, the edge image of the target image is determined.
  2. 根据权利要求1所述的方法,其特征在于,所述沿指定扫描方向对旋转后的目标图像中的像素进行扫描,包括:The method according to claim 1, wherein the scanning pixels in the rotated target image along a designated scanning direction comprises:
    沿所述指定扫描方向对所述旋转后的目标图像中每个像素依次进行检测;Sequentially detecting each pixel in the rotated target image along the designated scanning direction;
    若检测到所述像素的所述初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,更改所述像素的所述初始的边缘标识。If it is detected that the initial edge identifier of the pixel meets the first specified condition, and the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, change the initial edge of the pixel Logo.
  3. 根据权利要求2所述的方法,其特征在于,还包括:The method according to claim 2, further comprising:
    将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。The target image is repeatedly rotated by the designated angle along the designated rotation direction, until the number of pixels of the initial edge identifier changed in the target image scanning is 0.
  4. 据权利要求2所述的方法,其特征在于,还包括:The method according to claim 2, further comprising:
    将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到所述目标图像自初始位置被旋转至少一周且在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。The target image is repeatedly rotated by the designated angle along the designated rotation direction, until the target image is rotated at least one circle from the initial position and the number of pixels of the initial edge identifier changed during the scan of the target image is 0.
  5. 根据权利要求2所述的方法,其特征在于,按照每个像素所包含的边缘信息的强弱程度从强到弱的顺序,所述边缘标识依次被划分为第一标识、第二标识和第三标识,其中,所述第一标识,所述第二标识和所述第三标识互不相同;The method according to claim 2, characterized in that, according to the order of the strength of the edge information contained in each pixel from strong to weak, the edge identifiers are sequentially divided into a first identifier, a second identifier, and a second identifier. Three identifications, wherein the first identification, the second identification and the third identification are different from each other;
    所述第一指定条件包括:所述像素的所述初始的边缘标识为所述第二标识;The first specified condition includes: the initial edge identifier of the pixel is the second identifier;
    所述第二指定条件包括:所述像素对应的任一邻域像素当前的边缘标识为所述第一标识。The second specified condition includes: the current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier.
  6. 根据权利要求5所述的方法,其特征在于,所述像素所包含的边缘信息通过所述像素的梯度值表示;The method according to claim 5, wherein the edge information contained in the pixel is represented by the gradient value of the pixel;
    所述第一标识表征所述像素的梯度值大于第一阈值;The first identifier indicates that the gradient value of the pixel is greater than a first threshold;
    所述第二标识表征所述像素的梯度值在所述第一阈值与第二阈值之间;所述第二阈值小于所述第一阈值;The second identifier indicates that the gradient value of the pixel is between the first threshold and the second threshold; the second threshold is less than the first threshold;
    所述第三标识表征所述像素的梯度值小于所述第二阈值。The third identifier indicates that the gradient value of the pixel is smaller than the second threshold.
  7. 根据权利要求1所述的方法,其特征在于,所述沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识,包括:The method according to claim 1, wherein the scanning pixels in the rotated target image along a designated scanning direction to determine a new edge identifier for each pixel comprises:
    沿所述指定扫描方向依次读取所述旋转后的目标图像中像素的信息;所述像素的信息包括所述像素的所述初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识;Read the information of the pixels in the rotated target image sequentially along the specified scanning direction; the information of the pixels includes the initial edge identifier of the pixel and the current edge identifier of the target neighboring pixel of the pixel ;
    将所述像素的信息输入脉动单元中,通过所述脉动单元进行处理,输出所述像素的新的边缘标识。The information of the pixel is input into a pulsation unit, processed by the pulsation unit, and a new edge identifier of the pixel is output.
  8. 根据权利要求7所述的方法,其特征在于,所述目标邻域像素为所述像素对应的所有邻域像素中已被扫描过的部分。8. The method according to claim 7, wherein the target neighborhood pixel is a scanned part of all neighborhood pixels corresponding to the pixel.
  9. 根据权利要求7所述的方法,其特征在于,每次读取的像素数量根据数据总线的位宽确定。8. The method according to claim 7, wherein the number of pixels read each time is determined according to the bit width of the data bus.
  10. 根据权利要求7所述的方法,其特征在于,所述边缘标识以二进制形式表示;The method according to claim 7, wherein the edge identifier is expressed in binary form;
    每次读取的像素数量根据所述边缘标识的表示位数和数据总线的位宽所确定。The number of pixels read each time is determined according to the number of bits indicated by the edge identifier and the bit width of the data bus.
  11. 根据权利要求9或10所述的方法,其特征在于,所述脉动单元的数量基于所述像素数量所确定。The method according to claim 9 or 10, wherein the number of pulsating units is determined based on the number of pixels.
  12. 根据权利要求11所述的方法,其特征在于,所述脉动单元以级联 方式连接。The method according to claim 11, wherein the pulsation units are connected in a cascaded manner.
  13. 根据权利要求1所述的方法,其特征在于,所述指定扫描方向至少包括自左而右方向、自右向左方向、自上而下方向或者自下而上方向。The method according to claim 1, wherein the designated scanning direction includes at least a left-to-right direction, a right-to-left direction, a top-down direction, or a bottom-up direction.
  14. 根据权利要求1所述的方法,其特征在于,所述像素的所述初始的边缘标识的确定包括以下步骤:The method according to claim 1, wherein the determination of the initial edge identifier of the pixel comprises the following steps:
    使用高斯滤波器对所述目标图像进行处理,获取处理后的目标图像;Processing the target image by using a Gaussian filter to obtain a processed target image;
    计算所述处理后的目标图像中每个像素的梯度值和梯度方向;Calculating the gradient value and gradient direction of each pixel in the processed target image;
    基于所述像素的梯度方向和梯度值确定所述像素的所述初始的边缘标识。The initial edge identifier of the pixel is determined based on the gradient direction and the gradient value of the pixel.
  15. 一种图像边缘检测装置,其特征在于,所述装置包括图像旋转模块和扫描模块;An image edge detection device, characterized in that the device includes an image rotation module and a scanning module;
    所述图像旋转模块用于将目标图像旋转指定角度;所述目标图像中的每个像素对应一初始的边缘标识,所述初始的边缘标识用于描述所述像素所包含的边缘信息;The image rotation module is used to rotate the target image by a specified angle; each pixel in the target image corresponds to an initial edge identifier, and the initial edge identifier is used to describe the edge information contained in the pixel;
    所述扫描模块用于沿指定扫描方向对旋转后的目标图像中的像素进行扫描,确定关于每个像素的新的边缘标识;The scanning module is configured to scan pixels in the rotated target image along a designated scanning direction, and determine a new edge identifier for each pixel;
    所述装置还用于根据每个像素的所述新的边缘标识,确定所述目标图像的边缘图像。The device is further configured to determine the edge image of the target image according to the new edge identifier of each pixel.
  16. 根据权利要求15所述的装置,其特征在于,The device of claim 15, wherein:
    所述扫描模块具体用于:沿所述指定扫描方向对所述旋转后的目标图像中每个像素依次进行检测;若检测到所述像素的所述初始的边缘标识符合第一指定条件,且所述像素对应的任一邻域像素当前的边缘标识符合第二指定条件,更改所述像素的所述初始的边缘标识。The scanning module is specifically configured to: sequentially detect each pixel in the rotated target image along the specified scanning direction; if it is detected that the initial edge identifier of the pixel meets the first specified condition, and If the current edge identifier of any neighboring pixel corresponding to the pixel meets the second specified condition, the initial edge identifier of the pixel is changed.
  17. 根据权利要求16所述的装置,其特征在于,The device of claim 16, wherein:
    所述图像旋转模块具体用于:将所述目标图像沿指定旋转方向重复旋转所述指定角度,直到在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。The image rotation module is specifically configured to: repeatedly rotate the target image along the specified rotation direction by the specified angle until the number of pixels whose initial edge identification is changed in the scan of the target image is 0.
  18. 根据权利要求16所述的装置,其特征在于,The device of claim 16, wherein:
    所述图像旋转模块具体用于:将所述目标图像沿指定旋转方向重复旋转指定角度,直到所述目标图像自初始位置被旋转至少一周且在目标图像扫描中被更改所述初始的边缘标识的像素数量为0为止。The image rotation module is specifically configured to: repeatedly rotate the target image along a specified rotation direction by a specified angle, until the target image is rotated at least one circle from the initial position and the initial edge identification is changed during the scan of the target image. The number of pixels is up to 0.
  19. 根据权利要求16所述的装置,其特征在于,按照每个像素所包括包含的边缘信息的强弱程度从强到弱的顺序,所述边缘标识依次被划分为第一标识、第二标识和第三标识;其中,所述第一标识,所述第二标识和所述第三标识互不相同;The device according to claim 16, wherein, according to the order of the strength of the edge information included in each pixel, the edge identification is divided into a first identification, a second identification and A third identifier; wherein the first identifier, the second identifier and the third identifier are different from each other;
    所述第一指定条件包括:所述像素的所述初始的边缘标识为所述第二标识;The first specified condition includes: the initial edge identifier of the pixel is the second identifier;
    所述第二指定条件包括:所述像素对应的任一邻域像素当前的边缘标识为所述第一标识。The second specified condition includes: the current edge identifier of any neighboring pixel corresponding to the pixel is the first identifier.
  20. 根据权利要求19所述的装置,其特征在于,所述像素所包含的边缘信息通过所述像素的梯度值表示;The device according to claim 19, wherein the edge information contained in the pixel is represented by a gradient value of the pixel;
    所述第一标识表征所述像素的梯度值大于第一阈值;The first identifier indicates that the gradient value of the pixel is greater than a first threshold;
    所述第二标识表征所述像素的梯度值在所述第一阈值与第二阈值之间;所述第二阈值小于所述第一阈值;The second identifier indicates that the gradient value of the pixel is between the first threshold and the second threshold; the second threshold is less than the first threshold;
    所述第三标识表征所述像素的梯度值小于所述第二阈值。The third identifier indicates that the gradient value of the pixel is smaller than the second threshold.
  21. 根据权利要求15所述的装置,其特征在于,所述扫描模块包括脉动单元;The device according to claim 15, wherein the scanning module comprises a pulsation unit;
    所述扫描模块具体用于:沿所述指定扫描方向依次读取所述旋转后的目标图像中像素的信息;所述像素的信息包括所述像素的所述初始的边缘标识以及所述像素的目标邻域像素当前的边缘标识;将所述像素的信息输入脉动单元中,通过所述脉动单元进行处理,输出所述像素的新的边缘标识。The scanning module is specifically configured to: sequentially read the pixel information in the rotated target image along the designated scanning direction; the pixel information includes the initial edge identifier of the pixel and the pixel information The current edge identifier of the target neighboring pixel; the information of the pixel is input into the pulsation unit, processed by the pulsation unit, and the new edge identifier of the pixel is output.
  22. 根据权利要求21所述的装置,其特征在于,所述目标邻域像素为所述像素对应的所有邻域像素中已被扫描过的部分。The device according to claim 21, wherein the target neighborhood pixel is a scanned part of all neighborhood pixels corresponding to the pixel.
  23. 根据权利要求21所述的装置,其特征在于,所述扫描模块每次读取的像素数量根据数据总线的位宽确定。The device according to claim 21, wherein the number of pixels read by the scanning module each time is determined according to the bit width of the data bus.
  24. 根据权利要求21所述的装置,其特征在于,所述边缘标识以二进制形式表示;The device according to claim 21, wherein the edge identifier is expressed in a binary form;
    所述扫描模块每次读取的像素数量根据所述边缘标识的表示位数和数据总线的位宽所确定。The number of pixels read by the scanning module each time is determined according to the number of bits represented by the edge identifier and the bit width of the data bus.
  25. 根据权利要求23或24所述的装置,其特征在于,所述脉动单元的数量基于所述像素数量所确定。The device according to claim 23 or 24, wherein the number of pulsating units is determined based on the number of pixels.
  26. 根据权利要求25所述的装置,其特征在于,所述脉动单元以级联方式连接。The device according to claim 25, wherein the pulsation unit is connected in a cascade manner.
  27. 根据权利要求15所述的装置,其特征在于,所述指定扫描方向至少包括自左而右方向、自右向左方向、自上而下方向或者自下而上方向。The device according to claim 15, wherein the specified scanning direction includes at least a left-to-right direction, a right-to-left direction, a top-down direction, or a bottom-up direction.
  28. 根据权利要求15所述的装置,其特征在于,所述装置还包括初始边缘标识确定模块;The device according to claim 15, wherein the device further comprises an initial edge identification determination module;
    所述初始边缘标识确定模块用于:使用高斯滤波器对所述目标图像进行处理,获取处理后的目标图像;计算所述处理后的目标图像中每个像素的梯度值和梯度方向;基于所述像素的梯度方向和梯度值确定所述像素的所述初始的边缘标识。The initial edge identification determination module is used to process the target image by using a Gaussian filter to obtain the processed target image; calculate the gradient value and gradient direction of each pixel in the processed target image; The gradient direction and gradient value of the pixel determine the initial edge identifier of the pixel.
  29. 一种图像信号处理器,其特征在于,包括如权利要求15~28任意一项所述的装置,所述图像信号处理器用于对图像传感器采集的图像信号进行处理。An image signal processor, comprising the device according to any one of claims 15 to 28, and the image signal processor is used to process image signals collected by an image sensor.
PCT/CN2020/078066 2020-03-05 2020-03-05 Image edge detection method and apparatus, and image signal processor WO2021174506A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/078066 WO2021174506A1 (en) 2020-03-05 2020-03-05 Image edge detection method and apparatus, and image signal processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/078066 WO2021174506A1 (en) 2020-03-05 2020-03-05 Image edge detection method and apparatus, and image signal processor

Publications (1)

Publication Number Publication Date
WO2021174506A1 true WO2021174506A1 (en) 2021-09-10

Family

ID=77613796

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/078066 WO2021174506A1 (en) 2020-03-05 2020-03-05 Image edge detection method and apparatus, and image signal processor

Country Status (1)

Country Link
WO (1) WO2021174506A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117686096A (en) * 2024-01-30 2024-03-12 大连云智信科技发展有限公司 Livestock and poultry animal body temperature detection method based on target detection

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5604821A (en) * 1992-02-28 1997-02-18 The University Of South Florida Structure and method for dynamic scene analysis
CN101493932A (en) * 2009-03-05 2009-07-29 西安电子科技大学 Watershed texture imaging segmenting method based on morphology Haar small wave texture gradient extraction
CN101763512A (en) * 2009-12-11 2010-06-30 西安电子科技大学 Method for semi-automatically detecting road target in high-resolution remote sensing images
CN104272323A (en) * 2013-02-14 2015-01-07 Lsi公司 Method and apparatus for image enhancement and edge verification using at least one additional image
CN106682678A (en) * 2016-06-24 2017-05-17 西安电子科技大学 Image angle point detection and classification method based on support domain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5604821A (en) * 1992-02-28 1997-02-18 The University Of South Florida Structure and method for dynamic scene analysis
CN101493932A (en) * 2009-03-05 2009-07-29 西安电子科技大学 Watershed texture imaging segmenting method based on morphology Haar small wave texture gradient extraction
CN101763512A (en) * 2009-12-11 2010-06-30 西安电子科技大学 Method for semi-automatically detecting road target in high-resolution remote sensing images
CN104272323A (en) * 2013-02-14 2015-01-07 Lsi公司 Method and apparatus for image enhancement and edge verification using at least one additional image
CN106682678A (en) * 2016-06-24 2017-05-17 西安电子科技大学 Image angle point detection and classification method based on support domain

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117686096A (en) * 2024-01-30 2024-03-12 大连云智信科技发展有限公司 Livestock and poultry animal body temperature detection method based on target detection
CN117686096B (en) * 2024-01-30 2024-04-16 大连云智信科技发展有限公司 Livestock and poultry animal body temperature detection method based on target detection

Similar Documents

Publication Publication Date Title
CN108805023B (en) Image detection method, device, computer equipment and storage medium
CN109509200B (en) Checkerboard corner detection method based on contour extraction and computer readable storage medium
WO2014160433A2 (en) Systems and methods for classifying objects in digital images captured using mobile devices
EP3617938B1 (en) Lane line processing method and device
WO2020135056A1 (en) Image processing method and device
US9245194B2 (en) Efficient line detection method
CN111681256A (en) Image edge detection method and device, computer equipment and readable storage medium
CN110647882A (en) Image correction method, device, equipment and storage medium
CN111144337B (en) Fire detection method and device and terminal equipment
CN114820594B (en) Method for detecting edge sealing defect of plate based on image, related equipment and storage medium
JP2011134012A (en) Image processor, image processing method for the same and program
CN114022503A (en) Detection method, detection system, device and storage medium
CN108229583B (en) Method and device for fast template matching based on main direction difference characteristics
CN113785181A (en) OLED screen point defect judgment method and device, storage medium and electronic equipment
CN112437948A (en) Image diagnosis support system and image diagnosis support device
CN112419207A (en) Image correction method, device and system
WO2021174506A1 (en) Image edge detection method and apparatus, and image signal processor
CN113052162B (en) Text recognition method and device, readable storage medium and computing equipment
CN113283439A (en) Intelligent counting method, device and system based on image recognition
WO2024016686A1 (en) Corner detection method and apparatus
CN110147765A (en) A kind of image processing method and device
KR102452511B1 (en) Method and apparatus for detection element image in drawings
CN116993654A (en) Camera module defect detection method, device, equipment, storage medium and product
US10176399B1 (en) Method and apparatus for optical character recognition of dot text in an image
CN112784737B (en) Text detection method, system and device combining pixel segmentation and line segment anchor

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20923084

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20923084

Country of ref document: EP

Kind code of ref document: A1