The content of the invention
The embodiment of the present application provides a kind of calibrating template, template detection method, apparatus and terminal, to solve conventional art
In, when carrying out template detection to gridiron pattern scaling board, existing template detection precision is low, and the problem of influence stated accuracy.
In order to solve the above-mentioned technical problem, the embodiment of the invention discloses following technical scheme:
According to the first aspect of the embodiment of the present disclosure, there is provided a kind of calibrating template, the calibrating template include at least one
Demarcating circle group and at least three setting circle groups, the center of circle of at least three setting circles group are not located along the same line, wherein,
Each demarcating circle group includes at least two demarcating circles, the circle of whole demarcating circles in same demarcating circle group
The heart is identical, also, at least two demarcating circles in same demarcating circle group form annulus, and the color of annulus and adjacent area is not
Together;
Each setting circle group includes at least two setting circles, the circle of whole setting circles in same setting circle group
The heart is identical, also, at least two positioning rounds in same setting circle group are into annulus, and the color of annulus and adjacent area is not
Together;
Each setting circle group includes fisrt feature circle and second feature circle, wherein, the radius of the fisrt feature circle
It is unequal with the radius of the setting circle in all setting circle groups;
The radius and the radius of the demarcating circle in each demarcating circle group of the second feature circle are unequal.
With reference in a first aspect, in the first possible implementation of first aspect, the calibrating template also includes:
Calibration line, the length of the calibration line are equal to the distance of center circle between excentric any two circle.
According to the second aspect of the embodiment of the present disclosure, there is provided a kind of template detection method, the template detection method include:
The template image of filming apparatus shooting to be calibrated is obtained, includes preset calibrations template in the template image,
The preset calibrations module includes at least one demarcating circle group and at least three setting circle groups, at least three setting circles group
The center of circle is not located along the same line, wherein, each demarcating circle group includes at least two demarcating circles, in same demarcating circle group entirely
The center of circle of the demarcating circle in portion is identical, also, at least two demarcating circles in same demarcating circle group form annulus, and annulus with
The color of adjacent area is different;Each setting circle group includes at least two setting circles, whole institute in same setting circle group
State that the center of circle of setting circle is identical, also, at least two positioning rounds in same setting circle group are into annulus, and annulus and adjacent region
The color in domain is different;Each setting circle group includes fisrt feature circle and second feature circle, wherein, the fisrt feature circle
The radius of radius and the setting circle in all setting circle groups is unequal;The radius of second feature circle with it is each described
The radius of demarcating circle in demarcating circle group is unequal;
According to default connection block coverage, the connection block in the template image is filtered, obtained comprising described
Setting circle group connects block with the multiple of demarcating circle group;
The connection block is detected, obtains contour edge group corresponding to the connection block;
According to the center of each contour edge in the contour edge group, the center of the contour edge group, and root are determined
According to the size of each contour edge in the contour edge group, the type of the contour edge group is determined, the type includes:Mark
Fixed circle group and setting circle group, wherein, the center of the setting circle group is the anchor point, and the center of the demarcating circle group is described
Calibration point;
According to distributing position of the anchor point in the template image, determine calibration point in the template image
Distributing position, and the distributing position according to the anchor point and calibration point in the template image, determine the template image
Template coordinate.
It is described according to the contour edge in the first possible implementation of second aspect with reference to second aspect
The center of each contour edge in group, the center of the contour edge group is determined, including:
The average value at the center of each contour edge in the contour edge group is calculated, and using the average value as described in
The center of contour edge group;
Or,
Behind the center of each contour edge in obtaining the contour edge group, the center of each contour edge is judged
The distance between difference whether in default distance range;
If the range difference in the default distance range, calculates each contour edge in the contour edge group
Center average value, and the center using the average value as the contour edge group.
It is described according to anchor point and demarcation in second of possible implementation of second aspect with reference to second aspect
Distributing position of the point in the template image, determining the template coordinate of the template image includes:
According to the distributing position of the anchor point and calibration point in the template image, by the image to be calibrated
Each anchor point and calibration point on each anchor point and calibration point, with the calibrating template of known coordinate system establish mapping relations;
According to the anchor point and the seat of calibration point in the mapping relations, and the calibrating template of the known coordinate system
Mark, determine the template coordinate of the template image.
With reference to second aspect, in the third possible implementation of second aspect, the template detection method is also wrapped
Include:
Block coverage is being connected according to default, before being filtered to the connection block in the template image, to described
Template image carries out denoising;
The default connection block coverage of the basis, is filtered to the connection block in the template image, including:
After the template image after obtaining denoising, according to default connection block coverage, after the denoising
Template image filtered;
Or,
Block coverage is being connected according to default, before being filtered to the connection block in the template image, to described
Template image carries out binary conversion treatment;
The default connection block coverage of the basis, is filtered to the connection block in the template image, including:
After the template image after obtaining binary conversion treatment, according to default connection block coverage, at the binaryzation
Template image after reason is filtered.
With reference to second aspect, in the 4th kind of possible implementation of second aspect, the preset calibrations template is also wrapped
Calibration line is included, the length of the calibration line is equal to the distance of center circle between excentric arbitrary two circles, it is determined that institute
After the template coordinate for stating template image, the template detection method also includes:
By the template coordinate, coordinate of the center of circle of described two circles in the template image is determined;
According to coordinate of the center of circle of described two circles in the template image, described two circles are calculated in world coordinate system
In distance of center circle calculated value;
After calibration line measured value of the calibration line in world coordinate system is received, the distance of center circle calculated value is obtained
The distance between calibration line measured value difference, will pass through the precision that the range difference characterizes this template detection.
According to the third aspect of the embodiment of the present disclosure, there is provided a kind of template detection device, the template detection device include:
Image collection module, for obtaining the template image of filming apparatus shooting to be calibrated, wrapped in the template image
Containing preset calibrations template, the preset calibrations module includes at least one demarcating circle group and at least three setting circle groups, described
The center of circle of at least three setting circle groups is not located along the same line, wherein, each demarcating circle group includes at least two demarcation
Round, the center of circle of whole demarcating circles is identical in same demarcating circle group, also, at least two demarcation in same demarcating circle group
Circle forms annulus, and annulus is different from the color of adjacent area;Each setting circle group includes at least two setting circles, same
The center of circle of whole setting circles is identical in setting circle group, also, at least two positioning rounds in same setting circle group into
Annulus, and annulus is different from the color of adjacent area;Each setting circle group includes fisrt feature circle and second feature circle, its
In, the radius of the radius and the setting circle in all setting circle groups of the fisrt feature circle is unequal;Described second is special
Radius and the radius of the demarcating circle in each demarcating circle group for levying circle are unequal;
Filtering module, for connecting block coverage according to default, the connection block in the template image is filtered,
Obtain and connect block with the multiple of demarcating circle group comprising the setting circle group;
Detection module, for being detected to the connection block, obtain contour edge group corresponding to the connection block;
First determining module, for the center according to each contour edge in the contour edge group, determine the profile
The center of edge group, and according to the size of each contour edge in the contour edge group, determine the class of the contour edge group
Type, the type include:Demarcating circle group and setting circle group, wherein, the center of the setting circle group is the anchor point, the mark
The center of fixed circle group is the calibration point;
Second determining module, for the distributing position according to the anchor point in the template image, determine calibration point
Distributing position in the template image, and the distribution position according to the anchor point and calibration point in the template image
Put, determine the template coordinate of the template image.
With reference to the third aspect, in the first possible implementation of the third aspect, first determining module includes:
First computing unit, for calculating the average value at the center of each contour edge in the contour edge group, and will
Center of the average value as the contour edge group;
Or,
Judging unit, for behind the center of each contour edge in obtaining the contour edge group, judging described each
Whether the distance between center of contour edge difference is in default distance range;
Second computing unit, if for the range difference in the default distance range, calculate the profile side
The average value at the center of each contour edge in edge group, and the center using the average value as the contour edge group.
With reference to the third aspect, in second of possible implementation of the third aspect, second determining module includes:
Unit is established in mapping, will for the distributing position according to the anchor point and calibration point in the template image
Each anchor point and calibration point on the image to be calibrated, with each anchor point and mark on the calibrating template of known coordinate system
Fixed point establishes mapping relations;
Template coordinate determining unit, for according in the mapping relations, and the calibrating template of the known coordinate system
Anchor point and calibration point coordinate, determine the template coordinate of the template image.
With reference to the third aspect, in the third possible implementation of the third aspect, the template detection device also wraps
Include:
Denoising module, for according to default connection block coverage, being carried out to the connection block in the template image
Before filter, denoising is carried out to the template image;
The filtering module is additionally operable to after the template image after obtaining denoising, according to default connection block covering model
Enclose, the template image after the denoising is filtered;
And/or
Binary conversion treatment module, for connecting block coverage according to default, to the connection block in the template image
Before being filtered, binary conversion treatment is carried out to the template image;
The filtering module is additionally operable to after the template image after obtaining binary conversion treatment, according to default connection block covering model
Enclose, the template image after the binary conversion treatment is filtered.
With reference to the third aspect, in the 4th kind of possible implementation of the third aspect, the preset calibrations template is also wrapped
Calibration line is included, and the length of the calibration line is equal to the distance of center circle between excentric any two circle, it is determined that institute
After the template coordinate for stating template image, the template detection device also includes:
Central coordinate of circle determining module, for by the template coordinate, determining the center of circle of described two circles in the template
Coordinate in image;
Distance of center circle computing module, for coordinate of the center of circle according to described two circles in the template image, calculate institute
State distance of center circle calculated value of two circles in world coordinate system;
Range difference computing module, for after calibration line measured value of the calibration line in world coordinate system is received,
The distance between the distance of center circle calculated value and the calibration line measured value difference are obtained, this is characterized will pass through the range difference
The precision of template detection.
According to the fourth aspect of the embodiment of the present disclosure, there is provided a kind of terminal, including:Processor, memory and bus, its
In,
The processor is connected by bus with the memory;
The memory, the program code for the method for storage process data sharing;
The processor, performed for obtaining the program code stored in the memory, and according to described program code
Operate below:
The template image of filming apparatus shooting to be calibrated is obtained, includes preset calibrations template in the template image,
The preset calibrations module includes at least one demarcating circle group and at least three setting circle groups, at least three setting circles group
The center of circle is not located along the same line, wherein, each demarcating circle group includes at least two demarcating circles, in same demarcating circle group entirely
The center of circle of the demarcating circle in portion is identical, also, at least two demarcating circles in same demarcating circle group form annulus, and annulus with
The color of adjacent area is different;Each setting circle group includes at least two setting circles, whole institute in same setting circle group
State that the center of circle of setting circle is identical, also, at least two positioning rounds in same setting circle group are into annulus, and annulus and adjacent region
The color in domain is different;Each setting circle group includes fisrt feature circle and second feature circle, wherein, the fisrt feature circle
The radius of radius and the setting circle in all setting circle groups is unequal;The radius of second feature circle with it is each described
The radius of demarcating circle in demarcating circle group is unequal;
According to default connection block coverage, the connection block in the template image is filtered, obtained comprising described
Setting circle group connects block with the multiple of demarcating circle group;
The connection block is detected, obtains contour edge group corresponding to the connection block;
According to the center of each contour edge in the contour edge group, the center of the contour edge group, and root are determined
According to the size of each contour edge in the contour edge group, the type of the contour edge group is determined, the type includes:Mark
Fixed circle group and setting circle group, wherein, the center of the setting circle group is the anchor point, and the center of the demarcating circle group is described
Calibration point;
According to distributing position of the anchor point in the template image, determine calibration point in the template image
Distributing position, and the distributing position according to the anchor point and calibration point in the template image, determine the template image
Template coordinate.
A kind of calibrating template of disclosure, template detection method, apparatus and terminal.In calibrating template disclosed in the present application
In, the center of circle of each demarcating circle group is calibration point, and the center of circle of each setting circle group is anchor point, passes through mark disclosed in the present application
When solid plate carries out template detection, the center of circle of the demarcating circle group is determined by least two demarcating circles in each demarcating circle group,
So as to obtain calibration point, the center of circle of the setting circle group is determined by least two setting circles in each setting circle group, so as to obtain
Anchor point is taken, and the distribution situation of each calibration point in the picture is determined by the anchor point, further obtains template coordinate.
Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application is not easily susceptible to outer when obtaining calibration point
The interference of boundary's environment, the stability and correctness of calibration point acquisition are improved, accordingly improve the precision of template detection, and can
Further improve follow-up stated accuracy.
In addition, in calibrating template disclosed in the present application, each demarcating circle group and setting circle group are by least two center of circle phases
With circle composition, compared with chessboard case marker fixed board, circular to be influenceed by filming apparatus projection change smaller, robustness is stronger.
Embodiment
The embodiment of the present application provides a kind of calibrating template, template detection method, apparatus and terminal, to solve conventional art
In, when carrying out template detection to gridiron pattern scaling board, existing template detection precision is low, and the problem of influence stated accuracy.
In order that those skilled in the art more fully understands the technical scheme in the embodiment of the present invention, and make of the invention real
Apply the above-mentioned purpose of example, feature and advantage can be more obvious understandable, below in conjunction with the accompanying drawings to technical side in the embodiment of the present invention
Case is described in further detail.
A kind of calibrating template of disclosure, the calibrating template include at least one demarcating circle group and at least three positioning
Circle group, the center of circle of at least three setting circles group is not located along the same line.
Wherein, each demarcating circle group includes at least two demarcating circles, whole demarcation in same demarcating circle group
The round center of circle is identical, also, at least two demarcating circles in same demarcating circle group form annulus, and the face of annulus and adjacent area
Color is different.
It is identical in the center of circle for each demarcating circle that each demarcating circle group includes, and using the center of circle of the demarcating circle group as
Calibration point.In same demarcating circle group, including at least two demarcating circles, then at least two demarcating circle forms at least one circle
Ring, for the ease of distinguishing each demarcating circle, each annulus is different from the color of adjacent area.Also, in order to improve the essence of differentiation
Degree, the color of each annulus and adjacent area is generally from the higher color of contrast, for example, settable one of annulus is
Black, the adjacent area of the annulus is white.
For example, with reference to the structural representation of the demarcating circle group shown in Fig. 1, the demarcating circle group includes two demarcating circles, institute
State two demarcating circles and form inner circle 1 and an annulus 2, wherein, the adjacent area of annulus 2 is inner circle 1, in order to distinguish the two
Demarcating circle, inner circle 1 is arranged to white, annulus 2 is arranged to black.
In addition, the structural representation of another demarcating circle group shown in Figure 2, the demarcating circle group in the figure includes three
Demarcating circle, three demarcating circles form inner circle 3, annulus 4 and annulus 5.Wherein, the adjacent area of annulus 4 is inner circle 3 and circle
Ring 5, the adjacent area of annulus 5 is annulus 4.In order to distinguish these three demarcating circles, inner circle 3 and annulus 5 are arranged to white, annulus
4 are arranged to black.
Each setting circle group includes at least two setting circles, the circle of whole setting circles in same setting circle group
The heart is identical, also, at least two positioning rounds in same setting circle group are into annulus, and the color of annulus and adjacent area is not
Together.
It is identical in the center of circle for the setting circle that each setting circle group includes, and using the center of circle of the setting circle group as positioning
Point.Because the center of circle of at least three setting circles group is not located along the same line, thus according to the scaling board can obtain to
Few three anchor points, and at least three anchor point is in same straight line, so as to play a part of positioning.It is in addition, same
In one setting circle group, including at least two setting circles, then at least two positioning round is at least one annulus, for the ease of
Each setting circle is distinguished, each annulus is different from the color of adjacent area.Also, in order to improve the precision of differentiation, each annulus
Color with adjacent area is generally from the higher color of contrast, for example, settable one of annulus is black, the annulus
Adjacent area for white.
Further, each setting circle group includes fisrt feature circle and second feature circle, wherein, the fisrt feature
The radius of round radius and the setting circle in all setting circle groups is unequal, the radius of second feature circle with it is each
The radius of demarcating circle in the demarcating circle group is unequal.
Include fisrt feature in each setting circle group to justify, the radius of the fisrt feature circle in each setting circle group is equal
It is unequal with the radius of the setting circle in each setting circle group, that is to say, that the fisrt feature in each setting circle group is justified with removing
The radius of the setting circle in other each setting circle groups beyond itself is unequal, also, the fisrt feature fenestra and itself
The radius of other each setting circles in affiliated setting circle group is unequal, so as to the radius justified according to the fisrt feature
Size comes each setting circle group differentiation.
Accordingly, also include second feature circle in each setting circle group, the radius of second feature circle with it is each
The radius of demarcating circle in the demarcating circle group is unequal, and the radius size so as to be justified according to the second feature is distinguished
Setting circle group and demarcating circle group.
In addition, in the scaling board, the number of the circle included in each setting circle group and demarcating circle group can with identical,
Can be different, the application is not construed as limiting to this.
In calibrating template disclosed in the present application, the center of circle of each demarcating circle group is calibration point, each setting circle group
The center of circle is anchor point, by calibrating template disclosed in the present application carry out template detection when, by each demarcating circle group at least
Two demarcating circles determine the center of circle of the demarcating circle group, fixed by least two in each setting circle group so as to obtain calibration point
Circle of position determines the center of circle of the setting circle group, so as to obtain anchor point, and determines each calibration point in image by the anchor point
In distribution situation, further obtain template coordinate.Compared with gridiron pattern scaling board of the prior art, mark disclosed in the present application
Solid plate is not easily susceptible to the interference of external environment when obtaining calibration point, improves the stability and correctness of calibration point acquisition,
It is corresponding to improve the precision of template detection, and can further improve follow-up stated accuracy.
In addition, in calibrating template disclosed in the present application, each demarcating circle group and setting circle group are by least two center of circle phases
With circle composition, compared with chessboard case marker fixed board, circular to be influenceed by filming apparatus projection change smaller, robustness is stronger.
Further, the calibrating template also includes:
Calibration line, the length of the calibration line are equal to the distance of center circle between excentric any two circle.
Wherein, the length of the calibration line can be the calibrating template on, any two have it is excentric it is round it
Between distance of center circle.When drawing scaling board before, the distance of center circle between described two circles can be obtained, and draw on scaling board with
The calibration line of the distance of center circle equal length.During due to being measured to the calibrating template being placed in world coordinate system, it is difficult to
The center of circle is determined, therefore, characterizes the distance of center circle of described two circles by the calibration line on scaling board.Obtaining template coordinate
Afterwards, coordinate that can be according to the center of circle of described two circles on template image, is calculated distance of center circle calculated value, also, pass through
Scaling board in survey tool (such as slide measure) measurement physical world, can obtain the calibration line in world coordinate system
Length measurements, pass through the distance between the distance of center circle calculated value and length measurements difference, you can obtain this template detection
Precision.
A kind of schematic diagram of calibrating template shown in Figure 3, in the figure, set demarcating circle group in the calibrating template and
Setting circle group forms by two concentric circles, and certainly, the quantity of the circle included in each setting circle group and demarcating circle group can also
It is more than two numerical value for other, the application is not construed as limiting to this.Wherein, the demarcating circle group and setting circle group in the calibrating template
In, inner circle is white, and cylindrical is black, to distinguish inner circle and cylindrical, certainly, inner circle and cylindrical may be arranged as other
Different colors, the application are not limited this.
In addition, in the calibrating template shown in Fig. 3, comprising setting circle group be separately positioned on the upper left of calibrating template, the right side
Upper and lower-left position, the setting circle group for being arranged on calibrating template upper left refer to first of left side in the calibrating template the first row
Individual round group, the setting circle group for being arranged on calibrating template upper right refers to first round group on right side in the calibrating template the first row,
The setting circle group for being arranged on calibrating template lower-left refers to first round group in left side in the calibrating template last column.Also,
The center of circle of these three setting circle groups on the same line, can not play positioning action, for being determined during template detection
The distribution situation of demarcating circle group, so that it is determined that the template coordinate of calibrating template.Also, the concentric circles positioned at other positions is to being
Demarcating circle group.In order to distinguish each setting circle group, the inner circle radius of three setting circle groups is arranged to different in the calibrating template
Length;In order to which setting circle group and demarcating circle group differentiation are opened, inner circle radius and each demarcating circle group of three setting circle groups
Inner circle radius it is unequal, that is to say, that in fisrt feature in three setting circle groups circle and second feature circle be
Circle.Wherein, the white inner circle radius of the setting circle group of upper left is maximum, and the white inner circle radius of the setting circle group of lower-left is second largest,
The white inner circle radius of the setting circle group of upper right is minimum.In addition, in each demarcating circle group shown in Fig. 3, the radius of inner circle is homogeneous
Deng the radius of inner circle can also be unequal in other embodiments, in each demarcating circle group, and the application is not limited this.
In calibrating template disclosed in the present application, the demarcating circle group of setting and the quantity of setting circle group are more, template detection
Precision is higher, and the quantity of the demarcating circle group and setting circle group is more, and the time needed for template detection is longer.In practical application
In, multiple concentric circles pair for generally forming demarcating circle group and setting circle group, it is arranged to 3x4 to 12x15 form.
Further, be additionally provided with the calibrating template shown in Fig. 3 calibration line, the length of the calibration line etc. with
Distance of center circle between excentric any two circle.Wherein, the line segment of the calibrating template bottom is the calibration line.If
It is fixed described with excentric two circles respectively the first circle and the second circle, as shown in figure 3, including four in the calibrating template
Bar calibration line, according to order from left to right, first circle and the second circle are respectively last corresponding to first calibration line
The circle in first round group in row, and the circle in second round group, first circle corresponding to Article 2 calibration line and the
The circle in the 3rd round group in two circles respectively last column, and the circle in the 4th round group, Article 3 calibration line are corresponding
First circle and the second circle be respectively circle in the 5th round group in last column, and the circle in the 6th round group,
The circle in the 7th round group in described first circle and the second circle respectively last column corresponding to Article 4 calibration line, Yi Ji
Circle in eight round groups.Four calibration lines are separately positioned on the lower section of corresponding first circle and the second circle, and the demarcation
The beginning and end of line is in same level.It is, of course, also possible to other circles are chosen as the first circle and the second circle, and will demarcation
Line is arranged on the other positions of calibrating template, and the application is not limited this.
For example, in another calibrating template shown in Fig. 4, first circle and the second circle are respectively the of last column
Circle in one round group, and the circle in last circle group of last column, and the calibration line is arranged on first circle
With the lower section of the second circle.Another calibrating template shown in Figure 5, first circle are first of calibrating template the first row
Circle in circle group, second circle is the circle in second round group of the row of calibrating template second, with the described first circle and the second circle
The calibration line of distance of center circle equal length be arranged on the left side of the calibrating template, if the circle of setting first circle and the second circle
Line between the heart is center of circle line, and the calibration line is parallel with the center of circle line.Certainly, the calibration line can be also arranged to vertical side
To the application is not limited this.
Accordingly, disclosed herein as well is a kind of template detection method.
Workflow schematic diagram shown in Figure 6, template detection method disclosed in the present application comprise the following steps:
Step S11, the template image of filming apparatus shooting to be calibrated is obtained, includes pre- bidding in the template image
Solid plate, the preset calibrations module include at least one demarcating circle group and at least three setting circle groups, and described at least three is fixed
The center of circle of circle of position group is not located along the same line, wherein, each demarcating circle group includes at least two demarcating circles, same demarcation
The center of circle of whole demarcating circles is identical in circle group, also, at least two demarcating circles in same demarcating circle group form annulus,
And annulus is different from the color of adjacent area;Each setting circle group includes at least two setting circles, in same setting circle group
The center of circle of whole setting circles is identical, also, at least two positioning rounds in same setting circle group are into annulus, and annulus
It is different from the color of adjacent area;Each setting circle group includes fisrt feature circle and second feature circle, wherein, described first
The radius of the radius of characteristic circle and the setting circle in all setting circle groups is unequal;The radius of second feature circle with
The radius of demarcating circle in each demarcating circle group is unequal.
Step S12, according to default connection block coverage, the connection block in the template image is filtered, obtained
Comprising the setting circle group block is connected with the multiple of demarcating circle group.
Filming apparatus often photographs other beyond the preset calibrations template when being taken pictures to preset calibrations template
Object, so as to need to be filtered to template image by step S12.
In step s 12, template image is detected, the connection block in template image is obtained, then according to default
Connection block coverage filters to the connection block, filters out area coverage not in the default connection block coverage
Block is connected, connection block of the remaining area coverage in the default connection block coverage is setting circle group and demarcating circle
Group.
Wherein, it is the 3rd to justify to set outermost circle in each the demarcating circle group and setting circle group, and sets described the
The area coverage of three circles connects block area coverage for unit, then the minimum value in the default connection block coverage is not more than
Minimum value in the unit connection block area coverage, and the maximum in the default connection block coverage is not less than
Maximum in the unit connection block area coverage.
Step S13, the connection block is detected, obtains contour edge group corresponding to the connection block.
Wherein, the setting circle group and demarcating circle group be it is circular connect block, filming apparatus is taken pictures to calibrating template
When, being influenceed by projecting, ellipse is often presented in the setting circle group and demarcating circle group in template image, therefore to each connection
When block is detected, contour edge group corresponding to the connection block can be obtained by the method for ellipse fitting.
Furthermore it is also possible to by the method for ellipses detection, contour edge group corresponding to the connection block, the application couple are obtained
This is not construed as limiting.
After edge fitting is carried out to connection block, you can obtain the contour edge group corresponding with connection block.If for example, institute
Calibrating template is stated as shown in figure 3, then each contour edge group includes two oval contour edges.
Step S14, according to the center of each contour edge in the contour edge group, determine in the contour edge group
The heart, and according to the size of each contour edge in the contour edge group, determine the type of the contour edge group, the type
Including:Demarcating circle group and setting circle group, wherein, the center of the setting circle group is the anchor point, in the demarcating circle group
The heart is the calibration point.
Justify due to including second feature in the setting circle group, the radius of the second feature circle and each demarcating circle
The radius of demarcating circle in group is unequal, then can according to the type of each contour edge group of size discrimination of contour edge, by
Include demarcating circle group and setting circle group in the type of contour edge group, so as to which each contour edge group is divided into demarcating circle
Group and setting circle group.
Step S15, the distributing position according to the anchor point in the template image, determine calibration point in the template
Distributing position in image, and the distributing position according to the anchor point and calibration point in the template image, it is determined that described
The template coordinate of template image.
Justify due to including fisrt feature in each setting circle group, the radius of the fisrt feature circle is each described with other
The radius of setting circle in setting circle group is unequal, therefore, can be by the size of each contour edge in setting circle group, will
Each setting circle group differentiation comes, so that it is determined that distributing position of the anchor point in the template image.According to described fixed
Distributing position of the site in the template image, you can determine distributing position of each calibration point in the template image.
If the calibrating template included in the template image that the detection of this secondary module is directed to is as shown in figure 3, each setting circle
Fisrt feature circle in group is inner circle, by the size of contour edge corresponding to inner circle, can be opened three setting circle group differentiations
Come, so that it is determined that distributing position of the anchor point in the template image.Then, positioned by the anchor point, for example,
If will be distributed over first on the right side of the anchor point of upper left calibration point is defined as the first calibration point, it can determine that and be distributed in upper left
Second calibration point on the right side of anchor point is the second calibration point, so as to obtain distribution of each calibration point in template image successively
Position.
The step S11 of the application to step S15 discloses a kind of template detection method.Carried out by disclosed method
During template detection, the center of circle of the demarcating circle group is determined by least two demarcating circles in each demarcating circle group, so as to obtain mark
Fixed point, the center of circle of the setting circle group is determined by least two setting circles in each setting circle group, so as to obtain anchor point, and
The distribution situation of each calibration point in the picture is determined by the anchor point, further obtains template coordinate.With prior art
In gridiron pattern scaling board compare, calibrating template disclosed in the present application is not easily susceptible to the dry of external environment when obtaining calibration point
Disturb, improve the stability and correctness of calibration point acquisition, it is corresponding to improve the precision of template detection, and can further improve
Follow-up stated accuracy.
In addition, in calibrating template disclosed in the present application, each demarcating circle group and setting circle group are by least two center of circle phases
With circle composition, compared with chessboard case marker fixed board, circular to be influenceed by filming apparatus projection change smaller, robustness is stronger.
In step S14, the open center according to each contour edge in the contour edge group, the profile side is determined
The step for center of edge group, the step can be accomplished in several ways.
In wherein a kind of implementation, the center according to each contour edge in the contour edge group, it is determined that
The center of the contour edge group, including:
The average value at the center of each contour edge in the contour edge group is calculated, and using the average value as described in
The center of contour edge group.
For example, if the calibrating template that this template detection is directed to is as shown in figure 3, i.e. each demarcating circle group and setting circle group are equal
It is made up of 2 concentric circles, by edge fitting, after obtaining contour edge group, can detect and included in each contour edge group
There are two contour edges, then detect the center of two contour edges included in each contour edge group, described two profiles
The average value at the center at edge is the center of the contour edge group.
In another implementation, the center according to each contour edge in the contour edge group, institute is determined
The center of contour edge group is stated, including:
First, behind the center of each contour edge in obtaining the contour edge group, each contour edge is judged
The distance between center difference whether in default distance range;Then, if the range difference is described default apart from model
In enclosing, then the average value at the center of each contour edge in the contour edge group is calculated, and using the average value as described in
The center of contour edge group.
In above-mentioned steps, behind the center of each contour edge in getting contour edge group, each profile is judged
Whether the distance between the center at edge difference is in default distance range, if the range difference is more than described default apart from model
Enclose, then illustrate the centre distance of each contour edge in same contour edge group farther out, in this case, it is believed that the profile side
There is error in edge group, does not consider further that the contour edge group in subsequent step;If between the center of each contour edge
Range difference then illustrates that the centre distance of each contour edge in same contour edge group is nearer in default distance range,
The center of the contour edge group is then determined by the average value at the center of each contour edge in the contour edge group.
By above-mentioned steps, error can be reduced, further improves the precision of template detection.
According to the distributing position of each anchor point and calibration point in the template image, you can determine the template
The template coordinate of image.Wherein it is determined that the implementation of the template coordinate of the template image is including a variety of.
In wherein a kind of implementation, the distribution position according to anchor point and calibration point in the template image
Put, determining the template coordinate of the template image includes:
First, the distributing position according to the anchor point and calibration point in the template image, by the figure to be calibrated
As upper each anchor point and calibration point, establish and map with each anchor point and calibration point on the calibrating template of known coordinate system
Relation;
Then, according to the anchor point and calibration point in the mapping relations, and the calibrating template of the known coordinate system
Coordinate, determine the template coordinate of the template image.
, it is necessary to obtain the calibrating template of known coordinate system in advance in above-mentioned implementation, each mark in the calibrating template
The coordinate of fixed point and anchor point is known, in this case, according to each anchor point on the image to be calibrated and demarcation
The mapping relations between each anchor point and calibration point on point, with the calibrating template of known coordinate system, and the known seat
Mark the coordinate of each calibration point on the calibrating template of system, you can determine the template coordinate of the template image.Wherein, it is described
It can be world coordinate system to know coordinate system, or, can be the image coordinate system of other forms.
In another implementation, the seat of each anchor point and calibration point that are distributed in diverse location can be prestored
Mark, after the distributing position of each anchor point and calibration point in the template image is got, inquires about the coordinate prestored
Information, you can determine the template coordinate of the template image.
For example, if the calibrating template that this template detection is directed to is as shown in figure 3, will be distributed on the right side of the anchor point of upper left
First calibration point is defined as the first calibration point, it is determined that second be distributed on the right side of the anchor point of upper left calibration point is the second mark
Fixed point, and prestored the coordinate of the first calibration point and the second calibration point., can by anchor point when carrying out template detection
The distributing position of the first calibration point and the second calibration point in template image is determined, and inquires about the coordinate information prestored, i.e.,
The coordinate of the first calibration point and the second calibration point is can determine that, identical, other calibration points and anchor point can also be obtained in template
Coordinate in image, according to the coordinate, you can the template coordinate of determining module image.
Further, template detection method disclosed in the present application also includes:Block coverage is being connected according to default, to institute
State before the connection block in template image filtered, denoising is carried out to the template image.
In this case, according to default connection block coverage described in step S12, to the connection in the template image
Block is filtered, including:After the template image after obtaining denoising, according to default connection block coverage, gone to described
The template image after handling of making an uproar is filtered.
Wherein, denoising can use the methods of medium filtering or gaussian filtering, can reduce the influence of picture noise.
Further, template detection method disclosed in the present application also includes:Block coverage is being connected according to default, to institute
State before the connection block in template image filtered, binary conversion treatment is carried out to the template image.
In this case, according to default connection block coverage described in step S12, to the connection in the template image
Block is filtered, including:After the template image after obtaining binary conversion treatment, according to default connection block coverage, to described
Template image after binary conversion treatment is filtered.
By binary conversion treatment, the contrast in image can be increased, make image that more obvious visual effect be presented.Go
Processing and the binary conversion treatment of making an uproar can improve the accuracy of detection of calibration point and anchor point, and then improve the precision of template detection.
Further, the preset calibrations template also includes calibration line, and the length of the calibration line, which is equal to, has different circles
Distance of center circle between arbitrary two circles of the heart, it is determined that after the template coordinate of the template image, referring to Fig. 7, the mould
Board detecting method also includes:
Step S21, by the template coordinate, coordinate of the center of circle of described two circles in the template image is determined;
Step S22, the coordinate according to the center of circle of described two circles in the template image, it is alive that described two circles are calculated
Distance of center circle calculated value in boundary's coordinate system;
Step S23, after calibration line measured value of the calibration line in world coordinate system is received, the center of circle is obtained
Away from the distance between calculated value and the calibration line measured value difference, will pass through the essence that the range difference characterizes this template detection
Degree.
During due to being measured to the calibrating template being placed in world coordinate system, it is difficult to determine the center of circle, therefore, demarcating
The distance of center circle of described two circles is characterized on plate by the calibration line., can be according to described two circles after template coordinate is obtained
Coordinate of the center of circle on template image, distance of center circle calculated value is calculated, also, pass through survey tool (such as slide measure) and survey
The scaling board in physical world is measured, length measurements of the calibration line in world coordinate system can be obtained, pass through the circle
The heart is away from the distance between calculated value and length measurements difference, you can obtains the precision of this template detection.
Wherein, the coordinate according to the center of circle of described two circles in the template image, described two circles are calculated in the world
During distance of center circle calculated value in coordinate system, each anchor point and calibration point on image to be calibrated can be pre-established, is sat with the world
The mapping relations between each anchor point and calibration point on the calibrating template of system are marked, according to the mapping relations, determine described two
The world coordinates in the center of circle of individual circle, then according to the world coordinates, described two circles can both be calculated in world coordinate system
In distance of center circle calculated value.
The range difference of the distance of center circle calculated value and length measurements, the precision of this template detection can be reflected, it is described
Range difference is smaller, then illustrates that the precision of this template detection is higher.Test of many times shows, with prior art to gridiron pattern scaling board
The method for carrying out template detection is compared, and error rate can be reduced by 33.3% or so by template detection method disclosed in the present application.
Accordingly, a kind of template detection device is also disclosed in the application.Structural representation shown in Figure 8, the template
Detection means includes:Image collection module 11, filtering module 12, detection module 13, the first determining module 14 and second determine mould
Block 15.
Wherein, described image acquisition module 11, for obtaining the template image of filming apparatus shooting to be calibrated, the mould
Include preset calibrations template in plate image, the preset calibrations module includes at least one demarcating circle group and at least three positioning
Circle group, the center of circle of at least three setting circles group are not located along the same line, wherein, each demarcating circle group is included at least
Two demarcating circles, the center of circle of whole demarcating circles is identical in same demarcating circle group, also, in same demarcating circle group at least
Two demarcating circles form annulus, and annulus is different from the color of adjacent area;It is fixed that each setting circle group includes at least two
Circle of position, the center of circle of whole setting circles is identical in same setting circle group, also, at least two in same setting circle group are fixed
Circle of position forms annulus, and annulus is different from the color of adjacent area;Each setting circle group includes fisrt feature circle and second
Characteristic circle, wherein, the radius of the radius and the setting circle in all setting circle groups of the fisrt feature circle is unequal;Institute
Radius and the radius of the demarcating circle in each demarcating circle group for stating second feature circle are unequal;
The filtering module 12, for according to default connection block coverage, entering to the connection block in the template image
Row filtering, obtains and connects block with the multiple of demarcating circle group comprising the setting circle group;
The detection module 13, for being detected to the connection block, obtain contour edge corresponding to the connection block
Group;
First determining module 14, for the center according to each contour edge in the contour edge group, determine institute
The center of contour edge group is stated, and according to the size of each contour edge in the contour edge group, determines the contour edge
The type of group, the type include:Demarcating circle group and setting circle group, wherein, the center of the setting circle group is the anchor point,
The center of the demarcating circle group is the calibration point;
Second determining module 15, for the distributing position according to the anchor point in the template image, it is determined that
Distributing position of the calibration point in the template image, and point according to the anchor point and calibration point in the template image
Cloth position, determine the template coordinate of the template image.
Further, first determining module 14 includes:
First computing unit, for calculating the average value at the center of each contour edge in the contour edge group, and will
Center of the average value as the contour edge group;
Or,
Judging unit, for behind the center of each contour edge in obtaining the contour edge group, judging described each
Whether the distance between center of contour edge difference is in default distance range;
Second computing unit, if for the range difference in the default distance range, calculate the profile side
The average value at the center of each contour edge in edge group, and the center using the average value as the contour edge group.
Further, second determining module 15 includes:
Unit is established in mapping, will for the distributing position according to the anchor point and calibration point in the template image
Each anchor point and calibration point on the image to be calibrated, with each anchor point and mark on the calibrating template of known coordinate system
Fixed point establishes mapping relations;
Template coordinate determining unit, for according in the mapping relations, and the calibrating template of the known coordinate system
Anchor point and calibration point coordinate, determine the template coordinate of the template image.
Further, the template detection device also includes:
Denoising module, for according to default connection block coverage, being carried out to the connection block in the template image
Before filter, denoising is carried out to the template image;
Accordingly, the filtering module is additionally operable to after the template image after obtaining denoising, according to default connection block
Coverage, the template image after the denoising is filtered.
And/or the template detection device also includes:
Binary conversion treatment module, for connecting block coverage according to default, to the connection block in the template image
Before being filtered, binary conversion treatment is carried out to the template image;
Accordingly, the filtering module is additionally operable to after the template image after obtaining binary conversion treatment, according to default connection
Block coverage, the template image after the binary conversion treatment is filtered.
Further, the preset calibrations template also includes calibration line, and the length of the calibration line, which is equal to, has different circles
Distance of center circle between arbitrary two circles of the heart, it is determined that after the template coordinate of the template image, the template detection fills
Putting also includes:
Central coordinate of circle determining module, for by the template coordinate, determining the center of circle of described two circles in the template
Coordinate in image;
Distance of center circle computing module, for coordinate of the center of circle according to described two circles in the template image, calculate institute
State distance of center circle calculated value of two circles in world coordinate system;
Range difference computing module, for after calibration line measured value of the calibration line in world coordinate system is received,
The distance between the distance of center circle calculated value and the calibration line measured value difference are obtained, this is characterized will pass through the range difference
The precision of template detection.
Template detection device disclosed in the present application passes through at least two in each demarcating circle group when carrying out template detection
Demarcating circle determines the center of circle of the demarcating circle group, so as to obtain calibration point, passes through at least two setting circles in each setting circle group
The center of circle of the setting circle group is determined, so as to obtaining anchor point, and determines each calibration point in the picture by the anchor point
Distribution situation, further obtain template coordinate.Compared with gridiron pattern scaling board of the prior art, calibration mold disclosed in the present application
Plate is not easily susceptible to the interference of external environment when obtaining calibration point, improves the stability and correctness of calibration point acquisition, accordingly
The precision of template detection is improved, and can further improve follow-up stated accuracy.
In addition, in the calibrating template that the application uses, each demarcating circle group and setting circle group are by least two center of circle phases
With circle composition, compared with chessboard case marker fixed board, circular to be influenceed by filming apparatus projection change smaller, robustness is stronger.
Accordingly, a kind of terminal, structural representation shown in Figure 9 is also disclosed in the application, and the terminal 10 includes:Place
Device 100, memory 200 and bus 300 are managed, wherein,
The processor 100 is connected by bus 300 with the memory 200;
The memory 200, the program code for the method for storage process data sharing;
The processor 100, for obtaining the program code stored in the memory 200, and according to described program generation
Code performs following operate:
The template image of filming apparatus shooting to be calibrated is obtained, includes preset calibrations template in the template image,
The preset calibrations module includes at least one demarcating circle group and at least three setting circle groups, at least three setting circles group
The center of circle is not located along the same line, wherein, each demarcating circle group includes at least two demarcating circles, in same demarcating circle group entirely
The center of circle of the demarcating circle in portion is identical, also, at least two demarcating circles in same demarcating circle group form annulus, and annulus with
The color of adjacent area is different;Each setting circle group includes at least two setting circles, whole institute in same setting circle group
State that the center of circle of setting circle is identical, also, at least two positioning rounds in same setting circle group are into annulus, and annulus and adjacent region
The color in domain is different;Each setting circle group includes fisrt feature circle and second feature circle, wherein, the fisrt feature circle
The radius of radius and the setting circle in all setting circle groups is unequal;The radius of second feature circle with it is each described
The radius of demarcating circle in demarcating circle group is unequal;
According to default connection block coverage, the connection block in the template image is filtered, obtained comprising described
Setting circle group connects block with the multiple of demarcating circle group;
The connection block is detected, obtains contour edge group corresponding to the connection block;
According to the center of each contour edge in the contour edge group, the center of the contour edge group, and root are determined
According to the size of each contour edge in the contour edge group, the type of the contour edge group is determined, the type includes:Mark
Fixed circle group and setting circle group, wherein, the center of the setting circle group is the anchor point, and the center of the demarcating circle group is described
Calibration point;
According to distributing position of the anchor point in the template image, determine calibration point in the template image
Distributing position, and the distributing position according to the anchor point and calibration point in the template image, determine the template image
Template coordinate.
By above-mentioned terminal, template detection can be realized, and during template detection, by each demarcating circle group
At least two demarcating circles determine the center of circle of the demarcating circle group, so as to obtain calibration point, pass through at least two in each setting circle group
Individual setting circle determines the center of circle of the setting circle group, so as to obtain anchor point, and determines that each calibration point exists by the anchor point
Distribution situation in image, further obtain template coordinate.Compared with gridiron pattern scaling board of the prior art, disclosure
Calibrating template when obtaining calibration point, be not easily susceptible to the interference of external environment, improve the stability and just of calibration point acquisition
True property, it is corresponding to improve the precision of template detection, and can further improve follow-up stated accuracy.
It is required that those skilled in the art can be understood that the technology in the embodiment of the present invention can add by software
The mode of general hardware platform realize.Based on such understanding, the technical scheme in the embodiment of the present invention can be with software
The form of product is embodied, and the computer software product can be stored in storage medium, such as read-only storage (English:
Read-only memory, abbreviation:ROM), random access memory (English:Random access memory, abbreviation:
RAM), magnetic disc, CD etc., including some instructions are causing some portions of the computing device embodiment of the present invention or embodiment
Method described in point.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiments.It is real especially for system
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
It should be appreciated that the invention is not limited in the precision architecture for being described above and being shown in the drawings, and
And various modifications and changes can be being carried out without departing from the scope.The scope of the present invention is only limited by appended claim.