Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement an Optical Flow Camera #4104

Merged
merged 9 commits into from
Jun 2, 2021
Merged

Implement an Optical Flow Camera #4104

merged 9 commits into from
Jun 2, 2021

Conversation

sshashank124
Copy link
Contributor

@sshashank124 sshashank124 commented Apr 19, 2021

Description

Adds a new Optical Flow Camera sensor. Transmits data as an image with uint16 channels where the first channel represents the x-component of the optical flow and the second channel represents the y-component. The value of each channel maps to a float range of [-2, 2] which means that the maximum optical flow that can be represented between two consecutive frames is twice the dimensions of the viewport (image width x height).

Also includes a fix for correctly transmitting 16-bit buffers with the Vulkan backend. This fix was implemented by @Axel1092

Where has this been tested?

  • Platform(s): Linux
  • Python version(s): 3.6
  • Unreal Engine version(s): 4.26

Possible Drawbacks

PythonAPI/examples/manual_control.py code for displaying output of Optical Flow sensor runs a bit slower than real-time.


This change is Reviewable

@sshashank124 sshashank124 requested a review from a team as a code owner April 19, 2021 16:51
@Axel1092 Axel1092 self-assigned this Apr 20, 2021
Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 17 of 17 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @sshashank124)


LibCarla/source/carla/sensor/data/Color.h, line 68 at r1 (raw file):

    }

//    operator rpc::Color16bit() const {

If this part does not work better to remove it, not left it commented


PythonAPI/examples/manual_control.py, line 1117 at r1 (raw file):

            if OPENCV_INSTALLED:
                data_array = np.array(array[:, :, 0:2], dtype=np.float32)
                data_array[:, :, 0] = (data_array[:, :, 0] - 32767) * (2 * image.width / 65535)

I think this transformations are important to understand. Could you please describe in some comments what this operation does?


Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/OpticalFlowCamera.cpp, line 17 at r1 (raw file):

  AddPostProcessingMaterial(
      TEXT("Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
//  AddPostProcessingMaterial(

These materials as they are not used we could just remove the comented lines.

Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @sshashank124)


PythonAPI/examples/manual_control.py, line 1012 at r1 (raw file):

        self.sensors = [
            ['sensor.camera.rgb', cc.Raw, 'Camera RGB', {}],
            ['sensor.camera.optical_flow', cc.Raw, 'Optical Flow', {}],

Maybe it is better to move this to the end of the list to not change the order of the old sensors

Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 8 files at r2, 12 of 13 files at r3, 3 of 3 files at r4.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @sshashank124)

Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @sshashank124)

Axel1092
Axel1092 previously approved these changes Jun 1, 2021
Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @sshashank124)

Axel1092
Axel1092 previously approved these changes Jun 1, 2021
Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r5.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @sshashank124)

Copy link
Contributor

@Axel1092 Axel1092 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r6.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @sshashank124)

@Axel1092 Axel1092 merged commit 9417f2b into carla-simulator:dev Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants