Embodiment
With reference to figure 1, the handset size measuring method in one embodiment of the invention, comprises the following steps.
S110: the image obtaining reference body, according to the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body.
Reference body is used for as reference measurement, and the image of reference body can be obtained by image taking instrument, such as camera.The length pixel value of reference body and width pixel value refer to the length direction straight line of the image of reference body and the pixel value of Width line correspondences respectively.
S130: the length of measuring basis object and the width of reference body, obtains length ratio coefficient according to the length pixel value of reference body and the length of reference body, obtains width ratio coefficient according to the width pixel value of reference body and the width of reference body.
Wherein in an embodiment, reference body is reference handset, and the length of reference body and the width of reference body are the button of removing reference handset and the length measured by antenna and width.Therefore, according to the length ratio coefficient that the length pixel value of reference handset and the length of reference handset obtain, and according to the width ratio coefficient that the width pixel value of reference handset and the width of reference handset obtain, be the scale-up factor beyond removing button and size, so that follow-up length for calculating the tested mobile phone taken out beyond button and antenna and width.
Particularly, in the present embodiment, vernier caliper measurement can be adopted to remove length and the width of the reference handset beyond button and antenna.
S150: under the shooting environmental of image obtaining reference body, obtain the image of tested mobile phone, and according to the length pixel value of the tested mobile phone of the Image Acquisition of tested mobile phone and the width pixel value of tested mobile phone.
Shooting environmental refers to the photoenvironment etc. when adopting video camera shooting reference body.Under the same shooting environmental obtaining reference body, obtain the image of tested mobile phone, thus the length ratio coefficient obtained according to the related data of reference body and width ratio coefficient are equally applicable to tested mobile phone, and accuracy is higher.
S170: the length obtaining tested mobile phone according to the length pixel value of tested mobile phone and length ratio coefficient, obtains the width of tested mobile phone according to the width pixel value of tested mobile phone and width ratio coefficient.After the width pixel value of the length pixel value and tested mobile phone that obtain tested mobile phone, directly can calculate length and the width of tested mobile phone according to the length ratio coefficient obtained in step S130 and width ratio coefficient.
Above-mentioned handset size measuring method, according to length pixel value and the width pixel value of the Image Acquisition reference body of the reference body obtained, length ratio coefficient and width ratio coefficient is obtained respectively according to the length of reference body measured and the length pixel value of width and reference body and width pixel value, according to the length pixel value of the tested mobile phone of Image Acquisition and the width pixel value of tested mobile phone of the tested mobile phone obtained, then combine, length ratio coefficient, width ratio coefficient, the length pixel value of tested mobile phone and the width pixel value of tested mobile phone, obtain length and the width of tested mobile phone respectively.This handset size measuring method adoption rate computing and do not need to use the size that range sensor can measure tested mobile phone, cost is low and measuring accuracy is higher.
Wherein in an embodiment, according to the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body in step S110, can be specifically choose a maximum rectangle according to the image of reference body, obtain the longest straight line of the length direction of maximum rectangle and the straight line of Width, and detect the length pixel value of the longest straight line of length direction and the width pixel value of the longest straight line of Width respectively.
Wherein in an embodiment, in step S130, obtain length ratio coefficient according to the length pixel value of reference body and the length of reference body, obtain width ratio coefficient according to the width pixel value of reference body and the width of reference body, be specially:
Wherein, k
1for length ratio coefficient, k
2for width ratio coefficient, N
1for the length pixel value of reference body, L
1for the length of reference body, N
2for the width pixel value of reference body, L
2for the width of reference body.
Wherein in an embodiment, with reference to figure 2, according to the length pixel value of the tested mobile phone of the Image Acquisition of tested mobile phone and the width pixel value of tested mobile phone in step S150, comprise step S151 to step S155.
S151: the image rotating tested mobile phone, makes the image of tested mobile phone mate default rectangular coordinate system in a first direction and a second direction, and searches mobile phone profile.
The rectangular coordinate system that coupling is preset, the image referring to rotate tested mobile phone makes a lateral edges of tested mobile phone parallel with first direction, and opposite side edge is parallel with second direction.Such as, in the present embodiment, the rectangular coordinate preset to be inclination angle be zero rectangular coordinate system, first direction is horizontal direction, and second direction is vertical direction, therefore, is also the placement of horizontal vertical direction after the image rotation of tested mobile phone.Be appreciated that in other embodiments, the rectangular coordinate system of the rectangular coordinate system preset also can be inclination angle be other numerical value.
On the image that mobile phone profile refers to tested mobile phone, the image of corresponding mobile phone position part, can be the background parts getting rid of edge after carrying out binary conversion treatment to the image of tested mobile phone, search mobile phone profile.
S153: obtain the first length line on first direction according to mobile phone profile, obtains the second length line in second direction according to mobile phone profile.
First length line refers to mobile phone profile the longest straight line in a first direction, may be used for the length representing first direction; Second length line refers to mobile phone profile the longest straight line in a second direction, may be used for the length representing second direction.
S155: obtain the length pixel value of tested mobile phone and the width pixel value of tested mobile phone according to the first length line and the second length line.
In the present embodiment, step S155 is specially: choose straight line that in the first length line and the second length line, length the is longer length line as tested mobile phone, then another straight line is as the wide line of tested mobile phone.
Length line and the wide line of tested mobile phone is obtained according to the first length line and the second length line, first length line and the second length line choose the button, antenna etc. that can remove tested mobile phone, therefore the length pixel value that the length line finally obtained is corresponding and width pixel value corresponding to wide line are removes button, antenna, and result of calculation is more accurate.
Wherein in an embodiment, with reference to figure 3, obtain the first length line on first direction according to mobile phone profile in step S153, specifically can comprise step S1531 to step S1537.
S1531: the outer most edge straight line searching the first direction side of mobile phone profile.
Such as, first direction is horizontal direction, and with the left side of the horizontal direction of mobile phone profile for starting point, the outer most edge straight line of mobile phone profile is searched in movement to the right.
S1533: judge whether outer most edge straight line meets programmable button length range.If so, then can think that the outer most edge straight line found is button, perform step S1535.
Programmable button length range refers to meet the condition by key length, specifically can arrange according to actual conditions.
S1535: search the consult straight line the shortest with the spacing of outer most edge straight line.
Consult straight line is straight line the most adjacent with outer most edge straight line in a first direction.
S1537: judge whether consult straight line meets and preset length and width scope.If so, then step S1538 is performed.
Preset length and width scope and refer to the condition meeting mobile phone length and width, specifically can arrange according to the large probable value of handset size.
S1538: judge whether the distance between outer most edge straight line and consult straight line meets predeterminable range scope.If so, step S1539 is performed.
Predeterminable range scope is the distance between the button of definition and the first length line, can arrange according to actual conditions.
S1539: choosing consult straight line is the first length line.
Search the first length line by the judgement of multiple condition, choosing of straight line can be avoided to be subject to noise effect, improve the accuracy that line segment is searched.Particularly, in the present embodiment, the specific procedure obtaining the first length line on first direction according to mobile phone profile is as follows:
Analyze from outermost straight line, perform first and judge operation: judge whether outer most edge straight line L1 meets programmable button length range T1, if so, then perform second and judge operation; If not, search from secondary outside straight line, until find the outer most edge straight line meeting programmable button length range T1, if the straight line having traveled through side does not find the straight line meeting programmable button length range T1, then perform second and judge operation.
Second judges operation: judge whether the consult straight line L2 length the most adjacent with outer most edge straight line meets and preset length and width scope T2, if, then perform the 3rd and judge operation, if not, then judge that whether the length of consult straight line L2 is too small or excessive, judge that whether the length of consult straight line L2 is similar to the length of outer most edge straight line L1.If consult straight line L2 is too small or excessive, then thinks consult straight line L2 noise, give up consult straight line L2, return the second judgement operation, search the secondary adjacent straight line with outer most edge straight line.If whether the length of consult straight line L2 is similar to the length of outer most edge straight line L1, then think that consult straight line L2 is button, give up outer most edge straight line L1, and return the first judgement operation.
3rd judges operation: judge that the distance of outer most edge straight line L1 and consult straight line L2 meets predeterminable range scope T3.If so, then Output rusults: consult straight line L2 is the first length line; If not, then judge that outer most edge straight line L1 is as noise, record consult straight line L2, performs the 4th and judges operation.
Perform the 4th to judge to operate: judge whether consult straight line L2 side has straight line L3 that length is with it similar and distance T4 ten points is close.If so, Output rusults: a new position is found according to the weight of 2:1 in the position of consult straight line L2 and straight line L3.If not, then the straight line L4 whether meeting default length and width scope T2 in the scope T5 inside consult straight line L2 is in addition detected.If meet the straight line L4 of default length and width scope T2 in the scope T5 inside consult straight line L2 in addition, then output error: cannot determine which bar is mobile phone edge on earth, recording the position of consult straight line L2 and straight line L4, by judging that the close call of opposite side makes a decision, performing additional step again; If do not meet the straight line L4 of default length and width scope T2 in the scope T5 inside consult straight line L2, then Output rusults: consult straight line L2 is the first length line.
Additional step: the position of searching the outer most edge straight line L5 of opposite side, compares the distance of L5 and consult straight line L2, straight line L4, if one of them is excessive, beyond the scope of length and width, then give up, if two all in scope, then exporting consult straight line L2 and straight line L4 is the first length line.
Obtain the concrete steps of the second length line in second direction according to mobile phone profile in step S153, similar to the step obtaining the first length line on first direction according to mobile phone profile, do not repeat at this.
Be in the embodiment of reference handset at reference body, according to similar according to the concrete steps S151-step S155 of the length pixel value of the tested mobile phone of the Image Acquisition of tested mobile phone and the width pixel value of tested mobile phone in the concrete steps of the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body and step S150 in step S110, do not repeat at this.
Wherein in an embodiment, step S170 is specially:
Wherein, length is the length of tested mobile phone, and width is the width of tested mobile phone, and N_length is the length pixel value of tested mobile phone, and N_width is the width pixel value of tested mobile phone, k
1for length ratio coefficient, k
2for width ratio coefficient.
Be benchmark by the scale-up factor obtained with reference body measurement, calculate length and the width of tested mobile phone, do not need the size can measuring mobile phone by other external units, reduce and measure cost and measuring accuracy is higher.
With reference to figure 4, the handset size measuring system in one embodiment of the invention, comprises the first pixel value acquisition module 110, scale-up factor computing module 130, second pixel value acquisition module 150 and size computing module 170.
First pixel value acquisition module 110 for obtaining the image of reference body, according to the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body.
Reference body is used for as reference measurement, and the image of reference body can be obtained by image taking instrument, such as camera.The length pixel value of reference body and width pixel value refer to the length direction straight line of the image of reference body and the pixel value of Width line correspondences respectively.
The length of scale-up factor computing module 130 for measuring basis object and the width of reference body, obtain length ratio coefficient according to the length pixel value of reference body and the length of reference body, obtain width ratio coefficient according to the width pixel value of reference body and the width of reference body.
Wherein in an embodiment, reference body is reference handset, and the length of reference body and the width of reference body are the button of removing reference handset and the length measured by antenna and width.Therefore, according to the length ratio coefficient that the length pixel value of reference handset and the length of reference handset obtain, and according to the width ratio coefficient that the width pixel value of reference handset and the width of reference handset obtain, be the scale-up factor beyond removing button and size, so that follow-up length for calculating the tested mobile phone taken out beyond button and antenna and width.
Particularly, in the present embodiment, vernier caliper measurement can be adopted to remove length and the width of the reference handset beyond button and antenna.
Second pixel value acquisition module 150, under the shooting environmental of image obtaining reference body, obtains the image of tested mobile phone, and according to the length pixel value of the tested mobile phone of the Image Acquisition of tested mobile phone and the width pixel value of tested mobile phone.
Shooting environmental refers to the photoenvironment etc. when adopting video camera shooting reference body.Under the same shooting environmental obtaining reference body, obtain the image of tested mobile phone, thus the length ratio coefficient obtained according to the related data of reference body and width ratio coefficient are equally applicable to tested mobile phone, and accuracy is higher.
Size computing module 170, for obtaining the length of tested mobile phone according to the length pixel value of tested mobile phone and length ratio coefficient, obtains the width of tested mobile phone according to the width pixel value of tested mobile phone and width ratio coefficient.After the width pixel value of the length pixel value and tested mobile phone that obtain tested mobile phone, directly can calculate length and the width of tested mobile phone according to the length ratio coefficient obtained in scale-up factor computing module 130 and width ratio coefficient.
Above-mentioned handset size measuring system, first pixel value acquisition module 110 is according to the length pixel value of the Image Acquisition reference body of the reference body obtained and width pixel value, scale-up factor computing module 130 obtains length ratio coefficient and width ratio coefficient respectively according to the length of reference body measured and the length pixel value of width and reference body and width pixel value, second pixel value acquisition module 150 is according to the length pixel value of the tested mobile phone of Image Acquisition of the tested mobile phone obtained and the width pixel value of tested mobile phone, size computing module 170 is in conjunction with length ratio coefficient, the length pixel value of the tested mobile phone of width ratio coefficient and the width pixel value of tested mobile phone, obtain length and the width of tested mobile phone respectively.Do not need to use by adoption rate computing the size that range sensor can measure tested mobile phone, cost is low and measuring accuracy is higher.
Wherein in an embodiment, according to the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body in first pixel value acquisition module 110, can be specifically choose a maximum rectangle according to the image of reference body, obtain the longest straight line of the length direction of maximum rectangle and the straight line of Width, and detect the length pixel value of the longest straight line of length direction and the width pixel value of the longest straight line of Width respectively.
Wherein in an embodiment, scale-up factor computing module 130 basis:
Obtain length ratio coefficient and width ratio coefficient, wherein, k
1for length ratio coefficient, k
2for width ratio coefficient, N
1for the length pixel value of reference body, L
1for the length of reference body, N
2for the width pixel value of reference body, L
2for the width of reference body.
Wherein in an embodiment, with reference to figure 5, the second pixel value acquisition module 150 comprises image acquisition unit 151, image rotation unit 153, edge line detection unit 155 and pixel value acquiring unit 157.
Image acquisition unit 151, under the shooting environmental of image obtaining reference body, obtains the image of reference handset.
Image rotation unit 153, for rotating the image of tested mobile phone, making the image of tested mobile phone mate default rectangular coordinate system in a first direction and a second direction, and searching mobile phone profile.
The rectangular coordinate system that coupling is preset, the image referring to rotate tested mobile phone makes a lateral edges of tested mobile phone parallel with first direction, and opposite side edge is parallel with second direction.Such as, in the present embodiment, the rectangular coordinate preset to be inclination angle be zero rectangular coordinate system, first direction is horizontal direction, and second direction is vertical direction, therefore, is also the placement of horizontal vertical direction after the image rotation of tested mobile phone.Be appreciated that in other embodiments, the rectangular coordinate system of the rectangular coordinate system preset also can be inclination angle be other numerical value.
On the image that mobile phone profile refers to tested mobile phone, the image of corresponding mobile phone position part, can be the background parts getting rid of edge after carrying out binary conversion treatment to the image of tested mobile phone, search mobile phone profile.
Edge line detection unit 155, for obtaining the first length line on first direction according to mobile phone profile, obtains the second length line in second direction according to mobile phone profile.
First length line refers to mobile phone profile the longest outermost straight line in a first direction, may be used for the length representing first direction; Second length line refers to mobile phone profile the longest outermost straight line in a second direction, may be used for the length representing second direction.
Pixel value acquiring unit 157 is for obtaining the length pixel value of tested mobile phone and the width pixel value of tested mobile phone according to the first length line and the second length line.
In the present embodiment, pixel value acquiring unit 157 specifically chooses straight line that in the first length line and the second length line, length the is longer length line as tested mobile phone, then another straight line is as the wide line of tested mobile phone.
Length line and the wide line of tested mobile phone is obtained according to the first length line and the second length line, first length line and the second length line choose the button, antenna etc. that can remove tested mobile phone, therefore the length pixel value that the length line finally obtained is corresponding and width pixel value corresponding to wide line are removes button, antenna, and result of calculation is more accurate.
Wherein in an embodiment, with reference to figure 6, edge line detection unit 155 comprises that outer most edge straight line searches subelement 1551, first scope judgment sub-unit 1552, consult straight line searches subelement 1553, second scope judgment sub-unit 1554, the 3rd scope judgment sub-unit 1555, first length line chooses subelement 1556 and the second length line detection sub-unit 1557.
Outer most edge straight line searches subelement 1551, for searching the outer most edge straight line of the first direction side of mobile phone profile.Such as, first direction is horizontal direction, and with the left side of the horizontal direction of mobile phone profile for starting point, the outer most edge straight line of mobile phone profile is searched in movement to the right.
First scope judgment sub-unit 1552 is for judging whether outer most edge straight line meets programmable button length range.Programmable button length range refers to meet the condition by key length, specifically can arrange according to actual conditions.
Consult straight line searches subelement 1553 for when outer most edge straight line meets programmable button length range, searches the consult straight line the shortest with the spacing of outer most edge straight line.Consult straight line is the straight line the most adjacent with outer most edge straight line.
Second scope judgment sub-unit 1554 presets length and width scope for judging whether consult straight line meets.Preset length and width scope and refer to the condition meeting mobile phone length and width, specifically can arrange according to the large probable value of handset size.
When 3rd scope judgment sub-unit 1555 presets length and width scope for meeting at consult straight line, judge whether the distance between outer most edge straight line and consult straight line meets predeterminable range scope.Predeterminable range scope is the distance between the button of definition and the first length line, can arrange according to actual conditions.
It is the first length line that first length line chooses subelement 1556 for choosing consult straight line.
Search the first length line by the judgement of multiple condition, choosing of straight line can be avoided to be subject to noise effect, improve the accuracy that line segment is searched.Particularly, in the present embodiment, the specific procedure obtaining the first length line on first direction according to mobile phone profile is as follows:
Analyze from outermost straight line, perform first and judge operation: judge whether outer most edge straight line L1 meets programmable button length range T1, if so, then perform second and judge operation; If not, search from secondary outside straight line, until find the outer most edge straight line meeting programmable button length range T1, if the straight line having traveled through side does not find the straight line meeting programmable button length range T1, then perform second and judge operation.
Second judges operation: judge whether the consult straight line L2 length the most adjacent with outer most edge straight line meets and preset length and width scope T2, if, then perform the 3rd and judge operation, if not, then judge that whether the length of consult straight line L2 is too small or excessive, judge that whether the length of consult straight line L2 is similar to the length of outer most edge straight line L1.If consult straight line L2 is too small or excessive, then thinks consult straight line L2 noise, give up consult straight line L2, return the second judgement operation, search the secondary adjacent straight line with outer most edge straight line.If whether the length of consult straight line L2 is similar to the length of outer most edge straight line L1, then think that consult straight line L2 is button, give up outer most edge straight line L1, and return the first judgement operation.
3rd judges operation: judge that the distance of outer most edge straight line L1 and consult straight line L2 meets predeterminable range scope T3.If so, then Output rusults: consult straight line L2 is the first length line; If not, then judge that outer most edge straight line L1 is as noise, record consult straight line L2, performs the 4th and judges operation.
Perform the 4th to judge to operate: judge whether consult straight line L2 side has straight line L3 that length is with it similar and distance T4 ten points is close.If so, Output rusults: a new position is found according to the weight of 2:1 in the position of consult straight line L2 and straight line L3.If not, then the straight line L4 whether meeting default length and width scope T2 in the scope T5 inside consult straight line L2 is in addition detected.If meet the straight line L4 of default length and width scope T2 in the scope T5 inside consult straight line L2 in addition, then output error: cannot determine which bar is mobile phone edge on earth, recording the position of consult straight line L2 and straight line L4, by judging that the close call of opposite side makes a decision, performing additional step again; If do not meet the straight line L4 of default length and width scope T2 in the scope T5 inside consult straight line L2, then Output rusults: consult straight line L2 is the first length line.
Additional step: the position of searching the outer most edge straight line L5 of opposite side, compares the distance of L5 and consult straight line L2, straight line L4, if one of them is excessive, beyond the scope of length and width, then give up, if two all in scope, then exporting consult straight line L2 and straight line L4 is the first length line.
Second length line detection sub-unit 1557 is for obtaining the second length line in second direction according to mobile phone profile.Particularly, in the present embodiment, the concrete steps that second length line detection sub-unit 1557 obtains the second length line, to by performing, outer most edge straight line searches subelement 1551, first scope judgment sub-unit 1552, consult straight line is searched function that subelement 1553, second scope judgment sub-unit 1554, the 3rd scope judgment sub-unit 1555 and the first length line choose subelement 1556 to obtain the step of the first length line on first direction similar, do not repeat at this.
Be in the embodiment of reference handset at reference body, to obtain the length pixel value of tested mobile phone similar with the method for the width pixel value of tested mobile phone by performing image rotation unit 153, edge line detection unit 155 and the function of pixel value acquiring unit 157 for the method that first pixel value acquisition module 110 adopts according to the length pixel value of the Image Acquisition reference body of reference body and the width pixel value of reference body and the second pixel value acquisition module 150, do not repeat at this.
Wherein in an embodiment, size computing module 170 basis:
Obtain the length of tested mobile phone and the width of tested mobile phone, wherein, length is the length of tested mobile phone, and width is the width of tested mobile phone, and N_length is the length pixel value of tested mobile phone, and N_width is the width pixel value of tested mobile phone, k
1for length ratio coefficient, k
2for width ratio coefficient.
Be benchmark by the scale-up factor obtained with reference body measurement, calculate length and the width of tested mobile phone, do not need the size can measuring mobile phone by other external units, reduce and measure cost and measuring accuracy is higher.
Each technical characteristic of the above embodiment can combine arbitrarily, for making description succinct, the all possible combination of each technical characteristic in above-described embodiment is not all described, but, as long as the combination of these technical characteristics does not exist contradiction, be all considered to be the scope that this instructions is recorded.
The above embodiment only have expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but can not therefore be construed as limiting the scope of the patent.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.