Skip to content

Commit

Permalink
Rename DepthPlanner to DepthPlanar
Browse files Browse the repository at this point in the history
  • Loading branch information
saihv authored and Jonathan committed Mar 23, 2021
1 parent b9c2618 commit 76b3ba2
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion AirLib/include/common/ImageCaptureBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ImageCaptureBase
public: //types
enum class ImageType : int { //this indexes to array, -1 is special to indicate main camera
Scene = 0,
DepthPlanner,
DepthPlanar,
DepthPerspective,
DepthVis,
DisparityNormalized,
Expand Down
2 changes: 1 addition & 1 deletion Examples/DataCollection/DataCollectorSGM.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DataCollectorSGM {
std::vector<ImageRequest> request = {
ImageRequest("front_left", ImageType::Scene, false, false),
ImageRequest("front_right", ImageType::Scene, false, false),
ImageRequest("front_left", ImageType::DepthPlanner, true),
ImageRequest("front_left", ImageType::DepthPlanar, true),
ImageRequest("front_left", ImageType::DisparityNormalized, true)
};
const std::vector<ImageResponse>& response_init = client.simGetImages(request);
Expand Down
2 changes: 1 addition & 1 deletion Examples/DepthNav/DepthNavOptAStar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class DepthNavOptAStar {

do {
std::vector<ImageRequest> request = {
ImageRequest("1", ImageType::DepthPlanner, true) /*,
ImageRequest("1", ImageType::DepthPlanar, true) /*,
ImageRequest("1", ImageType::Scene),
ImageRequest("1", ImageType::DisparityNormalized, true) */
};
Expand Down
4 changes: 2 additions & 2 deletions Examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void runDepthNavGT()
typedef ImageCaptureBase::ImageType ImageType;

std::vector<ImageRequest> request = {
ImageRequest("front_left", ImageType::DepthPlanner, true) /*,
ImageRequest("front_left", ImageType::DepthPlanar, true) /*,
ImageRequest("front_left", ImageType::Scene),
ImageRequest("front_left", ImageType::DisparityNormalized, true) */
};
Expand Down Expand Up @@ -135,7 +135,7 @@ void runDepthNavSGM()
std::vector<ImageRequest> request = {
ImageRequest("front_left", ImageType::Scene, false, false),
ImageRequest("front_right", ImageType::Scene, false, false), /*
ImageRequest("front_left", ImageType::DepthPlanner, true),
ImageRequest("front_left", ImageType::DepthPlanar, true),
ImageRequest("front_left", ImageType::DisparityNormalized, true) */
};

Expand Down
2 changes: 1 addition & 1 deletion HelloCar/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
client.confirmConnection();

std::cout << "Press Enter to get FPV image" << std::endl; std::cin.get();
vector<ImageRequest> request = { ImageRequest("0", ImageType::Scene), ImageRequest("1", ImageType::DepthPlanner, true) };
vector<ImageRequest> request = { ImageRequest("0", ImageType::Scene), ImageRequest("1", ImageType::DepthPlanar, true) };
const vector<ImageResponse>& response = client.simGetImages(request);
std::cout << "# of images received: " << response.size() << std::endl;

Expand Down
6 changes: 2 additions & 4 deletions HelloDrone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ int main()
try {
client.confirmConnection();

std::cout << "Press Enter to get FPV image" << std::endl;
std::cin.get();

vector<ImageRequest> request{ ImageRequest("0", ImageType::Scene), ImageRequest("1", ImageType::DepthPlanner, true) };
std::cout << "Press Enter to get FPV image" << std::endl; std::cin.get();
vector<ImageRequest> request = { ImageRequest("0", ImageType::Scene), ImageRequest("1", ImageType::DepthPlanar, true) };
const vector<ImageResponse>& response = client.simGetImages(request);
std::cout << "# of images received: " << response.size() << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion PythonClient/airsim/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def from_msgpack(cls, encoded):

class ImageType:
Scene = 0
DepthPlanner = 1
DepthPlanar = 1
DepthPerspective = 2
DepthVis = 3
DisparityNormalized = 4
Expand Down
4 changes: 2 additions & 2 deletions PythonClient/computer_vision/cv_navigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def moveUAV(client,pos,yaw):
step = 0.1

responses = client.simGetImages([
airsim.ImageRequest("1", airsim.ImageType.DepthPlanner, True)])
airsim.ImageRequest("1", airsim.ImageType.DepthPlanar, True)])
response = responses[0]

#initial position
Expand All @@ -197,7 +197,7 @@ def moveUAV(client,pos,yaw):

# get response
responses = client.simGetImages([
airsim.ImageRequest("1", airsim.ImageType.DepthPlanner, True)])
airsim.ImageRequest("1", airsim.ImageType.DepthPlanar, True)])
response = responses[0]

# get numpy array
Expand Down
2 changes: 1 addition & 1 deletion PythonClient/multirotor/kinect_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def CreateTFMessage(self):
pub = KinectPublisher()

while not rospy.is_shutdown():
responses = client.simGetImages([airsim.ImageRequest(0, airsim.ImageType.DepthPlanner, True, False),
responses = client.simGetImages([airsim.ImageRequest(0, airsim.ImageType.DepthPlanar, True, False),
airsim.ImageRequest(0, airsim.ImageType.Scene, False, False)])
img_depth = pub.getDepthImage(responses[0])
img_rgb = pub.getRGBImage(responses[1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public void reset() {

public enum ImageType {
Scene = 0,
DepthPlanner,
DepthPlanar,
DepthPerspective,
DepthVis,
DisparityNormalized,
Expand Down
4 changes: 2 additions & 2 deletions Unreal/Plugins/AirSim/Source/PIPCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void APIPCamera::PostInitializeComponents()

captures_[Utils::toNumeric(ImageType::Scene)] =
UAirBlueprintLib::GetActorComponent<USceneCaptureComponent2D>(this, TEXT("SceneCaptureComponent"));
captures_[Utils::toNumeric(ImageType::DepthPlanner)] =
UAirBlueprintLib::GetActorComponent<USceneCaptureComponent2D>(this, TEXT("DepthPlannerCaptureComponent"));
captures_[Utils::toNumeric(ImageType::DepthPlanar)] =
UAirBlueprintLib::GetActorComponent<USceneCaptureComponent2D>(this, TEXT("DepthPlanarCaptureComponent"));
captures_[Utils::toNumeric(ImageType::DepthPerspective)] =
UAirBlueprintLib::GetActorComponent<USceneCaptureComponent2D>(this, TEXT("DepthPerspectiveCaptureComponent"));
captures_[Utils::toNumeric(ImageType::DepthVis)] =
Expand Down
4 changes: 2 additions & 2 deletions docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ while True:
# get camera images from the car
responses = client.simGetImages([
airsim.ImageRequest(0, airsim.ImageType.DepthVis),
airsim.ImageRequest(1, airsim.ImageType.DepthPlanner, True)])
airsim.ImageRequest(1, airsim.ImageType.DepthPlanar, True)])
print('Retrieved images: %d', len(responses))

# do something with images
Expand Down Expand Up @@ -101,7 +101,7 @@ client.moveToPositionAsync(-10, 10, -10, 5).join()
# take images
responses = client.simGetImages([
airsim.ImageRequest("0", airsim.ImageType.DepthVis),
airsim.ImageRequest("1", airsim.ImageType.DepthPlanner, True)])
airsim.ImageRequest("1", airsim.ImageType.DepthPlanar, True)])
print('Retrieved images: %d', len(responses))

# do something with the images
Expand Down
10 changes: 5 additions & 5 deletions docs/image_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ responses = client.simGetImages([
# uncompressed RGB array bytes
airsim.ImageRequest(1, airsim.ImageType.Scene, False, False),
# floating point uncompressed image
airsim.ImageRequest(1, airsim.ImageType.DepthPlanner, True)])
airsim.ImageRequest(1, airsim.ImageType.DepthPlanar, True)])

# do something with response which contains image data, pose, timestamp etc
```
Expand Down Expand Up @@ -112,7 +112,7 @@ int getStereoAndDepthImages()
//uncompressed RGB array bytes
ImageRequest("1", ImageType::Scene, false, false),
//floating point uncompressed image
ImageRequest("1", ImageType::DepthPlanner, true)
ImageRequest("1", ImageType::DepthPlanar, true)
};
const std::vector<ImageResponse>& response = client.simGetImages(request);
Expand Down Expand Up @@ -203,7 +203,7 @@ To change resolution, FOV etc, you can use [settings.json](settings.md). For exa
### Available ImageType Values
```cpp
Scene = 0,
DepthPlanner = 1,
DepthPlanar = 1,
DepthPerspective = 2,
DepthVis = 3,
DisparityNormalized = 4,
Expand All @@ -212,8 +212,8 @@ To change resolution, FOV etc, you can use [settings.json](settings.md). For exa
Infrared = 7
```

### DepthPlanner and DepthPerspective
You normally want to retrieve the depth image as float (i.e. set `pixels_as_float = true`) and specify `ImageType = DepthPlanner` or `ImageType = DepthPerspective` in `ImageRequest`. For `ImageType = DepthPlanner`, you get depth in camera plan, i.e., all points that are in plan parallel to camera have same depth. For `ImageType = DepthPerspective`, you get depth from camera using a projection ray that hits that pixel. Depending on your use case, planner depth or perspective depth may be the ground truth image that you want. For example, you may be able to feed perspective depth to ROS package such as `depth_image_proc` to generate a point cloud. Or planner depth may be more compatible with estimated depth image generated by stereo algorithms such as SGM.
### DepthPlanar and DepthPerspective
You normally want to retrieve the depth image as float (i.e. set `pixels_as_float = true`) and specify `ImageType = DepthPlanar` or `ImageType = DepthPerspective` in `ImageRequest`. For `ImageType = DepthPlanar`, you get depth in camera plan, i.e., all points that are in plan parallel to camera have same depth. For `ImageType = DepthPerspective`, you get depth from camera using a projection ray that hits that pixel. Depending on your use case, planner depth or perspective depth may be the ground truth image that you want. For example, you may be able to feed perspective depth to ROS package such as `depth_image_proc` to generate a point cloud. Or planner depth may be more compatible with estimated depth image generated by stereo algorithms such as SGM.

### DepthVis
When you specify `ImageType = DepthVis` in `ImageRequest`, you get an image that helps depth visualization. In this case, each pixel value is interpolated from black to white depending on depth in camera plane in meters. The pixels with pure white means depth of 100m or more while pure black means depth of 0 meters.
Expand Down
2 changes: 1 addition & 1 deletion ros/src/airsim_ros_pkgs/rviz/default.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Visualization Manager:
Size (Pixels): 3
Size (m): 0.10000000149011612
Style: Flat Squares
Topic: /airsim_node/front_left_custom/DepthPlanner/registered/points
Topic: /airsim_node/front_left_custom/DepthPlanar/registered/points
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Expand Down
6 changes: 3 additions & 3 deletions ros/src/airsim_ros_pkgs/src/airsim_ros_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ constexpr char AirsimROSWrapper::DMODEL_YML_NAME[];

const std::unordered_map<int, std::string> AirsimROSWrapper::image_type_int_to_string_map_ = {
{ 0, "Scene" },
{ 1, "DepthPlanner" },
{ 1, "DepthPlanar" },
{ 2, "DepthPerspective" },
{ 3, "DepthVis" },
{ 4, "DisparityNormalized" },
Expand Down Expand Up @@ -211,7 +211,7 @@ void AirsimROSWrapper::create_ros_pubs_from_settings_json()
{
current_image_request_vec.push_back(ImageRequest(curr_camera_name, curr_image_type, false, false));
}
// if {DepthPlanner, DepthPerspective,DepthVis, DisparityNormalized}, get float image
// if {DepthPlanar, DepthPerspective,DepthVis, DisparityNormalized}, get float image
else
{
current_image_request_vec.push_back(ImageRequest(curr_camera_name, curr_image_type, true));
Expand Down Expand Up @@ -1489,7 +1489,7 @@ void AirsimROSWrapper::process_and_publish_img_response(const std::vector<ImageR
camera_info_msg_vec_[img_response_idx_internal].header.stamp = curr_ros_time;
cam_info_pub_vec_[img_response_idx_internal].publish(camera_info_msg_vec_[img_response_idx_internal]);

// DepthPlanner / DepthPerspective / DepthVis / DisparityNormalized
// DepthPlanar / DepthPerspective / DepthVis / DisparityNormalized
if (curr_img_response.pixels_as_float)
{
image_pub_vec_[img_response_idx_internal].publish(get_depth_img_msg_from_response(curr_img_response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Visualization Manager:
Size (Pixels): 3
Size (m): 0.100000001
Style: Flat Squares
Topic: /airsim_node/drone_1/front_left_custom/DepthPlanner/registered/points
Topic: /airsim_node/drone_1/front_left_custom/DepthPlanar/registered/points
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<!-- Nodelets! -->
<!-- Convert it into a point cloud -->
<node pkg="nodelet" type="nodelet" name="airsim_depth2cloud" args="load depth_image_proc/point_cloud_xyzrgb depth_to_pointcloud_manager" output="screen">
<remap from="depth_registered/image_rect" to="/airsim_node/drone_1/front_left_custom/DepthPlanner"/>
<remap from="depth_registered/points" to="/airsim_node/drone_1/front_left_custom/DepthPlanner/registered/points"/>
<remap from="depth_registered/image_rect" to="/airsim_node/drone_1/front_left_custom/DepthPlanar"/>
<remap from="depth_registered/points" to="/airsim_node/drone_1/front_left_custom/DepthPlanar/registered/points"/>
<remap from="rgb/image_rect_color" to="/airsim_node/drone_1/front_left_custom/Scene"/>
<remap from="rgb/camera_info" to="/airsim_node/drone_1/front_left_custom/Scene/camera_info"/>
</node>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Visualization Manager:
Size (Pixels): 3
Size (m): 0.100000001
Style: Flat Squares
Topic: /airsim_node/front_left_custom/DepthPlanner/registered/points
Topic: /airsim_node/front_left_custom/DepthPlanar/registered/points
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Expand Down

0 comments on commit 76b3ba2

Please sign in to comment.