PCL Visualizer crashes on Mac OS

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

PCL Visualizer crashes on Mac OS

Dirk Langer
Hello,

I am new to PCL and installed from source pcl 1.7 with vtk 5.8
on a Macbook Pro Retina, OS X 10.8.3.
This version of PCL and VTK compile fine.
I had a problem previously compiling with VTK 6.1.0 and therefore downgraded to 5.8.

To get started I just want to run a simple example program to visualize a point cloud
from a PCD file. The program compiles fine, but gives me the following errors when
starting and then crashes (in the while loop).
The function 'point_cloud_display' is called from the main program, which runs under Qt.

Any ideas ?

Thanks,

             Dirk

int point_cloud_display()
{
    pcl::visualization::PCLVisualizer visualizer("Visualization");
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color(cloud,255,255,!
 255
);
    pcl::io::loadPCDFile ("../csm/Segmentation/region_growing_tutorial.pcd", *cloud);

    
    visualizer.setBackgroundColor (0, 0, 0);
    //visualizer.addCoordinateSystem (0.1);
    visualizer.initCameraParameters ();
    visualizer.addPointCloud<pcl::PointXYZ>(cloud, color, "cloud");

    
    while (!visualizer.wasStopped())
      {
         visualizer.updatePointCloud<pcl::PointXYZ>(cloud, color, "cloud");
         visualizer.spinOnce (100);
      }

    
}



objc[57962]: Class vtkCocoaServer is implemented in both /usr/local/lib/libpcl_visualization.1.7.dylib and /Users/dirk 1/Documents/Devel/csm/csm-build/csm. One of the two will be used. Which one is undefined.

objc[57962]: Class vtkCocoaGLView is implemented in both /usr/local/lib/libpcl_visualization.1.7.dylib and /Users/dirk 1/Documents/Devel/csm/csm-build/csm. One of the two will be used. Which one is undefined.

Starting CSM main program ......

2014-04-25 19:11:47.143 csm[57962:707] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.

2014-04-25 19:11:47.160 csm[57962:707] *** WARNING: Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
The program has unexpectedly finished.

/Users/dirk 1/Documents/Devel/csm/csm-build/csm crashed

Segmentation fault: 11








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

Re: PCL Visualizer crashes on Mac OS

KKyang
This post was updated on .
It says Class vtkCocoaServer is implemented in both.... which means you have two lib that have this function and your compiler doesn't know which one to use. Is csm an Xcode file?
For the deprecated function, you should not use it any more is because it may be no longer support (means you might not able to open your app) in some day or it might encounter unexpected results. Maybe VTK 5.8 is out of date for Mac OSX 10.8.3.
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

KKyang
In reply to this post by Dirk Langer
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

Dirk Langer
Yes, I saw this post and in fact is where I took the code from for testing, since my
previous example code was too complex, same errors though.
'csm' is the name of my main program, that calls the display function.

The problem I have here is that I don't see a mechanism by which the class vtkCocoaServer, etc. could be
included in my program 'csm' other than through the PCL library. Also, I think I deleted all previous installations
of vtk-6.1.0 which seemed to be incompatible with pcl 1.7.
Unless the class is defined somewhere in Qt5 ?

Regards,
                 Dirk



On 4/25/14 8:14 PM, KKyang wrote:
Someone has ask this question before.
http://www.pcl-users.org/Segmentation-Fault-with-PCLVisualizer-on-MAC-OS-td4020190.html

Cheers :)



--
View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033684.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
|

Re: PCL Visualizer crashes on Mac OS

KKyang
Wait, VTK 5.8 isn't fully compatible with QT5. Especially the visualization functions.

Sent from Mailbox


On Sat, Apr 26, 2014 at 11:38 AM, Dirk Langer [via Point Cloud Library (PCL) Users mailing list] <[hidden email]> wrote:

Yes, I saw this post and in fact is where I took the code from for testing, since my
previous example code was too complex, same errors though.
'csm' is the name of my main program, that calls the display function.

The problem I have here is that I don't see a mechanism by which the class vtkCocoaServer, etc. could be
included in my program 'csm' other than through the PCL library. Also, I think I deleted all previous installations
of vtk-6.1.0 which seemed to be incompatible with pcl 1.7.
Unless the class is defined somewhere in Qt5 ?

Regards,
                 Dirk



On 4/25/14 8:14 PM, KKyang wrote:
Someone has ask this question before.
http://www.pcl-users.org/Segmentation-Fault-with-PCLVisualizer-on-MAC-OS-td4020190.html

Cheers :)



--
View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033684.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



If you reply to this email, your message will be added to the discussion below:
http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033685.html
To unsubscribe from PCL Visualizer crashes on Mac OS, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

KKyang
In reply to this post by Dirk Langer
If you want to make QT5 works with VTK 6.1.0. You have to download cmake files from GitHub. I'm not sure if the VTK fix is merged to master or not. But there's a branch with fixed which is fix by fran6co.
https://github.com/fran6co/pcl/tree/vtk6-fixes.bck

Update: the branch seems finally merged.
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

Dirk Langer
Hmmh, so on this branch it looks like the compatibility issues with Qt5
and PCL are fixed,
whereas the version I downloaded from vtk.org did not.
I'll try recompiling vtk from this branch.

Thanks,

          Dirk

On 4/25/14 8:50 PM, KKyang wrote:

> If you want to make QT5 works with VTK 6.1.0. You have to download cmake
> files from GitHub. I'm not sure if the VTK fix is merged to master or not.
> But there's a branch with fixed which is fix by fran6co.
> https://github.com/fran6co/pcl/tree/vtk6-fixes.bck
>
> Update: the branch seems finally merged.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033687.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
|

Re: PCL Visualizer crashes on Mac OS

KKyang
Sorry, my mistake. They change the code, too. So both codes and cmake files are needed.
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

Dirk Langer
In reply to this post by KKyang
I tried compiling PCL from the branch 'fran6co' with VTK 6.1.0 and VTK
6.0.0.
In both cases the compilation failed due to incompatible headers and
classes.
For example:
/Users/dirk 1/Documents/Devel/csm/pcl/io/src/vtk_lib_io.cpp:486:39:
error: too
       few arguments to function call, expected 2, have 1
   image->SetNumberOfScalarComponents(1);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
/usr/local/include/vtk-6.0/vtkImageData.h:298:3: note:
'SetNumberOfScalarComponents' declared here
   static void SetNumberOfScalarComponents( int n, vtkInformation*
meta_data);

/Users/dirk 1/Documents/Devel/csm/pcl/io/src/vtk_lib_io.cpp:507:47:
error: no
       member named 'GetProducerPort' in 'vtkImageData'
shiftScaleFilter->SetInputConnection(image->GetProducerPort());

With version VTK 5.8, PCL compiled without problems.

            Dirk

On 4/25/14 8:50 PM, KKyang wrote:

> If you want to make QT5 works with VTK 6.1.0. You have to download cmake
> files from GitHub. I'm not sure if the VTK fix is merged to master or not.
> But there's a branch with fixed which is fix by fran6co.
> https://github.com/fran6co/pcl/tree/vtk6-fixes.bck
>
> Update: the branch seems finally merged.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033687.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
|

Re: PCL Visualizer crashes on Mac OS

KKyang
That's weird, I've just compile mine with visual studio 2010.
Don't know if you notice this thread: https://github.com/PointCloudLibrary/pcl/pull/363
I'll check the code to see how I successfully compile with it.
By the way, QT 5 change the way the widgets works. So you might get stuck if you want to use any widget related QT functions. That's what I mean incompatible.
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

KKyang
This post was updated on .
In reply to this post by Dirk Langer
Hi, I check out the code in vtk_lib_io you just mentioned.
https://github.com/fran6co/pcl/blob/vtk6-fixes.bck/io/src/vtk_lib_io.cpp

Around line 498 it says:
#if VTK_MAJOR_VERSION <6
    image->SetNumberOFScaleComponents(1);
    image->SetScalarTypeToFloat();
    image->AllocateScalars();
#else
  image->AllocateScalars(VTK_FLOAT,1);
#endif

Please check if your file has this code.
The other problem is same
#if VTK_MAJOR_VERSION < 6
  shiftScaleFilter->SetInputConnection(image->GetProducerPort());
#else
  shiftScaleFilter->SetInputData(image);
#endif

That's why you kept failing compile with VTK 6 cause it's a VTK 5 code.
I also check the cmake file, seems like it is set to auto recognize the version of VTK. I make the VTK library by myself. I don't know if that helps.
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

Dirk Langer
Hmmh, I do not have those lines of code.
May be I somehow pulled the wrong branch.
I'll check.
The VTK library I compile from source from vtk.org and use 'make install'.
So should be the same.
Which version of Eigen are you using ?
I have 'eigen-3.2.1', but noticed some errors there too.

Thanks,
         Dirk

On 4/26/14 12:11 AM, KKyang wrote:

> Hi, I check out the code in vtk_lib_io you just mentioned.
>
> Around line 498 it says:
> #if VTK_MAJOR_VERSION <6
>      image->SetNumberOFScaleComponents(1);
>      image->SetScalarTypeToFloat();
>      image->AllocateScalars();
> #else
>    image->AllocateScalars(VTK_FLOAT,1);
> #endif
>
> Please check if your file has this code.
> I also check the cmake file, seems like it is set to auto recognize the
> version of VTK. I make the VTK library by myself. I don't know if that
> helps.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033693.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
|

Re: PCL Visualizer crashes on Mac OS

KKyang
I'm using
boost-1.55.0
Eigen-3.2.1
flann-1.8.4
qhull-2012.1
VTK-6.1.0


Huang
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

Dirk Langer
Ok, that worked and it compiles now.
My branch was incorrect as there were 18 of them.

  $ git clone https://github.com/fran6co/pcl.git
  $ git branch -a
  $ git checkout remotes/origin/vtk6-fixes

got me the correct one.

Thanks,
        Dirk


On 4/26/14 12:54 AM, KKyang wrote:

> I'm using
> boost-1.55.0
> Eigen-3.2.1
> flann-1.8.4
> qhull-2012.1
> VTK-6.1.0
>
>
> Huang
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PCL-Visualizer-crashes-on-Mac-OS-tp4033682p4033696.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
|

Re: PCL Visualizer crashes on Mac OS

pawkro
What does

git branch -a

mean?
Reply | Threaded
Open this post in threaded view
|

Re: PCL Visualizer crashes on Mac OS

pawkro
In reply to this post by Dirk Langer
Do you know maybe if vtk6-fixes from fran6co:

  $ git clone https://github.com/fran6co/pcl.git
  $ git branch -a
  $ git checkout remotes/origin/vtk6-fixes

 is going to be merged with PCL master soon (git clone https://github.com/PointCloudLibrary/pcl.git) ?