Extract Regions with No data point

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Extract Regions with No data point

mrrmaurya
This post was updated on .
How do I extract the regions with no point data and save them?

I am trying the re frame the question asked earlier in the thread http://www.pcl-users.org/Find-Index-of-empty-region-missing-returns-of-the-region-td4044384.html

Look at the pcd file and the visualization of the file.

points.pcd

I want the black region that corresponds to no value in the file. I guess pcl visualizer just picks points from the file and plots them.

So how do I get datapoints whose values are not written.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Are you wanting to get voxel grid coordinates of empty regions? If so you could just check each voxel grid coordinate and use a KDTree to see if the voxel is occupied or not.

On Sat, Apr 29, 2017 at 2:58 AM, mrrmaurya <[hidden email]> wrote:
How do I extract the regions with no point data and save them?

I am trying the re frame the question asked earlier.

Look at the pcd file and the visualization of the file.
<http://www.pcl-users.org/file/n4044398/pointview.jpg>
points.pcd <http://www.pcl-users.org/file/n4044398/points.pcd>

I want the black region that corresponds to no value in the file. I guess
pcl visualizer just picks points from the file and plots them.

So how do I get datapoints whose values are not written.



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Or I guess it would probably be faster to just iterate through all of your points in the could and store in memory whether or not the voxel is occupied.

On Sat, Apr 29, 2017 at 8:26 AM, Christopher Flesher <[hidden email]> wrote:
Are you wanting to get voxel grid coordinates of empty regions? If so you could just check each voxel grid coordinate and use a KDTree to see if the voxel is occupied or not.

On Sat, Apr 29, 2017 at 2:58 AM, mrrmaurya <[hidden email]> wrote:
How do I extract the regions with no point data and save them?

I am trying the re frame the question asked earlier.

Look at the pcd file and the visualization of the file.
<http://www.pcl-users.org/file/n4044398/pointview.jpg>
points.pcd <http://www.pcl-users.org/file/n4044398/points.pcd>

I want the black region that corresponds to no value in the file. I guess
pcl visualizer just picks points from the file and plots them.

So how do I get datapoints whose values are not written.



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Something like this

std::vector<bool> voxelGrid (width*height*length, False);

for (size_t i=0; i<pointCloud.size(); i++) {
  int ix = pointCloud[i]->x / gridResolution;
  int iy = pointCloud[i]->y / gridResolution;
  int iz = pointCloud[i]->z / gridResolution;
  voxelGrid[ix*height*length + iy*length + iz] = True;
}

pcl::PointCloud<pcl::PointXYZ> result;
for (size_t ix=0; ix<width; ix++) {
for (size_t iy=0; iy<height; iy++) {
for (size_t iz=0; iz<length; iz++) {
  if (!voxelGrid[ix*height*length + iy*length + iz]) {
    pcl::PointXYZ p;
    p.x = ix*gridResolution;
    p.y = iy*gridResolution;
    p.z = iz*gridResolution;
    result.append(p);
  }
}}}

On Sat, Apr 29, 2017 at 8:28 AM, Christopher Flesher <[hidden email]> wrote:
Or I guess it would probably be faster to just iterate through all of your points in the could and store in memory whether or not the voxel is occupied.

On Sat, Apr 29, 2017 at 8:26 AM, Christopher Flesher <[hidden email]> wrote:
Are you wanting to get voxel grid coordinates of empty regions? If so you could just check each voxel grid coordinate and use a KDTree to see if the voxel is occupied or not.

On Sat, Apr 29, 2017 at 2:58 AM, mrrmaurya <[hidden email]> wrote:
How do I extract the regions with no point data and save them?

I am trying the re frame the question asked earlier.

Look at the pcd file and the visualization of the file.
<http://www.pcl-users.org/file/n4044398/pointview.jpg>
points.pcd <http://www.pcl-users.org/file/n4044398/points.pcd>

I want the black region that corresponds to no value in the file. I guess
pcl visualizer just picks points from the file and plots them.

So how do I get datapoints whose values are not written.



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
Sorry Chris, I dont get If that would solve my problem.

If you see it is n unorganised pcd file with WIDTH 31688 and HEIGHT so

How do you get the resolution and width*height*length and so on.

Somebody suggested to check for NaN but it does'nt  have it either.

May be solution is simple but I am still struggling to find it out.

If somebody gets the solution please update me. I want just the (x,y) where no points are recorded.


Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
I'm having trouble understanding your question. There are an infinite number of (x,y) points where there is no data unless you partition the space.

The simplest partition to determine (x,y) coordinates where there is no data is a 2D grid. You would choose the grid resolution you want and iterate through all points to determine width and height of your grid.

On Mon, May 1, 2017 at 9:29 AM, mrrmaurya <[hidden email]> wrote:
Sorry Chris, I dont get If that would solve my problem.

If you see it is n unorganised pcd file with WIDTH 31688 and HEIGHT so

How do you get the resolution and width*height*length and so on.

Somebody suggested to check for NaN but it does'nt  have it either.

May be solution is simple but I am still struggling to find it out.

If somebody gets the solution please update me. I want just the (x,y) where
no points are recorded.


Thanks



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044404.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Something like this:

float gridResolution = 0.01;

float xMin = -std::numeric_limits::infinity<float>();
float xMax =  std::numeric_limits::infinity<float>();
float yMin = -std::numeric_limits::infinity<float>();
float yMax =  std::numeric_limits::infinity<float>();

for (size_t i=0; i<pointCloud.size(); i++) {
  float x = pointCloud[i]->x;
  float y = pointCloud[i]->y;
  if      (x < xMin) xMin = x;
  else if (x > xMax) xMax = x;
  if      (y < yMin) yMin = y;
  else if (y > yMax) yMax = y;
}

int width = (xMax - xMin) / gridResolution;
int height = (yMax - yMin) / gridResolution;

std::vector<bool> voxelGrid (width*height, False);

for (size_t i=0; i<pointCloud.size(); i++) {
  int ix = pointCloud[i]->x / gridResolution;
  int iy = pointCloud[i]->y / gridResolution;
  voxelGrid[ix*height + iy] = True;
}

pcl::PointCloud<pcl::PointXYZ> result;
for (size_t ix=0; ix<width; ix++) {
for (size_t iy=0; iy<height; iy++) {
  if (!voxelGrid[ix*height + iy]) {
    pcl::PointXYZ p;
    p.x = ix*gridResolution;
    p.y = iy*gridResolution;
    p.z = 0.0;
    result.append(p);
  }
}}

On Mon, May 1, 2017 at 10:43 AM, Christopher Flesher <[hidden email]> wrote:
I'm having trouble understanding your question. There are an infinite number of (x,y) points where there is no data unless you partition the space.

The simplest partition to determine (x,y) coordinates where there is no data is a 2D grid. You would choose the grid resolution you want and iterate through all points to determine width and height of your grid.

On Mon, May 1, 2017 at 9:29 AM, mrrmaurya <[hidden email]> wrote:
Sorry Chris, I dont get If that would solve my problem.

If you see it is n unorganised pcd file with WIDTH 31688 and HEIGHT so

How do you get the resolution and width*height*length and so on.

Somebody suggested to check for NaN but it does'nt  have it either.

May be solution is simple but I am still struggling to find it out.

If somebody gets the solution please update me. I want just the (x,y) where
no points are recorded.


Thanks



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044404.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Err actually forgot to include the offset in the previous code:

float gridResolution = 0.01;

float xMin = -std::numeric_limits::infinity<float>();
float xMax =  std::numeric_limits::infinity<float>();
float yMin = -std::numeric_limits::infinity<float>();
float yMax =  std::numeric_limits::infinity<float>();

for (size_t i=0; i<pointCloud.size(); i++) {
  float x = pointCloud[i]->x;
  float y = pointCloud[i]->y;
  if      (x < xMin) xMin = x;
  else if (x > xMax) xMax = x;
  if      (y < yMin) yMin = y;
  else if (y > yMax) yMax = y;
}

int width = (xMax - xMin) / gridResolution;
int height = (yMax - yMin) / gridResolution;

std::vector<bool> voxelGrid (width*height, False);

for (size_t i=0; i<pointCloud.size(); i++) {
  int ix = (pointCloud[i]->x - xMin) / gridResolution;
  int iy = (pointCloud[i]->y - yMin) / gridResolution;
  voxelGrid[ix*height + iy] = True;
}

pcl::PointCloud<pcl::PointXYZ> result;
for (size_t ix=0; ix<width; ix++) {
for (size_t iy=0; iy<height; iy++) {
  if (!voxelGrid[ix*height + iy]) {
    pcl::PointXYZ p;
    p.x = ix*gridResolution + xMin;
    p.y = iy*gridResolution + yMin;
    p.z = 0.0;
    result.append(p);
  }
}}

On Mon, May 1, 2017 at 10:50 AM, Christopher Flesher <[hidden email]> wrote:
Something like this:

float gridResolution = 0.01;

float xMin = -std::numeric_limits::infinity<float>();
float xMax =  std::numeric_limits::infinity<float>();
float yMin = -std::numeric_limits::infinity<float>();
float yMax =  std::numeric_limits::infinity<float>();

for (size_t i=0; i<pointCloud.size(); i++) {
  float x = pointCloud[i]->x;
  float y = pointCloud[i]->y;
  if      (x < xMin) xMin = x;
  else if (x > xMax) xMax = x;
  if      (y < yMin) yMin = y;
  else if (y > yMax) yMax = y;
}

int width = (xMax - xMin) / gridResolution;
int height = (yMax - yMin) / gridResolution;

std::vector<bool> voxelGrid (width*height, False);

for (size_t i=0; i<pointCloud.size(); i++) {
  int ix = pointCloud[i]->x / gridResolution;
  int iy = pointCloud[i]->y / gridResolution;
  voxelGrid[ix*height + iy] = True;
}

pcl::PointCloud<pcl::PointXYZ> result;
for (size_t ix=0; ix<width; ix++) {
for (size_t iy=0; iy<height; iy++) {
  if (!voxelGrid[ix*height + iy]) {
    pcl::PointXYZ p;
    p.x = ix*gridResolution;
    p.y = iy*gridResolution;
    p.z = 0.0;
    result.append(p);
  }
}}

On Mon, May 1, 2017 at 10:43 AM, Christopher Flesher <[hidden email]> wrote:
I'm having trouble understanding your question. There are an infinite number of (x,y) points where there is no data unless you partition the space.

The simplest partition to determine (x,y) coordinates where there is no data is a 2D grid. You would choose the grid resolution you want and iterate through all points to determine width and height of your grid.

On Mon, May 1, 2017 at 9:29 AM, mrrmaurya <[hidden email]> wrote:
Sorry Chris, I dont get If that would solve my problem.

If you see it is n unorganised pcd file with WIDTH 31688 and HEIGHT so

How do you get the resolution and width*height*length and so on.

Somebody suggested to check for NaN but it does'nt  have it either.

May be solution is simple but I am still struggling to find it out.

If somebody gets the solution please update me. I want just the (x,y) where
no points are recorded.


Thanks



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044404.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
This post was updated on .
Thanks Chris,

I tried with the code. but somehow I get some errors specifically with
numeric_limits and cloud.size() and some other stuff

I am using VS2015 on windows 10.

I am not much familier with templates and possibly it might be  reason!
see the list of errors.


Your code may be free of errors. I may be missing some includes. It will really thankful if you help me figure out the same.

Here is the code that I was trying

------------------------------------------------
#include <iostream>
#include <limits>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>

int
main(int argc, char** argv)
{
        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);

        // Fill in the cloud data
        pcl::PCDReader reader;
        // Replace the path below with the path where you saved your file
        reader.read<pcl::PointXYZ>("points.pcd", *cloud);


        float gridResolution = 0.01;

        float xMin = -std::numeric_limits::infinity<float>();
        float xMax = std::numeric_limits::infinity<float>();
        float yMin = -std::numeric_limits::infinity<float>();
        float yMax = std::numeric_limits::infinity<float>();

        for (size_t i = 0; i<cloud.size(); i++) {
                float x = cloud[i]->x;
                float y = cloud[i]->y;
                if (x < xMin) xMin = x;
                else if (x > xMax) xMax = x;
                if (y < yMin) yMin = y;
                else if (y > yMax) yMax = y;
        }

        int width = (xMax - xMin) / gridResolution;
        int height = (yMax - yMin) / gridResolution;

        std::vector<bool> voxelGrid(width*height, False);

        for (size_t i = 0; i<cloud.size(); i++) {
                int ix = cloud[i]->x / gridResolution;
                int iy = cloud[i]->y / gridResolution;
                voxelGrid[ix*height + iy] = True;
        }

        pcl::PointCloud<pcl::PointXYZ> result;
        for (size_t ix = 0; ix<width; ix++) {
                for (size_t iy = 0; iy<height; iy++) {
                        if (!voxelGrid[ix*height + iy]) {
                                pcl::PointXYZ p;
                                p.x = ix*gridResolution;
                                p.y = iy*gridResolution;
                                p.z = 0.0;
                                result.append(p);
                        }
                }
        }

        // writing the empty region back to file
        pcl::PCDWriter writer;
        std::cerr << "Cloud with missing return: " << std::endl;
        std::cerr << result << std::endl;

        writer.write<pcl::PointXYZ>("missingcloud.pcd", result, false);

        return (0);
}

