question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extremely confusing API

See original GitHub issue
  1. what is the difference between createMonoCamera and createColorCamera? Aren’t they both referring to the same Monocular camera’s in the right and the left? If it’ sjust the grayscale that makes the difference, having a seperate name as MonoCamera is confusing as the camera remains the same but it’s just that the frames are being converted from rgb to grayscale.

  2. The compiler warns that 'can not find reference to MonoCameraProperties in depthai.py`. This makes it hard to navigate inside the API to see the possible settings or the API that I could use? This makes development hard as I need to search the documentation online for every other settings that depthai supports.

  3. The code is too verbose. For instance, depth_preview.py has the following code


# Define a source - two mono (grayscale) cameras
left = pipeline.createMonoCamera()
left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
left.setBoardSocket(dai.CameraBoardSocket.LEFT)

right = pipeline.createMonoCamera()
right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
right.setBoardSocket(dai.CameraBoardSocket.RIGHT)

# Create a node that will produce the depth map (using disparity output as it's easier to visualize depth this way)
depth = pipeline.createStereoDepth()
depth.setConfidenceThreshold(200)
depth.setOutputDepth(False)

but wouldn’t it be easier to create a depth node with a single line and retrieve the left and right frames as follows,

cam.retrieve_image(left_matrix, View.LEFT) # left rgb
cam.retrieve_image(right_matrix, View.RIGHT) #right rgb
cam.retrieve_depth() #16 bit depth image
  1. Please add a simplistic example to retrieve 1. RGB Left 2. RGB Right 3. Depth Image 4. Distance on mouse click. I see an example with open3d but having too many dependencies makes it hard to integrate.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Erol444commented, May 20, 2021

@Luxonis-Brandon

sorry for the late response. I would highly appreciate an example that shows how we could get the XYZ position from a xy position of the RGB Image. thank you! Also please, reduce the size of the code that it takes to grab the feeds.

Hello @Zumbalamambo, I’m currently just working on this for another project. I will make a demo that shows how to achieve this and add that to depthai-experiments, hopefully, this week. I will circle back here when I push it:)

The code that converts ROI to XYZ positions (you could just provide a single pixel) on the host is here, note here that color and depth frames are aligned.

Thanks, Erik

1reaction
Erol444commented, Apr 20, 2021

Hello @Zumbalamambo,

  1. as per the image that Brandon posted, those are actually different sensors. So the frames from the mono cameras aren’t actually converted from RGB to grayscale - they are grayscale by default (from the sensor). That’s why the cameras are also accessed differently in the API.
  2. What version of the depthai package are you using? Did you follow the installation instructions? If so, could you please provide the error that is returned and the script you are using? We would be more than happy to take a look.
  3. You are absolutely correct and this is actually the next step we are taking. Funny enough we were just discussing this with another developer today. We want to make the API such that displaying a rgb image on the host requires max 10 lines of code. This means we will be working on a top-level abstraction and node grouping on top of the current API layer. However, currently, there are tons of features that users are requesting which we are focusing on. I estimate that we will start working on this top-layer abstraction layer in the next few months:)
  4. From my knowledge of the o3d you can save the image/pcl from within the library, right? Here is the demo for the RGBD - to pointcloud: gen1 and for gen2 - this is not on main because it needs calibration to be read from gen1 and manually storing it on host and feeding it to the device. If that is not what you are looking for please correct me and I can add it to my TODO of experiments/demos to make:)

And apology for the late reply!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Confused about how APIs are called
However, what I don't understand is how APIs are called. ... Very broadly, these are called http client libraries.
Read more >
What Are Six of the Most Common API Mistakes?
Heitor Tashiro Sergent from Runscope, lays out six of the most common mistakes that arise from APIs that weren't made with enough care....
Read more >
6 Frequently Occurring API Errors And How to Prevent Them
One of the most common API errors occur when there's confusion between http:// and https:// protocols in URLs.
Read more >
Definition of api confusing me : r/FreeCodeCamp - Reddit
It's most likely a Node backend API that a frontend can consume to process payments, add items to a cart, etc. So you'd...
Read more >
don't you think the api is too much complicated?
I've been reading the api doc for two days. It makes me feel puzzle. As a js library for data visualization, what the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found