CN105976369B - A kind of method and system of detection pixel point to Edge Distance - Google Patents

A kind of method and system of detection pixel point to Edge Distance Download PDF

Info

Publication number
CN105976369B
CN105976369B CN201610285223.6A CN201610285223A CN105976369B CN 105976369 B CN105976369 B CN 105976369B CN 201610285223 A CN201610285223 A CN 201610285223A CN 105976369 B CN105976369 B CN 105976369B
Authority
CN
China
Prior art keywords
pixel
facial contour
distance
face
gradation zone
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
CN201610285223.6A
Other languages
Chinese (zh)
Other versions
CN105976369A (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.)
Shenzhen Sensetime Technology Co Ltd
Original Assignee
Shenzhen Sensetime 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 Shenzhen Sensetime Technology Co Ltd filed Critical Shenzhen Sensetime Technology Co Ltd
Priority to CN201610285223.6A priority Critical patent/CN105976369B/en
Publication of CN105976369A publication Critical patent/CN105976369A/en
Application granted granted Critical
Publication of CN105976369B publication Critical patent/CN105976369B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Landscapes

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

Abstract

This disclosure relates to a kind of method and system of detection pixel point to Edge Distance, the method step includes: to any pixel point in gradation zone, the facial contour feature point nearest apart from the pixel is found, the facial contour side where the nearest facial contour feature point is obtained;The distance on facial contour side where calculating the pixel to the nearest facial contour feature point.The characteristics of disclosure is not required to calculate the pixel to the distance on all facial contour sides, thus has calculation amount small to any pixel point in gradation zone, and operation is simple, and calculating speed is fast, can quickly improve gradation zone pixel replacement velocity.

Description

A kind of method and system of detection pixel point to Edge Distance
Technical field
This disclosure relates to image procossing, in particular, be related to a kind of detection pixel point to Edge Distance method and system.
Background technique
There are Facial metamorphosis or the demands of replacement in image or video processing obtains when carrying out Facial metamorphosis or replacement Facial contour feature point it is more, then deformation or replaced image syncretizing effect it is more natural.
During Facial metamorphosis or replacement, when facial contour feature point is more, calculation amount will be very huge, and meeting Phenomena such as be easy to causeing face real-time deformation or replacement delay, Caton.Therefore, a kind of quick solution how is found to subtract Few calculation amount, improves the fluency handled in real time, then become a reality needs.
Summary of the invention
In view of the above-mentioned problems, present disclose provides a kind of method and system of detection pixel point to Edge Distance.
A kind of detection pixel point is to the method for Edge Distance, and the method includes the following steps:
S100, to any pixel point in gradation zone, the facial contour feature point nearest to the distance found the pixel, Obtain the facial contour side where the face contour feature point;
Wherein, gradation zone is to need to be arranged the region of transparency when carrying out face replacement or local deformation;
S200, calculate the pixel to obtain facial contour side distance;Wherein: the facial contour side is connection phase Line segment between adjacent two face contour feature points.
Preferably, it before step S100, further comprises the steps of:
S000, gradation zone is determined.
Further, step S000 further comprises following step:
The distance of S001, calculating face face any pixel point to all face contour feature points, and then obtain the pixel Point arrives the shortest distance of all face contour feature points;
If the shortest distance being calculated in S002, step S001 is greater than the gradation zone judgment threshold of setting, the picture Vegetarian refreshments is not belonging to constitute the pixel collection of gradation zone;Otherwise, which belongs to the pixel collection for constituting gradation zone.
Preferably, the gradation zone judgment threshold is set according to the sum of the length on the facial contour side.
In addition, in another embodiment, the disclosure discloses a kind of system of detection pixel point to edge, the system System:
Facial contour side obtains module and distance calculation module;Wherein:
The facial contour side obtains module, is used for: to any pixel point in gradation zone, to the distance found the pixel The nearest facial contour feature point of point obtains the facial contour side where the face contour feature point, and by the pixel and is somebody's turn to do Facial contour side is exported to distance calculation module;Wherein: the gradation zone is the distance according to pixel to facial contour side The region of the corresponding transparency of pixel is set;
The distance calculation module, is used for: receiving pixel and face wheel that the facial contour side obtains module output Wide side, calculate the pixel to the facial contour side distance;Wherein: the facial contour side is to connect two neighboring face wheel Line segment between wide characteristic point.
Preferably, the system also includes:
Gradation zone determining module, is used for: determining gradation zone being exported and obtains module to facial contour side.
Further, it further comprises following units that the facial contour side, which obtains module:
Computing unit is used for: the distance of calculating face face any pixel point to facial contour feature point, and then is somebody's turn to do The shortest distance of the pixel to all face contour feature points;The pixel and the shortest distance are exported to judging unit;
Judging unit is used for: receiving the pixel and the shortest distance of computing unit output, and by the shortest distance and gradually Become region decision threshold value to be compared;If the shortest distance is greater than the gradation zone judgment threshold, received pixel It is not belonging to constitute the pixel collection of gradation zone;Otherwise, which belongs to the pixel point set for constituting gradation zone It closes.
Preferably, the gradation zone judgment threshold is set according to the sum of the length on the facial contour side.
The disclosure does not need to calculate the profile side that pixel is constituted to adjacent shape of face edge contour point in gradation zone one by one Distance obtain the shortest distance, but by first finding apart from that shortest shape of face edge contour point, then calculate its institute Distance on profile side, and then find apart from the nearest profile side of the pixel, thus have calculation amount small, operation is simple, The characteristics of calculating speed is fast, can quickly improve gradation zone pixel replacement velocity.
Detailed description of the invention
Fig. 1-1 is the first situation schematic diagram that the line segment distance is a little arrived outside directed line segment;
Fig. 1-2 is the second situation schematic diagram that the line segment distance is a little arrived outside directed line segment;
Fig. 1-3 is the third situation schematic diagram that the line segment distance is a little arrived outside directed line segment;
Fig. 2-1 is to constitute not closed curve schematic diagram after being sequentially connected adjacent facial contour feature point;
Fig. 2-2 is to constitute closed curve schematic diagram after being sequentially connected facial contour feature point;
Fig. 3 be in an embodiment of the present disclosure a kind of detection pixel point for providing to the method flow diagram at edge;
Fig. 4-1 is to replace figure using the shape of face that the shortest distance handles gradation zone in an embodiment of the present disclosure;
Fig. 4-2 is not replace figure using the shape of face that the shortest distance handles gradation zone in an embodiment of the present disclosure.
Specific embodiment
In one embodiment, a kind of detection pixel point is to the method for Edge Distance, and the method includes the following steps:
A kind of detection pixel point is to the method for Edge Distance, and the method includes the following steps:
S100, to any pixel point in gradation zone, the facial contour feature point nearest to the distance found the pixel, Obtain the facial contour side where the face contour feature point;Wherein, gradation zone is to carry out face replacement or local deformation When, need to be arranged the region of transparency;
S200, calculate the pixel to obtain facial contour side distance;Wherein: the facial contour side is connection phase Line segment between adjacent two face contour feature points.
For the embodiment, when replacing or the facial contour side of the human face region of local deformation is one and is not closed Curve when, the facial contour side where facial contour feature point may have one, it is also possible to have two.When to replace or part When the facial contour side of the human face region of deformation is a closed curve, the facial contour side where facial contour feature point has two Item.After the facial contour feature point nearest in gradation zone the pixel found, then find the facial contour Facial contour side where characteristic point calculates any one people that the pixel arrives for there is the situation on two facial contour sides The distance on face profile side can solve the problems, such as disclosed by the embodiments of the present invention.It is preferred that being arrived according to pixel each in gradation zone The weight of the shortest distance setting Background and foreground picture in the distance on the facial contour side, it is ensured that melt at better edge It closes, transition effect.
The usual method for finding the shortest distance of all pixels point to the facial contour side in gradation zone are as follows: successively look for Some pixel determines the pixel to institute to the distance by each adjacent facial contour side after in gradation zone There is the shortest distance in the distance on facial contour side.Subpoint P ' of the line segment exterior point P on line segment is first required out in aforementioned way, Then directed line segment?Projection on direction can be expressed as follows:
In formula:
If withIndicate vector length, thenIt indicatesUnit vector on direction, meaning are true to required vector Determine direction;
The inner product for two vectors for being, if 0 angle between vector AP and AB, calculating formula are as follows:
SoThe length value of as upper figure middle conductor AP ', without direction Property.This numerical value and above-mentioned characterization directionOverall structure has size, directive new vectorAs?Direction On projection vector, P ' be subpoint.
According to what is obtainedFrom the directionality of vector:
If situation is 0 < r < 1 shown in figure 1 above -1;
If it is situation as shown in Figs. 1-2, then r >=1;
If it is situation as shown in Figs. 1-3, then obtaining r≤0.
Therefore according to the difference of r value, the distance d put to directed line segment be may be calculated:
If each pixel of human face region will calculate, in pixel it can be seen from above-mentioned calculating process In the case where very much, calculation amount will be become very large, it is easy to phenomena such as causing delay, Caton.
But in the above-described embodiments, the method does not need to calculate in gradation zone pixel then one by one to all face wheels The distance on wide side obtains the shortest distance, but first finds that facial contour feature point nearest apart from the pixel, then count The distance on the facial contour side where the face contour feature point is calculated, and then finds the nearest face wheel apart from the pixel Wide side.
Due to ask the distance between two o'clock calculation amount be much smaller than ask a little to side distance calculation amount, thus with calculating It measures small, can quickly improve gradation zone pixel replacement rate and the characteristics of speed.
Method of disclosure can be applied to entire face's replacement, be also possible to local face replacement, or even be not limited to people Face.In one embodiment, as shown in Fig. 2-1, local face deformation or replacement, P are carried out using this method1、P2、P3、P4….PN For the facial contour feature point being evenly distributed on face edge contour, N is cheekbone or less part face contour feature point number, Any pixel point P in image morphing region needs to calculate pixel in order to which the weight of gradation zone Background and foreground picture is arranged Point P is to the shortest distance in the distance on all facial contour sides.Usual way is:
1. first calculating P point in facial contour side P1P2On subpoint P`, then calculate the distance a of P P` two o'clock;
2. calculating separately P point to the distance on other facial contour sides, it is followed successively by b, c, d, e ...;
Size 3. comparing a, b, c, d, e ..., obtain P point to all facial contour sides the shortest distance.
Using disclosed method, the shortest facial contour feature point of Range Profile vegetarian refreshments P need to be first only found out, then calculates pixel The distance on facial contour side where point P to the face contour feature point, so that it may obtain the shortest distance, or obtain the shortest distance With the secondary shortest distance.For Fig. 2-1, which illustrates to replace or the facial contour side of the human face region of local deformation is one The situation of inc curve.If Range Profile vegetarian refreshments P nearest facial contour feature point is P1Or PN, only need to calculate pixel P and arrive P1P2Or PN-1PNDistance, so that it may obtain the shortest distance;If Range Profile vegetarian refreshments P nearest facial contour feature point is Pi, 1 < I < N, then need to only calculate pixel P to Pi-1PiOr PiPi+1Distance, two distances can be obtained at this time, by comparing can be with Determine the shortest distance and time shortest distance.In use, if any one in two distances can meet image morphing needs, It then can be in Pi-1Pi、PiPi+1In, optionally on one side for calculating.For Fig. 2-2, which illustrates to replace or local deformation The facial contour side of human face region is the situation of a closed curve, then that Range Profile vegetarian refreshments P nearest facial contour is special Side where sign point is two.
In one embodiment, it when being replaced to a specific face, is successively looked for first using disclosed method Into gradation zone pixel to facial contour feature point the shortest distance, then where finding nearest facial contour feature point Facial contour side, so find the pixel to facial contour side the shortest distance or the secondary shortest distance, with the shortest distance or The proportional roles of Background and foreground picture in secondary shortest distance setting gradation zone obtain the shape of face replacement effect in Fig. 4-1 Figure.Fig. 4-2 is the face part replacement effect picture for not handling shape of face replacement using the shortest distance.It can by Fig. 4-1 and Fig. 4-2 To find out, locally replacement is more smooth natural for face of the Fig. 4-1 than Fig. 4-2.
Preferably, it before step S100, further comprises the steps of:
S000, gradation zone is determined.
Further, step S000 further comprises following step:
The distance of S001, calculating face face any pixel point to all face contour feature points, and then obtain the pixel Point arrives the shortest distance of all face contour feature points;
If the shortest distance being calculated in S002, step S001 is greater than the gradation zone judgment threshold of setting, the picture Vegetarian refreshments is not belonging to constitute the pixel collection of gradation zone;Otherwise, which belongs to the pixel collection for constituting gradation zone.
Preferably, the gradation zone judgment threshold is set according to the sum of the length on the facial contour side.It such as sets all The sum of the length on facial contour side is L, then gradation zone judgment threshold is S, and the value of S can be M times of L, and the size of M can basis Actual demand is adjusted.Wherein: M is bigger less than 1, M value, and gradation zone is bigger, and pixel to be treated is more, figure As transformation transition just more degree of having, gentler.
In one embodiment, a kind of implementation process for providing method of disclosure is as shown in Figure 3:
S1, setting gradation zone judgment threshold;
S2, the pixel for obtaining the facial not processed mistake of face;The pixel of the not processed mistake is not to be judged to Whether broke is pixel in gradation zone;
S3, the pixel is calculated to the distance of all face contour feature points, and then obtain nearest apart from the pixel Facial contour feature point and the shortest distance between them;
If the shortest distance for calculating acquisition in S4, S3 is greater than the gradation zone judgment threshold of setting, S5 is executed;Otherwise, Execute S7;
Facial contour side where S5, acquisition the facial contour feature point nearest apart from the pixel;
S6, calculate the pixel to obtain facial contour side distance;When the facial contour side of acquisition is two, appoint One is selected to be used to calculate;
S7, all pixels point for whether traversing perfect person's face portion;If traversal is complete, process is exited;Otherwise, S2 is executed.
Based on the method, provide in one embodiment a kind of detection pixel point to Edge Distance system, it is described System:
Facial contour side obtains module and distance calculation module;Wherein:
The facial contour side obtains module, is used for: to any pixel point in gradation zone, to the distance found the pixel The nearest facial contour feature point of point obtains the facial contour side where the face contour feature point, and by the pixel and is somebody's turn to do Facial contour side is exported to distance calculation module;Wherein: the gradation zone is the distance according to pixel to facial contour side The region of the corresponding transparency of pixel is set;
The distance calculation module, is used for: receiving the facial contour when obtaining module pixel point and facial contour, meter Calculate the pixel to the facial contour side distance;Wherein: the facial contour side is to connect two neighboring facial contour feature Line segment between point.
Preferably, the system:
Gradation zone determining module, is used for: determining gradation zone being exported and obtains module to facial contour side.
Further, it further comprises following units that the facial contour side, which obtains module::
It further comprises following units that the facial contour side, which obtains module:
Computing unit is used for: the distance of calculating face face any pixel point to facial contour feature point, and then is somebody's turn to do The shortest distance of the pixel to all face contour feature points;The pixel and the shortest distance are exported to judging unit;
Judging unit is used for: receiving the pixel and the shortest distance of computing unit output, and by the shortest distance and gradually Become region decision threshold value to be compared;If the shortest distance is greater than the gradation zone judgment threshold, received pixel It is not belonging to constitute the pixel collection of gradation zone;Otherwise, which belongs to the pixel point set for constituting gradation zone It closes.
Preferably, the gradation zone judgment threshold is set according to the sum of the length on the facial contour side.
The disclosure is described in detail above, used herein principle and embodiment party of the specific case to the disclosure Formula is expounded, disclosed method that the above embodiments are only used to help understand and its core concept;Meanwhile it is right In those skilled in the art, according to the thought of the disclosure, there will be changes in the specific implementation manner and application range, comprehensive Upper described, the content of the present specification should not be construed as the limitation to the disclosure.

Claims (8)

1. a kind of detection pixel point is to the method for Edge Distance, which is characterized in that the method includes the following steps:
S100, to any pixel point in gradation zone, find the facial contour feature point nearest apart from the pixel, obtain the people Facial contour side where face contour feature point;Wherein, the quantity on the facial contour side is one or two, gradation zone It is to need to be arranged the region of transparency when carrying out face replacement or local deformation;
S200, calculate the pixel to obtain any bar facial contour side distance;Wherein: the facial contour side is connection Line segment between two neighboring facial contour feature point.
2. the method according to claim 1, wherein being further comprised the steps of: before step S100
S000, gradation zone is determined.
3. according to the method described in claim 2, it is characterized in that, step S000 further comprises following step:
The distance of S001, calculating face face any pixel point to all face contour feature points, and then obtain the pixel and arrive The shortest distance of all face contour feature points;
If the shortest distance acquired in S002, step S001 is greater than the gradation zone judgment threshold of setting, the pixel is not Belong to the pixel collection for constituting gradation zone;Otherwise, which belongs to the pixel collection for constituting gradation zone.
4. according to the method described in claim 3, it is characterized in that, the gradation zone judgment threshold is according to the facial contour The setting of the sum of the length on side.
5. a kind of detection pixel point is to the system of Edge Distance, which is characterized in that the system comprises:
Facial contour side obtains module and distance calculation module;Wherein:
The facial contour side obtains module, is used for: to any pixel point in gradation zone, most to the distance found the pixel Close facial contour feature point, obtains the facial contour side where the face contour feature point, and by the pixel and the people Face profile side is exported to distance calculation module;Wherein: the quantity on the facial contour side is one or two, the transition region Domain is the region that the corresponding transparency of pixel is arranged according to the distance of pixel to facial contour side;
The distance calculation module, is used for: receiving the pixel and face wheel that the facial contour side obtains module output Wide side, calculate the pixel to any bar facial contour side distance;Wherein: the facial contour side is to connect two neighboring people Line segment between face contour feature point.
6. system according to claim 5, which is characterized in that the system also includes:
Gradation zone determining module, is used for: determining gradation zone being exported and obtains module to facial contour side.
7. system according to claim 5, which is characterized in that it further comprises following that the facial contour side, which obtains module, Unit:
Computing unit is used for: the distance of calculating face face any pixel point to facial contour feature point, and then obtains the pixel Point arrives the shortest distance of all face contour feature points;The pixel and the shortest distance are exported to judging unit;
Judging unit is used for: receiving the pixel and the shortest distance of computing unit output, and by the shortest distance and transition region Domain judgment threshold is compared;If the shortest distance is greater than the gradation zone judgment threshold, received pixel does not belong to In the pixel collection for constituting gradation zone;Otherwise, which belongs to the pixel collection for constituting gradation zone.
8. system according to claim 7, which is characterized in that the gradation zone judgment threshold is according to the facial contour The setting of the sum of the length on side.
CN201610285223.6A 2016-05-03 2016-05-03 A kind of method and system of detection pixel point to Edge Distance Active CN105976369B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610285223.6A CN105976369B (en) 2016-05-03 2016-05-03 A kind of method and system of detection pixel point to Edge Distance

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610285223.6A CN105976369B (en) 2016-05-03 2016-05-03 A kind of method and system of detection pixel point to Edge Distance

Publications (2)

Publication Number Publication Date
CN105976369A CN105976369A (en) 2016-09-28
CN105976369B true CN105976369B (en) 2019-08-06

Family

ID=56994101

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610285223.6A Active CN105976369B (en) 2016-05-03 2016-05-03 A kind of method and system of detection pixel point to Edge Distance

Country Status (1)

Country Link
CN (1) CN105976369B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112414552B (en) * 2020-11-24 2022-04-15 西南交通大学 Body temperature detection device for elevator and body temperature calculation method thereof

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1335582A (en) * 2000-07-24 2002-02-13 三菱电机株式会社 Virtual beautifying plastic system and its virtual beautifying plastic method
CN102393951A (en) * 2011-06-30 2012-03-28 Tcl集团股份有限公司 Deformation method of human face model
CN103914806A (en) * 2013-01-09 2014-07-09 三星电子株式会社 Display apparatus and control method for adjusting the eyes of a photographed user

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5451302B2 (en) * 2009-10-19 2014-03-26 キヤノン株式会社 Image processing apparatus and method, program, and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1335582A (en) * 2000-07-24 2002-02-13 三菱电机株式会社 Virtual beautifying plastic system and its virtual beautifying plastic method
CN102393951A (en) * 2011-06-30 2012-03-28 Tcl集团股份有限公司 Deformation method of human face model
CN103914806A (en) * 2013-01-09 2014-07-09 三星电子株式会社 Display apparatus and control method for adjusting the eyes of a photographed user

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
图像变形理论与算法研究;潘大鹏;《中国优秀硕士学位论文全文数据库.信息科技辑》;20100615(第06期);第28-29页第3.3.1节,第30页第3.3.1节第3-4段,第34页第3.4节,图3.12(a)

Also Published As

Publication number Publication date
CN105976369A (en) 2016-09-28

Similar Documents

Publication Publication Date Title
WO2016127883A1 (en) Image area detection method and device
CN104966286B (en) A kind of 3D saliencies detection method
CN103824050B (en) A kind of face key independent positioning method returned based on cascade
CN111127318B (en) Panoramic image splicing method in airport environment
CN107657249A (en) Method, apparatus, storage medium and the processor that Analysis On Multi-scale Features pedestrian identifies again
CN107465911B (en) A kind of extraction of depth information method and device
CN106530265B (en) A kind of Adaptive image fusion method based on chromaticity coordinate
CN108460781A (en) A kind of active contour image partition method and device based on improvement SPF
CN106384338B (en) A kind of Enhancement Method based on morphologic light field depth image
CN105976369B (en) A kind of method and system of detection pixel point to Edge Distance
CN107944437A (en) A kind of Face detection method based on neutral net and integral image
CN108648205A (en) A kind of sub-pixel edge detection method
Chen et al. Global minimum for curvature penalized minimal path method
CN103413332B (en) Based on the image partition method of two passage Texture Segmentation active contour models
CN104463896B (en) Image corner point detection method and system based on kernel similar region distribution characteristics
Yuan et al. Segmentation of color image based on partial differential equations
Yu et al. Fast and robust active contours for image segmentation
CN105374024B (en) The method of high-resolution satellite image on-water bridge extraction
CN103839035A (en) Person number statistical method and person number statistical system
CN107103579A (en) A kind of RANSAC improved methods towards image mosaic
Deng et al. A new active contour modeling method for processing-path extraction of flexible material
CN106875365B (en) Spill image partition method based on GSA
CN106296740B (en) A kind of target fine definition tracking based on low-rank sparse expression
CN106203266B (en) The extracting method and device of image extreme point
CN104123727B (en) Stereo matching method based on self-adaptation Gaussian weighting

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