cluster_extraction-Sample: Out of range error in the vector class

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

cluster_extraction-Sample: Out of range error in the vector class

Frank
Hi all!

I tried to run your sample in "cluster_extraction.cpp".

I use Windows 7 (64bit) with Visual Studio 2010. I have included all Headers and Libs that PCL needs as 64bit version (http://pointclouds.org/downloads/windows.html), also the compiler is set to 64bit.

Then I put the code from the sample file just into the main method of an win32 console application.

But I always get the same error in runtime:

"Expression: vector subscript out of range"

Does anyone have some help for me? Or is the file too large for my system? Or is this a 64bit specific problem?

Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

nizar sallem
Hi,
Unfortunately with the little information you provide we can not be of
much help. Can you be more specific please. On which data set did you
run it ?

Cheers,
--
Nizar

On 08/03/2011 02:05 PM, Frank wrote:

> Hi all!
>
> I tried to run your sample in "cluster_extraction.cpp".
>
> I use Windows 7 (64bit) with Visual Studio 2010. I have included all Headers
> and Libs that PCL needs as 64bit version
> (http://pointclouds.org/downloads/windows.html), also the compiler is set to
> 64bit.
>
> Then I put the code from the sample file just into the main method of an
> win32 console application.
>
> But I always get the same error in runtime:
>
> "Expression: vector subscript out of range"
>
> Does anyone have some help for me? Or is the file too large for my system?
> Or is this a 64bit specific problem?
>
> http://www.pcl-users.org/file/n3222057/outofrangeerror.jpg
>
> --
> View this message in context: http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222057.html
> Sent from the Point Cloud Library (PCL) Users 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
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Frank
Hi,

thanks for the response.

I used "table_scene_lms400.pcd" (like its mentioned in the source code) and I got it from here:
http://pr.willowgarage.com/data/pcl/

Or do you think this may be a corrupted file?

Cheers, Frank
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

nizar sallem
Hi Frank,
In deed the pcd format used there is a bit old. I believe there is some
tool to convert it to pcd v7 but I am not pretty sure.

Cheers,
--
Nizar

On 08/03/2011 02:14 PM, Frank wrote:

> Hi,
>
> thanks for the response.
>
> I used "table_scene_lms400.pcd" (like its mentioned in the source code) and
> I got it from here:
> http://pr.willowgarage.com/data/pcl/
>
> Or do you think this may be a corrupted file?
>
> Cheers, Frank
>
> --
> View this message in context: http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222069.html
> Sent from the Point Cloud Library (PCL) Users 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
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Frank
Hi Nizar,

thanks for the hint. Is this tool in the library?

The tool "pcd_convert_NaN_nan.exe" doesn't update the format and "convert_pcd_ascii_binary.exe" makes it binary...

Cheers, Frank
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

nizar sallem
Frank,
Try with the convert ascii binary else you will need to do it by hand.

Cheers,
--
Niza

On 08/03/2011 02:29 PM, Frank wrote:

> Hi Nizar,
>
> thanks for the hint. Is this tool in the library?
>
> The tool "pcd_convert_NaN_nan.exe" doesn't update the format and
> "convert_pcd_ascii_binary.exe" makes it binary...
>
> Cheers, Frank
>
> --
> View this message in context: http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222116.html
> Sent from the Point Cloud Library (PCL) Users 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
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Frank
In reply to this post by Frank
Hi Nizar,

sorry, I was wrong. The tool "convert_pcd_ascii_binary.exe" does update it to .7 if you set it to ASCII. Didn't saw that.

Unfortunately the same error occurs.

Do have any other idea?

Do you use Visual Studio 2010 with 64bit and does it work for you?

Cheers, Frank
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Sven Albrecht
In reply to this post by Frank
Hi Frank,

I highly suspect, that the problem is not related to the .pcd file, but to  
one line in cluster_extraction.cpp
If my hunch is correct, the problem is in line 67
extract.filter (*cloud_filtered);
where the output of the filter operation points to the same PointCloud as  
the filters input. The underlying code in extract_indices.hpp seems to  
work fine on Linux, but seems to create problems on Windows (see  
http://dev.pointclouds.org/issues/285).
So for now it is recommended not to use the same PointCloud for input and  
output. Unfortunately we haven't adapted the tutorials, yet (but will do  
soon).
As an intermediate solution I'd suggest replacing line 67 by
pcl::PointCloud<pcl::PointXYZ>::Ptr remaining_points (new  
pcl::PointCloud<pcl::PointXYZ>);
extract.filter (*remaining_points);
*cloud_filtered = *remaining_points;
which doesn't look that nice, but should work.

Cheers,
Sven

On Wed, 03 Aug 2011 14:14:48 +0200, Frank <[hidden email]> wrote:

> Hi,
>
> thanks for the response.
>
> I used "table_scene_lms400.pcd" (like its mentioned in the source code)  
> and
> I got it from here:
> http://pr.willowgarage.com/data/pcl/
>
> Or do you think this may be a corrupted file?
>
> Cheers, Frank
>
> --
> View this message in context:  
> http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222069.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at  
> Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Frank
Hi Sven,

thank you very much! That's it. Do you know where's the problem on the windows side is?

Cheers, Frank
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Sven Albrecht
Hi Frank,

to be honest - I'm more surprised that the code seems to work fine under  
Linux ;)
The problem is that the std::vector of the output PointCloud holding the  
point information will be resized to the number of points returned by the  
filtering operation. Afterwards the points (referred to by their indices)  
 from the input PointCloud will be copied to the output. If input and  
output are the same the vector will (almost always) be reduced in size, so  
that the (old) indices for the copy operation may point to elements which  
are not part of the reduced vector anymore. (Hope this explanation wasn't  
too confusing)
So I really have no idea why it actually seems to work alright in Linux...
But we're trying to think of something which will take care of this issue  
in later versions of pcl.

Cheers,
Sven

On Wed, 03 Aug 2011 15:42:26 +0200, Frank <[hidden email]> wrote:

> Hi Sven,
>
> thank you very much! That's it. Do you know where's the problem on the
> windows side is?
>
> Cheers, Frank
>
> --
> View this message in context:  
> http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222328.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at  
> Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

nizar sallem


On 08/03/2011 03:52 PM, Sven Albrecht wrote:

> Hi Frank,
>
> to be honest - I'm more surprised that the code seems to work fine under
> Linux ;)
> The problem is that the std::vector of the output PointCloud holding the
> point information will be resized to the number of points returned by
> the filtering operation. Afterwards the points (referred to by their
> indices) from the input PointCloud will be copied to the output. If
> input and output are the same the vector will (almost always) be reduced
> in size, so that the (old) indices for the copy operation may point to
> elements which are not part of the reduced vector anymore. (Hope this
> explanation wasn't too confusing)
> So I really have no idea why it actually seems to work alright in Linux...
> But we're trying to think of something which will take care of this
> issue in later versions of pcl.
hi Sven,
Cause in linux vectors are what they are supposed to be : contiguous
memory addresses which is not the case for windows. That is why it works
on linux and not on Windows.

>
> Cheers,
> Sven
>
> On Wed, 03 Aug 2011 15:42:26 +0200, Frank <[hidden email]> wrote:
>
>> Hi Sven,
>>
>> thank you very much! That's it. Do you know where's the problem on the
>> windows side is?
>>
>> Cheers, Frank
>>
>> --
>> View this message in context:
>> http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222328.html
>>
>> Sent from the Point Cloud Library (PCL) Users mailing list archive at
>> Nabble.com.
>> _______________________________________________
>> [hidden email] / http://pointclouds.org
>> http://pointclouds.org/mailman/listinfo/pcl-users
>>
>
>
Cheers,
--
Nizar
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cluster_extraction-Sample: Out of range error in the vector class

Radu B. Rusu
Administrator
In reply to this post by Sven Albrecht
Sven,

Good catch! Can someone please update the tutorial so that its behavior is correct in Windows too? This is not being
caught by our unit tests because we didn't think that people would use input = output with the filtering pipeline (as
it's not fully supported). :)

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 08/03/2011 06:52 AM, Sven Albrecht wrote:

> Hi Frank,
>
> to be honest - I'm more surprised that the code seems to work fine under Linux ;)
> The problem is that the std::vector of the output PointCloud holding the point information will be resized to the number
> of points returned by the filtering operation. Afterwards the points (referred to by their indices) from the input
> PointCloud will be copied to the output. If input and output are the same the vector will (almost always) be reduced in
> size, so that the (old) indices for the copy operation may point to elements which are not part of the reduced vector
> anymore. (Hope this explanation wasn't too confusing)
> So I really have no idea why it actually seems to work alright in Linux...
> But we're trying to think of something which will take care of this issue in later versions of pcl.
>
> Cheers,
> Sven
>
> On Wed, 03 Aug 2011 15:42:26 +0200, Frank <[hidden email]> wrote:
>
>> Hi Sven,
>>
>> thank you very much! That's it. Do you know where's the problem on the
>> windows side is?
>>
>> Cheers, Frank
>>
>> --
>> View this message in context:
>> http://www.pcl-users.org/cluster-extraction-Sample-Out-of-range-error-in-the-vector-class-tp3222057p3222328.html
>> Sent from the Point Cloud Library (PCL) Users 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