Summary of the invention
The purpose of the application is to propose a kind of Multifunction Sensor and method for sensing, to solve background section above
The technical issues of mentioning.
In a first aspect, the Multifunction Sensor includes: infrared light supply this application provides a kind of Multifunction Sensor,
For emitting infrared acquisition light to object under test;Visible light source, for being visited to object under test transmitting red-green-blue
Survey light;Photoelectric conversion device, for receive the infrared acquisition light and/or red-green-blue detection illumination be mapped to it is described to be measured
The reflected light that object generates respectively, and according to the infrared electric signal of each reflection photogenerated, feux rouges electric signal, green light electric signal, indigo plant
Photosignal;Data processing equipment, according to the linear function of electric signal and distance, calculate the infrared electric signal it is corresponding away from
From the red of the object under test is calculated according to the feux rouges electric signal, the green light electric signal, the blue light electric signal
Light accounting, green light accounting, blue light accounting calculate the feux rouges accounting, green light accounting, blue light accounting and storage of the object under test
Sample color concentrates the similarity of the RGB light accounting of each sample color, selects the maximum sample color of similarity as described to be measured
The color of object.
In some embodiments, the visible light source is red-green-blue light emitting diode.
In some embodiments, the infrared light supply is infrared diode.
In some embodiments, the photoelectric conversion device includes photodiode, and the photodiode is by induction
Light is converted to electric signal.
In some embodiments, the photoelectric conversion device further includes operational amplifier, and the operational amplifier is for putting
The electric signal of the big photodiode conversion.
In some embodiments, the data processing equipment controls the unlatching of the infrared light supply and/or visible light source
With closing.
In some embodiments, the Multifunction Sensor further includes power supply device and communication device.
Second aspect, this application provides a kind of infrared distance measurement methods, which comprises emits to object under test infrared
Detect light;It receives the infrared acquisition illumination and is mapped to the reflected light that the object under test generates, and the reflected light is subjected to light
Electricity conversion generates infrared electric signal;According to the linear function of electric signal and distance, the corresponding distance of the infrared electric signal is calculated.
The third aspect, this application provides a kind of color identification methods, which comprises is surveyed using infrared distance measurement method
Measure object under test between Multifunction Sensor at a distance from;The size for judging the distance with preset threshold, in response to the distance
No more than the preset threshold, then following identification step is executed: successively to object under test transmitting red-green-blue detection
Light;Receive the reflected light that red-green-blue detection illumination is mapped to the object under test respectively, and by each reflected light into
Row photoelectric conversion generates feux rouges electric signal, green light electric signal, blue light electric signal;According to the feux rouges electric signal, green light electricity
The feux rouges accounting, green light accounting, blue light accounting of the object under test is calculated in signal, the blue light electric signal;Described in calculating
Feux rouges accounting, green light accounting, blue light accounting and the sample color of storage of object under test concentrate the RGB light of each sample color to account for
The similarity of ratio selects color of the maximum sample color of similarity as the object under test.
In some embodiments, the color identification method further include: be greater than the default threshold in response to the distance
Value then uses infrared distance measurement method at predetermined intervals, measures between the object under test and the Multifunction Sensor
Distance, and the distance measured is compared with the preset threshold, if the distance measured is not more than the default threshold
Value, then execute identification step.
In some embodiments, the color identification method further include: to avoid interfering between light, the same period is most
One kind of more transmitting infrared acquisition light, feux rouges detection light, green light detection light, blue light detection light.
In some embodiments, the feux rouges accounting for calculating the object under test, green light accounting, blue light accounting and storage
Sample color concentrate each sample color RGB light accounting similarity, select the maximum sample color of similarity as it is described to
Survey the color of object, comprising: calculate the object under test feux rouges accounting, green light accounting, blue light accounting and the sample color collection of storage
Distance in conjunction between the feux rouges accounting, green light accounting, blue light accounting of each sample color, obtains distance set, wherein the distance
It is one of Euclidean distance, manhatton distance, Chebyshev's distance;It is the smallest apart from institute to choose value in the distance set
Color of the corresponding sample color as the object under test.
There is ranging and color to know simultaneously for Multifunction Sensor and inducing method provided by the present application, the Multifunction Sensor
Other function.In ranging, by emitting infrared acquisition light to object under test, then, according to the reflection photogenerated of object under test
Infrared electric signal, finally, by the linear function of electric signal and distance, be calculated between object under test at a distance from, this method
Easy to operate, accuracy is high.In color identification, first determines that the distance of object under test is not more than preset threshold value, solve distance
When farther out, it is easy the problem of misidentifying color;Then, the feux rouges accounting, green light accounting, blue light accounting for calculating object under test, away from
From difference, the value of electrical signals of RGB is different, but accounting (proportionate relationship) is constant, later, calculate object under test feux rouges accounting,
The sample color of green light accounting, blue light accounting and storage concentrates the similarity of the RGB light accounting of each sample color, selects similar
Color of the maximum sample color as object under test is spent, algorithm is simple, and identification color accuracy rate is high.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is the structural schematic diagram according to one embodiment of the Multifunction Sensor of the application.As shown in Figure 1, at this
In embodiment, which includes infrared light supply 1, visible light source 2, photoelectric conversion device 3, data processing equipment 4.
Wherein, infrared light supply 1 is used to emit infrared acquisition light to object under test;Visible light source 2 is used to emit to above-mentioned object under test
Red-green-blue detects light;Photoelectric conversion device 3 is for receiving above-mentioned infrared acquisition light and/or red-green-blue detection light
Be irradiated to the reflected light that above-mentioned object under test generates respectively, and according to the infrared electric signal of each reflection photogenerated, feux rouges electric signal,
Green light electric signal, blue light electric signal;Data processing equipment 4 calculates above-mentioned infrared electricity according to the linear function of electric signal and distance
The corresponding distance of signal;According to above-mentioned feux rouges electric signal, above-mentioned green light electric signal, above-mentioned blue light electric signal, it is calculated above-mentioned
Feux rouges accounting, green light accounting, the blue light accounting of object under test calculate feux rouges accounting, the green light accounting, blue light of above-mentioned object under test
Accounting and the sample color of storage concentrate the similarity of the RGB light accounting of each sample color, select the maximum sample color of similarity
Color as the object under test.
In the present embodiment, infrared light supply 1 be emit infrared light device, common infrared light supply have infrared diode,
The infrared light that infrared laser, the incandescent lamp for filtering off visible light or xenon lamp issue.
In the present embodiment, it is seen that radiant 2 is the device for emitting red-green-blue detection light, it is seen that radiant can be with
It is three monochromatic rgb leds, is also possible to a redgreenblue light emitting diode, and the diode is in difference
Under input control, feux rouges, green light, blue light can be emitted.
In the present embodiment, photoelectric conversion device 3 is the device that the light of induction is converted to electric signal, photoelectric conversion device
3 include light-sensitive element, and light-sensitive element can be one of photo resistance, photodiode, phototriode.The intensity of light is not
Together, the value for the electric signal that photoelectric conversion device 3 generates is also different, and above electrical signal can be voltage signal, current signal, modulation
One of rear voltage signal, modulated current signal.For example, light is stronger, the current value of photodiode is bigger.
In some optional implementations of the present embodiment, photoelectric conversion device 3 further includes operational amplifier, the operation
Amplifier is used to amplify the electric signal of above-mentioned light-sensitive element conversion.
In the present embodiment, data processing equipment 4 is the infrared electric signal generated to photoelectric conversion device, feux rouges telecommunications
Number, green light electric signal, blue light electric signal do data processing, obtain the distance of object under test and the device of color, i.e., progress data
Collection, operation and processing.Data processing equipment 4 can be micro-control unit (Microcontroller Unit, MCU) also known as
Single-chip microcontroller.Data processing equipment 4 includes at least central processing unit (Central Process Unit, CPU), read-only memory
(ROM-Read Only Memory, ROM) or flash memory, random access memory (Random Access Memory, RAM), meter
Number device, analog-digital converter etc..Wherein, program is stored in ROM, and sample color concentrates the data such as the RGB light accounting of each sample color
It is stored in RAM.
In the present embodiment, data processing equipment 4 controls unlatching and the pass of above-mentioned infrared light supply and/or visible light source
It closes.To avoid interfering between light, the same period at most only emits infrared acquisition light, feux rouges detection light, green light and detects light, blue light
Detect one kind of light.
In some optional implementations of the present embodiment, Multifunction Sensor further includes power supply device and communication device
(Fig. 1 is not shown).Wherein, power supply device includes at least: battery, Power Management Unit, charge/discharge unit, Overvoltage protecting unit
Deng.Communication device for being communicated with host computer or other devices, for example, receive host computer measurement object under test distance and/
Or the instruction of identification color, the color of the distance of measurement and/or identification is sent to host computer.The communication device can be wired
Communication, the one kind wirelessly communicated, wireless communication can be Wi-Fi (Wireless Fidelity, wireless fidelity module), NFC
One kind of (Near Field Communication, wireless near field communication), Bluetooth communication.
Under different application scenarios and demand, which can provide different functions, for example, individually surveying
It measures at a distance between object under test, color that object under test is individually identified, measure distance simultaneously and carry out color identification, first with one
Fixed time interval ranging is from only when the distance measured is not more than preset threshold value, just progress color identification improves color
The accuracy of identification.
With continued reference to Fig. 2, showing is schematic diagram according to an application scenarios of the Multifunction Sensor of the application.It carries
The intelligent building blocks robot (not shown) of Multifunction Sensor 201 cruises indoors, detects barrier.Multifunction Sensor 201
Including such as lower component: infrared diode, photodiode, RGB light emitting diode (rgb led), operation amplifier
Device, single-chip microcontroller, bluetooth.Infrared diode is opened in single-chip microcontroller control, and with the time interval of 100 microseconds, constantly emits infrared spy
Survey light.The relative position of a certain moment Multifunction Sensor 201 and barrier 202 is as shown in figure a.When the infrared acquisition light of transmitting
It encounters barrier 202 to be reflected back, reflected infrared light is received by photodiode, and photodiode will be received anti-
It penetrates light and carries out photoelectric conversion, generate infrared voltage signal, the infrared voltage signal of generation is amplified processing by operational amplifier,
Single-chip microcontroller calculates the corresponding distance of amplified infrared voltage signal, distance value is 50 according to the function of electric signal and distance
Centimetre, it is greater than 30 centimetres of preset threshold.As the movement of intelligent building blocks robot is constantly close to barrier 202, a certain moment
The relative position of Multifunction Sensor 201 and barrier 202 is as shown in figure b.According to infrared acquisition light and its reflected light, measure
Distance value with barrier 202 is 25 centimetres, is less than 30 centimetres of preset threshold, then infrared diode is closed in single-chip microcontroller control, so
Red diodes are opened in control afterwards, and transmitting feux rouges detects light, encounters barrier 202 and be reflected back, and photodiode receives anti-
It penetrates light and carries out photoelectric conversion, generate red voltages signal and send single-chip microcontroller to after operational amplifier enhanced processing, it is then, single
Red diodes are closed in the control of piece machine, open green diode, then acquire green light voltage signal by similar step, later,
Green diode is closed in single-chip microcontroller control, opens blue light diode, then acquires blue light voltage signal by similar step, later
The sample color that single-chip microcontroller calculates the accounting of RGB voltage signal, and calculates itself and storage concentrates the RGB light of each sample color
The Euclidean distance of accounting chooses the smallest sample color-black of Euclidean distance value, the color as barrier 202.Single-chip microcontroller will be surveyed
The black of 25 centimetres of the distance, identification that obtain is sent to the master control of intelligent building blocks robot by bluetooth.What ranging and color identified
Accuracy is all very high.
With continued reference to Fig. 3, the flow chart of one embodiment of the infrared distance measurement method of the application is shown.The infrared survey
Away from method, comprising the following steps:
Step 301, emit infrared acquisition light to object under test.
In the present embodiment, infrared light supply emits infrared acquisition light to object under test.Above-mentioned infrared light supply uses infrared hair
Optical diode.
Step 302, the reflected light that infrared acquisition illumination is mapped to object under test generation is received, and reflected light is subjected to photoelectricity and is turned
It changes and generates infrared electric signal.
In the present embodiment, photoelectric conversion device receives the reflected light that infrared acquisition illumination is mapped to object under test generation, and
Reflected light is subjected to photoelectric conversion and generates infrared electric signal.Reflected light strengthens difference, and the value of electric signal is also just different.Above-mentioned telecommunications
Number it can be one of voltage signal, current signal, modulated voltage signal, modulated current signal.For example, light
Stronger, current value is bigger.
Step 303, according to the linear function of electric signal and distance, the corresponding distance of above-mentioned infrared electric signal is calculated.
In the present embodiment, the linear function for needing pre-generated electric signal and distance, includes the following steps:
Firstly, recording a series of corresponding electric signal generated of different distance values in known situation.
A series of distance sample set is designed, equidistant distance sample set can be used, it can also be using non-etc.
The distance sample set of spacing.Wherein, an equidistant distance sample set design is as follows: distance sample is starting point 0cm, eventually
Point 200cm is divided into 40 distance samples of 5cm.Be sequentially adjusted in test object between sensor at a distance to be above-mentioned apart from sample
The value of distance sample in this set;Sensor emits infrared light to above-mentioned test object, and sensor is according to the tester of induction
The reflection photogenerated electric signal of body reflection, and record and save the electric signal.
Secondly, drawing distance and the song between electric signal according to a series of above-mentioned different distance values and its corresponding electric signal
Line.
Can be using distance as X-axis, electric signal is Y-axis, according to distance and the value of electric signal, a series of point is drawn out, then
These points are connected by a curve using smooth curve.
Finally, carrying out linearization process to above-mentioned curve, the linear function of electric signal and distance is obtained.
From figure 3, it can be seen that in the present embodiment, by emitting infrared acquisition light to object under test, then, according to determinand
The sensor and determinand is calculated finally, passing through the linear function of electric signal and distance in the reflection photogenerated electric signal of body
Distance between body, this method is easy to operate, and accuracy is high.
With continued reference to Fig. 4, the flow chart of one embodiment of the color identification method of the application is shown.The color is known
Other method, comprising the following steps:
Step 401, at a distance from using infrared distance measurement method measurement object under test between Multifunction Sensor.
Same object color, distance is remoter, and the reflected light that can be incuded is weaker, and when apart from farther out, redgreenblue number
Value difference is different smaller, is easy misrecognition color.So in the present embodiment, first using infrared distance measurement method measurement object under test and more
Distance between function sensor.Meanwhile after the completion of ranging, infrared light supply is closed, reduces the interference to subsequent step.
Step 402, judge size of the distance with preset threshold, be not more than preset threshold in response to distance, then execute identification
Step, i.e. step 403 to step 406.
In the present embodiment, preset a threshold value, and in the preset threshold range, color identification accuracy compared with
It is high.The size of the distance and the preset threshold that are measured in judgment step 401.If above-mentioned distance is greater than above-mentioned preset threshold,
After waiting the preset time, using infrared distance measurement method measure above-mentioned object under test between above-mentioned Multifunction Sensor at a distance from,
And be compared the distance measured with above-mentioned preset threshold, if above-mentioned distance is greater than above-mentioned preset threshold, wait default
Time after, continue measurement until distance is no more than preset threshold or receives stopping measurement instruction, if it is above-mentioned measure away from
From above-mentioned preset threshold is not more than, then identification step, i.e. step 403 to step 406 are executed.
Step 403, light successively is detected to object under test transmitting red-green-blue.
The three primary colours of light are RGB, and the light of various colors is mixed by the red-green-blue of different proportion.
Luminous intensity is the intensity value in 0~255 range, usually indicates red, green, blue light intensity value with RGB respectively.The RGB of different colours
Value it is different.For example, pure red RGB (255,0,0), black RGB (0,0,0) etc..
In the present embodiment, to avoid interfering between light, the same period, at most only transmitting feux rouges detection light, green light were detected
One kind of light, blue light detection light.
In the present embodiment, at predetermined intervals, light successively is detected to object under test transmitting red-green-blue.
Step 404, red-green-blue detection illumination is received respectively and is mapped to the reflected light of object under test, and by each reflection
Light carries out photoelectric conversion, generates feux rouges electric signal, green light electric signal, blue light electric signal.
In the present embodiment, known by step 403, be at predetermined intervals, successively to emit RGB to object under test
Three primary colours detect light.Photoelectric replacement device successively receives the reflection that red-green-blue detection illumination is mapped to object under test respectively
Light, and each reflected light is subjected to photoelectric conversion, generate feux rouges electric signal, green light electric signal, blue light electric signal.That is: firstly, to
Object under test emits feux rouges and detects light, generates feux rouges electric signal according to the feux rouges of the object under test reflection sensed;Then, to
It surveys object emission green light and detects light, green light electric signal is generated according to the green light of the object under test reflection sensed;Finally, to be measured
Object emission blue light detects light, generates blue light electric signal according to the blue light of the object under test reflection sensed.
The object under test of different colours is different to the albedo of RGB light, for example, red object reflection red light and
Absorb the light of other colors.
Photoelectric replacement device generates the electric signal of corresponding size according to the power of the light of induction.Above electrical signal can be with
It is one of voltage signal, current signal, modulated voltage signal, modulated current signal.For example, light is stronger,
Current value is bigger.
Step 405, according to feux rouges electric signal, green light electric signal, blue light electric signal, the feux rouges that object under test is calculated is accounted for
Than, green light accounting, blue light accounting.
In the present embodiment, according to feux rouges electric signal, green light electric signal, blue light electric signal, the feux rouges of object under test is calculated
Accounting, green light accounting, blue light accounting, comprising:
Firstly, the value of radical sign is opened in square summation for calculating feux rouges electric signal, green light electric signal, blue light electric signal.
Then, feux rouges electric signal, green light electric signal, blue light electric signal are successively opened into radical sign divided by above-mentioned square of summation
Value, is calculated the feux rouges accounting, green light accounting, blue light accounting of above-mentioned object under test.
In some optional implementations of the present embodiment, according to feux rouges electric signal, green light electric signal, blue light telecommunications
Number, calculate the feux rouges accounting, green light accounting, blue light accounting of object under test, comprising:
Firstly, seeking the sum of calibrated feux rouges electric signal, green light electric signal, blue light electric signal.
Then, feux rouges electric signal, green light electric signal, blue light electric signal successively divided by the value of above-mentioned summation, are calculated
Feux rouges accounting, green light accounting, the blue light accounting of above-mentioned object under test.
Step 406, feux rouges accounting, green light accounting, blue light accounting and the sample color of storage for calculating object under test are concentrated respectively
The similarity of the RGB light accounting of a sample color selects color of the maximum sample color of similarity as the object under test.
In the present embodiment, one RGB light of selection can be concentrated to account for from the sample color of storage by similarity algorithm
A sample color most more similar than the RGB accounting with object under test, the color as above-mentioned object under test.For example, cosine phase
Like degree algorithm.
In some optional implementations of the present embodiment, selection can be concentrated the same from sample color by distance algorithm
Color of the true qualities as object under test, comprising: by the sample of object under test feux rouges accounting, green light accounting, blue light accounting and storage
Distance in color set between the feux rouges accounting, green light accounting, blue light accounting of each sample color, obtains distance set, wherein above-mentioned
Distance is one of Euclidean distance, manhatton distance, Chebyshev's distance;Choose value in above-mentioned distance set it is the smallest away from
Color from corresponding sample color as the object under test.
From fig. 4, it can be seen that first being measured at a distance between object under test, only in pre-determined distance just in the present embodiment
Color identification is carried out, accuracy is high.The ratio of red, green, blue is analyzed, distance changes in any case, can only cause the change of light intensity
Change, and the ratio of RGB light will not become, and have the occasion of mechanical oscillation that can also accurately identify color of object even if in target.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from the inventive concept, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.