The present invention relates to cameras for use in vehicles, and more particularly to a camera for use in a vehicle wherein an overlay is applied to the image on board the camera.
A typical camera for mounting on a vehicle has a lens member, an imager, a circuit board and housing members that connect together. Some cameras have the capability to apply an overlay onto the image received by the imager, and to send the image with the overlay in it directly to an in-vehicle display for viewing by the vehicle driver. Over time, however, it is possible that during use of the vehicle, the camera system can become misaligned. This can occur gradually from a variety of factors. It can also occur suddenly, such as, during an accident. Whether gradually or because of an accident, the misalignment can occur without being detected upon visual inspection of the camera.
In a first aspect, the invention is directed to a vehicular camera and a method for calibrating the camera after it has been installed in a vehicle. In particular, the invention is directed to calibrating a vehicular camera after the camera has been installed in a vehicle, wherein the camera is of a type that applies an overlay to an image and outputs the image with the overlay to an in-vehicle display.
In a particular embodiment, the camera includes a lens, an imager and a camera microcontroller. The camera is positioned to receive images from behind a vehicle including a portion of the bumper of the vehicle. The imager includes an image sensor and an imager microcontroller. The image sensor is positioned to receive light corresponding to images from the lens. The camera microcontroller is configured to apply an overlay to the images. The camera microcontroller is configured to receive data from the imager microcontroller relating to bars of pixels on the image sensor, wherein the microcontroller is further configured to detect a reference point in the images using the data and is configured to determine an offset amount with which to shift the overlay on the images.
In a second aspect, the invention is directed to a method of calibrating a vehicular camera installed in a vehicle wherein the camera has an imager and a camera microcontroller, comprising:
a) determining whether the contrast in images received by the imager is beyond a selected threshold value;
b) searching for a reference point in the images depending on the result of step a) using the camera microcontroller; and
c) adjusting the position of an overlay applied by the microcontroller to the images depending on the result of step b).
The present invention will now be described by way of example only with reference to the attached drawings, in which:
a and 6b are exemplary views from the camera of the bumper of the vehicle shown in
a is a view of a search window in an exemplary image received by the camera of
b is a chart showing the gradients associated with the brightness levels of the vertically stacked bars shown in
a is a view of a second search window in the exemplary image shown in
b is a chart showing the gradients associated with the brightness levels of the vertically stacked bars shown in
a is a view of a third search window in the exemplary image shown in
b is a chart showing the gradients associated with the brightness levels of the vertically stacked bars shown in
a is a view of a fourth search window in the exemplary image shown in
b is a chart showing the gradients associated with the brightness levels of the vertically stacked bars shown in
a is a view of a fifth search window in the exemplary image shown in
b is a chart showing the gradients associated with the brightness levels of the vertically stacked bars shown in
a is a view of a region of interest in which a plurality of search windows are selected, for determining the horizontal position of the reference point;
b is a chart showing the pixel positions of the pixels having the highest associated gradients associated with the brightness levels search windows shown in
a a view of a plurality of selected search windows in the region of interest shown in
b is a view of another plurality of selected search windows in the region of interest shown in
Reference is made to
Reference is made to
The lens assembly 12 is an assembly that includes a lens 20 and a lens barrel 22. The lens 20 may be held in the lens barrel 22 in any suitable way. The lens barrel 22 may be held in the lens holder 14a in any suitable way.
The imager 16 may be any suitable type of imager 16 such as the imager model no. MT9V126 provided by Aptina Imaging, San Jose, Calif. and includes an image sensor 16a, such as a CMOS sensor or a CCD sensor, and an imager microcontroller 16b that performs several functions. For example, the imager microcontroller 16b applies a distortion correction algorithm to the images 25 received by the image sensor 16a. Additionally, the imager microcontroller 16b applies graphical overlays to the images 25. Once the images 25 have been processed by the imager microcontroller 16b they are sent to the in-vehicle display 24 via an electrical conduit shown at 27a, which may be, for example a coaxial cable.
The microcontroller 18 may be any suitable type of microcontroller, such as the microcontroller model no. PIC24HJ128GP502 provided by Microchip Technology, Chandler, Ariz. The microcontroller 18 includes flash memory shown at 23 in which is stored the program for carrying out the periodic calibration of the camera 11.
External flash memory shown at 29 is used to store a plurality of overlays that can be applied to the images 25. Example overlays are shown in
The microcontroller 18 communicates with the imager microcontroller 16b via a bus, such as an I2C bus, shown at 27b, to provide information, such as the location in the flash memory 29 from which the imager microcontroller 16b is to pull an overlay 26 to apply to the images 25.
While the camera microcontroller 18 and the imager microcontroller 16b communicate, the camera microcontroller 18 does not have access to the actual pixel data from the imager 16.
Referring generally to
Periodically calibrating the camera 11 after it is installed in the vehicle 10 provides several advantages. One advantage is that the overlays 26, 28 applied to the image 25 by the microcontroller 18 will be properly aligned with the image 25 so that the driver of the vehicle 10 is provided with accurate position-related information from the overlays.
Referring to
The camera microcontroller 18 is capable of calibrating the camera 11 periodically using the statistical data provided by the imager microcontroller 16b. To calibrate the camera 11, the microcontroller 18 determines whether there is any horizontal or vertical offset in the images 25 by searching for a reference point in the images 25 and comparing its actual position to its expected position. Optionally, the microcontroller 18 may also determine whether there is any rotational offset in the images 25 by searching for a plurality of reference points in the images 25 and comparing their actual positions with their expected positions. The results of the comparisons can then be used to apply linear and optionally rotational adjustments to the positions of the overlays 26 in the images 25.
The camera microcontroller 18 initially populates a database 110 with 50 (or some other selected number of) successful reference point detection cycles before an adjustment is made to the positions of the overlays 26, and any adjustments to the positions of the overlays 26 is made based on the offsets determined in the 50 successful cycles. As an example, adjustments to the positions of the overlays 26 may be made based on the median values of the 50 past successful cycles. A successful reference point detection cycle is a reference point detection cycle that is considered acceptable for addition to the database 110. Thereafter, with each new successful reference point detection cycle, the microcontroller 18 replaces the oldest record in the database 110 with the data from the new detection cycle. After each new successful detection cycle, the microcontroller 18 may adjust the positions of the overlays 26, not based solely on the offsets found in the current detection cycle, but based on the running history contained in the database 110.
Referring to
The calibration manager module 100 determines whether the conditions are appropriate to conduct any reference point detection cycle and sends control to the pre-processing module 102 if the conditions are appropriate.
Preferably, the microcontroller 18 conducts reference point detection cycles on different driving days and at different driving times, with no more than one successful reference point detection cycle per day. Preferably, reference point detection cycles are taken at selected time intervals regardless of the amount of mileage that has been accumulated by the vehicle 10.
In an embodiment, the calibration manager module 100 triggers a reference point detection cycle under the following conditions:
the vehicle is driving forward;
the in-vehicle display is not displaying camera images;
the vehicle is driving at least 40 km/hr
the vehicle's steering angle is no more than a selected amount of degrees away from zero;
the outside temperature is within a selected range;
the vehicle headlights are off;
the vehicle's heading direction is in a selected range of directions;
the vehicles wipers have been off for a selected period of time;
the time of day is within a selected range;
the amount of time the vehicle has been driving on the current trip exceeds a selected amount of time;
a valid calibration has not taken place already on the current day; and
a selected period of time has elapsed since the previous calibration.
If the above conditions are not met, the microcontroller 18 waits an additional selected period of time and then tries again to determine whether the conditions are met to trigger reference point detection cycle. If the vehicle 10 (
The pre-processing module 102 assists in the selection of an exposure value to be used on images 25 received by the imager 16, and also determines whether the image 25 will have sufficient contrast to permit the structure on which the one or more reference points is present to be distinguished clearly from the background. In the embodiment shown in the figures the aforementioned structure is the vehicle bumper 202, and the background is shown at 206. If the pre-processing module 102 determines that the contrast is not sufficient in the image 25, then the reference point detection cycle is not run.
In the embodiment shown in the figures, the selection of the exposure to use on the images 25 is carried out by the imager microcontroller 16b based on a search window 203 (
Once an exposure is selected and images 25 are received by the imager 16, the pre-processing module 102 determines if the contrast in the images 25 is likely to result in successful reference point detection cycles. As noted above, the imager 16 does not provide the image 25 itself to the microcontroller 18, but instead provides statistical information regarding a search window from the image 25. In order to determine whether the contrast is good, the pre-processing module 102 processes statistical data from a plurality of search windows shown in
The positions and sizes of the search windows 200 and 204 are selected so that even if the camera 11 (
The statistics engine 36 (
(
The statistics engine 36 divides each second search window 204 into 8 horizontally stacked bars 210 and outputs the sum of the greyscale values of the pixels contained in each bar 210 to the microcontroller 18. The microcontroller 18 calculates the mean and variance of the 8 sums. The microcontroller 18 then determines whether the differences in the mean values between any two of the three windows 200 are less than selected threshold values. The microcontroller 18 also determines whether the differences in the mean values between any two of the three windows 204 are less than selected threshold values. The microcontroller 18 also determines whether the difference in the mean values of each vertically adjacent pair of a window 200 and a window 204 is greater than a selected threshold value. In other words, the microcontroller 18 checks if the difference between the mean values of the windows 200a and 204a is greater than a selected value, and checks if the difference between the mean value of the windows 200b and 204b is greater than a selected value, and so on. Additionally, the microcontroller 18 also determines if the variance of each window 200 and 204 is less than a selected threshold value. If all of the above conditions are met, then the pre-processing module 102 permits an reference point detection cycle to be carried out. If any of these conditions are not met, then an reference point detection cycle is not carried out at that time.
In some embodiments, it is possible that the pre-processing module 102 could be programmed to determine a suitable exposure to use for the images 25 received by the imager 16. In one example, the pre-processing module 102 could iteratively select exposures to use, refining each selection based on the results of the comparisons using the mean values and variances described above.
The linear offset detection module 104 determines the position of a first reference point in the image 25. The reference point to search for depends on the position of the camera 11. For example, in embodiments wherein the camera 11 is a tailgate-mounted rearview camera (as shown in
Using the statistical information that the statistics engine 36 (
The microcontroller 18 (
Initially, a search window 38 (
The sums of the greyscale values of the vertically stacked bars 40 shown in
The microcontroller 18 calculates the absolute values of gradients associated with the image bars 40 (referred to as absolute gradients). The absolute gradient at a particular image bar 40 is referred to as GRAD(n), where n is the numerical position of a particular image bar 40 in the search window 38. The absolute gradient is calculated as follows:
Put in word form, the absolute gradient GRAD(n) of the nth image bar is the absolute value of the sum of brightness values in the next image bar minus the sum of brightness values in the preceding image bar, all divided by 2. It will be understood that the formula above can be used for the second image bar 40b through to the seventh image bar 40g (ie. the second-to-last image bar). For the first image bar 40a:
GRAD(1)=ABS[VAL(2)−VAL(1)]
For the eighth (ie. last) image bar 40h:
GRAD(8)=ABS[VAL(8)−VAL(7)]
The absolute gradients GRAD(1) to GRAD(8) are shown graphically at 47 in the chart 48 shown in
It will be noted that the position of the first reference point 34 may not necessarily be in the image bar 40 with the highest gradient. It could at least theoretically be in the image bar 40 up from that one (where the bumper edge 32 appears domed) or in the image bar down from that one (where the bumper edge 32 appears dished). In the image 25 shown in
The microcontroller 18 then selects a second, narrower search window, shown at 49 in
The absolute gradient calculations and analysis are performed on the second search window 49 to find which image bar 50 has the highest associated gradient. The resulting gradients are shown at 52 (and individually at 52a-52h), in the chart in
The microcontroller 18 selects a third search window shown at 54 in
The microcontroller 18 divides the third search window 54 (
The microcontroller 18 selects a fourth search window 60 (
The microcontroller 18 divides the fourth search window 60 (
The microcontroller 18 selects a fifth search window 66 (
The microcontroller 18 divides the fifth search window 66 into 8 vertically stacked image bars 67, each of which is 1 pixel high, and performs the absolute gradient calculations thereon. The resulting gradient chart is shown at 68 in
To determine the horizontal position of the first reference point 34, the microcontroller 18 (
The microcontroller 18 selects two first search windows 1000a and 1000b that are each 1 pixel wide×8 pixels high, thereby forming a single compound search window that is 1 pixel wide×16 pixels high. The microcontroller 18 obtains the greyscale values of each pixel in the two search windows 1000a and 1000b and determines which pixel out of the 16 pixels has the highest associated gradient. That pixel represents the bumper edge 32, and so the microcontroller 18 stores the position of that pixel in memory. The microcontroller 18 then selects two second search windows 1008a and 1008b which are 8 pixels to the right of the first search windows 1000a and 1000b. The microcontroller 18 determines the greyscale values of each pixel in the two windows 1008a and 1008b and determines the pixel with the highest gradient among them and stores its position in memory. The microcontroller 18 then selects another pair of search windows 1016a and 1016b and determines the pixel with the highest gradient among them. The microcontroller 18 continues along the region of interest 70 selecting vertically stacked pairs of search windows at 8 pixel intervals.
The chart shown in
The conditioning of the data in the vector takes place based on one or more rules that are applied to the data. A first rule is that the pixel position value of the first element in the vector, (ie. the pixel position value corresponding to the search windows 1000a and 1000b), cannot be larger than that of the second element in the vector (ie. cannot be larger than the pixel position value of the subsequent search windows 1008a and 1008b). If it is larger, its value is reduced to be the same as that of the second element. A second rule is that, if the pixel position value of any particular vector element (referred to as vector element (i) where i corresponds to its position in the vector) is less than that of the immediately preceding vector element (ie. vector element (i−1)) and that of the immediately proceeding vector element (ie. vector element (i+1)) and if the immediately preceding and immediately proceeding vector elements have the same pixel position value as each other, then the pixel position value of the particular vector element (ie. vector element (i) is changed to match that of the immediately preceding and immediately proceeding vector elements. A third rule is that if the pixel position value of any particular vector (ie. vector element (i)) is greater than that of vector element (i+1) and is greater than that of vector element (i−1), and if the pixel position value of vector element (i+1) is greater than that of vector element (i−1), then the pixel position value of vector element (i) is changed to match that of vector element (i+1). A fourth rule is similar to the third rule. If the pixel position value of any particular vector (ie. vector element (i)) is greater than that of vector element (i+1) and is greater than that of vector element (i−1), and if the pixel position value of vector element (i−1) is greater than that of vector element (i+1), then the pixel position value of vector element (i) is changed to match that of vector element (i−1). A fifth rule is that if the pixel position value of the last vector element, (ie. vector element (32)), is greater than that of the preceding vector element (ie. vector element (31)), then the value of the last vector element is changed to match that of the preceding vector element. A sixth rule is that if the highest pixel position value stored in the vector appears less than 4 times in the vector, then the pixel position values of the associated vector elements are changed to match the second highest pixel position value stored in the vector. It will be noted that the particular rules described above are based on knowledge a priori of what general shape the bumper 202 should have in the image 25. It will be noted that the aforementioned rules are intended as exemplary. It is alternatively possible for the system to apply a different set of rules to condition the values in the vector. It will be noted that the rules may change depending on the vehicle model on which the camera 11 is installed.
Once the pixel position values stored in the vector are conditioned using the aforementioned rules, the values are tested to determine if they are considered valid to determine whether the reference point detection can continue or whether to abandon the reference point detection cycle until some other time. The conditions checked to determine whether the values are valid may include one or more of the following 5 questions:
1. Is the highest pixel position value between 11 and 13?
2. Does the highest pixel position value appear at least 3 times in the vector?
3. Is the number of times that the highest pixel position value appears between the first occurrence of it (at vector element (i)) and the last occurrence of it (at vector element (j), greater than or equal to (j−i)/2, where i and j are the values of the positions in the vector corresponding to the first and last occurrences of the highest pixel position value respectively?
4. Are the pixel position values of the first and last vector elements less then highest pixel position value present in the vector?
5. Are the pixel position values of all the vector elements between the first and last occurrences of the highest pixel position values greater than or equal to 11?
For the above questions, any ‘no’ answer may be referred to as a glitch. A variable (which is given the name ‘count1’) stores the number of ‘rising glitches’ (ie. glitches where the pixel position value of vector element (i)>the pixel position value of the vector element (i+1)).
A variable (which is given the name ‘count2’) stores the number of ‘falling glitches’ (ie. glitches where the pixel position value of vector element (i)<the pixel position value of the vector element (i+1)).
A variable (which is given the name ‘count3’) stores the number of ‘flat glitches’ (glitches where the pixel position value of vector element (i) is not equal to highest pixel position value).
If Count1+count2+count3=>5 then the reference point detection cycle is abandoned.
For any glitch, the glitch amplitude corresponds to how far past the given limit the pixel position value was for any given vector element. If there are more than 3 glitches having a glitch amplitude of more than 3, then the reference point detection cycle is abandoned.
If the reference point detection cycle has not been abandoned based on the aforementioned questions, the vector is passed through a 5 taps median filter. The filter goes through each vector element (i), and determines a median value for a group of 5 vector elements centered on element (i) (ie. the group of vector elements consisting of vector element (i−2), vector element (i−1), vector element (i), vector element (i+1) and vector element (i+2)). The filter then changes the value of the vector element (i) to the determined median value. It will be understood that the 5 taps median filter is an optional procedure. It is possible for the vector to be used as is without being passed through the filter. It is alternatively possible for the vector to be filtered in any other suitable way.
As can be seen in the chart, the pixel position value (in this case a value of 14) is the same for the search window pairs 1096a, 1096b to 1160a, 1160b (
First, the microcontroller 18 determines whether the same pixel position value (in this case a value of 14) is found for search window pairs 1095a, 1095b to 1089a, 1089b that are immediately to the left of the pair 1096a, 1096b, and for search window pairs 1161a, 1161b to 1167a, 1167b that are immediately to the right of the pair 1160a, 1160b.
Referring to
To determine the horizontal position of the first reference point 34, the microcontroller 18 determines the middle (horizontally) between the leftmost search window pair and the rightmost search window pair that have the same peak pixel position value. In the particular example shown, the leftmost search window pair is shown at 1089a, 1089b, and the rightmost search window pair is shown at 1160a, 1160b. The two window pairs are 71 pixels apart horizontally. The middle of the peak is therefore 36 pixels to the right of search window pair 1089a, 1089b, and is determined by the microcontroller 18 to be the horizontal position of the first reference point 34.
Referring to
Once the horizontal and vertical pixel values of the first reference point 34 are determined, the database 110 (
The post-processing module 106 is used to determine whether or not to adjust the positions of the overlays 26 based on the database 110 of calibration data. In one embodiment, the post-processing module 106 is itself made up of two modules including a statistics analysis module 300 and a decision logic module 302. The statistics analysis module 300 determines the mean values, the variance for the horizontal and vertical pixel positions in the database 110, the median of the pixel position data and the mode for the pixel position data, and the variance for the time of day data in the database 110.
Based on the results of the analysis conducted by the statistics analysis module 300, the decision logic module 106 determines whether or not to adjust the positions of the overlays 26. The actual adjustment that is made to the positions of the overlays 26 may be selected based on the entirety of the pixel position data in the database 110, not just on the currently determined pixel position values. It will be noted that the vertical and horizontal pixel positions of the overlays 26 are independent from one another. As such, it is possible that one coordinate (eg. the vertical position) of the overlays 26 may be adjusted, while the other coordinate (eg. the horizontal position) of the overlays 26 is not adjusted. For example, in one embodiment, if the amount of horizontal offset between the horizontal position detected for the reference point 34 and the horizontal position currently used by the camera 11 is greater than 4 pixels, then the horizontal position used by the camera 11 for the overlays 26 will be updated. Separately, if the amount of vertical offset between the vertical position detected for the reference point 34 and the vertical position currently used by the camera 11 is greater than 2 pixels, then the vertical position used by the camera 11 for the overlays 26 will be updated.
If the microcontroller 18 determines that the amount of overall offset exceeds a selected amount, the microcontroller 18 notifies the vehicle driver that the camera 11 may be too far outside of its intended operating position and may require servicing. This can be especially useful in situations where the camera 11 has become seriously misaligned with the vehicle 10 or if the lens 20 has become significantly misaligned with the imager 16 due, for example, to a collision wherein damage to the camera 11 or vehicle tailgate has occurred and has gone unnoticed.
The optional rotational offset detection module 108 (
If the lens 20 (
The rotation angle search window 402 may be selected based on the detected vertical position of the first reference point 34 (
To determine the pixel positions at which the bumper edge 32 leaves the search window 402, the microcontroller 18 selects a first compound search window that is 1 pixel wide by 16 pixels high, and is thus made up of a pair of 1 pixel by 8 pixel search windows, along the left side of the search window 402. The pixel position representing the highest gradient in that compound search window is the pixel position at which the bumper edge leaves the left side of the search window 402. Similarly, the microcontroller 18 selects a second compound search window on the right side of the search window 402 and determines the pixel with the highest associated gradient to determine the pixel position at which the bumper edge leaves the right side of the search window 402. By applying the following formula the rotation angle of the camera 11 can be determined:
Camera angle=arctan ((H2b−H2a)/W)
Once the camera angle is determined, it can be compared to historical data for the camera angle that is optionally contained in the database 110 and can be used to adjust the positions of the overlays 26. As can be seen in
Optionally, the camera 11 may be capable of being calibrated at night. To provide this capability, the camera 11 may include a NIR (near infra-red) LED (shown at 11a in
It will be noted that the calibration of the camera 11 can be carried out without the need to add any structure to the vehicle than is already present thereon (ie. without the need to add targets or other calibration-specific structure to the vehicle 10), and without the need for additional structure or modification to the camera 11 itself.
In addition to calibrating the camera 11 periodically after the vehicle 10 has been bought, the above-described camera 11 can be calibrated as described prior to the vehicle 10 leaving the assembly plant. Additionally or alternatively, the camera 11 can be calibrated when the vehicle 10 is at the dealer, prior to being sold or during a servicing of the vehicle 10. For example, a technician/service person at a vehicle dealer can send a signal to the camera 11 to enter a ‘service mode’ to facilitate its use in calibrating itself.
While the above description constitutes a plurality of embodiments of the present invention, it will be appreciated that the present invention is susceptible to further modification and change without departing from the fair meaning of the accompanying claims.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CA11/00048 | 1/13/2011 | WO | 00 | 8/20/2012 |
Number | Date | Country | |
---|---|---|---|
61294619 | Jan 2010 | US |