Most efficient way to get Point with min z

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Most efficient way to get Point with min z

Humam
What is the most efficient way to get the point with the min Z?
Currently I am doing it like this:
        std::min_element(point_cloud_->points.cbegin(),
point_cloud_->points.cend(), [](const auto l, const auto r) {
                l.z < r.z;
        });
P.S. I will do it only once per point cloud.



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Most efficient way to get Point with min z

icedoggy
This post was updated on .
Hi.
try
pcl::PointXYZ minPt;
pcl::PointXYZ maxPt;
pcl::getMinMax3D(*cloud, minPt, maxPt);

then you can access the min or max points by:

float minz = minPt.z;
float maxz = maxPt.z;

for example.
for more details see:
http://docs.pointclouds.org/1.8.1/group__common.html#ga3166f09aafd659f69dc75e63f5e10f81





--
Sent from: http://www.pcl-users.org/
_______________________________________________
PCL-users@pointclouds.org / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Most efficient way to get Point with min z

Humam
Thanks but this function return the min z not the point with the min z. There is a difference.

On Sat, Dec 16, 2017 at 5:17 PM, icedoggy <[hidden email]> wrote:
Hi.
try
pcl::PointXYZ minPt;
pcl::PointXYZ maxPt;
pcl::getMinMax3D(*cloudPlane, minPt, maxPt);

then you can access the min or max points by:

float minz = minPt.z;
float maxz = maxPt.z;

for example.
for more details see:
http://docs.pointclouds.org/1.8.1/group__common.html#ga3166f09aafd659f69dc75e63f5e10f81





--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Most efficient way to get Point with min z

icedoggy
AH, I now see what you are trying to achieve. I didn't even look at your code
before.
Okay, I don't know of any pcl function to do that. Your implementation seems
quite reasonable but I cannot say if there is a more efficient way to do it.
Once per point cloud shouldn't be too costly - depending on what you're
trying to do and the size of your cloud...



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Most efficient way to get Point with min z

Humam
I see. Actually, I have set of clusters(each one of them is small point cloud). I should compute the point with the min z for each of them in real time application 30 FPS because of that I am looking for the most efficient way. Thanks for your time.

On Sun, Dec 17, 2017 at 1:36 PM, icedoggy <[hidden email]> wrote:
AH, I now see what you are trying to achieve. I didn't even look at your code
before.
Okay, I don't know of any pcl function to do that. Your implementation seems
quite reasonable but I cannot say if there is a more efficient way to do it.
Once per point cloud shouldn't be too costly - depending on what you're
trying to do and the size of your cloud...


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Most efficient way to get Point with min z

ROZAR Fabien
To get the point with the min z, you need to read every point at least one
time. Behind the code you propose, I think there is basicly a for loop and
I don't think that you can do it better (without a quantum computer...).

frozar

Le 17/12/2017 à 20:36, Humam Helfawi a écrit :

> I see. Actually, I have set of clusters(each one of them is small
> point cloud). I should compute the point with the min z for each of
> them in real time application 30 FPS because of that I am looking for
> the most efficient way. Thanks for your time.
>
> On Sun, Dec 17, 2017 at 1:36 PM, icedoggy <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     AH, I now see what you are trying to achieve. I didn't even look
>     at your code
>     before.
>     Okay, I don't know of any pcl function to do that. Your
>     implementation seems
>     quite reasonable but I cannot say if there is a more efficient way
>     to do it.
>     Once per point cloud shouldn't be too costly - depending on what
>     you're
>     trying to do and the size of your cloud...
>
>
>
>     --
>     Sent from: http://www.pcl-users.org/
>     _______________________________________________
>     [hidden email] <mailto:[hidden email]> /
>     http://pointclouds.org
>     http://pointclouds.org/mailman/listinfo/pcl-users
>     <http://pointclouds.org/mailman/listinfo/pcl-users>
>
>
>
>
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users