CN105354843A - Image boundary extraction method and system - Google Patents

Image boundary extraction method and system Download PDF

Info

Publication number
CN105354843A
CN105354843A CN201510728086.4A CN201510728086A CN105354843A CN 105354843 A CN105354843 A CN 105354843A CN 201510728086 A CN201510728086 A CN 201510728086A CN 105354843 A CN105354843 A CN 105354843A
Authority
CN
China
Prior art keywords
boundary pixel
pixel point
boundary
strong
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510728086.4A
Other languages
Chinese (zh)
Other versions
CN105354843B (en
Inventor
朱洪波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201510728086.4A priority Critical patent/CN105354843B/en
Publication of CN105354843A publication Critical patent/CN105354843A/en
Application granted granted Critical
Publication of CN105354843B publication Critical patent/CN105354843B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The present invention provides an image boundary extraction method and system. The method comprises: acquiring gradient strength and a gradient direction of each pixel point of an image; according to the gradient strengthen and the gradient direction of each pixel point, determining strong boundary pixel points and weak boundary pixel points of the image; using row as the unit, and according to the strong boundary pixel points and the weak boundary pixel points, determining and obtaining second canny boundary pixel points respectively in order from top to bottom and in order from bottom to top; and according to the strong boundary pixel points and the second canny boundary pixel points, extracting a boundary of the image. According to the image boundary extraction method and system provided by the present invention, parallelization of boundary connection is realized and the speed of canny boundary connection is improved.

Description

A kind of image boundary extraction method and system
Technical field
The present invention relates to technical field of image processing, particularly relate to a kind of image boundary extraction method and system.
Background technology
The place that in picture, gray-value variation is more violent, is just defined as border.Boundary Extraction, refers in Digital Image Processing, for a process of picture profile.It is generally acknowledged that Boundary Extraction to retain the violent region of the grey scale change of image, this mathematically, method is exactly differential (being exactly difference for digital picture) the most intuitively, in the angle of signal transacting, alternatively with Hi-pass filter, i.e. reserved high-frequency signal.
Card Buddhist nun boundary filter is the image boundary extraction algorithm being rich in great reputation, and it mainly comprises following several step: denoising, obtain gradient image, compute gradient direction and intensity, obtain strong and weak boundary pixel, and, contour connection.
The standing procedure of contour connection is initialization stack, and first all strong boundary pixel point press-in stacks, first element of then popping, judges whether its 8 neighbours exist weak boundary pixel, if existed, is then set to strong boundary pixel point and is pressed into stack.The element entering stack can not be pressed into stack again.Repeat this process until stack is for empty.This process nature is very complicated, for the element that each is popped, needs to calculate its coordinate, then obtains the side-play amount of image cursor, then takes out its all 8 neighbours and judge one by one, and operates accordingly, causes the speed of contour connection slower.
Summary of the invention
The invention provides a kind of image boundary extraction method and system, to solve in existing image boundary extraction scheme, the slow-footed problem of contour connection.
In order to solve the problem, the invention discloses a kind of image boundary extraction method, comprising:
Get gradient intensity and the gradient direction of each pixel of image;
Strong boundary pixel point and the weak boundary pixel of described image is determined according to the gradient intensity of each pixel described and gradient direction;
With behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel;
According to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
Correspondingly, the invention also discloses a kind of image boundary extraction system, comprising:
Intensity and direction acquisition module, for getting gradient intensity and the gradient direction of each pixel of image;
Strong and weak boundary pixel point determination module, for determining strong boundary pixel point and the weak boundary pixel of described image according to the gradient intensity of each pixel described and gradient direction;
Boundary Extraction module, for with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel, according to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
Compared with background technology, the present invention includes following advantage:
After the gradient intensity of each pixel getting image and gradient direction, strong boundary pixel point and the weak boundary pixel of image is determined according to the gradient intensity of each pixel and gradient direction, again with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to strong boundary pixel point and weak boundary pixel, according to strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of image, achieve the parallelization of contour connection, improve the speed of card Buddhist nun contour connection.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of a kind of image boundary extraction method in the embodiment of the present invention one;
Fig. 2 is the flow chart of steps of a kind of image boundary extraction method in the embodiment of the present invention two;
Fig. 3 is the structural representation of a kind of image boundary extraction system in the embodiment of the present invention three.
Embodiment
For enabling above-mentioned purpose of the present invention, feature and advantage become apparent more, and below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
A kind of image boundary extraction method and system provided by the invention is introduced in detail below by enumerating several specific embodiment.
Embodiment one
Introduce a kind of image boundary extraction method that the embodiment of the present invention provides in detail.
With reference to Fig. 1, show the flow chart of steps of a kind of image boundary extraction method in the embodiment of the present invention.
Step 100, carries out low-pass filtering to remove the impact of noise to image.
Low-pass filtering generally selects Gaussian filter, and its expression formula is wherein, the coordinate that (x, y) is pixel, G (x, y) be value after gaussian filtering, σ is standard deviation, and it is a two dimensional filter, but because it is that ranks are separable, so the mode that can be separated by ranks is realized, namely first carry out a horizontal Gausian low-pass filtering, its result through a vertical Gaussian filtering, namely obtains gaussian filtering image again.When σ is time, 5 tap Gaussian filters can be expressed as { 1,13,36,13,1}/64.The result that the image removed after noise can be expressed as the first step is expressed as I l(x, y).
Step 102, obtains horizontal gradient image and the VG (vertical gradient) image of each pixel through removing the image after noise.
Use an one dimension boundary filter to low-pass filtering image I l(x, y) carries out a horizontal filtering and obtains horizontal gradient image I h(x, y), and then to I l(x, y) carries out a vertical filtering and obtains VG (vertical gradient) image I v(x, y).One dimension boundary filter can select the derivative of Gaussian filter, as σ being time, 5 tap Gaussian derivative filter be-3 ,-29,0,29,3}/32.This step also can select other boundary filters, as sobel wave filter etc.
Step 104, determines according to the horizontal gradient image of each pixel and VG (vertical gradient) image the gradient intensity and the gradient direction that obtain each pixel.
Obtain image gradient intensity I g(x, y)=abs (I h(x, y))+abs (I v(x, y)).If I h(x, y) and I v(x, y) symbol is contrary, so arranges sign (x, y)=0, otherwise arranges sign (x, y)=1.Then computed image gradient direction
In practical implementations, abs (I h(x, y)) × tan (π/8) may be calculated abs (I h(x, y)) × 27146 > > 16, can complete with an instruction under x86 architecture; And abs (I h(x, y)) × tan (3 π/8) is calculated as (abs (I h(x, y)) × 27146 > > 16)+(abs (I h(x, y)) < < 1).Wherein, << shifts left, and >> is dextroposition.
High threshold T is set hwith Low threshold T l.Usually T is set h=2 × T l.Initialisation image boundary value I e(x, y) is 4, or other numbers being greater than 1.Then, when the gradient intensity of a pixel (x, y) is extreme value on its gradient direction, arrange the gradient intensity of a pixel (x, y) is maximum value on its gradient direction, if namely coordinate is the pixel of (x, y) is 45 degree of boundary pixel point, so I g(x, y) > I g(x+1, y-1) and I g(x, y) > I g(x-1, y+1); If the pixel that coordinate is (x, y) is 135 degree of boundary pixel point, so I g(x, y) > I g(x+1, y+1) and I g(x, y) > I g(x-1, y-1); If the pixel that coordinate is (x, y) is horizontal boundary pixel, so I g(x, y) > I g(x+1, y) and I g(x, y) > I g(x-1, y); If the pixel that coordinate is (x, y) is vertical boundary pixel, so I g(x, y) > I g(x, y+1) and I g(x, y) > I g(x, y-1).
Step 106, determines strong boundary pixel point and the weak boundary pixel of image according to the gradient intensity of each pixel and gradient direction.
Wherein, gradient intensity is greater than a Low threshold preset, and the pixel that gradient intensity is maximum value on gradient direction is weak boundary pixel; Gradient intensity is greater than a high threshold preset, and the pixel that gradient intensity is maximum value on gradient direction is strong boundary pixel point; Described default Low threshold is less than described default high threshold.
Step 108, with behavior unit, respectively according to order from the top down and order from bottom to top, determines to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel; According to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
Described step 108 can be divided into following two steps to perform, and comprises order from the top down i.e. coupling part and order from bottom to top i.e. coupling part from bottom to top from the top down, wherein, often walks and be divided into cal connecting parts and horizontal connecting portions.Usually, two steps perform once, also can perform repeatedly according to actual needs.
First introduce coupling part from the top down, it processes from the first row, then the second row, until last column terminates.Process for every a line is divided into again two parts, namely first performs vertical connection to it, then connects its executive level.
Cal connecting parts.First for any one pixel in current line, if there is at least one in its upper adjacent 3 pixels for strong boundary pixel point, and current pixel point is weak boundary pixel, and so putting current pixel point is strong boundary pixel point.This process can realize with single-instruction multiple-data stream (SIMD) (SingleInstructionMultipleData, SIMD) parallel instructions.
Horizontal connecting portions.For any one weak boundary pixel in current line, if it can be connected to strong boundary pixel point by continuous print weak boundary pixel in current line, so putting current pixel point is strong boundary pixel point.This process can be realized by long subtraction.First forward subtraction, connects from left to right to current line; Another mistake, to subtraction, connects from right to left from current line.The principle of work of long subtraction is exemplified below: for a continuous print image boundary value I e(x, y) pixel vectors vexe, allow it and one be 1 vector compare, then will be set to 2 for genuine position, if this vector is vexn, then deduct vector v exn with vector v exe, result is vector v exr, the vector being 255 entirely by vector v exr and all elements compares, result to be genuine position be exactly need to be set to 1 position, be namely set to strong boundary pixel point.This principle is very simple, at the subtraction that strong boundary pixel point establishes 2 to carry out some directions, so it can produce borrow, because be lint-long integer subtraction, before all 0, namely weak boundary pixel all can be set to 255, and this borrow is until next strong boundary pixel point or non-border pixel point just can stop, and all 255 of middle generation is all the point needing to be set to strong boundary pixel.
Then introduce coupling part from bottom to top, it processes from last column, then row second from the bottom, until the first row terminates.Process for every a line is divided into again two parts, namely first performs vertical connection to it, then connects its executive level.Introduce two part respectively below.
Cal connecting parts.First for any one pixel in current line, if there is at least one strong boundary pixel point in its lower adjacent 3 pixels, and current pixel point is weak boundary pixel, and so putting current pixel point is strong boundary pixel point.Can realize by effective SIMD parallel instructions.
Horizontal connecting portions.Detailed process is identical with the above-mentioned horizontal connecting portions be connected from the top down, no longer repeats here.
The strong boundary pixel point original in order to differentiate between images and the strong boundary pixel point after weak boundary pixel is upgraded, original strong boundary pixel point can being called the first card Buddhist nun boundary pixel point, being called the second card Buddhist nun boundary pixel point by upgrading by weak boundary pixel the strong boundary pixel point obtained.
The set of first card Buddhist nun's boundary pixel point and the second card Buddhist nun boundary pixel point is exactly the card Buddhist nun boundary pixel point needing to obtain, i.e. the border of image.
In sum, embodiment of the present invention technical scheme is after the gradient intensity of each pixel getting image and gradient direction, strong boundary pixel point and the weak boundary pixel of image is determined according to the gradient intensity of each pixel and gradient direction, again with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to strong boundary pixel point and weak boundary pixel, according to strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of image, achieve the parallelization of contour connection, improve the speed of card Buddhist nun contour connection.
Embodiment two
Introduce a kind of image boundary extraction method that the embodiment of the present invention provides in detail.
With reference to Fig. 2, show the flow chart of steps of a kind of image boundary extraction method in the embodiment of the present invention.
Step 200, carries out low-pass filtering to remove the impact of noise to image.
Low-pass filtering generally selects Gaussian filter, and its expression formula is wherein, the coordinate that (x, y) is pixel, G (x, y) be value after gaussian filtering, σ is standard deviation, and it is a two dimensional filter, but because it is that ranks are separable, so the mode that can be separated by ranks is realized, namely first carry out a horizontal Gausian low-pass filtering, its result through a vertical Gaussian filtering, namely obtains gaussian filtering image again.When σ is time, 5 tap Gaussian filters can be expressed as { 1,13,36,13,1}/64.The result that the image removed after noise can be expressed as the first step is expressed as I l(x, y).
Step 202, obtains horizontal gradient image and the VG (vertical gradient) image of each pixel through removing the image after noise.
Use an one dimension boundary filter to low-pass filtering image I l(x, y) carries out a horizontal filtering and obtains horizontal gradient image I h(x, y), and then to I l(x, y) carries out a vertical filtering and obtains VG (vertical gradient) image I v(x, y).One dimension boundary filter can select the derivative of Gaussian filter, as σ being time, 5 tap Gaussian derivative filter be-3 ,-29,0,29,3}/32.This step also can select other boundary filters, as sobel wave filter etc.
Step 204, determines according to the horizontal gradient image of each pixel and VG (vertical gradient) image the gradient intensity and the gradient direction that obtain each pixel.
Obtain image gradient intensity I g(x, y)=abs (I h(x, y))+abs (I v(x, y)).If I h(x, y) and I v(x, y) symbol is contrary, so arranges sign (x, y)=0, otherwise arranges sign (x, y)=1.Then computed image gradient direction
In practical implementations, abs (I h(x, y)) × tan (π/8) may be calculated abs (I h(x, y)) × 27146 > > 16, can complete with an instruction under x86 architecture; And abs (I h(x, y)) × tan (3 π/8) is calculated as (abs (I h(x, y)) × 27146 > > 16)+(abs (I h(x, y)) < < 1).Wherein, << shifts left, and >> is dextroposition.
High threshold T is set hwith Low threshold T l.Usually T is set h=2 × T l.Initialisation image boundary value I e(x, y) is 4, or other numbers being greater than 1.Then, when the gradient intensity of a pixel (x, y) is extreme value on its gradient direction, arrange the gradient intensity of a pixel (x, y) is maximum value on its gradient direction, if namely coordinate is the pixel of (x, y) is 45 degree of boundary pixel point, so I g(x, y) > I g(x+1, y-1) and I g(x, y) > I g(x-1, y+1); If the pixel that coordinate is (x, y) is 135 degree of boundary pixel point, so I g(x, y) > I g(x+1, y+1) and I g(x, y) > I g(x-1, y-1); If the pixel that coordinate is (x, y) is horizontal boundary pixel, so I g(x, y) > I g(x+1, y) and I g(x, y) > I g(x-1, y); If the pixel that coordinate is (x, y) is vertical boundary pixel, so I g(x, y) > I g(x, y+1) and I g(x, y) > I g(x, y-1).
Step 206, determines strong boundary pixel point and the weak boundary pixel of image according to the gradient intensity of each pixel and gradient direction.(step 206 obtains strong and weak boundary pixel point part)
Wherein, gradient intensity is greater than a Low threshold preset, and the pixel that gradient intensity is maximum value on gradient direction is weak boundary pixel; Gradient intensity is greater than a high threshold preset, and the pixel that gradient intensity is maximum value on gradient direction is strong boundary pixel point; Described default Low threshold is less than described default high threshold.
Step 208, with behavior unit, respectively according to order from the top down and order from bottom to top, determines to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel; According to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
Preferably, in described step 208, with behavior unit, respectively according to order from the top down and order from bottom to top, be alternately connected according to described strong boundary pixel point and weak boundary pixel and obtain the second card Buddhist nun boundary pixel point at least one times.That is, can according to actual conditions, alternate run being linked in sequence and obtaining the second card Buddhist nun boundary pixel point and being linked in sequence from bottom to top obtains the second card Buddhist nun boundary pixel point from the top down at least one times.
Also the situation not completing alternate run is comprised, namely with behavior unit, according to order from the top down, be connected the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel according to described strong boundary pixel point, with order from bottom to top, to be connected according to described strong boundary pixel point the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel identical or different.As from the top down be linked in sequence once, then from bottom to top be linked in sequence once, finally order from the top down connects once again, then terminates.
Described step 208 can be divided into following two steps to perform, and comprises order from the top down i.e. coupling part and order from bottom to top i.e. coupling part from bottom to top from the top down, wherein, often walks and be divided into cal connecting parts and horizontal connecting portions.Usually, two steps perform once, also can perform repeatedly according to actual needs.
First introduce coupling part from the top down, it processes from the first row, then the second row, until last column terminates.Process for every a line is divided into again two parts, namely first performs vertical connection to it, then connects its executive level.
Cal connecting parts.First for any one pixel in current line, if there is at least one in its upper adjacent 3 pixels for strong boundary pixel point, and current pixel point is weak boundary pixel, and so putting current pixel point is strong boundary pixel point.This process can realize with single-instruction multiple-data stream (SIMD) (SingleInstructionMultipleData, SIMD) parallel instructions.
Horizontal connecting portions.Particularly, for any one weak boundary pixel in current line, if it can be connected to strong boundary pixel point by continuous print weak boundary pixel in current line, so putting current pixel point is strong boundary pixel point.This process can be realized by long subtraction.First forward subtraction, connects from left to right to current line; Another mistake, to subtraction, connects from right to left from current line.
The principle of work of long subtraction is exemplified below: for a continuous print image boundary value I e(x, y) pixel vectors vexe, allow it and one be 1 vector compare, then will be set to 2 for genuine position, if this vector is vexn, then deduct vector v exn with vector v exe, result is vector v exr, the vector being 255 entirely by vector v exr and all elements compares, result to be genuine position be exactly need to be set to 1 position, be namely set to strong boundary pixel point.This principle is very simple, at the subtraction that strong boundary pixel point establishes 2 to carry out some directions, so it can produce borrow, because be lint-long integer subtraction, before all 0, namely weak boundary pixel all can be set to 255, and this borrow is until next strong boundary pixel point or non-border pixel point just can stop, and all 255 of middle generation is all the point needing to be set to strong boundary pixel.
Then introduce coupling part from bottom to top, it processes from last column, then row second from the bottom, until the first row terminates.Process for every a line is divided into again two parts, namely first performs vertical connection to it, then connects its executive level.Introduce two part respectively below.
Cal connecting parts.First for any one pixel in current line, if there is at least one strong boundary pixel point in its lower adjacent 3 pixels, and current pixel point is weak boundary pixel, and so putting current pixel point is strong boundary pixel point.Can realize by effective SIMD parallel instructions.
Horizontal connecting portions.Detailed process is identical with the above-mentioned horizontal connecting portions be connected from the top down, no longer repeats here.
The strong boundary pixel point original in order to differentiate between images and the strong boundary pixel point after weak boundary pixel is upgraded, original strong boundary pixel point can being called the first card Buddhist nun boundary pixel point, being called the second card Buddhist nun boundary pixel point by upgrading by weak boundary pixel the strong boundary pixel point obtained.
The set of first card Buddhist nun's boundary pixel point and the second card Buddhist nun boundary pixel point is exactly the card Buddhist nun boundary pixel point needing to obtain, i.e. the border of image.Preferably, according to the content of above-mentioned coupling part from the top down and coupling part from bottom to top, described step 208 can comprise:
Coupling part from the top down:
Step 2081, with behavior unit, according to order from the top down, from the first row, to last column, with the arbitrary pixel in current line for target pixel points, is updated to strong boundary pixel point by the target pixel points meeting first condition.With the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point.
Described first condition be with adjacent 3 pixels in described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
Described second condition is that described target pixel points is connected to strong boundary pixel point by continuous print weak boundary pixel in described current line.
Coupling part from bottom to top:
Step 2082, with behavior unit, according to order from bottom to top, from last column, to the first row, with the arbitrary pixel in current line for target pixel points, is updated to strong boundary pixel point by the target pixel points meeting Article 3 part.With the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point.
Described Article 3 part be with adjacent 3 pixels under described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
Step 2083, according to strong boundary pixel point and the second card Buddhist nun boundary pixel point, extracts the border of image.
If the SIMD instruction set position long of current computer is 128, it can calculate 16 8 unsigned numbers or signed number simultaneously, or 8 16 figure places, or 4 32 figure places, or 2 64 figure places.Vertical connection is that the mode of 8 unsigned number vectors of 16 is carried out with word length, when first 16 byte calculates complete, then carries out next 16 bytes, until current line calculates complete.For 16 bytes, its computation process is described below:
If the image boundary value (vector) of each pixel is as shown in table 1 in current line, current 16 byte vector shown in centre, wherein 0 is weak boundary pixel, and 1 is strong boundary pixel point, and 4 is non-boundary pixel point.
Table 1
And on it in adjacent lines each pixel image boundary value as shown in table 2, wherein first 4 beginning 16 byte vector be directly over current line correspondence vector.
Table 2
Take out the left adjacent vector of each vector top in current line respectively, directly over adjacent vector and right adjacent vector as shown in table 3:
0 4 4 4 1 4 4 4 1 4 4 4 4 4 4 4
4 4 4 1 4 4 4 1 4 4 4 4 4 4 4 4
4 4 1 4 4 4 1 4 4 4 4 4 4 4 4 4
Table 3
Compare with each vector sum vector 1 (namely 16 bytes are all the vectors of 1) in table 3 and obtain as the vector of 3 in table 4, the position being 1 becomes 255, and other position is 0:
0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0
0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0
0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0
Table 4
3 vectors in his-and-hers watches 4 perform or operation obtains as the upper adjacent mask vector in table 5:
0 0 255 255 255 0 255 255 255 0 0 0 0 0 0 0
Table 5
Then each vector in current line and vector 0 are compared the vector obtained as in table 6, i.e. current weak boundary vector:
0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0
Table 6
Performed and operation with the upper adjacent mask vector in table 5 by current weak boundary vector in table 6, obtaining as the strong Margin Vector in table 7, is wherein that the position of 255 is exactly the vector needing to be set to strong Margin Vector in each vector of current line:
0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0
Table 7
Because 255 is negative one, so with the vector in current line deduct strong Margin Vector just can obtain upgrade after current line in vector, as shown in table 8, visible needs are set to the pixel of strong boundary pixel point, as the 4th byte and the 8th byte, be set to strong boundary pixel point, and they are also that it has strong boundary pixel point to exist in adjacent 3 pixels, and current pixel point is weak boundary pixel.
4 4 4 1 4 4 4 1 4 4 4 0 4 4 4 1
Table 8
Introduce horizontal connecting portions below, horizontal connecting portions 128 long subtractions realize, be divided into 2 parts, Part I connects forward, if namely a pixel is weak boundary pixel, and a strong boundary pixel point can be found by a series of continuous print weak boundary pixel left, so these weak boundary pixels are all set to strong boundary pixel point.Part II connects backward, if namely a pixel is weak boundary pixel, and can find a strong boundary pixel point by a series of continuous print weak boundary pixel to the right, so these weak boundary pixels are all set to strong boundary pixel point.Introduce coupling part forward below.
Connect forward and carry out from left to right in units of 15 pixels, complete 15 pixels of single treatment then process next group 15 pixels, until current line is disposed.Why single treatment 15 pixels are because need pressure pixel to ensure borrow, can pass through 16 pixel borders.If each vector is as shown in table 9 in current line:
Table 9
16 byte long vector sum vectors 1 of current line are compared the mask vector obtained as in table 10:
0 255 255 255 0 255 255 0 0 0 0 255 255 0 255 255
Table 10
Mask vector in table 10 and vector 4 are carried out or operate the subtraction vector obtained as in table 11:
0 4 4 4 0 4 4 0 0 0 0 4 4 0 4 4
Table 11
Then carry out 128 subtraction operations with the subtraction vector in vector sum table 11 each in current line, obtain as the second mask vector in table 12:
0 253 252 252 255 252 252 255 255 255 255 252 252 3 253 252
Table 12
Due to borrow operation, all weak boundary pixels that can be connected to strong boundary pixel point by a continuous print weak boundary pixel left side in each vector of current line, in the second mask vector, all become 255, all non-border pixel points and strong boundary pixel point are not then 255.So the second mask vector and vector 255 are compared, obtain as the second subtraction vector in table 13, it is exactly the vector needing to be set to strong boundary pixel point:
0 0 0 0 255 0 0 255 255 255 255 0 0 0 0 0
Table 13
Then each vector in the current line after upgrading can be obtained with the second subtraction vector that vector each in current line deducts in table 13, as shown in table 14:
0 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1
Table 14
Coupling part and join algorithm is similar forward backward, just it carries out in units of 15 pixels from right to left, before each operation, first current vector is loaded, then rearrange (shuffle) operation to the element that it carries out in array by random sequence, last byte is moved on to most significant digit, second byte moves on to a time high position,, the byte of most significant digit then moves on to lowest order.If each vector is as shown in Table 15 in current line:
4 4 4 4 4 4 0 4 4 4 4 0 4 4 0 4
Table 15
Vector sum each in current line is performed shuffle operation as vector each in table 16, obtains as each vector in table 17:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Table 16
4 0 4 4 0 4 4 4 4 0 4 4 4 4 4 4
Table 17
Visible byte order is all put upside down, and 128 subtractions so just can be allowed to realize carry backward, then realize the connection forward of weak boundary pixel.
On some platforms, data word length is 128, but there is no 128 subtraction operations, and only have 64 subtraction operations, 128 subtraction operations can be simulated by certain operations at this platform, be exactly after 64 subtraction operations, judge whether the most significant digit of first 64 bit data is 1, if be 1, so second 64 bit data is performed and subtract 1 operation, namely deduct the borrow of first 64 bit data.Or on this platform, 64 subtraction single treatment 7 bit data can be used.
The embodiment of the present invention is not limited to above technology contents, and the architecture of what first the embodiment of the present invention was protected an is contour connection, connects exactly as mentioned above first from the top down, realizes left connection and right connection to every row with lint-long integer subtraction simultaneously.Then connect from bottom to top, realized to every capable continuation lint-long integer subtraction simultaneously left connection and right connection.
In sum, embodiment of the present invention technical scheme is after the gradient intensity of each pixel getting image and gradient direction, strong boundary pixel point and the weak boundary pixel of image is determined according to the gradient intensity of each pixel and gradient direction, again with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to strong boundary pixel point and weak boundary pixel, according to strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of image, achieve the parallelization of contour connection, improve the speed of card Buddhist nun contour connection.
And, do not rely on number and the density of pixel, so card Buddhist nun contour connection speed is very stable.
Embodiment three
Introduce a kind of image boundary extraction system that the embodiment of the present invention provides in detail.
With reference to Fig. 3, show the structural representation of a kind of image boundary extraction system in the embodiment of the present invention.
Described system can comprise: intensity and direction acquisition module 300, strong and weak boundary pixel point determination module 302, Boundary Extraction module 304.
Introduce the relation between the function of each module and each module below respectively in detail.
Intensity and direction acquisition module 300, for getting gradient intensity and the gradient direction of each pixel of image.
Strong and weak boundary pixel point determination module 302, for determining strong boundary pixel point and the weak boundary pixel of described image according to the gradient intensity of each pixel described and gradient direction.
Wherein, gradient intensity is greater than default Low threshold, and the pixel that gradient intensity is maximum value on gradient direction is weak boundary pixel.
Gradient intensity is greater than default high threshold, and the pixel that gradient intensity is maximum value on gradient direction is strong boundary pixel point.
Described default Low threshold is less than described default high threshold.
Boundary Extraction module 304, for with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel, according to described strong boundary pixel point and described second card Buddhist nun boundary pixel point, extract the border of described image.
At one preferably in embodiment of the present invention, described Boundary Extraction module 304 is with behavior unit, respectively according to order from the top down and order from bottom to top, be alternately connected according to described strong boundary pixel point and weak boundary pixel and obtain the second card Buddhist nun boundary pixel point at least one times.
And, described Boundary Extraction module 304 is with behavior unit, according to order from the top down, be connected the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel according to described strong boundary pixel point, with order from bottom to top, to be connected according to described strong boundary pixel point the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel identical or different.
At one preferably in embodiment of the present invention, described Boundary Extraction module 304 is with behavior unit, according to order from the top down, from the first row, to last column, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting first condition is updated to strong boundary pixel point, with the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point; With behavior unit, according to order from bottom to top, from last column, to the first row, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting Article 3 part is updated to strong boundary pixel point; With the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point.
Wherein, described first condition be with adjacent 3 pixels in described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
Described second condition is that described target pixel points is connected to strong boundary pixel point by continuous print weak boundary pixel in described current line.
Described Article 3 part be with adjacent 3 pixels under described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
In sum, embodiment of the present invention technical scheme is after the gradient intensity of each pixel getting image and gradient direction, strong boundary pixel point and the weak boundary pixel of image is determined according to the gradient intensity of each pixel and gradient direction, again with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to strong boundary pixel point and weak boundary pixel, according to strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of image, achieve the parallelization of contour connection, improve the speed of card Buddhist nun contour connection.
And, do not rely on number and the density of pixel, so card Buddhist nun contour connection speed is very stable.
For device embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Above to a kind of image boundary extraction method and system that the embodiment of the present invention provides, be described in detail, apply specific case herein to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (12)

1. an image boundary extraction method, is characterized in that, comprising:
Get gradient intensity and the gradient direction of each pixel of image;
Strong boundary pixel point and the weak boundary pixel of described image is determined according to the gradient intensity of each pixel described and gradient direction;
With behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel;
According to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
2. method according to claim 1, it is characterized in that, with behavior unit, respectively according to order from the top down and order from bottom to top, be alternately connected according to described strong boundary pixel point and weak boundary pixel and obtain the second card Buddhist nun boundary pixel point at least one times.
3. method according to claim 2, it is characterized in that, with behavior unit, according to order from the top down, be connected the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel according to described strong boundary pixel point, with order from bottom to top, to be connected according to described strong boundary pixel point the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel identical or different.
4. method according to claim 1, is characterized in that, describedly determines to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel, comprising:
With behavior unit, according to order from the top down, from the first row, to last column, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting first condition is updated to strong boundary pixel point, with the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point;
With behavior unit, according to order from bottom to top, from last column, to the first row, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting Article 3 part is updated to strong boundary pixel point; With the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point.
5. method according to claim 4, is characterized in that,
Described first condition be with adjacent 3 pixels in described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel;
Described second condition is that described target pixel points is connected to strong boundary pixel point by continuous print weak boundary pixel in described current line;
Described Article 3 part be with adjacent 3 pixels under described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
6. method according to claim 1, is characterized in that,
Gradient intensity is greater than default Low threshold, and the pixel that gradient intensity is maximum value on gradient direction is weak boundary pixel;
Gradient intensity is greater than default high threshold, and the pixel that gradient intensity is maximum value on gradient direction is strong boundary pixel point;
Described default Low threshold is less than described default high threshold.
7. an image boundary extraction system, is characterized in that, comprising:
Intensity and direction acquisition module, for getting gradient intensity and the gradient direction of each pixel of image;
Strong and weak boundary pixel point determination module, for determining strong boundary pixel point and the weak boundary pixel of described image according to the gradient intensity of each pixel described and gradient direction;
Boundary Extraction module, for with behavior unit, respectively according to order from the top down and order from bottom to top, determine to obtain the second card Buddhist nun boundary pixel point according to described strong boundary pixel point and weak boundary pixel, according to described strong boundary pixel point and the second card Buddhist nun boundary pixel point, extract the border of described image.
8. system according to claim 7, it is characterized in that, described Boundary Extraction module, with behavior unit, respectively according to order from the top down and order from bottom to top, is alternately connected according to described strong boundary pixel point and weak boundary pixel and obtains the second card Buddhist nun boundary pixel point at least one times.
9. system according to claim 8, it is characterized in that, described Boundary Extraction module is with behavior unit, according to order from the top down, be connected the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel according to described strong boundary pixel point, with order from bottom to top, to be connected according to described strong boundary pixel point the number of times obtaining the second card Buddhist nun boundary pixel point with weak boundary pixel identical or different.
10. system according to claim 7, it is characterized in that, described Boundary Extraction module is with behavior unit, according to order from the top down, from the first row, to last column, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting first condition is updated to strong boundary pixel point, with the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point; With behavior unit, according to order from bottom to top, from last column, to the first row, with the arbitrary pixel in current line for target pixel points, the target pixel points meeting Article 3 part is updated to strong boundary pixel point; With the arbitrary weak boundary pixel in current line for target pixel points, the target pixel points meeting second condition is updated to strong boundary pixel point, the pixel being updated to strong boundary pixel point is defined as the second card Buddhist nun boundary pixel point.
11. systems according to claim 10, is characterized in that,
Described first condition be with adjacent 3 pixels in described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel;
Described second condition is that described target pixel points is connected to strong boundary pixel point by continuous print weak boundary pixel in described current line;
Described Article 3 part be with adjacent 3 pixels under described target pixel points in there is at least one strong boundary pixel point, and described target pixel points is weak boundary pixel.
12. systems according to claim 7, is characterized in that,
Gradient intensity is greater than default Low threshold, and the pixel that gradient intensity is maximum value on gradient direction is weak boundary pixel;
Gradient intensity is greater than default high threshold, and the pixel that gradient intensity is maximum value on gradient direction is strong boundary pixel point;
Described default Low threshold is less than described default high threshold.
CN201510728086.4A 2015-10-30 2015-10-30 A kind of image boundary extraction method and system Active CN105354843B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510728086.4A CN105354843B (en) 2015-10-30 2015-10-30 A kind of image boundary extraction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510728086.4A CN105354843B (en) 2015-10-30 2015-10-30 A kind of image boundary extraction method and system

