- Open any prebuilt scene in the Driving Scenario app.
- In the Driving Scenario Designer app, in the top toolbox, click on Add Camera. You will get a prompt to attach the camera sensor at your preferred position on the ego vehicle.
- In the Driving Scenario Designer app, click on the export dropdown and select Simulink Model under Simulink section.
- In the Simulink model you should be able to see a Scenario Reader block that gives object detections as output. But you still do not have images from the point of view of the camera. To achieve it, follow the steps below.
- Double click in Simulink to get a prompt to add a block. Enter Simulation 3D Camera and add it to the model.
- Once the Simulation 3D Camera is added, double click the Simulation 3D Camera block.
- In the dialog box that appears, select checkbox specify offset. Here we can set the relative translation to match with the sensor in the scenario. To find the values of these parameters, select sensors in the Driving Scenario Designer, and go to sensor placements.
- In the same dialog box, go to properties tab and set the values by matching them with camera settings in the Driving Scenario App.
- In the Simulink model, add a Simulation 3D Scene Configuration block. Double click to open the block. Set the Scene name to the prebilt scene that you had used in the Driving Scenario App.
- In the Simulink model double click to open the Scenario Reader block, and check the box next to output ego vehicle pose.
- Next, add a CuboidTo3DSimulation and Simulation3DVehicle block. The image below point 12 describes how to set the signals.
- Once all these steps are completed, the Simulation 3D Camera will return a frame as an output, which contains the image from the point of view of the camera on the ego vehicle.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412464/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412469/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412474/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412479/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412484/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412489/image.png)