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
17package [email protected];
18
19import ISurroundViewSession;
20
21/**
22 * Interface representing a surround view 2d session.
23 *
24 * Surround view 2d provides a top/bird's eye view of the car and its surroundings.
25 */
26interface ISurroundView2dSession extends ISurroundViewSession {
27
28    /**
29     * Gets mapping information for 2d surround view.
30     *
31     * Mapping information maps the output frame of 2d surround view to actual dimensions
32     * covered on the ground. Mapping information is fixed for a car and is based upon its camera
33     * coverage. Mapping information can be used for doing overlays of objects in 3d space
34     * onto the surround view 2d output frame.
35     *
36     * @param sv2dConfig Configuration to set.
37     * @return sv2dMappingInfo mapping information of the 2d surround view.
38     */
39    get2dMappingInfo() generates (Sv2dMappingInfo sv2dMappingInfo);
40
41    /**
42     * Sets the configuration of 2d surround view.
43     *
44     * Configuration is used for supported different target use-cases of the surround view eg.
45     * fullscreen or preview. Default configuration is FULLSCREEN.
46     * A set config call can be performed at any time (before or after startStream) of the session.
47     * Once config change is complete, a CONFIG_CHANGED event is sent, after which
48     * all frames received will be of the updated config.
49     *
50     * @param sv2dConfig Configuration to set.
51     * @return svResult  Returns OK if successful, appropriate error result otherwise.
52     */
53    set2dConfig(Sv2dConfig sv2dConfig) generates (SvResult svResult);
54
55    /**
56     * Gets the current configuration of the 2d surround view.
57     *
58     * Configuration is used for supported different target use-cases of the surround view eg.
59     * fullscreen view or preview. Use setConfig call to set a configuration.
60     *
61     * @return sv2dConfig the active current configuration of the 2d session.
62     */
63    get2dConfig() generates (Sv2dConfig sv2dConfig);
64
65    /**
66     * Projects points on camera image to surround view 2d image.
67     *
68     * Useful for mapping points detected on individual camera frames onto the surround view 2d
69     * output frame.
70     *
71     * @param cameraPoints  List of camera pixel points to be projected in range including (0, 0)
72     *                      and (width - 1, height -1) of camera frame. If point is outside camera
73                            frame INVALID_ARG error is returned.
74     * @param cameraId      Id of the EvsCamera to use for projecting points. Id must be one of the
75     *                      cameras as returned by getCameraIds() else INVALID_ARG error is returned
76     * @return points2d     Returns a list of 2d pixel points projecting into surround view 2d
77     *                      frame in the same order as cameraPoints. Point projected maybe outside
78     *                      surround view frame i.e. outside (0, 0) and
79     *                      (sv_width - 1, sv_height - 1). Points that do not project to ground
80     *                      plane are set with inValid true.
81     */
82    projectCameraPoints(vec<Point2dInt> cameraPoints, string cameraId) generates (
83            vec<Point2dFloat> points2d);
84};
85