PointCloudLibrary / PointCloudLibrary/pcl

[common] pcl::getMinMax3d() support for pcl::PointXY

Open
#6,271 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug needs: author reply
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Describe the bug

i cannot create pcl::segmentation with pcl::PointXY , it have a default way to convert to Eigen vector 4 map
Context

What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world

Expected behavior

it should be able to give you min max of x y points and 0 for z and w

Current Behavior

What happens instead of the expected behavior?
compilation issue
To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. A reproducible example helps to provide faster answers. If you load data e.g. from a PCD or PLY file, please provide the file.

Screenshots/Code snippets

In order to help explain your problem, please consider adding

  • screenshots of the GUI issues
  • code snippets: syntax for code with correct language highlights

Your Environment (please complete the following information):

  • OS: [e.g. Ubuntu 16.04]
  • Compiler: [:eg GCC 8.1]
  • PCL Version [e.g. 1.10, HEAD]

Possible Solution

//////////////////////////////////////////////////////////////////////////
template <typename PointT> void
pcl::MaximumLikelihoodSampleConsensus<PointT>::getMinMax (
    const PointCloudConstPtr &cloud, 
    const IndicesPtr &indices,
    Eigen::Vector4f &min_p, 
    Eigen::Vector4f &max_p) const
{
  min_p.setConstant (std::numeric_limits<float>::max());
  max_p.setConstant (std::numeric_limits<float>::lowest());
  min_p[3] = max_p[3] = 0;

  for (std::size_t i = 0; i < indices->size (); ++i)
  {
    if ((*cloud)[(*indices)[i]].x < min_p[0]) min_p[0] = (*cloud)[(*indices)[i]].x;
    if ((*cloud)[(*indices)[i]].y < min_p[1]) min_p[1] = (*cloud)[(*indices)[i]].y;
    if ((*cloud)[(*indices)[i]].z < min_p[2]) min_p[2] = (*cloud)[(*indices)[i]].z;

    if ((*cloud)[(*indices)[i]].x > max_p[0]) max_p[0] = (*cloud)[(*indices)[i]].x;
    if ((*cloud)[(*indices)[i]].y > max_p[1]) max_p[1] = (*cloud)[(*indices)[i]].y;
    if ((*cloud)[(*indices)[i]].z > max_p[2]) max_p[2] = (*cloud)[(*indices)[i]].z;
  }
}

you can make this global common i cannot use it outside this class

Image
all min max does not support the PointXY

Not obligatory, but suggest a fix/reason for the bug. Feel free to create a PR if you feel comfortable.

Additional context

Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the common pcl::getMinMax3d() implementation and the pcl::PointXY type, then compare them with MaximumLikelihoodSampleConsensus::getMinMax shown in the issue. Reproduce the compilation failure with pcl::PointXY and segmentation, and consider the work done when min/max results provide x and y while z and w are zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.