Summary of the invention
The embodiment of the present application provides a kind of calibrating template, template detection method, device and terminal, and to solve in conventional art, when carrying out template detection to gridiron pattern scaling board, the template detection precision of existence is low, and affects the problem of stated accuracy.
In order to solve the problems of the technologies described above, the embodiment of the invention discloses following technical scheme:
According to the first aspect of disclosure embodiment, provide a kind of calibrating template, described calibrating template comprises at least one and demarcates circle group and at least three setting circle groups, and the center of circle of described at least three setting circle groups is not located along the same line, wherein,
Each described demarcation circle group comprises at least two and demarcates round, and the center of circle that described demarcation whole in same demarcation circle group is round is identical, and same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area;
Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area;
Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal;
Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal.
In conjunction with first aspect, in the first possible implementation of first aspect, described calibrating template also comprises:
Calibration line, the length of described calibration line equals to have the distance of center circle between excentric any two circles.
According to the second aspect of disclosure embodiment, provide a kind of template detection method, described template detection method comprises:
Obtain the template image of filming apparatus shooting to be calibrated, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal; Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal;
According to default connection block coverage, filter the connection block in described template image, acquisition comprises described setting circle group and is communicated with block with the multiple of demarcation circle group;
Described connection block is detected, obtains the contour edge group that described connection block is corresponding;
According to the center of each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point;
According to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
In conjunction with second aspect, in the first possible implementation of second aspect, the described center according to each contour edge in described contour edge group, determine the center of described contour edge group, comprising:
Calculate the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group;
Or,
Behind the center obtaining each contour edge in described contour edge group, whether the range difference between the center judging each contour edge described is in the distance range preset;
If described range difference is in described default distance range, then calculate the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group.
In conjunction with second aspect, in the implementation that the second of second aspect is possible, described according to anchor point and calibration point the distributing position in described template image, determine that the template coordinate of described template image comprises:
The distributing position in described template image according to described anchor point and calibration point, by each anchor point on described image to be calibrated and calibration point, sets up mapping relations with each anchor point on the calibrating template of known coordinate system and calibration point;
According to described mapping relations, and the coordinate of anchor point on the calibrating template of described known coordinate system and calibration point, determine the template coordinate of described template image.
In conjunction with second aspect, in the third possible implementation of second aspect, described template detection method also comprises:
Being communicated with block coverage according to presetting, before the connection block in described template image is filtered, denoising is carried out to described template image;
Described basis is preset and is communicated with block coverage, filters, comprising the connection block in described template image:
After template image after obtaining denoising, according to default connection block coverage, the template image after described denoising is filtered;
Or,
Being communicated with block coverage according to presetting, before the connection block in described template image is filtered, binary conversion treatment is carried out to described template image;
Described basis is preset and is communicated with block coverage, filters, comprising the connection block in described template image:
After template image after obtaining binary conversion treatment, according to default connection block coverage, the template image after described binary conversion treatment is filtered.
In conjunction with second aspect, in the 4th kind of possible implementation of second aspect, described preset calibrations template also comprises calibration line, the length of described calibration line equals to have the distance of center circle between excentric arbitrary two circles, after the template coordinate determining described template image, described template detection method also comprises:
By described template coordinate, determine the coordinate of the center of circle in described template image of described two circles;
According to the coordinate of the center of circle in described template image of described two circles, calculate the distance of center circle calculated value of described two circles in world coordinate system;
After receiving the calibration line measured value of described calibration line in world coordinate system, obtain the range difference between described distance of center circle calculated value and described calibration line measured value, to be characterized the precision of this template detection by described range difference.
According to the third aspect of disclosure embodiment, provide a kind of template detection device, described template detection device comprises:
Image collection module, for obtaining the template image of filming apparatus shooting to be calibrated, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal; Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal;
Filtering module, for being communicated with block coverage according to presetting, filters the connection block in described template image, and acquisition comprises described setting circle group and is communicated with block with the multiple of demarcation circle group;
Detection module, for detecting described connection block, obtains the contour edge group that described connection block is corresponding;
First determination module, for the center according to each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point;
Second determination module, for according to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
In conjunction with the third aspect, in the first possible implementation of the third aspect, described first determination module comprises:
First computing unit, for calculating the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group;
Or,
Judging unit, for behind the center obtaining each contour edge in described contour edge group, whether the range difference between the center judging each contour edge described is in the distance range preset;
Second computing unit, if for described range difference in described default distance range, then calculates the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group.
In conjunction with the third aspect, in the implementation that the second of the third aspect is possible, described second determination module comprises:
Unit is set up in mapping, for the distributing position in described template image according to described anchor point and calibration point, by each anchor point on described image to be calibrated and calibration point, set up mapping relations with each anchor point on the calibrating template of known coordinate system and calibration point;
Template coordinate determining unit, for according to described mapping relations, and the coordinate of anchor point on the calibrating template of described known coordinate system and calibration point, determine the template coordinate of described template image.
In conjunction with the third aspect, in the third possible implementation of the third aspect, described template detection device also comprises:
Denoising module, for being communicated with block coverage according to presetting, before filtering, carries out denoising to described template image to the connection block in described template image;
Described filtering module also for after the template image after obtaining denoising, according to default connection block coverage, filters the template image after described denoising;
And/or,
Binary conversion treatment module, for being communicated with block coverage according to presetting, before filtering, carries out binary conversion treatment to described template image to the connection block in described template image;
Described filtering module also for after the template image after obtaining binary conversion treatment, according to default connection block coverage, filters the template image after described binary conversion treatment.
In conjunction with the third aspect, in the 4th kind of possible implementation of the third aspect, described preset calibrations template also comprises calibration line, and the length of described calibration line equals to have the distance of center circle between excentric any two circles, after the template coordinate determining described template image, described template detection device also comprises:
Central coordinate of circle determination module, for by described template coordinate, determines the coordinate of the center of circle in described template image of described two circles;
Distance of center circle computing module, for the coordinate of the center of circle in described template image according to described two circles, calculates the distance of center circle calculated value of described two circles in world coordinate system;
Range difference computing module, for after receiving the calibration line measured value of described calibration line in world coordinate system, obtain the range difference between described distance of center circle calculated value and described calibration line measured value, to be characterized the precision of this template detection by described range difference.
According to the fourth aspect of disclosure embodiment, a kind of terminal is provided, comprises: processor, storer and bus, wherein,
Described processor, by bus, is connected with described storer;
Described storer, for the program code of the method for storage process data sharing;
Described processor, for obtaining the program code stored in described storer, and performs following operation according to described program code:
Obtain the template image of filming apparatus shooting to be calibrated, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal; Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal;
According to default connection block coverage, filter the connection block in described template image, acquisition comprises described setting circle group and is communicated with block with the multiple of demarcation circle group;
Described connection block is detected, obtains the contour edge group that described connection block is corresponding;
According to the center of each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point;
According to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
The application discloses a kind of calibrating template, template detection method, device and terminal.In calibrating template disclosed in the present application, each center of circle demarcating circle group is calibration point, the center of circle of each setting circle group is anchor point, when carrying out template detection by calibrating template disclosed in the present application, the center of circle that circle determines this demarcation circle group is demarcated by each at least two of demarcating in circle group, thus acquisition calibration point, the center of circle of this setting circle group is determined by least two setting circles in each setting circle group, thus acquisition anchor point, and determine each calibration point distribution situation in the picture by described anchor point, obtain template coordinate further.Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application, when obtaining calibration point, is not vulnerable to the interference of external environment, improves stability and the correctness of calibration point acquisition, the precision of corresponding raising template detection, and follow-up stated accuracy can be improved further.
In addition, in calibrating template disclosed in the present application, each circle group and setting circle group of demarcating, by the identical circle composition at least two centers of circle, determine plate with chessboard case marker and is compared, and circular less by the project impact that changes of filming apparatus, robustness is stronger.
Embodiment
The embodiment of the present application provides a kind of calibrating template, template detection method, device and terminal, and to solve in conventional art, when carrying out template detection to gridiron pattern scaling board, the template detection precision of existence is low, and affects the problem of stated accuracy.
Technical scheme in the embodiment of the present invention is understood better in order to make those skilled in the art, and enable the above-mentioned purpose of the embodiment of the present invention, feature and advantage become apparent more, below in conjunction with accompanying drawing, technical scheme in the embodiment of the present invention is described in further detail.
The application discloses a kind of calibrating template, and described calibrating template comprises at least one and demarcates circle group and at least three setting circle groups, and the center of circle of described at least three setting circle groups is not located along the same line.
Wherein, each described demarcation circle group comprises at least two and demarcates round, and the center of circle that described demarcation whole in same demarcation circle group is round is identical, and same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area.
Each center of circle demarcating circle comprised in each demarcation circle group is identical, and using the center of circle of round for described demarcation group as calibration point.In same demarcation circle group, comprise at least two and demarcate circle, then demarcate at least one annulus round-formed at least two described in, demarcate circle for the ease of distinguishing each, each annulus is different from the color of adjacent area.Further, in order to improve the precision of differentiation, the color of each annulus and adjacent area selects the color that contrast is higher usually, and such as, can arrange one of them annulus is black, and the adjacent area of this annulus is white.
Such as, the structural representation of demarcation circle group shown in Figure 1, this demarcation circle group comprises two and demarcates circle, demarcate round-formed inner circle 1 and an annulus 2 for described two, wherein, the adjacent area of annulus 2 is inner circle 1, demarcates circle to distinguish these two, inner circle 1 is set to white, annulus 2 is set to black.
In addition, another kind shown in Figure 2 demarcates the structural representation of circle group, and the demarcation circle group in this figure comprises three and demarcates circle, demarcates round-formed inner circle 3, annulus 4 and annulus 5 for described three.Wherein, the adjacent area of annulus 4 is inner circle 3 and annulus 5, and the adjacent area of annulus 5 is annulus 4.Demarcate circle to distinguish these three, inner circle 3 and annulus 5 are set to white, and annulus 4 is set to black.
Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area.
The center of circle of the setting circle comprised in each setting circle group is identical, and using the center of circle of described setting circle group as anchor point.Because the center of circle of described at least three setting circle groups is not located along the same line, therefore can obtain at least three anchor points according to this scaling board, and described at least three anchor points are not at same straight line, thus the effect of location can be played.In addition, in same setting circle group, comprise at least two setting circles, then described in, at least two setting circles form at least one annulus, and for the ease of distinguishing each setting circle, each annulus is different from the color of adjacent area.Further, in order to improve the precision of differentiation, the color of each annulus and adjacent area selects the color that contrast is higher usually, and such as, can arrange one of them annulus is black, and the adjacent area of this annulus is white.
Further, each described setting circle group comprises fisrt feature circle and second feature circle, wherein, location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal, described second feature radius of a circle and the demarcation radius of a circle demarcated described in each in circle group all unequal.
Fisrt feature circle is all included in each setting circle group, fisrt feature radius of a circle in each setting circle group is all unequal with the location radius of a circle in each setting circle group, that is, fisrt feature circle in each setting circle group is all unequal with the location radius of a circle in other each setting circle groups except self, and, in this fisrt feature fenestra and setting circle group belonging to self other each to locate radius of a circle all unequal, thus can to come according to each setting circle group differentiation of the large young pathbreaker of described fisrt feature radius of a circle.
Accordingly, second feature circle is also included in each setting circle group, described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal, thus can according to described second feature radius of a circle size discrimination setting circle group and demarcate circle group.
In addition, in described scaling board, each setting circle group can be identical with the number demarcating the circle comprised in circle group, also can be different, and the application is not construed as limiting this.
In calibrating template disclosed in the present application, each center of circle demarcating circle group is calibration point, the center of circle of each setting circle group is anchor point, when carrying out template detection by calibrating template disclosed in the present application, the center of circle that circle determines this demarcation circle group is demarcated by each at least two of demarcating in circle group, thus acquisition calibration point, the center of circle of this setting circle group is determined by least two setting circles in each setting circle group, thus acquisition anchor point, and determine each calibration point distribution situation in the picture by described anchor point, obtain template coordinate further.Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application, when obtaining calibration point, is not vulnerable to the interference of external environment, improves stability and the correctness of calibration point acquisition, the precision of corresponding raising template detection, and follow-up stated accuracy can be improved further.
In addition, in calibrating template disclosed in the present application, each circle group and setting circle group of demarcating, by the identical circle composition at least two centers of circle, determine plate with chessboard case marker and is compared, and circular less by the project impact that changes of filming apparatus, robustness is stronger.
Further, described calibrating template also comprises:
Calibration line, the length of described calibration line equals to have the distance of center circle between excentric any two circles.
Wherein, the length of described calibration line can be on described calibrating template, any two distance of center circle had between excentric circle.When drawing scaling board before, the distance of center circle between described two circles can be obtained, and draw the calibration line equal with described distance of center circle length on scaling board.During owing to measuring the calibrating template be placed in world coordinate system, be difficult to determine the center of circle, therefore, scaling board characterized by described calibration line the distance of center circle of described two circles.After acquisition template coordinate, can according to the coordinate of the center of circle on template image of described two circles, calculate distance of center circle calculated value, and, the scaling board in physical world is measured by survey instrument (as vernier caliper), the length measurements of described calibration line in world coordinate system can be obtained, by the range difference between described distance of center circle calculated value and length measurements, the precision of this template detection can be obtained.
The schematic diagram of a kind of calibrating template shown in Figure 3, in this figure, the demarcation circle arranged in this calibrating template is organized and setting circle group forms by two concentric circless, certainly, the numerical value that each setting circle group and the quantity of demarcating the circle comprised in circle group also can be greater than two for other, the application is not construed as limiting this.Wherein, the demarcation circle in this calibrating template organizes and in setting circle group, inner circle is white, and cylindrical is black, and to distinguish inner circle and cylindrical, certainly, inner circle and cylindrical can also be set to other different colors, and the application does not limit this.
In addition, in the calibrating template shown in Fig. 3, the setting circle group comprised is separately positioned on the position of the upper left of calibrating template, upper right and lower-left, the setting circle group being arranged on calibrating template upper left refers to first round group in left side in this calibrating template the first row, the setting circle group being arranged on calibrating template upper right refers to first round group on right side in this calibrating template the first row, and the setting circle group being arranged on calibrating template lower-left refers to first round group in left side in this calibrating template last column.Further, positioning action not on the same line, can be played in the center of circle of these three setting circle groups, for determining the distribution situation of demarcating circle group in template detection process, thus determines the template coordinate of calibrating template.Further, the concentric circles being positioned at other positions demarcates circle group to being.In order to distinguish each setting circle group, in this calibrating template, the inner circle radius of three setting circle groups is set to different length; In order to by setting circle group with demarcate circle group differentiation and open, the inner circle radius of described three setting circle groups is with each to demarcate the inner circle radius that circle organizes all unequal, and that is, the fisrt feature in described three setting circle groups is round and second feature is round is inner 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, and the white inner circle radius of the setting circle group of upper right is minimum.In addition, each shown in Fig. 3 is demarcated in circle group, and interior radius of a circle is all equal, and in other embodiments, each is demarcated in circle group, and radius of a circle also can be unequal, and the application does not limit this.
In calibrating template disclosed in the present application, the quantity of the demarcation of setting circle group and setting circle group is more, and the precision of template detection is higher, and described demarcate circle organize and the quantity of setting circle group more, the time needed for template detection is longer.In actual applications, usually by demarcating multiple concentric circless pair of circle group and the formation of setting circle group, the form of 3x4 to 12x15 is set to.
Further, in the calibrating template shown in Fig. 3, be also provided with calibration line, the length of described calibration line etc. and the distance of center circle had between excentric any two circles.Wherein, the line segment of this calibrating template bottom is described calibration line.There are described in setting excentric two circles and be respectively the first circle and the second circle, as shown in Figure 3, four calibration lines are included in this calibrating template, according to order from left to right, Article 1, described first circle that calibration line is corresponding and the second circle are respectively the circle in first round group in last column, and the circle in second round group, described first circle that Article 2 calibration line is corresponding and the second circle are respectively the circle in the 3rd round group in last column, and the circle in the 4th round group, described first circle that Article 3 calibration line is corresponding and the second circle are respectively the circle in the 5th round group in last column, and the circle in the 6th round group, described first circle that Article 4 calibration line is corresponding and the second circle are respectively the circle in the 7th round group in last column, and the circle in the 8th round group.These four calibration lines are separately positioned on the below of corresponding first circle and the second circle, and the starting point of described calibration line and terminal are in same level.Certainly, can also choose other circles as the first circle and the second circle, and calibration line is arranged on other positions of calibrating template, the application does not limit this.
Such as, in the another kind of calibrating template shown in Fig. 4, the circle that described first circle and the second circle are respectively in first round group of last column, and the circle in last circle group of last column, and this calibration line is arranged on the below of described first circle and the second circle.Another kind of calibrating template shown in Figure 5, described first circle is the circle in first round group of calibrating template the first row, described second circle is the circle in second round group of calibrating template second row, the calibration line that distance of center circle length that is round with described first and the second circle is equal is arranged on the left side of described calibrating template, if the line set between described first circle and the center of circle of the second circle is center of circle line, this calibration line and described center of circle line parallel.Certainly, also this calibration line can be arranged to vertical direction, the application does not limit 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 comprises the following steps:
Step S11, obtain the template image of filming apparatus to be calibrated shooting, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal; Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal.
Step S12, basis are preset and are communicated with block coverage, filter the connection block in described template image, and acquisition comprises described setting circle group and is communicated with block with round the multiple of group of demarcation.
Filming apparatus, when taking pictures to preset calibrations template, often photographs other objects beyond described preset calibrations template, thus needs to be filtered template image by step S12.
In step s 12, template image is detected, obtain the connection block in template image, then according to the connection block coverage preset, this connection block is filtered, the connection block of filtering area coverage not in described default connection block coverage, the connection block of remaining area coverage in described default connection block coverage is setting circle group and demarcates circle group.
Wherein, setting outermost circle in each described demarcation circle group and setting circle group is the 3rd circle, and the area coverage setting described 3rd circle is that unit is communicated with block area coverage, minimum value then in described default connection block coverage is not more than the minimum value in described unit connection block area coverage, and the maximal value in described default connection block coverage is not less than the maximal value in described unit connection block area coverage.
Step S13, described connection block to be detected, obtain the contour edge group that described connection block is corresponding.
Wherein, described setting circle group and demarcate circle group and be and circular be communicated with block, filming apparatus is when taking pictures to calibrating template, the impact projected, setting circle group in template image and demarcation circle group often present ellipse, therefore, when being communicated with block to each and detecting, the method by ellipse fitting obtains contour edge group corresponding to described connection block.
In addition, can also by the method for ellipses detection, obtain the contour edge group that described connection block is corresponding, the application is not construed as limiting this.
After edge fitting is carried out to connection block, the contour edge group corresponding with being communicated with block can be obtained.Such as, if described calibrating template as shown in Figure 3, then each contour edge group comprises two oval contour edges.
Step S14, center according to each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point.
Owing to comprising second feature circle in described setting circle group, described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal, then can according to the type of each contour edge group of the size discrimination of contour edge, type due to contour edge group comprises demarcates circle group and setting circle group, thus each contour edge group described is divided into demarcation circle group and setting circle group.
Step S15, according to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
Owing to including fisrt feature circle in each setting circle group, described fisrt feature radius of a circle and other each described in location radius of a circle in setting circle group all unequal, therefore, by the size of each contour edge in setting circle group, each setting circle group differentiation is come, thus determines the distributing position of described anchor point in described template image.According to the distributing position of described anchor point in described template image, the distributing position of each calibration point in described template image can be determined.
If this secondary module detect for described template image in the calibrating template that comprises as shown in Figure 3, fisrt feature circle in each setting circle group is inner circle, by the size of contour edge corresponding to inner circle, three setting circle group differentiations can be come, thus determine the distributing position of anchor point in described template image.Then, positioned by described anchor point, such as, if first calibration point on the right side of the anchor point being distributed in upper left is defined as the first calibration point, then can determine that second calibration point be distributed on the right side of the anchor point of upper left is the second calibration point, thus obtain the distributing position of each calibration point in template image successively.
The step S11 to step S15 of the application discloses a kind of template detection method.When carrying out template detection by method disclosed in the present application, the center of circle that circle determines this demarcation circle group is demarcated by each at least two of demarcating in circle group, thus acquisition calibration point, the center of circle of this setting circle group is determined by least two setting circles in each setting circle group, thus acquisition anchor point, and determine each calibration point distribution situation in the picture by described anchor point, obtain template coordinate further.Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application, when obtaining calibration point, is not vulnerable to the interference of external environment, improves stability and the correctness of calibration point acquisition, the precision of corresponding raising template detection, and follow-up stated accuracy can be improved further.
In addition, in calibrating template disclosed in the present application, each circle group and setting circle group of demarcating, by the identical circle composition at least two centers of circle, determine plate with chessboard case marker and is compared, and circular less by the project impact that changes of filming apparatus, robustness is stronger.
In step S14, the open center according to each contour edge in described contour edge group, determine this step of center of described contour edge group, this step realizes by various ways.
Wherein in a kind of implementation, the described center according to each contour edge in described contour edge group, determine the center of described contour edge group, comprising:
Calculate the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group.
Such as, if this template detection for calibrating template as shown in Figure 3, namely each demarcation circle group and setting circle group form by 2 concentric circless, passing through edge fitting, after obtaining contour edge group, can detect in each contour edge group and include two contour edges, then detect the center of two contour edges comprised in each contour edge group, the mean value at the center of described two contour edges is the center of this contour edge group.
In another kind of implementation, the described center according to each contour edge in described contour edge group, determine the center of described contour edge group, comprising:
First, behind the center obtaining each contour edge in described contour edge group, whether the range difference between the center judging each contour edge described is in the distance range preset; Then, if described range difference is in described default distance range, then calculate the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group.
In above-mentioned steps, behind the center getting each contour edge in contour edge group, whether the range difference between the center judging each contour edge described is in the distance range preset, if described range difference exceedes described default distance range, then illustrate that the centre distance of each contour edge in same contour edge group is far away, in this case, think that error appears in this contour edge group, in subsequent step, no longer consider this contour edge group; If the range difference between the center of each contour edge described is in the distance range preset, then illustrate that the centre distance of each contour edge in same contour edge group is comparatively near, then determine the center of described contour edge group by the mean value at the center of each contour edge in this contour edge group.
By above-mentioned steps, can error be reduced, improve the precision of template detection further.
The distributing position in described template image according to each anchor point described and calibration point, can determine the template coordinate of described template image.Wherein, determine that the implementation of the template coordinate of described template image comprises multiple.
Wherein in a kind of implementation, described according to anchor point and calibration point the distributing position in described template image, determine that the template coordinate of described template image comprises:
First, the distributing position in described template image according to described anchor point and calibration point, by each anchor point on described image to be calibrated and calibration point, sets up mapping relations with each anchor point on the calibrating template of known coordinate system and calibration point;
Then, according to described mapping relations, and the coordinate of anchor point on the calibrating template of described known coordinate system and calibration point, determine the template coordinate of described template image.
In above-mentioned implementation, need the calibrating template obtaining known coordinate system in advance, in this calibrating template, the coordinate of each calibration point and anchor point is known, in this case, according to each anchor point on described image to be calibrated and calibration point, and the mapping relations between each anchor point and calibration point on the calibrating template of known coordinate system, and the coordinate of each calibration point on the calibrating template of described known coordinate system, can determine the template coordinate of described template image.Wherein, described known coordinate system can be world coordinate system, or, can be other forms of image coordinate system.
In another kind of implementation, can prestore and be distributed in each anchor point of diverse location and the coordinate of calibration point, after getting each anchor point and the distributing position of calibration point in described template image, inquire about the coordinate information prestored, the template coordinate of described template image can be determined.
Such as, if this template detection for calibrating template as shown in Figure 3, first calibration point on the right side of the anchor point being distributed in upper left is defined as the first calibration point, determine that second calibration point be distributed on the right side of the anchor point of upper left is the second calibration point, and prestored the coordinate of the first calibration point and the second calibration point.When carrying out template detection, pass through anchor point, the distributing position of the first calibration point in template image and the second calibration point can be determined, and inquire about the coordinate information prestored, the coordinate of the first calibration point and the second calibration point can be determined, identical, other calibration points and the coordinate of anchor point in template image can also be obtained, according to described coordinate, get final product the template coordinate of determination module image.
Further, template detection method disclosed in the present application also comprises: being communicated with block coverage according to presetting, before filtering, carry out denoising to described template image to the connection block in described template image.
In this case, being communicated with block coverage according to presetting described in step S12, the connection block in described template image being filtered, comprising: after the template image after obtaining denoising, according to default connection block coverage, the template image after described denoising is filtered.
Wherein, denoising can adopt the method such as medium filtering or gaussian filtering, can reduce the impact of picture noise.
Further, template detection method disclosed in the present application also comprises: being communicated with block coverage according to presetting, before filtering, carry out binary conversion treatment to described template image to the connection block in described template image.
In this case, being communicated with block coverage according to presetting described in step S12, the connection block in described template image being filtered, comprising: after the template image after obtaining binary conversion treatment, according to default connection block coverage, the template image after described binary conversion treatment is filtered.
By binary conversion treatment, the contrast in image can be increased, make image present comparatively significantly visual effect.Denoising and binary conversion treatment all can improve the accuracy of detection of calibration point and anchor point, and then improve the precision of template detection.
Further, described preset calibrations template also comprises calibration line, and the length of described calibration line equals to have the distance of center circle between excentric arbitrary two circles, after the template coordinate determining described template image, see Fig. 7, described template detection method also comprises:
Step S21, by described template coordinate, determine the coordinate of the center of circle in described template image of described two circles;
Step S22, the coordinate of the center of circle in described template image according to described two circles, calculate the distance of center circle calculated value of described two circles in world coordinate system;
Step S23, after receiving the calibration line measured value of described calibration line in world coordinate system, obtain the range difference between described distance of center circle calculated value and described calibration line measured value, to be characterized the precision of this template detection by described range difference.
During owing to measuring the calibrating template be placed in world coordinate system, be difficult to determine the center of circle, therefore, scaling board characterized by described calibration line the distance of center circle of described two circles.After acquisition template coordinate, can according to the coordinate of the center of circle on template image of described two circles, calculate distance of center circle calculated value, and, the scaling board in physical world is measured by survey instrument (as vernier caliper), the length measurements of described calibration line in world coordinate system can be obtained, by the range difference between described distance of center circle calculated value and length measurements, the precision of this template detection can be obtained.
Wherein, according to the coordinate of the center of circle in described template image of described two circles, when calculating the distance of center circle calculated value of described two circles in world coordinate system, each anchor point on image to be calibrated and calibration point can be set up in advance, and the mapping relations between each anchor point and calibration point on the calibrating template of world coordinate system, according to these mapping relations, determine the world coordinates in the center of circle of described two circles, then according to this world coordinates, the distance of center circle calculated value of described two circles in world coordinate system can both have been calculated.
The range difference of described distance of center circle calculated value and length measurements, can reflect the precision of this template detection, and described range difference is less, then illustrate that the precision of this template detection is higher.Test of many times shows, compared with the method for gridiron pattern scaling board being carried out to template detection with prior art, error rate can be reduced about 33.3% by template detection method disclosed in the present application.
Accordingly, the application also discloses a kind of template detection device.Structural representation shown in Figure 8, described template detection device comprises: image collection module 11, filtering module 12, detection module 13, first determination module 14 and the second determination module 15.
Wherein, described image collection module 11, for obtaining the template image of filming apparatus shooting to be calibrated, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area, each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area, each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal, described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal,
Described filtering module 12, for being communicated with block coverage according to presetting, filters the connection block in described template image, and acquisition comprises described setting circle group and is communicated with block with the multiple of demarcation circle group;
Described detection module 13, for detecting described connection block, obtains the contour edge group that described connection block is corresponding;
Described first determination module 14, for the center according to each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point;
Described second determination module 15, for according to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
Further, described first determination module 14 comprises:
First computing unit, for calculating the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group;
Or,
Judging unit, for behind the center obtaining each contour edge in described contour edge group, whether the range difference between the center judging each contour edge described is in the distance range preset;
Second computing unit, if for described range difference in described default distance range, then calculates the mean value at the center of each contour edge in described contour edge group, and using the center of described mean value as described contour edge group.
Further, described second determination module 15 comprises:
Unit is set up in mapping, for the distributing position in described template image according to described anchor point and calibration point, by each anchor point on described image to be calibrated and calibration point, set up mapping relations with each anchor point on the calibrating template of known coordinate system and calibration point;
Template coordinate determining unit, for according to described mapping relations, and the coordinate of anchor point on the calibrating template of described known coordinate system and calibration point, determine the template coordinate of described template image.
Further, described template detection device also comprises:
Denoising module, for being communicated with block coverage according to presetting, before filtering, carries out denoising to described template image to the connection block in described template image;
Accordingly, described filtering module also for after the template image after obtaining denoising, according to default connection block coverage, filters the template image after described denoising.
And/or described template detection device also comprises:
Binary conversion treatment module, for being communicated with block coverage according to presetting, before filtering, carries out binary conversion treatment to described template image to the connection block in described template image;
Accordingly, described filtering module also for after the template image after obtaining binary conversion treatment, according to default connection block coverage, filters the template image after described binary conversion treatment.
Further, described preset calibrations template also comprises calibration line, and the length of described calibration line equals to have the distance of center circle between excentric arbitrary two circles, and after the template coordinate determining described template image, described template detection device also comprises:
Central coordinate of circle determination module, for by described template coordinate, determines the coordinate of the center of circle in described template image of described two circles;
Distance of center circle computing module, for the coordinate of the center of circle in described template image according to described two circles, calculates the distance of center circle calculated value of described two circles in world coordinate system;
Range difference computing module, for after receiving the calibration line measured value of described calibration line in world coordinate system, obtain the range difference between described distance of center circle calculated value and described calibration line measured value, to be characterized the precision of this template detection by described range difference.
Template detection device disclosed in the present application is when carrying out template detection, the center of circle that circle determines this demarcation circle group is demarcated by each at least two of demarcating in circle group, thus acquisition calibration point, the center of circle of this setting circle group is determined by least two setting circles in each setting circle group, thus acquisition anchor point, and determine each calibration point distribution situation in the picture by described anchor point, obtain template coordinate further.Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application, when obtaining calibration point, is not vulnerable to the interference of external environment, improves stability and the correctness of calibration point acquisition, the precision of corresponding raising template detection, and follow-up stated accuracy can be improved further.
In addition, in the calibrating template that the application adopts, each circle group and setting circle group of demarcating, by the identical circle composition at least two centers of circle, determine plate with chessboard case marker and is compared, and circular less by the project impact that changes of filming apparatus, robustness is stronger.
Accordingly, the application also discloses a kind of terminal, structural representation shown in Figure 9, and described terminal 10 comprises: processor 100, storer 200 and bus 300, wherein,
Described processor 100, by bus 300, is connected with described storer 200;
Described storer 200, for the program code of the method for storage process data sharing;
Described processor 100, for obtaining the program code stored in described storer 200, and performs following operation according to described program code:
Obtain the template image of filming apparatus shooting to be calibrated, preset calibrations template is included in described template image, described preset calibrations module comprises at least one and demarcates circle group and at least three setting circle groups, the center of circle of described at least three setting circle groups is not located along the same line, wherein, each described demarcation circle group comprises at least two and demarcates circle, the center of circle that described demarcation whole in same demarcation circle group is round is identical, and, same at least two of demarcating in circle group demarcate round-formed annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises at least two setting circles, and the center of circle of described setting circles whole in same setting circle group is identical, and at least two setting circles in same setting circle group form annulus, and annulus is different from the color of adjacent area; Each described setting circle group comprises fisrt feature circle and second feature is justified, and wherein, the location radius of a circle in described fisrt feature radius of a circle and all described setting circle groups is all unequal; Described second feature radius of a circle and demarcate described in each circle group in demarcation radius of a circle all unequal;
According to default connection block coverage, filter the connection block in described template image, acquisition comprises described setting circle group and is communicated with block with the multiple of demarcation circle group;
Described connection block is detected, obtains the contour edge group that described connection block is corresponding;
According to the center of each contour edge in described contour edge group, determine the center of described contour edge group, and according to the size of each contour edge in described contour edge group, determine the type of described contour edge group, described type comprises: demarcate circle group and setting circle group, wherein, the center of described setting circle group is described anchor point, and the center of described demarcation circle group is described calibration point;
According to the distributing position of described anchor point in described template image, determine the distributing position of calibration point in described template image, and according to described anchor point and calibration point the distributing position in described template image, determine the template coordinate of described template image.
By above-mentioned terminal, template detection can be realized, and in template detection process, the center of circle that circle determines this demarcation circle group is demarcated by each at least two of demarcating in circle group, thus acquisition calibration point, determined the center of circle of this setting circle group by least two setting circles in each setting circle group, thus obtain anchor point, and determine each calibration point distribution situation in the picture by described anchor point, obtain template coordinate further.Compared with gridiron pattern scaling board of the prior art, calibrating template disclosed in the present application, when obtaining calibration point, is not vulnerable to the interference of external environment, improves stability and the correctness of calibration point acquisition, the precision of corresponding raising template detection, and follow-up stated accuracy can be improved further.
Those skilled in the art can be well understood to the mode that technology in the embodiment of the present invention can add required general hardware platform by software and realize.Based on such understanding, technical scheme in the embodiment of the present invention can embody with the form of software product, this computer software product can be stored in storage medium, as ROM (read-only memory) is (English: read-only memory, abbreviation: ROM), random access memory is (English: random access memory, RAM), magnetic disc, CD etc. abbreviation:, comprises some instructions and performs method described in some part of the embodiment of the present invention or embodiment in order to make processor.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiment.Especially, for system embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Should be understood that, the present invention is not limited to precision architecture described above and illustrated in the accompanying drawings, and can carry out various amendment and change not departing from its scope.Scope of the present invention is only limited by appended claim.