CN103839246B - Method and apparatus for obtaining image contour line - Google Patents

Method and apparatus for obtaining image contour line Download PDF

Info

Publication number
CN103839246B
CN103839246B CN201210472406.0A CN201210472406A CN103839246B CN 103839246 B CN103839246 B CN 103839246B CN 201210472406 A CN201210472406 A CN 201210472406A CN 103839246 B CN103839246 B CN 103839246B
Authority
CN
China
Prior art keywords
image
contour line
edge pixel
characteristic vector
pixel point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210472406.0A
Other languages
Chinese (zh)
Other versions
CN103839246A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201210472406.0A priority Critical patent/CN103839246B/en
Publication of CN103839246A publication Critical patent/CN103839246A/en
Application granted granted Critical
Publication of CN103839246B publication Critical patent/CN103839246B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The invention relates to a method for obtaining an image contour line. The method comprises the following steps: obtaining an image and calculating gradient information of the image; calculating a structure feature of the image according to the gradient information; calculating a feature vector of the structure feature; extracting a vertical component of the feature vector and extracting an edge pixel point of the image based on the vertical component of the feature vector; and generating a contour line according to the edge pixel point. In addition, the invention also provides an apparatus for obtaining an image contour line. With the method and the apparatus, the accuracy can be improved.

Description

