diff --git a/AirLib/include/common/ImageCaptureBase.hpp b/AirLib/include/common/ImageCaptureBase.hpp index 1830969e92..04012901e4 100644 --- a/AirLib/include/common/ImageCaptureBase.hpp +++ b/AirLib/include/common/ImageCaptureBase.hpp @@ -26,6 +26,8 @@ namespace airlib Segmentation, SurfaceNormals, Infrared, + OpticalFlow, + OpticalFlowVis, Count //must be last }; diff --git a/PythonClient/airsim/types.py b/PythonClient/airsim/types.py index 08c099224d..7aef005549 100644 --- a/PythonClient/airsim/types.py +++ b/PythonClient/airsim/types.py @@ -37,6 +37,10 @@ def SurfaceNormals(cls): return 6 def Infrared(cls): return 7 + def OpticalFlow(cls): + return 8 + def OpticalFlowVis(cls): + return 9 def __getattr__(self, key): if key == 'DepthPlanner': @@ -52,6 +56,8 @@ class ImageType(metaclass=_ImageType): Segmentation = 5 SurfaceNormals = 6 Infrared = 7 + OpticalFlow = 8 + OpticalFlowVis = 9 class DrivetrainType: MaxDegreeOfFreedom = 0 diff --git a/Unreal/Plugins/AirSim/Content/Blueprints/BP_PIPCamera.uasset b/Unreal/Plugins/AirSim/Content/Blueprints/BP_PIPCamera.uasset index 211f883e3f..cc1d325496 100644 Binary files a/Unreal/Plugins/AirSim/Content/Blueprints/BP_PIPCamera.uasset and b/Unreal/Plugins/AirSim/Content/Blueprints/BP_PIPCamera.uasset differ diff --git a/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowMaterial.uasset b/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowMaterial.uasset new file mode 100644 index 0000000000..4a8f9e9106 Binary files /dev/null and b/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowMaterial.uasset differ diff --git a/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowRGBMaterial.uasset b/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowRGBMaterial.uasset new file mode 100644 index 0000000000..11cf3d710d Binary files /dev/null and b/Unreal/Plugins/AirSim/Content/HUDAssets/OpticalFlowRGBMaterial.uasset differ diff --git a/Unreal/Plugins/AirSim/Source/PIPCamera.cpp b/Unreal/Plugins/AirSim/Source/PIPCamera.cpp index 05cbdcf25b..70391ed528 100644 --- a/Unreal/Plugins/AirSim/Source/PIPCamera.cpp +++ b/Unreal/Plugins/AirSim/Source/PIPCamera.cpp @@ -41,6 +41,8 @@ APIPCamera::APIPCamera() image_type_to_pixel_format_map_.Add(5, EPixelFormat::PF_B8G8R8A8); image_type_to_pixel_format_map_.Add(6, EPixelFormat::PF_B8G8R8A8); image_type_to_pixel_format_map_.Add(7, EPixelFormat::PF_B8G8R8A8); + image_type_to_pixel_format_map_.Add(8, EPixelFormat::PF_B8G8R8A8); + image_type_to_pixel_format_map_.Add(9, EPixelFormat::PF_B8G8R8A8); object_filter_ = FObjectFilter(); } @@ -70,6 +72,10 @@ void APIPCamera::PostInitializeComponents() UAirBlueprintLib::GetActorComponent(this, TEXT("InfraredCaptureComponent")); captures_[Utils::toNumeric(ImageType::SurfaceNormals)] = UAirBlueprintLib::GetActorComponent(this, TEXT("NormalsCaptureComponent")); + captures_[Utils::toNumeric(ImageType::OpticalFlow)] = + UAirBlueprintLib::GetActorComponent(this, TEXT("OpticalFlowCaptureComponent")); + captures_[Utils::toNumeric(ImageType::OpticalFlowVis)] = + UAirBlueprintLib::GetActorComponent(this, TEXT("OpticalFlowVisCaptureComponent")); for (unsigned int i = 0; i < imageTypeCount(); ++i) { detections_[i] = NewObject(this);