Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python: TypeError: draw_geometries(): incompatible function arguments

I am trying to implement an Open3D model to generate point cloud from a monocular depth map.

Referred to this YouTube video – https://youtu.be/teHGdlGhQZo

OpenCV == 4.4.0

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Open3D == 0.15.1

BGR Image – 640x480x3

Depth Image – 640x480x3

Code –

import open3d as o3d
import numpy as np
import matplotlib.pyplot as plt
import os 
import sys
import cv2
import open3d_tutorial as o3dtut
o3dtut.interactive = not "CI" in os.environ

color_raw = o3d.io.read_image('colorImg.jpg')
depth_raw = o3d.io.read_image('depthImg2.png')

rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(color_raw,depth_raw)
print(rgbd_image)
camera_intrinsic = o3d.camera.PinholeCameraIntrinsic(
        o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault)

pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, camera_intrinsic)
pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
o3d.visualization.draw_geometries([pcd], zoom=0.5)

Error Message –

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_18872/3179634559.py in <module>
      1 pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
----> 2 o3d.visualization.draw_geometries([pcd], zoom=0.5)

TypeError: draw_geometries(): incompatible function arguments. The following argument types are supported:
    1. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False) -> None
    2. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False, lookat: numpy.ndarray[numpy.float64[3, 1]], up: numpy.ndarray[numpy.float64[3, 1]], front: numpy.ndarray[numpy.float64[3, 1]], zoom: float) -> None

Invoked with: [PointCloud with 306097 points.]; kwargs: zoom=0.5

Already Tried –

Tried changing the Open3D version from 0.16 -> 0.15

Tried twitching the dimensions of the images.

>Solution :

remove the zoom parameter, just checked that draw_geometries isn’t currently supporting this.
Remove it and your code will work just fine.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading