Invention content,
Based on above-mentioned technical problem, the present invention provides a kind of method can determine surface pointer position, and this method is regarded by mobile phone
Frequency is shot, and positioning pointer current location is identified from data image, and by current location and the angle adjusted is needed to pass through bluetooth
It is sent to above wrist-watch, wrist-watch is adjusted to correct position according to instruction.It is high according to test accuracy rate at present.It significantly facilitates
The use of user, improves user experience.
The specific technical solution of the present invention is as follows:
A kind of method of determining surface pointer position, described method includes following steps:
Step 1 carries out captured in real-time to the surface of wrist-watch using the camera of filming apparatus and obtains video;
Step 2, the video that the filming apparatus shoots camera are identified, the figure for being identified as extracting the video
As being identified;
Step 3, the filming apparatus position described image, and described image is made to be located in dial plate region;
Step 4, the filming apparatus carry out localization process to the indicator in the dial plate region, obtain pointer;
Step 5, the filming apparatus determine the angle of the needle deflection preset.
Further, the filming apparatus be include processor and the mobile phone of video capture device, preferably can be with
The mobile phone of IOS systems.
Further, in the step 2, the processor is extracted the image of the video by rule, specially:It will
The picture number being presently processing is 0, extracts every frame image of the video, or the figure that extraction number is odd number or even number
The image for the multiple for being 4 is numbered in picture, the image for the multiple that either extraction number is 3 or extraction.
Further, in the step 2, the extraction is carried out according to the processing speed of the processor, if current figure
It is finished as untreated, then the image sended over is skipped over not extract and is identified, until present image is disposed and extracts place again
Reason is sent to the first frame image of processor after finishing.
Further, in the step 3, the positioning includes positioning pretreatment, and the positioning pretreatment includes that will scheme
As carrying out gray processing, it is made to generate the gray level image in 1 channel by 4 channel images.In requirement of the multiple assessment to processor
When the speed of calculating, it is found that there are larger obstacles for extraction of the factors such as light, color to subsequent pointer, therefore, audaciously
The creative gray level image that 4 usual channel images are directly reduced to 1 channel is handled, so not only processing speed
Soon, even more the requirement of handset capability is reduced.
Further, gaussian filtering process is carried out to the gray level image, obtains smooth grey image.
Further, in the step 3, after pretreatment, using Hough transformation image procossing, according to the shape of dial plate
Shape positions dial plate in the gray level image, obtains positional matrix, goes to cut in the step 2 with the positional matrix
The image of extraction removes the region except positional matrix in described image, including the image extracted in the step 2
Image within the scope of positional matrix, referred to as positions image.
Further, in the step 4, image border processing is carried out to the positioning image so that the positioning
The only remaining lines of image.Since all indicators are all straight lines, in order to pointedly only retain lines.
Further, in the step 4, straight line is found using Hough transformation, invalid line segment is filtered.
Further, the method being filtered to invalid line segment is as follows:Judge dial plate central point to line segment most
The length L of short distance H and line segment, the processor are stored with first threshold and second threshold:
If the H is less than the first threshold, and the L is more than the second threshold, then judges the lines for pointer, and filter
Fall the line segment of non-pointer.
Further, the second threshold includes the 2nd 1 threshold value and the two or two threshold value:
If the H is less than the first threshold, and the L is more than the 2nd 1 threshold value and is less than the two or two threshold value,
Then judge the lines for clock hands;
If the H is less than the first threshold, and the L is more than the two or two threshold value, then judges the lines for minute hand
Pointer;
The processor filters out the line segment of non-pointer.
Further, the second threshold includes the 2nd 1 threshold value, the two or two threshold value and the two or three threshold value:
If the H is less than the first threshold, and the L is more than the 2nd 1 threshold value and is less than the two or two threshold value,
Then judge the lines for clock hands;
If the H is less than the first threshold, and the L is more than the two or two threshold value and is less than the two or three threshold value,
Then judge the lines for minute hand pointer;
If the H is less than the first threshold, and the L is more than the two or three threshold value, then judges the lines for second hand
Pointer;
The processor filters out the line segment of non-pointer.
Further, in the step 5, a color point is preset in the dial plate, the processor is to described fixed
Bit image carries out color identification and judges the color point, and calculates the color point and the line of dial plate central point and the angle of pointer
Degree.
Further, which is the color point of 12 o'clock of dial plate position.
Further, step 2 is repeated to step 5, and the frame image of subsequent third number of thresholds is handled and counted
The angle for calculating color point described in needle deflection, obtains the angle of third number of thresholds, takes the wherein maximum angle of probability of occurrence
Spend the angle as color point described in the needle deflection.
Further, the third threshold value is not less than 10.
Through the above technical solution, first, the pointer of wrist-watch can be calculated accurately, in real time residing for surface
Position, second is that the processor requirement to mobile phone is not high, identification uses asynchronous process, allows cell phone application not become card, and using choosing
Selecting property ignores picture frame mode, allows low-end mobile phone can also be expressively very smooth even if image cannot be rapidly processed.
Specific implementation mode
Technical scheme of the present invention is at large illustrated below.
As long as the present invention solves image recognition, noise comes and the algorithmic issue of three aspect of time calibration, and practical right
In the different optimization problem of the requirement of cell phone processor.
The extraction of surface pointer has had the extraction of image, and still, the extraction of image is since there are light, colors to ask
Topic, single picture is relatively difficult to relatively accurately determine the position of pointer, and shoots plurality of pictures then due between the time of shooting
Every problem, leading to pointer, there are very big probabilities to walk about.
For the present invention by the way of video extraction picture, video has continuity, and can extract within 1 second in video very much
The picture of frame, when handling several frames therein, the position of pointer is basically unchanged.
Concrete implementation mode is as follows:
First, using filming apparatus, such as mobile phone, certainly, more preferably the mobile phone with IOS systems carries out the surface of wrist-watch
Captured in real-time obtains video, then handles video.
When handling video, since the frame number of video capture is more, it is limited to the processing capacity of processor, it is optimal
State is processor all carries out processing calculating to every frame image, but in fact, when handling image, processor
Probably present image is handled not yet when next frame image is sent, at this point, the hair can be ignored in processor
The next frame image to come over, until processor has handled current image.
It is No. 0 figure by the picture number being presently processing such as according to rule it is of course also possible to carry out pressure processing
Picture, subsequent image are numbered according to natural number, and 2 multiple, 3 multiple or the 4 frame image of multiple is taken to be handled.
Present image is untreated complete, can force to stop currently processed, and then handles the image that is sended over by rule.
After having extracted image, in order to preferably navigate to dial plate, other factors are reduced(Such as light, color)Interference,
Gray processing is carried out to image, by 4 original channel images, the gray level image in 1 channel is generated, can reduce and handset capability is wanted
It asks.It is directed to gray level image again and carries out gaussian filtering process, smooth grey image.
Since dial plate has particularity, there is specific geometric figure, it is described to use Hough transformation image procossing be right
Dial plate is positioned, and such as when it is rectangular to become disk, can orient a positional matrix, the range in the positional matrix is exactly table
The range of disk.Or when dial plate is circle, a matrix can also be oriented, the range in the matrix is exactly dial plate
Range.Even, when orienting a rectangular matrix when dial plate is circle, it may be used completely black or go to fill in vain entirely
Vacancy between circle side.
It goes to cut the image extracted using the edge of positional matrix or positional matrix(The image is not above-mentioned gray-scale map
Picture, second is that the coloured image of the tool extracted from video)So that the coloured image of the tool only has the region of dial plate.
Image after cutting can be defined as positioning image.
Then marginalisation processing is carried out to the positioning image so that the only remaining lines of image recycle the transformation of Hough lines
Straight line is looked for, the straight line found at this time is very more, needs to filter out invalid line segment.The filter method of invalid line segment is as follows:
It is to judge that dial plate central point is less than specific threshold values to the shortest distance of line segment to filter the method used in vain(According to reality
Border situation adjustment), also, line segment length is more than or equal to some threshold values(It is determined according to the distance length of hand of dial)It is considered have
Effect.Otherwise, then task lines are invalid.
Certainly, during practical operation, it is understood that there may be two pointers are overlapped or essentially coincided(Two needle deflections
Angle is no more than 2 degree or smaller angle), then mobile phone sending signal to wrist-watch allows appointing in the above-mentioned two pointer of wrist-watch
One pointer first rotates certain angle.
Shooting when, when most of, mobile phone can wrist-watch be not what face was shot, in order to be adapted to wrist-watch not necessarily
It is to ajust scanning, needs to look for a datum mark to pointer, such as the datum mark in 12 o'clock direction, we can be chosen at the side at 12 o'clock
It is such as red to one coloured color point of tool of setting.
Processor is known using color otherwise, to color point(Red point)Position judged, confirm red count
Method is the rgb value according to image pixel(0-255), R subtracts G more than or equal to 80 and scarce R subtracts B and is considered red more than or equal to 80
Point.
According to the length of line segment and angle difference minute hand, hour hands, there is the second hand that can also distinguish between of second hand, finally combine center
Point calculates the angle at each 12 o'clock of needle deflection.
The image of extraction all calculates once, after one has been calculated, is calculated again the frame image subsequently transmitted, such as counts
It calculates 10 times, takes angle of the maximum angle of probability of occurrence as needle deflection color point in 10 times.In 10 times, occur
3 times 14 degree, 4 times 15 degree, 3 times 16 degree, then take 15 degree be the needle deflection color point angle.
Through the above technical solution, first, the pointer of wrist-watch can be calculated accurately, in real time residing for surface
Position, second is that the processor requirement to mobile phone is not high, identification uses asynchronous process, allows cell phone application not become card, and using choosing
Selecting property ignores picture frame mode, allows low-end mobile phone can also be expressively very smooth even if image cannot be rapidly processed.