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

Deprecated getImageArray() call? #3

Open
scottnortman opened this issue Jul 30, 2021 · 0 comments
Open

Deprecated getImageArray() call? #3

scottnortman opened this issue Jul 30, 2021 · 0 comments

Comments

@scottnortman
Copy link

Hi,

I followed the example as shown for the visual_tracker.py example for another project I am working on, and my python ROS2 node always crashes when I call camera.getImageArray()

Instead, I was able to get the following code to work:

    def get_image_from_camera( self ):
        '''
        Get an image from the camera.  Per webots documentation, the method
        getImage returns a byte string and it needs to be converted.

        '''
        img = self.camera.getImage()
        imageRGBA = np.fromstring( img, dtype='uint8').reshape((self.camera.getHeight(), self.camera.getWidth(), 4))

        return imageRGBA

Not sure if this is due to any recent webots changes as I am running the latest 2021b, but I wanted to let you know.

--Scott

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

No branches or pull requests

1 participant