Obtain the method and device of image contour line
Technical field
The present invention relates to technical field of image processing, more particularly to a kind of method and device for obtaining image contour line.
Background technology
In the image processing arts, it usually needs the contour line of the subregion in image is obtained by rim detection, use In the differentiation subregion and whole image.For example, human region contour line in the picture can be obtained by rim detection, from And take out from image by human region.
In conventional art, the method for obtaining image contour line generally calculates the gradient information of each pixel of image, then will The gradient information of image is compared with threshold value, the pixel for obtaining gradient information more than threshold value as edge pixel point, finally The edge pixel for getting point is coupled together the contour line to form image.
However, being set in threshold value by the method for the gradient information and threshold value acquisition image contour line of pixel in conventional art When putting less, the contour line in image is more, is unfavorable for defined area scope;When threshold value arranges larger, the contour line for obtaining Larger space then occurs.Therefore, the method for obtaining image contour line in conventional art is obtaining the accurate of image contour line There is obvious deficiency in property.
The content of the invention
Based on this, it is necessary to provide a kind of method of the acquisition image contour line that can improve accuracy.
A kind of method for obtaining image contour line, including:
Image is obtained, the gradient information of described image is calculated;
The architectural feature of described image is calculated according to the gradient information;
Calculate the characteristic vector of the architectural feature;
The vertical component of the characteristic vector is extracted, and described image is extracted according to the vertical component of the characteristic vector Edge pixel point;
Contour line is generated according to the edge pixel point.
Additionally, there is a need to the device for providing a kind of acquisition image contour line that can improve accuracy.
A kind of device for obtaining image contour line, including:
Gradient information acquisition module, for obtaining image, calculates the gradient information of described image;
Architectural feature acquisition module, for calculating the architectural feature of described image according to the gradient information;
Characteristic vector acquisition module, for calculating the characteristic vector of the architectural feature;
Edge pixel point acquisition module, for extracting the vertical component of the characteristic vector, and according to the characteristic vector Vertical component extract described image edge pixel point;
Contour generating module, for generating contour line according to the edge pixel point.
The method and apparatus of above-mentioned acquisition image contour line, first obtains the gradient information of image, further according to the gradient of image The architectural feature of acquisition of information image, and the characteristic vector of the architectural feature of image is further calculated, then according to described The vertical component of characteristic vector extracts the edge pixel point of image.So that the edge pixel point for extracting is relative in conventional art The space obtained by threshold value between the edge pixel point on contour line is less, so as to improve the image contour line for getting Accuracy.
Description of the drawings
Fig. 1 is the flow chart of the method for acquisition image contour line in one embodiment;
Fig. 2 is the structural representation of the device of acquisition image contour line in one embodiment;
Fig. 3 is the structural representation of the device of acquisition image contour line in another embodiment.
Specific embodiment
In one embodiment, as shown in figure 1, it is a kind of obtain image contour line method, including:
Step S102, obtains image, calculates the gradient information of image.
In one embodiment, Sobel Operator can be passed through(Sobel operator)Calculate the gradient information of image.
Matrix of the Sobel Operator comprising two groups of 3x3, respectively x- directions difference matrix and y- directions difference matrix.Can be by Sobel Operator makees planar convolution with the image for getting, you can draw the gradient information in x- directions and y- directions respectively.Can lead to Cross equation below:
Calculate the gradient information of image.Wherein, T is the set of the pixel of the image for getting, GxAnd GyRespectively calculate The horizontal gradient information for arriving and vertical gradient information.
Step S104, calculates the architectural feature of image according to gradient information.
In one embodiment, can be by the structure tensor field of calculating image(struct tensor)Obtain the knot of image Structure feature.Structure tensor field is the expression of architectural feature.
In the present embodiment, can be according to equation below:
Calculate image spatial feature.Wherein, structure tensor fields of the S for image, GxAnd GyRespectively aforementioned calculated x- Direction gradient information and y- direction gradient information.
In the present embodiment, also Gaussian Blur can be carried out to image before the structure tensor field of image is calculated, removal is made an uproar Sound.
Step S106, the characteristic vector of computation structure feature.
In one embodiment, can be according to formula:
A=Gx×Gx, B=Gx×Gy, C=Gy×Gy
The characteristic vector of computation structure feature.Wherein, A, B, C be the corresponding element value of structure tensor field matrix, λ1And λ2Point Not Wei structure tensor field matrix eigenvalue, v1And v2The respectively vertical component and tangential component of the characteristic vector of architectural feature.
The direction of the tangential component of the characteristic vector for getting is the direction vector of the pixel, and vertical component is and pixel The vertical vector in direction vector direction.
Step S108, extracts the vertical component of characteristic vector, and extracts the side of image according to the vertical component of characteristic vector Edge pixel.
In one embodiment, the step of extracting the edge pixel point of image according to the vertical component of characteristic vector can be concrete For:
The vertical direction information of the vertical component of characteristic vector is obtained, and Gauss difference algorithm is passed through according to vertical direction information Extract the edge pixel point of image.
Gaussian difference(DOG, Difference of Gauss)Algorithm is a kind of algorithm for image enhancement.Can be incited somebody to action by DOG algorithms Marginal area in image strengthens(That is marginal portion signal enhancing, the other parts decay of image)It is right in extraction marginal area afterwards The edge pixel point answered.
In the present embodiment, the edge pixel point of image can be extracted according to vertical direction information by default DOG functions. DOG functions can be matlab(A mathematical tool)Built-in function.
Step S110, generates contour line according to edge pixel point.
In one embodiment, can be by the connection of edge pixel point be generated image contour line.
In one embodiment, the step of generating contour line according to edge pixel point can be specially:Extract characteristic vector Tangential component, and Fuzzy processing is carried out to edge pixel according to tangential component obtain contour line.
In the present embodiment, the step of carrying out Fuzzy processing according to tangential component to edge pixel can be specially:
The tangential direction information of the tangential component of characteristic vector is obtained, and edge pixel is entered in tangential direction information The process of row Gaussian Blur.
Gaussian Blur(Gaussian Blur)Algorithm is by the pixel the edge pixel point for closing in tangential direction Colour according to default Gaussian function by weighted average calculation come by edge pixel point extend, so as to edge pixel point two-by-two Between space completion.Edge pixel point after completion constitutes image contour line.
In the present embodiment, in tangential direction edge pixel can be carried out by calling default Gaussian blurring function Gaussian Blur process.During Gaussian blurring function can be the obfuscation instrument that OpenCV (a image processing function storehouse) is provided Gaussian Blur built-in function.
In other embodiments, also obfuscation can be carried out to edge pixel by dynamic fuzzy, radial blur scheduling algorithm Process.Dynamic fuzzy function corresponding with dynamic fuzzy, radial blur algorithm and radial blur function can be that OpenCV is provided Obfuscation instrument in built-in function.
In one embodiment, can also be according to default scaling before the step of calculating the gradient information of pixel in image Ratio carries out diminution process to image.
In the present embodiment, can also be according to scaling to profile after the step of generating contour line according to edge pixel point Line is amplified process.
In the present embodiment, the scaling for carrying out reducing process is identical with the scaling for being amplified process.Will figure As carry out reduce process when, can according to scaling by calculate reduce before image in pixel pixel value meansigma methodss come Generate the pixel value of the pixel of the image after reducing.When image is amplified process, contour line also amplifies therewith.
Diminution process is carried out to image in advance, the image after according to diminution is amplified after generating contour line again so that When the characteristic vector of gradient information, architectural feature and architectural feature of image is calculated, amount of calculation reduces, and improves and processes effect Rate.And as the processing and amplifying that carries out of contour line to generating is for waiting than amplifying restoring operation, i.e., to split-phase neighbour in the middle part of contour line Edge pixel point between position relationship done trickle approximate, without changing the global shape of contour line, therefore, in scaling When ratio is less than threshold value, the accuracy of the image contour line of generation still can be guaranteed.
In one embodiment, as shown in Fig. 2 it is a kind of obtain image contour line device, including:Gradient information obtains mould Block 102, architectural feature acquisition module 104, characteristic vector acquisition module 106, edge pixel point acquisition module 108 and contour line Generation module 110, wherein:
Gradient information acquisition module 102, for obtaining image, calculates the gradient information of image.
In one embodiment, gradient information acquisition module 102 can be used for by Sobel Operator(Sobel operator)Calculate the gradient information of image.
Matrix of the Sobel Operator comprising two groups of 3x3, respectively x- directions difference matrix and y- directions difference matrix.Can be by Sobel Operator makees planar convolution with the image for getting, you can draw the gradient information in x- directions and y- directions respectively.Gradient Data obtaining module 102 can be used for by equation below:
Calculate the gradient information of image.Wherein, T is the set of the pixel of the image for getting, GxAnd GyRespectively calculate The horizontal gradient information for arriving and vertical gradient information.
Architectural feature acquisition module 104, for calculating the architectural feature of image according to gradient information.
In one embodiment, the structure tensor field that architectural feature acquisition module 104 can be used for by calculating image obtains The architectural feature of image.Structure tensor field is the expression of architectural feature.
In the present embodiment, architectural feature acquisition module 104 can be used for according to equation below:
Calculate image spatial feature.Wherein, structure tensor fields of the S for image, GxAnd GyRespectively aforementioned calculated x- Direction gradient information and y- directions vertical gradient information.
In the present embodiment, architectural feature acquisition module 104 can be additionally used in right before the structure tensor field of image is calculated Image carries out Gaussian Blur, removes noise.
Characteristic vector acquisition module 106, for the characteristic vector of computation structure feature.
In one embodiment, characteristic vector acquisition module 106 can be used for according to formula:
A=Gx×Gx, B=Gx×Gy, C=Gy×Gy
The characteristic vector of computation structure feature.Wherein, A, B, C be the corresponding element value of structure tensor field matrix, λ1And λ2Point Not Wei structure tensor field matrix eigenvalue, v1And v2The respectively vertical component and tangential component of the characteristic vector of architectural feature.
The direction of the tangential component of the characteristic vector for getting is the direction vector of the pixel, and vertical component is and pixel The vertical vector in direction vector direction.
Edge pixel point acquisition module 108, for extracting the vertical component of characteristic vector, and according to the vertical of characteristic vector The edge pixel point of component extraction image.
In one embodiment, edge pixel point acquisition module 108 is additionally operable to hanging down for the vertical component of acquisition characteristic vector Straight directional information, and the edge pixel point of image is extracted according to vertical direction information by Gauss difference algorithm.
Gaussian difference(DOG, Difference of Gauss)Algorithm is a kind of algorithm for image enhancement.Can be incited somebody to action by DOG algorithms Marginal area in image strengthens(That is marginal portion signal enhancing, the other parts decay of image)It is right in extraction marginal area afterwards The edge pixel point answered.
In the present embodiment, edge pixel point acquisition module 108 can be used to pass through default DOG according to vertical direction information Function extracts the edge pixel point of image.DOG functions can be matlab(A mathematical tool)Built-in function.
Contour generating module 110, for generating contour line according to edge pixel point.
In one embodiment, contour generating module 110 can be used for by the connection of edge pixel point is generated image wheel Profile.
In one embodiment, contour generating module 110 can be used to extract the tangential component of characteristic vector, and according to cutting Line component carries out Fuzzy processing to edge pixel and obtains contour line.
In the present embodiment, contour generating module 110 can be used for the tangential direction of the tangential component for obtaining characteristic vector Information, and Gaussian Blur process is carried out to edge pixel in tangential direction information.
Gaussian Blur(Gaussian Blur)Algorithm is by the pixel the edge pixel point for closing in tangential direction Colour according to default Gaussian function by weighted average calculation come by edge pixel point extend, so as to edge pixel point two-by-two Between space completion.Edge pixel point after completion constitutes image contour line.
In the present embodiment, contour generating module 110 can be used for by calling default Gaussian blurring function in tangent line Gaussian Blur process is carried out to edge pixel on direction.During Gaussian blurring function can be the obfuscation instrument that OpenCV is provided Gaussian Blur built-in function.
In other embodiments, contour generating module 110 can be used for by dynamic fuzzy, radial blur scheduling algorithm opposite side Edge pixel carries out Fuzzy processing.Dynamic fuzzy function corresponding with dynamic fuzzy, radial blur algorithm and radial blur letter Number can be the built-in function in the obfuscation instrument that OpenCV is provided.
In one embodiment, as shown in figure 3, the device for obtaining image contour line also includes image scaling module 112, use Diminution process is carried out to image according to default scaling before the gradient information in calculating image, and according to edge Pixel is amplified process according to scaling after generating contour line to contour line.
In the present embodiment, the scaling for carrying out reducing process is identical with the scaling for being amplified process.Will figure When processing as carrying out reducing, image scaling module 112 can be used for according to scaling by calculating pixel in the image before reducing Point pixel value meansigma methodss come generate reduce after image pixel pixel value.When image is amplified process, wheel Profile also amplifies therewith.
Diminution process is carried out to image in advance, the image after according to diminution is amplified after generating contour line again so that When the characteristic vector of gradient information, architectural feature and architectural feature of image is calculated, amount of calculation reduces, and improves and processes effect Rate.And as the processing and amplifying that carries out of contour line to generating is for waiting than amplifying restoring operation, i.e., to split-phase neighbour in the middle part of contour line Edge pixel point between position relationship done trickle approximate, without changing the global shape of contour line, therefore, in scaling When ratio is less than threshold value, the accuracy of the image contour line of generation still can be guaranteed.
The method and apparatus of above-mentioned acquisition image contour line, first obtains the gradient information of image, further according to the gradient of image The architectural feature of acquisition of information image, and the characteristic vector of the architectural feature of image is further calculated, then according to described The vertical component of characteristic vector extracts the edge pixel point of image.So that the edge pixel point for extracting is relative in conventional art The space obtained by threshold value between the edge pixel point on contour line is less, so as to improve the image contour line for getting Accuracy.
One of ordinary skill in the art will appreciate that all or part of flow process in realizing above-described embodiment method, can be Instruct related hardware to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow process of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory(Read-Only Memory, ROM)Or random access memory(Random Access Memory, RAM)Deng.
Embodiment described above only expresses the several embodiments of the present invention, and its description is more concrete and detailed, but and Therefore the restriction to the scope of the claims of the present invention can not be interpreted as.It should be pointed out that for one of ordinary skill in the art For, without departing from the inventive concept of the premise, some deformations and improvement can also be made, these belong to the guarantor of the present invention Shield scope.Therefore, the protection domain of patent of the present invention should be defined by claims.

Claims (8)

1. it is a kind of obtain image contour line method, including:
Image is obtained, the gradient information of described image is calculated;
The architectural feature of described image is calculated according to the gradient information;
Calculate the characteristic vector of the architectural feature;
The vertical component of the characteristic vector is extracted, and extracts the edge of described image according to the vertical component of the characteristic vector Pixel, including:The vertical direction information of the vertical component of the characteristic vector is obtained, and according to vertical direction information by height This difference algorithm extracts the edge pixel point of described image;
Contour line is generated according to the edge pixel point.
2. it is according to claim 1 obtain image contour line method, it is characterised in that it is described according to the edge pixel Putting the step of generating contour line is:
The tangential component of the characteristic vector is extracted, and the edge pixel point is carried out at obfuscation according to the tangential component Reason obtains contour line.
3. it is according to claim 2 obtain image contour line method, it is characterised in that it is described according to the tangential component The step of Fuzzy processing is carried out to the edge pixel point be:
The tangential direction information of the tangential component of the characteristic vector is obtained, and to the edge in the tangential direction information Pixel carries out Gaussian Blur process.
4. according to any one of claims 1 to 3 acquisition image contour line method, it is characterised in that the calculating institute Also include before the step of stating the gradient information of image:
Diminution process is carried out to described image according to default scaling;
Also include after the step of generation contour line according to the edge pixel point:
Process is amplified to the contour line according to the scaling.
5. it is a kind of obtain image contour line device, it is characterised in that include:
Gradient information acquisition module, for obtaining image, calculates the gradient information of described image;
Architectural feature acquisition module, for calculating the architectural feature of described image according to the gradient information;
Characteristic vector acquisition module, for calculating the characteristic vector of the architectural feature;
Edge pixel point acquisition module, for extracting the vertical component of the characteristic vector, and hanging down according to the characteristic vector The edge pixel point of straight component extraction described image;
Contour generating module, for generating contour line according to the edge pixel point;
The edge pixel point acquisition module is additionally operable to the vertical direction information of the vertical component for obtaining the characteristic vector, and root The edge pixel point of described image is extracted by Gauss difference algorithm according to vertical direction information.
6. it is according to claim 5 obtain image contour line device, it is characterised in that the contour generating module is also For extracting the tangential component of the characteristic vector, and the edge pixel point is carried out at obfuscation according to the tangential component Reason obtains contour line.
7. it is according to claim 6 obtain image contour line device, it is characterised in that the contour generating module is also For obtaining the tangential direction information of the tangential component of the characteristic vector, and to the edge in the tangential direction information Pixel carries out Gaussian Blur process.
8. according to any one of claim 5 to 7 acquisition image contour line device, it is characterised in that described device is also Including image scaling module, for before the gradient information of described image is calculated according to default scaling to described image Carry out diminution process, and after contour line is generated according to the edge pixel point according to the scaling to the profile Line is amplified process.
CN201210472406.0A 2012-11-20 2012-11-20 Method and apparatus for obtaining image contour line Active CN103839246B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210472406.0A CN103839246B (en) 2012-11-20 2012-11-20 Method and apparatus for obtaining image contour line

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210472406.0A CN103839246B (en) 2012-11-20 2012-11-20 Method and apparatus for obtaining image contour line

