Linker error when I try 5 lines of ImageViewer example

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

Linker error when I try 5 lines of ImageViewer example

Jun8
Hello,

I tried the example given in the ImageViewer documentation, I get the following linker error (am using Ubuntu 10.10 with pcl_trunk v5760, modified on 5/18/2012)

CMakeFiles/imageviewer_experiment.dir/imageviewer_experiment.cpp.o: In function `void pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
imageviewer_experiment.cpp:(.text._ZN3pcl13visualization11ImageViewer11addRGBImageINS_12PointXYZRGBAEEEvRKNS_10PointCloudIT_E8ConstPtrERKSsd[void pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)]+0x36): undefined reference to `void pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA> const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)'
collect2: ld returned 1 exit status

Here's my code:

#include <pcl/visualization/image_viewer.h>
#include <pcl/io/pcd_io.h>
#include <iostream>

 int main(int argc, char const *argv[])
 {
        if (argc != 2) {
                cerr << "Usage: " << argv[0] << " pcd_filename " << endl << endl;
                exit(-1);
        }

        // Load input cloud from the given PCD file.
        pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input_cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
        if (pcl::io::loadPCDFile<pcl::PointXYZRGBA> (argv[1], *input_cloud) == -1) {
                PCL_ERROR ("Couldn't read input PCD file %s \n", argv[1]);
                return (-1);
        }
        std::cout << "Loaded cloud from PCD file" << endl;

        pcl::visualization::ImageViewer iv;
        iv.addCircle (10, 10, 5, 1.0, 0.0, 0.0, "circles", 1.0);    // add a red, fully opaque circle with radius 5 pixels at (10,10) in layer "circles"
        iv.addFilledRectangle (10, 20, 10, 20, 0.0, 1.0, 0.0, "boxes", 0.5);    // add a green, 50% transparent box at (10,10->20,20) in layer "boxes"
        iv.addRGBImage<pcl::PointXYZRGBA> (input_cloud);                  // add a RGB image from a point cloud dataset in an "rgb_image" default layer
        iv.spin ();                                                 // press 'q' to exit
        // iv.removeLayer ("circles");                                 // remove layer "circles"
        // iv.spin ();                                                 // press 'q' to exit

        return 0;
 }

What am I missing here?

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

Re: Linker error when I try 5 lines of ImageViewer example

Radu B Rusu
Administrator
Are you linking against libpcl_visualization?

Cheers,
Radu.

On 06/21/2012 07:08 PM, Jun8 wrote:

> Hello,
>
> I tried the example given in the
> http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_image_viewer.html#_details
> ImageViewer documentation , I get the following linker error (am using
> Ubuntu 10.10 with pcl_trunk v5760, modified on 5/18/2012)
>
> CMakeFiles/imageviewer_experiment.dir/imageviewer_experiment.cpp.o: In
> function `void
> pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr
> const&, std::basic_string<char, std::char_traits&lt;char>,
> std::allocator<char>  >  const&, double)':
> imageviewer_experiment.cpp:(.text._ZN3pcl13visualization11ImageViewer11addRGBImageINS_12PointXYZRGBAEEEvRKNS_10PointCloudIT_E8ConstPtrERKSsd[void
> pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr
> const&, std::basic_string<char, std::char_traits&lt;char>,
> std::allocator<char>  >  const&, double)]+0x36): undefined reference to `void
> pcl::visualization::ImageViewer::addRGBImage<pcl::PointXYZRGBA>(pcl::PointCloud<pcl::PointXYZRGBA>
> const&, std::basic_string<char, std::char_traits&lt;char>,
> std::allocator<char>  >  const&, double)'
> collect2: ld returned 1 exit status
>
> Here's my code:
>
> #include<pcl/visualization/image_viewer.h>
> #include<pcl/io/pcd_io.h>
> #include<iostream>
>
>   int main(int argc, char const *argv[])
>   {
> if (argc != 2) {
> cerr<<  "Usage: "<<  argv[0]<<  " pcd_filename "<<  endl<<  endl;
> exit(-1);
> }
>
> // Load input cloud from the given PCD file.
> pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input_cloud (new
> pcl::PointCloud<pcl::PointXYZRGBA>);
> if (pcl::io::loadPCDFile<pcl::PointXYZRGBA>  (argv[1], *input_cloud) == -1)
> {
> PCL_ERROR ("Couldn't read input PCD file %s \n", argv[1]);
> return (-1);
> }
> std::cout<<  "Loaded cloud from PCD file"<<  endl;
>
> pcl::visualization::ImageViewer iv;
> iv.addCircle (10, 10, 5, 1.0, 0.0, 0.0, "circles", 1.0);    // add a red,
> fully opaque circle with radius 5 pixels at (10,10) in layer "circles"
> iv.addFilledRectangle (10, 20, 10, 20, 0.0, 1.0, 0.0, "boxes", 0.5);    //
> add a green, 50% transparent box at (10,10->20,20) in layer "boxes"
> iv.addRGBImage<pcl::PointXYZRGBA>  (input_cloud);                  // add a
> RGB image from a point cloud dataset in an "rgb_image" default layer
> iv.spin ();                                                 // press 'q' to
> exit
> // iv.removeLayer ("circles");                                 // remove
> layer "circles"
> // iv.spin ();                                                 // press 'q'
> to exit
>
> return 0;
>   }
>
> What am I missing here?
>
> Thanks!
>
> --
> View this message in context: http://www.pcl-users.org/Linker-error-when-I-try-5-lines-of-ImageViewer-example-tp4019537.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: Linker error when I try 5 lines of ImageViewer example