Publications (2)

Publication Number Publication Date
CN105354843A true CN105354843A (en) 2016-02-24
CN105354843B CN105354843B (en) 2017-12-05

Family

ID=55330810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510728086.4A Active CN105354843B (en) 2015-10-30 2015-10-30 A kind of image boundary extraction method and system

Country Status (1)

Country Link
CN (1) CN105354843B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105913415A (en) * 2016-04-06 2016-08-31 吴晓军 Image sub-pixel edge extraction method having extensive adaptability
CN109448012A (en) * 2018-10-29 2019-03-08 山东浪潮云信息技术有限公司 A kind of method for detecting image edge and device
WO2020037566A1 (en) * 2018-08-22 2020-02-27 深圳配天智能技术研究院有限公司 Image processing and matching method and device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090046930A1 (en) * 2007-08-14 2009-02-19 Electronics And Telecommunications Research Institute Method and apparatus for extracting line segments from image using incremental pixel extension
CN102044071A (en) * 2010-12-28 2011-05-04 上海大学 Single-pixel margin detection method based on FPGA

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090046930A1 (en) * 2007-08-14 2009-02-19 Electronics And Telecommunications Research Institute Method and apparatus for extracting line segments from image using incremental pixel extension
CN102044071A (en) * 2010-12-28 2011-05-04 上海大学 Single-pixel margin detection method based on FPGA

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
QIAN XU 等: "A Distributed Canny Edge Detector: Algorithm and FPGA Implementation", 《IEEE TRANSACTIONS ON IMAGE PROCESSING》 *
YUANCHENG "MIKE" LUO 等: "Canny Edge Detection on NVIDIA CUDA", 《 COMPUTER VISION AND PATTERN RECOGNITION WORKSHOPS, 2008. CVPRW "08. IEEE COMPUTER SOCIETY CONFERENCE ON》 *
余洪山 等: "一种改进型Canny边缘检测算法", 《计算机工程与应用》 *
唐闻: "X自适应阈值Canny算子在图像边缘提取中的应用", 《硅谷》 *
齐丹阳 等: "一种改进边缘连接的Canny边缘检测算法", 《武汉科技大学学报》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105913415A (en) * 2016-04-06 2016-08-31 吴晓军 Image sub-pixel edge extraction method having extensive adaptability
CN105913415B (en) * 2016-04-06 2018-11-30 博众精工科技股份有限公司 A kind of image sub-pixel edge extracting method with extensive adaptability
WO2020037566A1 (en) * 2018-08-22 2020-02-27 深圳配天智能技术研究院有限公司 Image processing and matching method and device and storage medium
CN109448012A (en) * 2018-10-29 2019-03-08 山东浪潮云信息技术有限公司 A kind of method for detecting image edge and device

Also Published As

Publication number Publication date
CN105354843B (en) 2017-12-05

Similar Documents

Publication Publication Date Title
CN108681994B (en) Image processing method and device, electronic equipment and readable storage medium
CN113870293B (en) Image processing method, image processing device, electronic equipment and storage medium
CN103679169B (en) The extracting method of characteristics of image and device
KR101506060B1 (en) Feature-based signatures for image identification
Menaka et al. FPGA implementation of low power and high speed image edge detection algorithm
CN108765282B (en) Real-time super-resolution method and system based on FPGA
CN111091572B (en) Image processing method and device, electronic equipment and storage medium
CN111444807B (en) Target detection method, device, electronic equipment and computer readable medium
US10582179B2 (en) Method and apparatus for processing binocular disparity image
CN111340109A (en) Image matching method, device, equipment and storage medium
CN108960012B (en) Feature point detection method and device and electronic equipment
CN105354843A (en) Image boundary extraction method and system
Chen et al. Fast defocus map estimation
EP3038017A1 (en) Method of generating descriptor for interest point in image and apparatus implementing the same
Spizhevoi et al. OpenCV 3 Computer Vision with Python Cookbook: Leverage the power of OpenCV 3 and Python to build computer vision applications
CN112183517B (en) Card edge detection method, device and storage medium
US20230252605A1 (en) Method and system for a high-frequency attention network for efficient single image super-resolution
Kang et al. ASF-YOLO: A novel YOLO model with attentional scale sequence fusion for cell instance segmentation
WO2023019682A1 (en) Watermark removal method and apparatus, terminal device and readable storage medium
CN114418987B (en) Retina blood vessel segmentation method and system with multi-stage feature fusion
CN106470293B (en) Image processing apparatus and image processing method
CN111414823B (en) Human body characteristic point detection method and device, electronic equipment and storage medium
CN106683044B (en) Image splicing method and device of multi-channel optical detection system
CN104517264A (en) Image processing method and device
CN116012393A (en) Carton point cloud segmentation method, device and processing equipment

Legal Events

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