Publications (2)

Publication Number Publication Date
CN103839246A CN103839246A (en) 2014-06-04
CN103839246B true CN103839246B (en) 2017-03-22

Family

ID=50802716

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210472406.0A Active CN103839246B (en) 2012-11-20 2012-11-20 Method and apparatus for obtaining image contour line

Country Status (1)

Country Link
CN (1) CN103839246B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268828A (en) * 2014-09-30 2015-01-07 可牛网络技术(北京)有限公司 Image fuzzification processing method and device
CN105590068A (en) * 2015-12-25 2016-05-18 北京奇虎科技有限公司 File fingerprint check method and device
CN107169976A (en) * 2017-04-20 2017-09-15 温州市鹿城区中津先进科技研究院 The product contour line method for drafting of electric business platform exhibiting pictures big data
CN107577424A (en) * 2017-08-18 2018-01-12 深圳云天励飞技术有限公司 Image processing method, apparatus and system
CN109949385A (en) * 2019-03-05 2019-06-28 上海商汤智能科技有限公司 A kind of image adaptive method of adjustment, equipment, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5457754A (en) * 1990-08-02 1995-10-10 University Of Cincinnati Method for automatic contour extraction of a cardiac image
CN101557454A (en) * 2008-04-09 2009-10-14 富士施乐株式会社 Image extracting apparatus, image extracting method and computer readable medium
CN101706962A (en) * 2009-11-27 2010-05-12 四川长虹电器股份有限公司 Image edge extraction method
CN102289825A (en) * 2011-07-08 2011-12-21 暨南大学 Real-time image edge detection circuit and realization method thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8300949B2 (en) * 2010-05-18 2012-10-30 Sharp Laboratories Of America, Inc. Edge detection technique having improved feature visibility

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5457754A (en) * 1990-08-02 1995-10-10 University Of Cincinnati Method for automatic contour extraction of a cardiac image
CN101557454A (en) * 2008-04-09 2009-10-14 富士施乐株式会社 Image extracting apparatus, image extracting method and computer readable medium
CN101706962A (en) * 2009-11-27 2010-05-12 四川长虹电器股份有限公司 Image edge extraction method
CN102289825A (en) * 2011-07-08 2011-12-21 暨南大学 Real-time image edge detection circuit and realization method thereof

Also Published As

Publication number Publication date
CN103839246A (en) 2014-06-04

Similar Documents

Publication Publication Date Title
CN108229490B (en) Key point detection method, neural network training method, device and electronic equipment
CN103839246B (en) Method and apparatus for obtaining image contour line
US9536147B2 (en) Optical flow tracking method and apparatus
CN105590319A (en) Method for detecting image saliency region for deep learning
CN103218605B (en) A kind of fast human-eye positioning method based on integral projection and rim detection
CN110910421B (en) Weak and small moving object detection method based on block characterization and variable neighborhood clustering
CN103473537B (en) A kind of target image contour feature method for expressing and device
US20150186753A1 (en) Image Processing Apparatus, Image Processing Method, and Image Processing Program
TWI314301B (en) Adaptive image sharpening method
CN110111350A (en) A kind of welding pool edge detection method, device and storage medium
Han et al. Research and implementation of an improved canny edge detection algorithm
CN105809633A (en) Color noise removing method and device
JP2011253354A (en) Image processing apparatus, method and program
CN109410246B (en) Visual tracking method and device based on correlation filtering
CN110807457A (en) OSD character recognition method, device and storage device
CN102013101A (en) Blind detection method of permuted and tampered images subjected to fuzzy postprocessing
CN110321808B (en) Method, apparatus and storage medium for detecting carry-over and stolen object
Sanmiguel et al. Pixel-based colour contrast for abandoned and stolen object discrimination in video surveillance
KR101407070B1 (en) Method of extracting feature for human detection and apparatus for performing the same
CN111899200B (en) Infrared image enhancement method based on 3D filtering
JP5029545B2 (en) Image processing method and apparatus
WO2019242388A1 (en) Obstacle recognition method for library robot based on depth image
Qu et al. Linear interpolation with edge-preserving adaptive weights
CN107491746B (en) Face pre-screening method based on large gradient pixel analysis
CN111860161A (en) Target shielding detection method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant