pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

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

pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

Paolo Bologna
Hello,
this is my first post so I take this opportunity to thank everybody working on PCL library letting users and developers have great time with it.

As already written on Subject both pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer/pcd_viewer J command do write a full black image.
My platform is Linux 3.5.0-36 SMP x86_64 with VTK 5.8.0-5 (ubuntu Binary).

I've tested this behaviour on -trunk (28/06/2013) and 1.6. Can it depend from anything machine-specific?
Does pcl::visualization::PCLVisualizer::saveScreenshot work for you?
If this is machine-specific what can I do to address the problem?

I've also managed to use vtkRenderWindow::SetOffScreenRendering(1) with vtkWindowToImageFilter and it works but then I can't get back to the right GLX context and PCLVisualizer::spinOnce() segfaults; it seems main RenderWindow (the one generated by PCLVisualizer constructor) detaches its vtkRenderWindow (remains black) as soon as another vtkRenderWindow adds a renderer to a vtkRenderWindow with SetOffScreenRendering setted to true and then I can't restore it. Any clue?

Is there any way to obtain pointer to the vtkRenderWindowInteractor initialized by PCLVisualizer as one can do with vtkRenderWindow and PCLVisualizer::getRenderWindow? I have the suspect PCLVisualizer loses its vtkRenderWindow and vtkRenderWindowInteractor as a vtkRenderWindow adds a renderer and its OffScreenRendering is set to true.

I didn't know if this thread is pcl-users or pcl-developers specific, as the issue is present in 1.6 stable (that is what users do use) I've posted it here...

Thanks in advance for your support

Paolo Bologna
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

alfonsoros
This post was updated on .
I also have the same problem. I'm getting black images with saveScreenshot.
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

Khalid Yousif

I have the same problem as yours.

On 25/05/2014 2:22 AM, "alfonsoros" <[hidden email]> wrote:




--
View this message in context: http://www.pcl-users.org/pcl-visualization-PCLVisualizer-saveScreenshot-and-pcl-viewer-J-command-returning-black-image-tp4028645p4034158.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::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar
Hello. I have the same problem, black images obtained by viewer->saveScreenshot("screenshot.png");
I am pressing j while the cloud is shown on the screen but all the screenshots are black images.

boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
           
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud_ptr_rgb);
viewer->addPointCloud<pcl::PointXYZRGB> (cloud_ptr_rgb, rgb, "sample cloud");

viewer->initCameraParameters ();
viewer->setShowFPS(false);
viewer->setRepresentationToSurfaceForAllActors();

viewer->addCoordinateSystem (1.0);
//viewer->spinOnce(8000); // show the point cloud shortly
viewer->spin();
viewer->saveScreenshot("screenshot.png");

Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar
It looks to me that this is the problem with VTK.
I tried to run this VTK  example http://www.cmake.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot  for saving a screenshot of the render window to PNG file and it produces the black image. I am using VTK 6.1. on Ubuntu 14.04 (virtual machine).

Any ideas?

Thanks a lot


Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

VictorLamoine
Administrator
Hello,

The VTK example you pointed out works for me.
I'm using VTK 6.1 compiled from sources.

Using PCL trunk the key "J" is working in a visualizer and produces a (non black) PNG file.
I used the PCL Visualizer example to test.

Bye
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar
This post was updated on .
Hello.
Thank you for your answer, VictorL.

However, I am using the same: VTK 6.1 compiled from source on Ubuntu 14.04 with PCL 1.7 compiled from trunk source as well. For me, buttons j and J do not work with the PCL Visualizer example (produce black PNG screenshots)

I solved the problem with mentioned VTK example by adding a line windowToImageFilter->ReadFrontBufferOff(); right after creating of the windowToImageFilter object. I am getting good screenshots now.

Can this change be done in PCL code (function PCLVisualizer::saveScreenshot) as well and where?

Cheers.
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

VictorLamoine
Administrator
I'm not using PCL 1.7 but PCL trunk (1.8), lot's of fixes for VTK 6 have been released since PCL 1.7, please consider updating your PCL version to PCL 1.7.2 (it contains the VTK fixes).
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar
Excuse me I was not precise. I am not using trunk, but latest release 1.7.2. compiled from source
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

VictorLamoine
Administrator
Ok, can you please try compile the latest trunk and see if you still have the problem?

2014-10-09 11:37 GMT+02:00 ingvar <[hidden email]>:
Excuse me I was not precise. I am not using trunk, but latest release 1.7.2.
compiled from source



--
View this message in context: http://www.pcl-users.org/pcl-visualization-PCLVisualizer-saveScreenshot-and-pcl-viewer-J-command-returning-black-image-tp4028645p4035708.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::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar
This post was updated on .
Hi,
I compiled the latest trunk (1.8) but the problem is still there.
When building the visualizer tutorial, I am getting these warnings from cmake:

-- Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
** WARNING ** io features related to openni will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled

Does it tell you anything, I mean the last line (png)?

Thanks a lot.
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

VictorLamoine
Administrator
I get the PNG warning too, this does not seem to be the problem here.
I don't know what is the problem here.
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

ingvar

I solved the problem by adding the line
wif_->ReadFrontBufferOff();
just after the line 101 (wif_ = vtkSmartPointer<vtkWindowToImageFilter>::New ();)
in the PCL source file interactor_style.cpp

Then I recompiled this file again.

Thanks for help!
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

Sergey
Administrator
Hi,

I sent a pull request with your proposed fix. Would be nice if you verify that it solves
your problem and leave a comment at GitHub.

Regards,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

Jan Kucera (Kozuch)
I made the fix that is suggested in the last posts here - I am on prebuilt 1.7+trusty1 and 1.7.1-3+trusty2 on Ubuntu 14.04. I downloaded 1.7.2 and compiled it (with the fix) but after "sudo make install" I see no change. I made a "cmake ." and "make" on my cpp application file, but seems it takes the preinstalled version still, because "dpkg -l | grep '^ii' | grep libpcl" shows 1.7.1-3+trusty2 still. I will appreciate any help.
Reply | Threaded
Open this post in threaded view
|

Re: pcl::visualization::PCLVisualizer::saveScreenshot and pcl_viewer J command returning black image

Jan Kucera (Kozuch)
I found my way through finally...

2014-10-30 12:42 GMT+01:00 Jan Kucera (Kozuch) <[hidden email]>:
I made the fix that is suggested in the last posts here - I am on prebuilt
1.7+trusty1 and 1.7.1-3+trusty2 on Ubuntu 14.04. I downloaded 1.7.2 and
compiled it (with the fix) but after "sudo make install" I see no change. I
made a "cmake ." and "make" on my cpp application file, but seems it takes
the preinstalled version still, because "dpkg -l | grep '^ii' | grep libpcl"
shows 1.7.1-3+trusty2 still. I will appreciate any help.



--
View this message in context: http://www.pcl-users.org/pcl-visualization-PCLVisualizer-saveScreenshot-and-pcl-viewer-J-command-returning-black-image-tp4028645p4036015.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