Haoxiang Li | 830834b | 2020-03-05 15:54:34 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "CoreLibSetupHelper.h" |
| 18 | |
| 19 | using namespace android_auto::surround_view; |
| 20 | |
| 21 | namespace android_auto { |
| 22 | namespace surround_view { |
| 23 | |
| 24 | vector<SurroundViewCameraParams> GetCameras() { |
| 25 | std::vector<android_auto::surround_view::SurroundViewCameraParams> cameras; |
| 26 | |
| 27 | // Camera 1. |
| 28 | { |
| 29 | android_auto::surround_view::SurroundViewCameraParams camera_params; |
| 30 | |
| 31 | camera_params.intrinsics[0] = 608.0026093794693; |
| 32 | camera_params.intrinsics[1] = 0.0; |
| 33 | camera_params.intrinsics[2] = 968.699544102168; |
| 34 | camera_params.intrinsics[3] = 0.0; |
| 35 | camera_params.intrinsics[4] = 608.205469489769; |
| 36 | camera_params.intrinsics[5] = 476.38843298898996; |
| 37 | camera_params.intrinsics[6] = 0.0; |
| 38 | camera_params.intrinsics[7] = 0.0; |
| 39 | camera_params.intrinsics[8] = 1.0; |
| 40 | |
| 41 | camera_params.distorion[0] = -0.03711481733589263; |
| 42 | camera_params.distorion[1] = -0.0014805627895442888; |
| 43 | camera_params.distorion[2] = -0.00030212056866592464; |
| 44 | camera_params.distorion[3] = -0.00020149538570397933; |
| 45 | |
| 46 | camera_params.rvec[0] = 2.26308; |
| 47 | camera_params.rvec[1] = 0.0382788; |
| 48 | camera_params.rvec[2] = -0.0220549; |
| 49 | |
| 50 | camera_params.tvec[0] = -7.8028875403817685e-02; |
| 51 | camera_params.tvec[1] = 1.4537396465103221e+00; |
| 52 | camera_params.tvec[2] = -8.4197165554645001e-02; |
| 53 | |
| 54 | camera_params.size.width = 1920; |
| 55 | camera_params.size.height = 1024; |
| 56 | |
| 57 | camera_params.circular_fov = 179; |
| 58 | |
| 59 | cameras.push_back(camera_params); |
| 60 | } |
| 61 | |
| 62 | // Camera 2. |
| 63 | { |
| 64 | android_auto::surround_view::SurroundViewCameraParams camera_params; |
| 65 | |
| 66 | camera_params.intrinsics[0] = 607.8691721095306; |
| 67 | camera_params.intrinsics[1] = 0.0; |
| 68 | camera_params.intrinsics[2] = 975.5686146375716; |
| 69 | camera_params.intrinsics[3] = 0.0; |
| 70 | camera_params.intrinsics[4] = 608.0112887189435; |
| 71 | camera_params.intrinsics[5] = 481.1938786570715; |
| 72 | camera_params.intrinsics[6] = 0.0; |
| 73 | camera_params.intrinsics[7] = 0.0; |
| 74 | camera_params.intrinsics[8] = 1.0; |
| 75 | |
| 76 | camera_params.distorion[0] = -0.040116809827977926; |
| 77 | camera_params.distorion[1] = 0.0028769489398543014; |
| 78 | camera_params.distorion[2] = -0.002651039958977229; |
| 79 | camera_params.distorion[3] = 0.00024260630476736675; |
| 80 | |
| 81 | camera_params.rvec[0] = 1.67415; |
| 82 | camera_params.rvec[1] = -1.74075; |
| 83 | camera_params.rvec[2] = 0.789399; |
| 84 | |
| 85 | camera_params.tvec[0] = 2.9715052384687407e-01; |
| 86 | camera_params.tvec[1] = 1.1407102692699396e+00; |
| 87 | camera_params.tvec[2] = 3.0074545273489206e-01; |
| 88 | |
| 89 | camera_params.size.width = 1920; |
| 90 | camera_params.size.height = 1024; |
| 91 | |
| 92 | camera_params.circular_fov = 179; |
| 93 | |
| 94 | cameras.push_back(camera_params); |
| 95 | } |
| 96 | |
| 97 | // Camera 3. |
| 98 | { |
| 99 | android_auto::surround_view::SurroundViewCameraParams camera_params; |
| 100 | |
| 101 | camera_params.intrinsics[0] = 608.557299289448; |
| 102 | camera_params.intrinsics[1] = 0.0; |
| 103 | camera_params.intrinsics[2] = 960.1949354417656; |
| 104 | camera_params.intrinsics[3] = 0.0; |
| 105 | camera_params.intrinsics[4] = 608.8093878512448; |
| 106 | camera_params.intrinsics[5] = 474.74744054048256; |
| 107 | camera_params.intrinsics[6] = 0.0; |
| 108 | camera_params.intrinsics[7] = 0.0; |
| 109 | camera_params.intrinsics[8] = 1.0; |
| 110 | |
| 111 | camera_params.distorion[0] = -0.03998488563470043; |
| 112 | camera_params.distorion[1] = 0.0024786686909103388; |
| 113 | camera_params.distorion[2] = -0.002354736769480817; |
| 114 | camera_params.distorion[3] = 0.00018369619088506146; |
| 115 | |
| 116 | camera_params.rvec[0] = -0.106409; |
| 117 | camera_params.rvec[1] = -2.83697; |
| 118 | camera_params.rvec[2] = 1.28629; |
| 119 | |
| 120 | camera_params.tvec[0] = 1.7115269161259747e-01; |
| 121 | camera_params.tvec[1] = 1.4376160762596599e+00; |
| 122 | camera_params.tvec[2] = -1.9028844233159006e-02; |
| 123 | |
| 124 | camera_params.size.width = 1920; |
| 125 | camera_params.size.height = 1024; |
| 126 | |
| 127 | camera_params.circular_fov = 179; |
| 128 | |
| 129 | cameras.push_back(camera_params); |
| 130 | } |
| 131 | |
| 132 | // Camera 4. |
| 133 | { |
| 134 | android_auto::surround_view::SurroundViewCameraParams camera_params; |
| 135 | |
| 136 | camera_params.intrinsics[0] = 608.1221963545495; |
| 137 | camera_params.intrinsics[1] = 0.0; |
| 138 | camera_params.intrinsics[2] = 943.6280444638576; |
| 139 | camera_params.intrinsics[3] = 0.0; |
| 140 | camera_params.intrinsics[4] = 608.0523818661524; |
| 141 | camera_params.intrinsics[5] = 474.8564698210861; |
| 142 | camera_params.intrinsics[6] = 0.0; |
| 143 | camera_params.intrinsics[7] = 0.0; |
| 144 | camera_params.intrinsics[8] = 1.0; |
| 145 | |
| 146 | camera_params.distorion[0] = -0.038096507459563965; |
| 147 | camera_params.distorion[1] = 0.0004008114278766646; |
| 148 | camera_params.distorion[2] = -0.0013549275607082035; |
| 149 | camera_params.distorion[3] = -5.9961182248325556e-06; |
| 150 | |
| 151 | camera_params.rvec[0] = 1.63019; |
| 152 | camera_params.rvec[1] = 1.76475; |
| 153 | camera_params.rvec[2] = -0.827941; |
| 154 | |
| 155 | camera_params.tvec[0] = -3.0842691427126512e-01; |
| 156 | camera_params.tvec[1] = 1.0884122033556984e+00; |
| 157 | camera_params.tvec[2] = 3.4419058255954926e-01; |
| 158 | |
| 159 | camera_params.size.width = 1920; |
| 160 | camera_params.size.height = 1024; |
| 161 | |
| 162 | camera_params.circular_fov = 179; |
| 163 | |
| 164 | cameras.push_back(camera_params); |
| 165 | } |
| 166 | return cameras; |
| 167 | |
| 168 | } |
| 169 | |
| 170 | SurroundView2dParams Get2dParams() { |
| 171 | android_auto::surround_view::Size2dInteger |
| 172 | resolution{ /*width=*/ 1024, /*height*/ 768}; |
| 173 | // make sure resolution has the same ratio with physical_size. |
| 174 | // {480 *360 } |
| 175 | android_auto::surround_view::Size2dFloat physical_size{8.0, 6.0}; |
| 176 | android_auto::surround_view::Coordinate2dFloat physical_center{0, 0}; |
| 177 | |
| 178 | return android_auto::surround_view::SurroundView2dParams( |
| 179 | resolution, physical_size, physical_center); |
| 180 | } |
| 181 | |
| 182 | SurroundView3dParams Get3dParams() { |
| 183 | return android_auto::surround_view::SurroundView3dParams( |
| 184 | /*plane_radius=*/ 8.0f, |
| 185 | /*plane_divisions=*/ 50, |
| 186 | /*curve_height=*/ 6.0f, |
| 187 | /*curve_divisions=*/ 50, |
| 188 | /*angular_divisions=*/ 90, |
| 189 | /*curve_coefficient=*/ 3.0f, |
| 190 | /*resolution=*/ Size2dInteger(1024, 768)); |
| 191 | } |
| 192 | |
| 193 | BoundingBox GetBoundingBox() { |
| 194 | return android_auto::surround_view::BoundingBox( |
| 195 | /*x=*/ -0.01f, |
| 196 | /*y=*/ 0.01f, |
| 197 | /*width=*/ 0.01f, |
| 198 | /*height=*/ 0.01f); |
| 199 | } |
| 200 | |
| 201 | vector<float> GetUndistortionScales() { |
| 202 | return vector<float>{1.0f, 1.0f, 1.0f, 1.0f}; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | } // namespace surround_view |
| 207 | } // namespace audroid_auto |
| 208 | |