1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright 2020 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport ISurroundViewSession; 20*4d7e907cSAndroid Build Coastguard Worker 21*4d7e907cSAndroid Build Coastguard Worker/** 22*4d7e907cSAndroid Build Coastguard Worker * Interface representing a surround view 3d session. 23*4d7e907cSAndroid Build Coastguard Worker * 24*4d7e907cSAndroid Build Coastguard Worker * Surround view 3d provides a virtual view from any desired position in the 3d space around the 25*4d7e907cSAndroid Build Coastguard Worker * car. Surround view 3d creates an approximate 3d surface around the car to match the surrounds 26*4d7e907cSAndroid Build Coastguard Worker * and provides a virtual view as seen on this surface. 27*4d7e907cSAndroid Build Coastguard Worker */ 28*4d7e907cSAndroid Build Coastguard Workerinterface ISurroundView3dSession extends ISurroundViewSession { 29*4d7e907cSAndroid Build Coastguard Worker 30*4d7e907cSAndroid Build Coastguard Worker /** 31*4d7e907cSAndroid Build Coastguard Worker * Sets the desired views of surround view 3d. 32*4d7e907cSAndroid Build Coastguard Worker * 33*4d7e907cSAndroid Build Coastguard Worker * Surround view 3d takes a list of desired virtual view points and provides an output frame 34*4d7e907cSAndroid Build Coastguard Worker * for each view. Default view list is a single view from behind the car front facing in the 35*4d7e907cSAndroid Build Coastguard Worker * front direction. 36*4d7e907cSAndroid Build Coastguard Worker * A call to setViews() results in the views set by a previous call to be discarded. 37*4d7e907cSAndroid Build Coastguard Worker * Each view set is identified by an Id which is returned with the corresponding output frame 38*4d7e907cSAndroid Build Coastguard Worker * of that view. 39*4d7e907cSAndroid Build Coastguard Worker * Clients can call setViews() at any stage of the session (before/after startStream). Client 40*4d7e907cSAndroid Build Coastguard Worker * may continue to receive frames of previous views after setViews() call for a while and can 41*4d7e907cSAndroid Build Coastguard Worker * identify updated set of views once effective using the view Id provided in the updated 42*4d7e907cSAndroid Build Coastguard Worker * views frames. 43*4d7e907cSAndroid Build Coastguard Worker * 44*4d7e907cSAndroid Build Coastguard Worker * @param views List of desired views to generate output frames. 45*4d7e907cSAndroid Build Coastguard Worker * @return svResult Returns OK if successful, appropriate error result otherwise. 46*4d7e907cSAndroid Build Coastguard Worker */ 47*4d7e907cSAndroid Build Coastguard Worker setViews(vec<View3d> views) generates (SvResult svResult); 48*4d7e907cSAndroid Build Coastguard Worker 49*4d7e907cSAndroid Build Coastguard Worker /** 50*4d7e907cSAndroid Build Coastguard Worker * Sets the configuration of 3d surround view. 51*4d7e907cSAndroid Build Coastguard Worker * 52*4d7e907cSAndroid Build Coastguard Worker * Configuration is used for supported different target use-cases of the surround view eg. 53*4d7e907cSAndroid Build Coastguard Worker * fullscreen view or preview. A set config call can be performed at anytime (before or after 54*4d7e907cSAndroid Build Coastguard Worker * startStream) of the session. 55*4d7e907cSAndroid Build Coastguard Worker * Once config change is complete, a CONFIG_CHANGED event is sent, after which 56*4d7e907cSAndroid Build Coastguard Worker * all frames received will be of the updated config. 57*4d7e907cSAndroid Build Coastguard Worker * 58*4d7e907cSAndroid Build Coastguard Worker * @param sv3dConfig Configuration to set. 59*4d7e907cSAndroid Build Coastguard Worker * @return svResult Returns OK if successful, appropriate error result otherwise. 60*4d7e907cSAndroid Build Coastguard Worker */ 61*4d7e907cSAndroid Build Coastguard Worker set3dConfig(Sv3dConfig sv3dConfig) generates (SvResult svResult); 62*4d7e907cSAndroid Build Coastguard Worker 63*4d7e907cSAndroid Build Coastguard Worker /** 64*4d7e907cSAndroid Build Coastguard Worker * Gets the current configuration of the 3d surround view. 65*4d7e907cSAndroid Build Coastguard Worker * 66*4d7e907cSAndroid Build Coastguard Worker * Configuration is used for supported different target use-cases of the surround view eg. 67*4d7e907cSAndroid Build Coastguard Worker * fullscreen view or preview. Use setConfig call to set a configuration. 68*4d7e907cSAndroid Build Coastguard Worker * 69*4d7e907cSAndroid Build Coastguard Worker * @return sv3dConfig The current active configuration of the 3d session. 70*4d7e907cSAndroid Build Coastguard Worker */ 71*4d7e907cSAndroid Build Coastguard Worker get3dConfig() generates (Sv3dConfig sv3dConfig); 72*4d7e907cSAndroid Build Coastguard Worker 73*4d7e907cSAndroid Build Coastguard Worker /** 74*4d7e907cSAndroid Build Coastguard Worker * Updates 3d overlays in scene. 75*4d7e907cSAndroid Build Coastguard Worker * 76*4d7e907cSAndroid Build Coastguard Worker * updateOverlays() provides a way to set a 3d overlay object in the scene. An overlay is an 77*4d7e907cSAndroid Build Coastguard Worker * 3d object in the scene which can be a visual indicator to provide additional information eg. 78*4d7e907cSAndroid Build Coastguard Worker * parking sensor distance indicators or overlays for objects in scene. 79*4d7e907cSAndroid Build Coastguard Worker * 80*4d7e907cSAndroid Build Coastguard Worker * An overlay object is defined by a set of points (forming triangles) with some color and 81*4d7e907cSAndroid Build Coastguard Worker * transparency values and each overlay is identified by an overlay Id. 82*4d7e907cSAndroid Build Coastguard Worker * When an overlay with a new Id is passed, a new overlay is added to the scene. 83*4d7e907cSAndroid Build Coastguard Worker * When an overlay with previous id is passed, its vertices/color are updated with passed data. 84*4d7e907cSAndroid Build Coastguard Worker * If the overlay data is empty, the overlay is removed from the scene. 85*4d7e907cSAndroid Build Coastguard Worker * 86*4d7e907cSAndroid Build Coastguard Worker * @param overlaysData Object with shared memory containing overlays to add/update in the 87*4d7e907cSAndroid Build Coastguard Worker * scene. Refer to OverlaysData structure for layout in shared memory. 88*4d7e907cSAndroid Build Coastguard Worker * @return svResult Returns OK if successful, appropriate error result otherwise. 89*4d7e907cSAndroid Build Coastguard Worker */ 90*4d7e907cSAndroid Build Coastguard Worker updateOverlays(OverlaysData overlaysData) generates (SvResult svResult); 91*4d7e907cSAndroid Build Coastguard Worker 92*4d7e907cSAndroid Build Coastguard Worker /** 93*4d7e907cSAndroid Build Coastguard Worker * Projects points on camera image to surround view 3D surface. 94*4d7e907cSAndroid Build Coastguard Worker * 95*4d7e907cSAndroid Build Coastguard Worker * Useful for mapping points detected on individual camera frames onto the surround view 3D 96*4d7e907cSAndroid Build Coastguard Worker * surface, these 3d points can then be used to set overlays using the updateOverlays() for 97*4d7e907cSAndroid Build Coastguard Worker * the detected objects in the scene. 98*4d7e907cSAndroid Build Coastguard Worker * Note: 99*4d7e907cSAndroid Build Coastguard Worker * 3d points returned are projected on an approximate 3d surface and do not provide the exact 100*4d7e907cSAndroid Build Coastguard Worker * 3d location. 101*4d7e907cSAndroid Build Coastguard Worker * 102*4d7e907cSAndroid Build Coastguard Worker * @param cameraPoints List of camera pixel points to be projected in range including (0, 0) 103*4d7e907cSAndroid Build Coastguard Worker * and (width - 1, height -1) of camera frame. If point is outside camera 104*4d7e907cSAndroid Build Coastguard Worker frame INVALID_ARG error is returned. 105*4d7e907cSAndroid Build Coastguard Worker * @param cameraId Id of the EvsCamera to use for projecting points. Id must be one of the 106*4d7e907cSAndroid Build Coastguard Worker * cameras as returned by getCameraIds() else INVALID_ARG error is returned 107*4d7e907cSAndroid Build Coastguard Worker * @return points3d Returns a list of 3d points on the approximate 3d surface in the 108*4d7e907cSAndroid Build Coastguard Worker * automotive coordinate system in the same order as cameraPoints. 109*4d7e907cSAndroid Build Coastguard Worker * Points that do not project to 3d surface are set with inValid true. 110*4d7e907cSAndroid Build Coastguard Worker */ 111*4d7e907cSAndroid Build Coastguard Worker projectCameraPointsTo3dSurface(vec<Point2dInt> cameraPoints, string cameraId) generates ( 112*4d7e907cSAndroid Build Coastguard Worker vec<Point3dFloat> points3d); 113*4d7e907cSAndroid Build Coastguard Worker}; 114