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

How to extract the different intensities from the polar camera rostopic /image_raw #212

Closed
zarathacia opened this issue Apr 22, 2024 · 3 comments

Comments

@zarathacia
Copy link

Describe what you want to implement and what the issue & the steps to reproduce it are:

Using this rospackage i am able to receive the images from the baslar polar camera and my goal is to be able to extract the different intensities, colors and stokes from each superpixel.
i am setting my image_encoding to: image_encoding: "bayer_rggb16" and using this code i am trying to acces the 2x2 matrix :
# Convert the ROS Image message to a NumPy array
image = self.bridge.imgmsg_to_cv2(msg, desired_encoding='bayer_rggb16')

        # Initialize arrays to hold polarization data
        P0 = np.zeros((int(image.shape[0]/2), int(image.shape[1]/2)), dtype=np.uint16)
        P45 = np.zeros((int(image.shape[0]/2), int(image.shape[1]/2)), dtype=np.uint16)
        P90 = np.zeros((int(image.shape[0]/2), int(image.shape[1]/2)), dtype=np.uint16)
        P135 = np.zeros((int(image.shape[0]/2), int(image.shape[1]/2)), dtype=np.uint16)

        # Extract polarization channels from the image
        for i in range(0, image.shape[0], 2):
            for j in range(0, image.shape[1], 2):
                super_pixel = image[i:i+2, j:j+2]
                P0[int(i/2), int(j/2)] = super_pixel[0,0]
                P45[int(i/2), int(j/2)] = super_pixel[1,0]
                P90[int(i/2), int(j/2)] = super_pixel[1,1]
                P135[int(i/2), int(j/2)] = super_pixel[0,1]

        # Example of displaying one of the images (e.g., P0)
        cv2.imshow("P0", P0)
        cv2.imshow("P45", P45)
        cv2.imshow("P90", P90)
        cv2.imshow("P135", P135)
        cv2.waitKey(1)

but still i think this is not the right way to access the intensities. is there a way to be sure? or an example of how to do this?

Hardware setup description

i have an acA2440-75uc POL
running on ROS noetic with ubuntu 20.04

Runtime information

running on ROS noetic with ubuntu 20.04

Is your camera operational with the Basler pylon Viewer on your platform?

Yes

@m-binev
Copy link
Collaborator

m-binev commented Apr 30, 2024

@zarathacia we appreciate your post here, but I would recommend approaching the official Basler support in regard to the mentioned polarized camera instead.
Cheers

@zarathacia
Copy link
Author

@m-binev thank you for the response i have indeed contacted the official Basler support and i would like to make sure that the pylon ROS packages is publishing the RAW images from the camera. Is there a way to set the package to do it? or is the default setting already give the raw images?

@thierry-c
Copy link

Basler France support will continue through the support channel the discussion already initiated with you. Thank you.

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

4 participants