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

create RGBD from numpy arrays #805

Closed
lukaspistelak opened this issue Jan 29, 2019 · 2 comments
Closed

create RGBD from numpy arrays #805

lukaspistelak opened this issue Jan 29, 2019 · 2 comments
Labels

Comments

@lukaspistelak
Copy link

lukaspistelak commented Jan 29, 2019

according to this link:
#473

 def register_RGBD(self,t_rgb, t_depth, s_rgb, s_depth,fx, fy, cx, cy):
        
        height=t_rgb.shape[0]
        width=t_rgb.shape[1]
        
       # np.set_printoptions(threshold=np.nan)
         
        intrinsic = PinholeCameraIntrinsic(width, height, fx, fy, cx, cy)     
        #intrinsic = PinholeCameraIntrinsic( PinholeCameraIntrinsicParameters.PrimeSenseDefault)               
        print("t_depth",t_depth[0,:])
        
        with_opencv=True        
        
        s_rgb=Image(s_rgb)              
        s_depth=Image(s_depth)
        
        t_rgb=Image(t_rgb)                
        t_depth=Image(t_depth)
         
        #t_depth = read_image(python_Image.fromarray(t_depth)) #print("t_depth",t_depth)
         
        source_rgbd_image = create_rgbd_image_from_color_and_depth( s_rgb, s_depth)
        target_rgbd_image = create_rgbd_image_from_color_and_depth( t_rgb, t_depth)        
        #      
        print("(target_rgbd_image.depth).dtype",np.asarray(target_rgbd_image.depth)[0,:])

I want to create rgbd from 2 numpy arrays: rgb_numpy_array and depth_numpy_array
When I print the first row of input dept numpy array uint16 and rgbd numpy float32 array the values are absolute different:

('t_depth', array([   0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
          0,    0,    0,    0,    0,    0,    0,    0, 3501, 3501, 3501,
       3489, 3489,    0, 3466, 3466,    0,    0,    0,    0,    0,    0,
          0,    0,    0,    0,    0, 3421, 3421, 3443, 3466, 3501, 3524,
       3560, 3622, 3660, 3712, 3738, 3765, 3792, 3820, 3834, 3877, 3891,
       3906, 3920, 3920, 3935, 3935, 3950, 3965, 3965, 3980, 3995, 4010,
       4026, 4026, 4026, 4041, 4041, 4041, 4041, 4026, 4026, 4026, 4026,
       4026, 4026, 4026, 4026, 4026, 4041, 4041, 4057, 4073, 4089, 4105,
       4137, 4187, 4238, 4343, 4473, 4611, 4736, 4824, 4914, 5008, 5081,
       5131, 5156, 5156, 5131, 5106, 5057, 5032, 5008, 4961, 4937, 4937,
       4937, 4937, 4937, 4961, 5008, 5057, 5081, 5081, 5156, 5182, 5208,

VS.:

('(target_rgbd_image.depth).dtype', array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
@syncle
Copy link
Contributor

syncle commented Jan 30, 2019

@lukaspistelak Could you share minimal code and example data so we can take a look? It would help to understand the issue based on real example. Thanks!

@lukaspistelak
Copy link
Author

Oups sorry for my mistake:
this method:

open3d.geometry.create_rgbd_image_from_color_and_depth(color: open3d.geometry.Image, depth: open3d.geometry.Image, depth_scale: float=1000.0, depth_trunc: float=3.0, convert_rgb_to_intensity: bool=True) → open3d.geometry.RGBDImage

has the depth_trunc: default value : float=3.0 metres!

that's the reason why will be cut off my values:! :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants