Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 1 | # Copyright 2013 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 15 | import its.caps |
Clemenz Portmann | 8f3b076 | 2017-12-19 09:18:50 -0800 | [diff] [blame] | 16 | import its.device |
| 17 | |
| 18 | import numpy as np |
| 19 | |
Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 20 | |
| 21 | def main(): |
| 22 | """Basic test for bring-up of 3A. |
| 23 | |
| 24 | To pass, 3A must converge. Check that the returned 3A values are legal. |
| 25 | """ |
| 26 | |
| 27 | with its.device.ItsSession() as cam: |
| 28 | props = cam.get_camera_properties() |
Chien-Yu Chen | bad96ca | 2014-10-20 17:30:56 -0700 | [diff] [blame] | 29 | its.caps.skip_unless(its.caps.read_3a(props)) |
Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 30 | |
| 31 | sens, exp, gains, xform, focus = cam.do_3a(get_results=True) |
Clemenz Portmann | 8f3b076 | 2017-12-19 09:18:50 -0800 | [diff] [blame] | 32 | print 'AE: sensitivity %d, exposure %dms' % (sens, exp/1000000) |
| 33 | print 'AWB: gains', gains, 'transform', xform |
| 34 | print 'AF: distance', focus |
| 35 | assert sens > 0 |
| 36 | assert exp > 0 |
| 37 | assert len(gains) == 4 |
| 38 | for g in gains: |
| 39 | assert not np.isnan(g) |
| 40 | assert len(xform) == 9 |
| 41 | for x in xform: |
| 42 | assert not np.isnan(x) |
| 43 | assert focus >= 0 |
Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 44 | |
| 45 | if __name__ == '__main__': |
| 46 | main() |
| 47 | |