Git Product home page Git Product logo

Comments (8)

pfankhauser avatar pfankhauser commented on August 18, 2024

Are you using an image with a channel for the alpha layer? There's a round trip unit test that passes for the CV_8UC4 CV image type and I just added a nan-value/transparent pixel here.

If this does not solve your problem, could you please create a PR with a failing unit tests that shows the issue?

from grid_map.

romainreignier avatar romainreignier commented on August 18, 2024

Ah no, I forgot to mention that I am using a CV_8UC1 grayscale image, that is why, there is no other solution to translate a NaN to a mid value between Free and Occupied.

from grid_map.

pfankhauser avatar pfankhauser commented on August 18, 2024

So is there anything you would like to see differently in the behavior of Grid Map or should I close this issue?

from grid_map.

romainreignier avatar romainreignier commented on August 18, 2024

What do you think about setting NaN values to the mid value between lowerValue and upperValue?

from grid_map.

romainreignier avatar romainreignier commented on August 18, 2024

*if there is no alpha channel, of couse.

from grid_map.

pfankhauser avatar pfankhauser commented on August 18, 2024

I would keep the current behavior, since I feel it's the one with the least assumptions. Your use case is very special, and if I'm not mistaken, you could achieve your desired behavior by setting your empty/nan cells to the mid-value before converting it to the image format.

from grid_map.

romainreignier avatar romainreignier commented on August 18, 2024

Yes, of course, it is what I have done.
But for the map_server for example, a unknown cell is a pixel with value 128 that is why I was surprised that grid_map did not picked a middle value.
Anyway, as you said, my use case may be special for the grid_map because I did not managed to find an easy way to convert pixels position to grid_map coordinates then OccupancyGrid coordinates. So I have ended up writing my own conversion methods.
Maybe you could add in the doc that the NaN values are converted to the value 0 for images with no alpha layer.

from grid_map.

juanluishortelano avatar juanluishortelano commented on August 18, 2024

I have also encountered this problem.

The issue is that the output of SLAM algorithms for unknown area is -1 in occupancy grids, that gets transformed into NaN in Grid maps and finally that gets transformed into 0 in cv::Mat. That causes cv::Mats to make no difference between occupied cells and unknown cells.

I don't think changing NaN cells to a middle value before converting to grid map is a good solution because an occupancy grid is supposed to give a probability of occupancy of each cell and is not supposed to give a value to unknown space.

from grid_map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.