Home > other >  Python: TypeError: draw_geometries(): incompatible function arguments
Python: TypeError: draw_geometries(): incompatible function arguments

Time:10-22

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

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.

CodePudding user response:

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

  • Related