------------------------------------------------

Thanks in advance for your help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
You need an include for limits. The other error you need to use cloud->size() instead of cloud.size()

On Wed, May 3, 2017 at 1:17 AM, mrrmaurya <[hidden email]> wrote:
Thanks Chris,

I tried with the code. but somehow I get some errors specifically with
numeric_limits and cloud.size() and some other stuff
see the list of errors.
<http://www.pcl-users.org/file/n4044421/error.jpg>

Your code may be free of errors. I may be missing some includes. It will
really thankful if you help me figure out the same.

Here is the code that I was trying

------------------------------------------------
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>

int
main(int argc, char** argv)
{
        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new
pcl::PointCloud<pcl::PointXYZ>);

        // Fill in the cloud data
        pcl::PCDReader reader;
        // Replace the path below with the path where you saved your file
        reader.read<pcl::PointXYZ>("points.pcd", *cloud);


        float gridResolution = 0.01;

        float xMin = -std::numeric_limits::infinity<float>();
        float xMax = std::numeric_limits::infinity<float>();
        float yMin = -std::numeric_limits::infinity<float>();
        float yMax = std::numeric_limits::infinity<float>();

        for (size_t i = 0; i<cloud.size(); i++) {
                float x = cloud[i]->x;
                float y = cloud[i]->y;
                if (x < xMin) xMin = x;
                else if (x > xMax) xMax = x;
                if (y < yMin) yMin = y;
                else if (y > yMax) yMax = y;
        }

        int width = (xMax - xMin) / gridResolution;
        int height = (yMax - yMin) / gridResolution;

        std::vector<bool> voxelGrid(width*height, False);

        for (size_t i = 0; i<cloud.size(); i++) {
                int ix = cloud[i]->x / gridResolution;
                int iy = cloud[i]->y / gridResolution;
                voxelGrid[ix*height + iy] = True;
        }

        pcl::PointCloud<pcl::PointXYZ> result;
        for (size_t ix = 0; ix<width; ix++) {
                for (size_t iy = 0; iy&lt;height; iy++) {
                        if (!voxelGrid[ix*height + iy]) {
                                pcl::PointXYZ p;
                                p.x = ix*gridResolution;
                                p.y = iy*gridResolution;
                                p.z = 0.0;
                                result.append(p);
                        }
                }
        }

        // writing the empty region back to file
        pcl::PCDWriter writer;
        std::cerr &lt;&lt; &quot;Cloud with missing return: &quot; &lt;&lt;
std::endl;
        std::cerr &lt;&lt; result &lt;&lt; std::endl;

        writer.write&lt;pcl::PointXYZ>("missingcloud.pcd", result, false);

        return (0);
}

------------------------------------------------

Thanks in advance for your help




--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044421.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
This post was updated on .
Thanks Chris.
I had included the <limits>.
I could get rid of that error by modifying the code to
float xMin = -std::numeric_limits<float>::infinity();
....

However I modified the line as under to get rid of cloud[i] error
float x = cloud[i]->x;        /// i get rid of this error by using cloud->points[i].x  instead of cloud[i].x
float y = cloud[i]->y; //// same here



The program compiles but while running it gives exception.


The break operation gives message "SYMBOL FILE NOT LOADED"

The debug window shows the following messages
'bare_earth.exe' (Win32): Loaded 'C:\Users\maurya\Desktop\PCL Research\missingvalues\build\Release\bare_earth.exe'. Module was built without symbols.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. Cannot find or open the PDB file.
'bare_earth.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file.

Why is it asking for PDB file? All other programs work well!
Please help

The full code goes as under.

-----------------------
#include <iostream>
#include <limits>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>
#include <vector>


int
main(int argc, char** argv)
{
       
        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);

        // Fill in the cloud data
        pcl::PCDReader reader;
        // Replace the path below with the path where you saved your file
        reader.read<pcl::PointXYZ>("points.pcd", *cloud);

       
        float gridResolution = 0.01;

        float xMin = -std::numeric_limits<float>::infinity();
        float xMax = std::numeric_limits<float>::infinity();
        float yMin = -std::numeric_limits<float>::infinity();
        float yMax = std::numeric_limits<float>::infinity();

        for (size_t i = 0; i<cloud->size(); i++) {
                float x = cloud->points[i].x;
                float y = cloud->points[i].y;
                if (x < xMin) xMin = x;
                else if (x > xMax) xMax = x;
                if (y < yMin) yMin = y;
                else if (y > yMax) yMax = y;
        }

        int width = (xMax - xMin) / gridResolution;
        int height = (yMax - yMin) / gridResolution;

        std::vector<bool> voxelGrid(width*height, false);
       
        for (size_t i = 0; i<cloud->size(); i++) {
                int ix = cloud->points[i].x / gridResolution;
                int iy = cloud->points[i].y / gridResolution;
                voxelGrid[ix*height + iy] = true;
        }

        pcl::PointCloud<pcl::PointXYZ> result;
        for (size_t ix = 0; ix<width; ix++) {
                for (size_t iy = 0; iy<height; iy++) {
                        if (!voxelGrid[ix*height + iy]) {
                                pcl::PointXYZ p;
                                p.x = ix*gridResolution;
                                p.y = iy*gridResolution;
                                p.z = 0.0;
                                result.push_back(p);  // result.append(p);
                        }
                }
        }

        // writing the empty region back to file
        pcl::PCDWriter writer;
        std::cerr << "Cloud with missing return: " << std::endl;
        std::cerr << result << std::endl;

        writer.write<pcl::PointXYZ>("missingcloud.pcd", result, false);

        return (0);
}
-----------------------

Please help to figure out what is the reason for such run time exception
Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
Oh, right. You have to dereference the pointer, like this:

float x = (*cloud)[i].x;
float y = (*cloud)[i].y;

On Wed, May 3, 2017 at 2:08 PM, mrrmaurya <[hidden email]> wrote:
Thanks Chris.
I had included the <limits>.
I could get rid of that error by modifying the code to
float xMin = -std::numeric_limits<float>::infinity();
....

However I have one error left with
float x = cloud[i]->x;        /// i get error for cloud.[i]
float y = cloud[i]->y;

I get error "expression must have pointer type" for cloud.[i]

I am trying to figure out.

If you know a quick fix please let me know.

Thanks



--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044435.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
This post was updated on .
Thanks Chris for a prompt reply.

I updated the code.  But no sucess.

I get runtime error "Exception thrown at 0x00007FF78D8FAC03 in bare_earth.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF."

What must be wrong?

Please see the attached code. I have also attached the Cmakefile.txt along with the pcdfile.
bare_earth.cpp
CMakeLists.txt
points.pcd

possibly it is visual studio problem? It has message no symbols loaded.

Or else it is some dereferencing problem as read stackoverflow posts.
can your check the code on your machine if I have missed something?

When I try to debug line by line I get error on the line

voxelGrid[ix*height + iy] = true; //// this is the place where it exits during debug
with message "Expression: vector<bool> iterator not dereferencable"
 
I am trying to come out of it. some silly stuff but still it is!
Many thanks for you helping me out with my problem.

Again awaiting your response.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
See attached code. One major problem was the infinity signs should have been flipped. Also offsets needed to be there.

On Wed, May 3, 2017 at 3:35 PM, mrrmaurya <[hidden email]> wrote:
Thanks Chris for a prompt reply.

I updated the code.  But no sucess.

I get runtime error "Exception thrown at 0x00007FF78D8FAC03 in
bare_earth.exe: 0xC0000005: Access violation reading location
0xFFFFFFFFFFFFFFFF."

What must be wrong?

Please see the attached code. I have also attached the Cmakefile.txt along
with the pcdfile.
bare_earth.cpp <http://www.pcl-users.org/file/n4044437/bare_earth.cpp>
CMakeLists.txt <http://www.pcl-users.org/file/n4044437/CMakeLists.txt>
points.pcd <http://www.pcl-users.org/file/n4044437/points.pcd>

Many thanks for you helping me out with my problem.

Again awaiting your response.




--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044437.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


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

bare_earth.cpp (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

Chris Flesher
You can turn on debugging symbols by adding

SET(CMAKE_BUILD_TYPE Debug)

To your CMakeLists.txt file. It would be good for you to learn some debugging skills so you can figure out small issues like these.

On Thu, May 4, 2017 at 7:14 AM, Christopher Flesher <[hidden email]> wrote:
See attached code. One major problem was the infinity signs should have been flipped. Also offsets needed to be there.

On Wed, May 3, 2017 at 3:35 PM, mrrmaurya <[hidden email]> wrote:
Thanks Chris for a prompt reply.

I updated the code.  But no sucess.

I get runtime error "Exception thrown at 0x00007FF78D8FAC03 in
bare_earth.exe: 0xC0000005: Access violation reading location
0xFFFFFFFFFFFFFFFF."

What must be wrong?

Please see the attached code. I have also attached the Cmakefile.txt along
with the pcdfile.
bare_earth.cpp <http://www.pcl-users.org/file/n4044437/bare_earth.cpp>
CMakeLists.txt <http://www.pcl-users.org/file/n4044437/CMakeLists.txt>
points.pcd <http://www.pcl-users.org/file/n4044437/points.pcd>

Many thanks for you helping me out with my problem.

Again awaiting your response.




--
View this message in context: http://www.pcl-users.org/Extract-Regions-with-No-data-point-tp4044398p4044437.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[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
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
In reply to this post by Chris Flesher
Thanks Chris

I tried it but I still get exceptions. something I am seriously missing.
Its week now I am stuck at it

I wish I could come out of it very soon.
Thanks once again.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Extract Regions with No data point

mrrmaurya
This post was updated on .
In reply to this post by Chris Flesher
I still could not figure out the issue. it is some memory allocation issue probably.

because it works for small file with few thousand points but gives exception for larger file with lacs of points.
I do agree and admit I am falling short on debugging skills but request the community to Please help me out of this.

#include <pcl/point_cloud.h>
#include <iostream>
#include <limits>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/voxel_grid.h>


int
main(int argc, char* argv[])
{

        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);

        // Fill in the cloud data
        pcl::PCDReader reader;
        // Replace the path below with the path where you saved your file
        reader.read<pcl::PointXYZ>("points4_Ground.pcd", *cloud);


        float gridResolution = 1.0;

        float xMin = std::numeric_limits<float>::infinity();
        float xMax = -std::numeric_limits<float>::infinity();
        float yMin = std::numeric_limits<float>::infinity();
        float yMax = -std::numeric_limits<float>::infinity();

        for (size_t i = 0; i<cloud->size(); i++) {
                float x = (*cloud)[i].x;
                float y = (*cloud)[i].y;
                if (x < xMin) xMin = x;
                else if (x > xMax) xMax = x;
                if (y < yMin) yMin = y;
                else if (y > yMax) yMax = y;
        }

        int width = (xMax - xMin) / gridResolution;
        int height = (yMax - yMin) / gridResolution;

        std::vector<bool> voxelGrid(width*height, false);
        for (size_t i = 0; i<cloud->size(); i++) {
                int ix = ((*cloud)[i].x - xMin) / gridResolution;
                int iy = ((*cloud)[i].y - yMin) / gridResolution;
                voxelGrid[ix*height + iy] = true;
        }

///the problem seems here/////////////////////////////////////
        pcl::PointCloud<pcl::PointXYZ> result;
        for (size_t ix = 0; ix<width; ix++) {
                for (size_t iy = 0; iy<height; iy++) {
                        if (!voxelGrid[ix*height + iy]) {

                                pcl::PointXYZ p;
                                p.x = ix*gridResolution + xMin;
                                p.y = iy*gridResolution + yMin;
                                p.z = 0.0;
                                result.push_back(p);
                               
                        }
                }
        }

        // writing the empty region back to file
        pcl::PCDWriter writer;
        std::cerr << "Cloud with missing return: " << std::endl;
        std::cerr << result << std::endl;

        writer.write<pcl::PointXYZ>("missingcloud.pcd", result, false);

        return (0);
}

just take me out of this. I want to write those values in the .pcd file. please see the file once again attached for you.bare_earth.cpp

during debugging it exits at the following  error during debug watch
debug assertion message

Debug Assertion Failed!

Program: C:\WINDOWS\SYSTEM32\MSVCP140D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\vector
Line: 2167

Expression: vector<bool> iterator not dereferencable

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

--------------
please help
Loading...