How to avoid the camera scanning the ground when navigating purely visually

Hi, @staff

I have a question about purely visual navigation:

I use a cart equipped with a binocular camera for purely visual navigation tasks.

However, because my ground material is reflective, the cart will misidentify the scanned ground as an obstacle when navigating, making it impossible to navigate.

I would like to ask if there is a way to solve this problem at the software level.
My humble opinion is to filter out the lower part of the image scanned by the camera directly in rtabmap.

Thank you,

Hello @zlwnge,

I don’t know if it is possible directly in rtabmap. But you could write a custom node that filters the input image by cropping a part of it and keeping the other part that serves you. You can do that using openCV and Numpy if you are working with Python.

This is a minimal example:

import cv2
import numpy as np

image= cv2.imread('input_image.png')

cropped= image[30:250, 100:230]

cv2.imshow('Cropped Image', cropped)

In this example the image is cropped by keeping all pixels that are vertically starting at 30px and ending at 250px, and horizontally from 100px to 230px, the rest gets discarded.

You could use this kind of functionality applied to a node that subscribes to the original image and publishes the cropped image.

Hope this helps,


1 Like

Hi @rzegers ,

Thank you for your help first!

I wrote a function package to get the image information and then modify it and publish it.

But now I have another problem.

just like this pic, the camera node published depth data through the /origin_topic, and the suber subscribed it.
I modified the data and publish it through /new_topic. But I have no method to deliver it to suber. Because I don’t want to change the suber’s code.

So I’m wondering if there is a way to deliver the modified data to the original subscriber without modifying his code.

Thank you,

Hello @zlwnge , I am not sure if I understand you correctly. Why would the subscriber subscribe to both /origin and also /new ? Should it not subscribe to one topic or the other? Why subscribe to both?



Hi, @rzegers ,

I’m very sorry I didn’t articulate what I meant.

I want subscribers to subscribe to the “origin” that I have modified. That is, I want to act as an invisible hand and drop the data in the middle without informing both parties.

It’s like when two people write a letter and I open the envelope halfway, change a paragraph, put it back in the original envelope, and pass it on to the subscriber.

Please let me know if there is anything I haven’t described clearly.

Thank you!

Hi @zlwnge,
from your image (by the way I think your image is missing one node that modifies the data) and your explanation it seems to me that you want to implement two nodes in parallel. One node that only republishes data without modifying it and one node that modifies the data.
So your camera node publishes data to the topic /origin. Then you have one node “Node A” that subscribe to topic “origin” and publishes to topic “new” without modifying anything. Then you have another node “Node B” that also subscribe to topic “origin” and publishes to topic “new” but modifies the data. Finally your node that uses the data subscribes to the topic “new”. This last node will get unmodified and modified data.
I still cannot understand why you would want to have a node that gets modified and unmodified data through the same topic but this is how I would implement it is I would need to do so.



1 Like

Hi, @rzegers

I am very So Sorry for my unclear expression.

Node A publish data to topic /depth/image, then Node B gets data from /depth/image.

Now I let a Node C subscribe the /depth/image and get the data, then Node C modified the data. But I still want to publish it to the topic /depth/image, thus making Node B get the modified data rather than the origin data.

But now I know this seems impossible. Because it is not possible to deliver two different pieces of data on one topic, even though their message types are the same. It seems to cause conflict, right?

Thank you very much for your patience and guidance!

Hi @zlwnge,
you can have multiple nodes publishing to the same topic that is possible. From the technical point of view you can do that, no problem. My question is more about the logical point of view, why would you want Node C to subscribe to both unmodified data from Node A and also simultaneously modified data from node B.
But regardless, you can move on and implement it, technically it is possible.



1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.