Jun8
My CMakeLists.txt file is simple:

cmake_minimum_required(VERSION 2.8)

PROJECT( imageviewer_experiment )
find_package(PCL 1.2 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

ADD_EXECUTABLE( imageviewer_experiment imageviewer_experiment.cpp )
TARGET_LINK_LIBRARIES( imageviewer_experiment ${PCL_LIBRARIES})

The output of running cmake .. in the build directory is below, /usr/local/lib/libpcl_visualization.so is listed.

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'eigen3'
--   found eigen3, version 3.0.2
-- Found eigen: /usr/include/eigen3
-- Boost version: 1.42.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
-- checking for module 'flann'
--   found flann, version 1.7.1
-- Found Flann: /usr/lib/libflann_cpp_s.a
-- checking for module 'openni-dev'
--   found openni-dev, version 1.3.2.1
-- Found openni: /usr/lib/libOpenNI.so
-- Found libusb-1.0: /usr/include
-- Found qhull: /usr/lib/libqhull.so
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/local/lib/libpcl_common.so
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/local/lib/libpcl_kdtree.so
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/local/lib/libpcl_octree.so
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/local/lib/libpcl_search.so
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/libpcl_sample_consensus.so
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/local/lib/libpcl_filters.so
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/local/lib/libpcl_tracking.so
-- looking for PCL_IO
-- Found PCL_IO: /usr/local/lib/libpcl_io.so
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/local/lib/libpcl_geometry.so
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/local/lib/libpcl_segmentation.so
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/local/lib/libpcl_features.so
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/local/lib/libpcl_surface.so
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/local/lib/libpcl_registration.so
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/local/lib/libpcl_visualization.so
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/local/lib/libpcl_keypoints.so
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/local/lib/libpcl_recognition.so
-- looking for PCL_APPS
-- Found PCL_APPS: /usr/local/lib/libpcl_apps.so
-- looking for PCL_ML
-- Found PCL_ML: /usr/local/lib/libpcl_ml.so
-- Found PCL: /usr/lib/libboost_system-mt.so;/usr/lib/libboost_filesystem-mt.so;/usr/lib/libboost_thread-mt.so;/usr/lib/libboost_date_time-mt.so;/usr/lib/libboost_iostreams-mt.so;optimized;/usr/local/lib/libpcl_common.so;debug;/usr/local/lib/libpcl_common.so;optimized;/usr/lib/libflann_cpp_s.a;debug;/usr/lib/libflann_cpp_s.a;optimized;/usr/local/lib/libpcl_kdtree.so;debug;/usr/local/lib/libpcl_kdtree.so;optimized;/usr/local/lib/libpcl_octree.so;debug;/usr/local/lib/libpcl_octree.so;optimized;/usr/local/lib/libpcl_search.so;debug;/usr/local/lib/libpcl_search.so;optimized;/usr/local/lib/libpcl_sample_consensus.so;debug;/usr/local/lib/libpcl_sample_consensus.so;optimized;/usr/local/lib/libpcl_filters.so;debug;/usr/local/lib/libpcl_filters.so;optimized;/usr/local/lib/libpcl_tracking.so;debug;/usr/local/lib/libpcl_tracking.so;/usr/lib/libOpenNI.so;vtkCommon;vtkRendering;vtkHybrid;optimized;/usr/local/lib/libpcl_io.so;debug;/usr/local/lib/libpcl_io.so;optimized;/usr/local/lib/libpcl_geometry.so;debug;/usr/local/lib/libpcl_geometry.so;optimized;/usr/local/lib/libpcl_segmentation.so;debug;/usr/local/lib/libpcl_segmentation.so;optimized;/usr/local/lib/libpcl_features.so;debug;/usr/local/lib/libpcl_features.so;optimized;/usr/lib/libqhull.so;debug;/usr/lib/libqhull.so;optimized;/usr/local/lib/libpcl_surface.so;debug;/usr/local/lib/libpcl_surface.so;optimized;/usr/local/lib/libpcl_registration.so;debug;/usr/local/lib/libpcl_registration.so;optimized;/usr/local/lib/libpcl_visualization.so;debug;/usr/local/lib/libpcl_visualization.so;optimized;/usr/local/lib/libpcl_keypoints.so;debug;/usr/local/lib/libpcl_keypoints.so;optimized;/usr/local/lib/libpcl_recognition.so;debug;/usr/local/lib/libpcl_recognition.so;optimized;/usr/local/lib/libpcl_apps.so;debug;/usr/local/lib/libpcl_apps.so;optimized;/usr/local/lib/libpcl_ml.so;debug;/usr/local/lib/libpcl_ml.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cuneyt/workspace/imageviewer_experiment/build
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when I try 5 lines of ImageViewer example

Radu B Rusu
Administrator
Whoops - you found a tiny bug. Can you please use showRGBImage instead of addRGBImage? I'll correct this in trunk and
branches/pcl-1.x

Thanks!

Cheers,
Radu.

On 06/22/2012 10:03 AM, Jun8 wrote:

> My CMakeLists.txt file is simple:
>
>
>
> The output of running cmake .. in the build directory is below,
> /usr/local/lib/libpcl_visualization.so is listed.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Linker-error-when-I-try-5-lines-of-ImageViewer-example-tp4019537p4019580.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: Linker error when I try 5 lines of ImageViewer example

Jun8
Radu,

Awesome, showRGBImage works! Thanks a lot.

How can I save the visualization I create (cloud's RGB component + rectangles drawn on it) to a PGN file from within my code?

Thanks,

C
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when I try 5 lines of ImageViewer example

Radu B Rusu
Administrator
This has already been answered on the mailing list ;) Please use the search archive. I believe saveScreenshot is what
you want
(http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_p_c_l_visualizer.html#ac6fbe63d727c9f910c0fed5b373b88e4).

Cheers,
Radu.


On 06/22/2012 07:38 PM, Jun8 wrote:

> Radu,
>
> Awesome, showRGBImage works! Thanks a lot.
>
> How can I save the visualization I create (cloud's RGB component +
> rectangles drawn on it) to a PGN file from within my code?
>
> Thanks,
>
> C
>
> --
> View this message in context: http://www.pcl-users.org/Linker-error-when-I-try-5-lines-of-ImageViewer-example-tp4019537p4019591.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: Linker error when I try 5 lines of ImageViewer example

Jun8
Thanks Radu! Two more dumb questions (I've been at this for 13+ hours and it's getting late here):

* I tried iv.saveScreenShot(), which of course didn't work since pcl::visualization::ImageViewer doesn't have that method. What am I missing here? pcl::visualization has the method.
* Is there a way to render the image but not display it, as I'll be creating more than 10L of these, other than using addRGBImage?

Thanks a lot once again,

C
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when I try 5 lines of ImageViewer example

Radu B Rusu
Administrator


On 06/22/2012 07:56 PM, Jun8 wrote:
> Thanks Radu! Two more dumb questions (I've been at this for 13+ hours and
> it's getting late here):
>
> * I tried iv.saveScreenShot(), which of course didn't work since
> pcl::visualization::ImageViewer doesn't have that method. What am I missing
> here? pcl::visualization has the method.

We don't have this yet, but it's easily implementable. If you create a feature request on http://dev.pointclouds.org,
I'll get to it in the next few days.

> * Is there a way to render the image but not display it, as I'll be creating
> more than 10L of these, other than using addRGBImage?

VTK has offscreen rendering but I haven't looked at it recently. Marcus or someone else might know :)

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

Re: Linker error when I try 5 lines of ImageViewer example

Jun8
Thanks for all the help! I think I need an account on dev list to submit a feature requeest, applied for one, now waiting for approval.

A thought: I noticed that the ImageViewer methods (addRectangel, etc.) all take in pixel coordinates as arguments. This creates a separation between PCL and this class, I think. For example I cannot feed XYZ coordinates I get from getMinMax3D for an plane inlier cloud (in world coordinates) to ImageViewer to draw rectangles for detected planes; rather, I have to add the cumbersome world to pixel conversion. Is there an easy way to circumvent this? Is it easy for you to add methods that operate on world coordinates and do the conversion implicitly?

Thanks!

C
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when I try 5 lines of ImageViewer example

Radu B. Rusu
Administrator
addRectangle takes either pixels or Points (see
http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_image_viewer.html#a0eae37d9f7fdd3e71dc95bea071198f3). I
believe only addCircle might be missing an overload here. Are you on the latest trunk?

Cheers,
Radu.


On 06/23/2012 12:05 PM, Jun8 wrote:

> Thanks for all the help! I think I need an account on dev list to submit a
> feature requeest, applied for one, now waiting for approval.
>
> A thought: I noticed that the ImageViewer methods (addRectangel, etc.) all
> take in pixel coordinates as arguments. This creates a separation between
> PCL and this class, I think. For example I cannot feed XYZ coordinates I get
> from getMinMax3D for an plane inlier cloud (in world coordinates) to
> ImageViewer to draw rectangles for detected planes; rather, I have to add
> the cumbersome world to pixel conversion. Is there an easy way to circumvent
> this? Is it easy for you to add methods that operate on world coordinates
> and do the conversion implicitly?
>
> Thanks!
>
> C
>
> --
> View this message in context: http://www.pcl-users.org/Linker-error-when-I-try-5-lines-of-ImageViewer-example-tp4019537p4019601.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