From 3da7f456e2d65495a796a538a02086272f9a23de Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 28 Dec 2018 00:06:22 +0100 Subject: [PATCH] Remove FZ-API (Solves #2701) Added a error pragma in case someone is still fotonic_grabber. --- CMakeLists.txt | 1 - PCLConfig.cmake.in | 2 +- apps/optronic_viewer/CMakeLists.txt | 99 --- .../pcl/apps/optronic_viewer/cloud_filter.h | 446 ------------ .../pcl/apps/optronic_viewer/filter_window.h | 117 ---- .../pcl/apps/optronic_viewer/main_window.h | 171 ----- .../pcl/apps/optronic_viewer/openni_grabber.h | 85 --- .../include/pcl/apps/optronic_viewer/qt.h | 98 --- apps/optronic_viewer/src/cloud_filter.cpp | 662 ------------------ apps/optronic_viewer/src/filter_window.cpp | 168 ----- apps/optronic_viewer/src/main.cpp | 50 -- apps/optronic_viewer/src/main_window.cpp | 500 ------------- apps/optronic_viewer/src/openni_grabber.cpp | 84 --- cmake/Modules/FindFZAPI.cmake | 26 - io/CMakeLists.txt | 13 +- io/include/pcl/io/fotonic_grabber.h | 120 +--- io/src/fotonic_grabber.cpp | 351 ---------- pcl_config.h.in | 2 - 18 files changed, 3 insertions(+), 2992 deletions(-) delete mode 100644 apps/optronic_viewer/CMakeLists.txt delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h delete mode 100644 apps/optronic_viewer/src/cloud_filter.cpp delete mode 100644 apps/optronic_viewer/src/filter_window.cpp delete mode 100644 apps/optronic_viewer/src/main.cpp delete mode 100644 apps/optronic_viewer/src/main_window.cpp delete mode 100644 apps/optronic_viewer/src/openni_grabber.cpp delete mode 100644 cmake/Modules/FindFZAPI.cmake delete mode 100644 io/src/fotonic_grabber.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8167ccc6b15..7adccc93c20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -310,7 +310,6 @@ endif() # Dependencies for different grabbers PCL_ADD_GRABBER_DEPENDENCY("OpenNI" "OpenNI grabber support") PCL_ADD_GRABBER_DEPENDENCY("OpenNI2" "OpenNI2 grabber support") -PCL_ADD_GRABBER_DEPENDENCY("FZAPI" "Fotonic camera support") PCL_ADD_GRABBER_DEPENDENCY("Ensenso" "IDS-Imaging Ensenso camera support") PCL_ADD_GRABBER_DEPENDENCY("davidSDK" "David Vision Systems SDK support") PCL_ADD_GRABBER_DEPENDENCY("DSSDK" "DepthSense SDK support") diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 905912bb12c..da79050c5fe 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -436,7 +436,7 @@ list(LENGTH pcl_all_components PCL_NB_COMPONENTS) @PCLCONFIG_OPTIONAL_DEPENDENCIES@ -set(pcl_header_only_components 2d cuda_common geometry gpu_tracking modeler in_hand_scanner point_cloud_editor cloud_composer optronic_viewer) +set(pcl_header_only_components 2d cuda_common geometry gpu_tracking modeler in_hand_scanner point_cloud_editor cloud_composer) include(FindPackageHandleStandardArgs) diff --git a/apps/optronic_viewer/CMakeLists.txt b/apps/optronic_viewer/CMakeLists.txt deleted file mode 100644 index 5597d326539..00000000000 --- a/apps/optronic_viewer/CMakeLists.txt +++ /dev/null @@ -1,99 +0,0 @@ -set(SUBSUBSYS_NAME optronic_viewer) -set(SUBSUBSYS_DESC "PCL Optronic Viewer") -set(SUBSUBSYS_DEPS common geometry io filters sample_consensus segmentation visualization kdtree features surface octree registration keypoints tracking search apps) - -# Find VTK and QVTK -if(VTK_FOUND AND VTK_USE_QVTK) - set(DEFAULT TRUE) - set(REASON) - set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") - include("${VTK_USE_FILE}") -elseif(NOT VTK_FOUND) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not found.") -elseif(NOT VTK_USE_QVTK) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not built with Qt support.") -endif() - -# QT5 Found? -if(NOT Qt5_FOUND) - set(DEFAULT AUTO_OFF) - set(REASON "Qt5 was not found.") -elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) -endif() - -# FZAPI -if(FZAPI_FOUND) - set(DEFAULT TRUE) - set(REASON) -elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT AUTO_OFF) - set(REASON "FZAPI was not found.") -endif() - -# Default to not building for now -if(${DEFAULT} STREQUAL "TRUE") - set(DEFAULT FALSE) -endif() - -PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" ${DEFAULT} "${REASON}") -PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS} EXT_DEPS vtk) - -PCL_ADD_DOC("${SUBSUBSYS_NAME}") - -if(NOT build) - return() -endif() - -include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - -# Set Qt files and resources here -set(moc_incs - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/filter_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/openni_grabber.h" -) - -set(incs - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/qt.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/openni_grabber.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_filter.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/filter_window.h" -) - -set(srcs - src/main.cpp - src/cloud_filter.cpp - src/openni_grabber.cpp - src/filter_window.cpp - src/main_window.cpp -) - -set(impl_incs) - -# Qt stuff -QT5_WRAP_CPP(moc_srcs ${moc_incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) - -# Generate executable -set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") -PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${moc_srcs} ${srcs} ${incs} ${impl_incs}) -target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search QVTK Qt5::Widgets) - -# Put the ui in the windows project file -if(("${CMAKE_BUILD_TOOL}" MATCHES "msdev") OR("${CMAKE_BUILD_TOOL}" MATCHES "devenv")) - list(APPEND srcs ${uis}) -endif() - -# Install include files -PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs}) -PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) - -PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") - -# Add to the compound apps target -list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME}) -set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h deleted file mode 100644 index 35f61da8839..00000000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#pragma once - -#include -#include -#include - -#include - -#include - -#include -#include - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - ///////////////////////////////////////////////////////////////////////// - /** \brief Interface for a class that implements a filter for a point - * cloud. - */ - class CloudFilter - { - public: - virtual ~CloudFilter () {} - - /** \brief Applies the filter on the input and stores the result in the - * output cloud. - */ - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) = 0; - - /** \brief Returns the name of the filter. */ - virtual std::string - getName () - { - return name_; - } - - /** \brief Sets the name of the filter. */ - virtual void - setName (std::string & name) - { - name_ = name; - } - - /** \brief Returns a Qt page which allows to configure the filter. */ - virtual QWizardPage * - getParameterPage () = 0; - - protected: - /** \brief The name of the filter. */ - std::string name_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Factory class to create a filter. */ - class CloudFilterFactory - { - public: - virtual ~CloudFilterFactory () {} - - /** \brief Returns the name of the filter type. */ - virtual std::string - getName () - { - return filter_type_name_; - } - - /** \brief Creates a filter object. */ - virtual CloudFilter* - create () = 0; - - protected: - /** \brief Constructor which sets the filter type name. */ - CloudFilterFactory (std::string name) - : filter_type_name_ (name) - {} - - protected: - /** \brief Filter type name */ - std::string filter_type_name_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Helper class for the factory to simplify implementation of - * new cloud filters. This class makes the implementation of a - * separate factory class obsolete, e.g.: - * - * Header: - * char g_voxel_grid_cf_name[]; - * typedef CloudFilterFactory2 VoxelGridCFF2; - * - * Source: - * extern char pcl::apps::optronic_viewer::g_voxel_grid_cf_name[] = "VoxelGrid Filter"; - */ - template - class CloudFilterFactory2 - : public CloudFilterFactory - { - public: - /** \brief Creates a new cloud factory with the name specified in - * the template parameter. - */ - CloudFilterFactory2 () : CloudFilterFactory (name) {} - virtual ~CloudFilterFactory2 () {} - - /** \brief Creates a new filter object. */ - virtual CloudFilter* - create () - { - return (new T ()); - } - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a voxel grid filter. Divides the space in voxels - * and takes a point per voxel. - */ - class VoxelGridCF - : public CloudFilter - { - public: - VoxelGridCF (); - virtual ~VoxelGridCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - // filter parameters - float voxel_grid_size_x_; - float voxel_grid_size_y_; - float voxel_grid_size_z_; - - QLabel * voxel_grid_size_x_label_; - QLabel * voxel_grid_size_y_label_; - QLabel * voxel_grid_size_z_label_; - QLineEdit * voxel_grid_size_x_line_edit_; - QLineEdit * voxel_grid_size_y_line_edit_; - QLineEdit * voxel_grid_size_z_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a pass-through filter. Removes all points that are - * out of a specified range for a specified component (e.g. x, y, - * or z). - */ - class PassThroughCF - : public CloudFilter - { - public: - PassThroughCF (); - virtual ~PassThroughCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - std::string filter_field_name_; - float filter_limits_min_; - float filter_limits_max_; - - QLabel * filter_field_name_label_; - QLabel * filter_limits_min_label_; - QLabel * filter_limits_max_label_; - QLineEdit * filter_field_name_line_edit_; - QLineEdit * filter_limits_min_line_edit_; - QLineEdit * filter_limits_max_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a radius-outlier filter. Removes all points that - * have less than a specified number of points as neighbors - * (within a specified radius). - */ - class RadiusOutlierCF - : public CloudFilter - { - public: - RadiusOutlierCF (); - virtual ~RadiusOutlierCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float search_radius_; - int min_neighbors_in_radius_; - - QLabel * search_radius_label_; - QLabel * min_neighbors_in_radius_label_; - QLineEdit * search_radius_line_edit_; - QLineEdit * min_neighbors_in_radius_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for the fast-bilateral filter. Applies the fast- - * bilateral filter on a cloud for smoothing. - */ - class FastBilateralCF - : public CloudFilter - { - public: - FastBilateralCF (); - virtual ~FastBilateralCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float sigma_s_; - float sigma_r_; - - QLabel * sigma_s_label_; - QLabel * sigma_r_label_; - QLineEdit * sigma_s_line_edit_; - QLineEdit * sigma_r_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a Median filter. Applies the Median filter on a - * cloud. - */ - class MedianCF - : public CloudFilter - { - public: - MedianCF (); - virtual ~MedianCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float max_allowed_movement_; - int window_size_; - - QLabel * max_allowed_movement_label_; - QLabel * window_size_label_; - QLineEdit * max_allowed_movement_line_edit_; - QLineEdit * window_size_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a random sample filter. Selects a random sample - * of points from the input cloud. - */ - class RandomSampleCF - : public CloudFilter - { - public: - RandomSampleCF (); - virtual ~RandomSampleCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - int seed_; - int sample_; - - QLabel * seed_label_; - QLabel * sample_label_; - QLineEdit * seed_line_edit_; - QLineEdit * sample_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a filter that finds the dominant plane in the - * cloud and either keeps only the plane or everything else. - */ - class PlaneCF - : public CloudFilter - { - public: - PlaneCF (); - virtual ~PlaneCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - double threshold_; - int max_iterations_; - - double refinement_sigma_; - int max_refinement_iterations_; - - bool return_negative_; - - double cluster_tolerance_; - int min_cluster_size_; - - QLabel * threshold_label_; - QLabel * max_iterations_label_; - QLabel * refinement_sigma_label_; - QLabel * max_refinement_iterations_label_; - QLabel * return_negative_label_; - QLabel * cluster_tolerance_label_; - QLabel * min_cluster_size_label_; - - QLineEdit * threshold_line_edit_; - QLineEdit * max_iterations_line_edit_; - QLineEdit * refinement_sigma_line_edit_; - QLineEdit * max_refinement_iterations_line_edit_; - QCheckBox * return_negative_check_box_; - QLineEdit * cluster_tolerance_line_edit_; - QLineEdit * min_cluster_size_line_edit_; - - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - - ///////////////////////////////////////////////////////////////////////// - char g_voxel_grid_cf_name[]; - char g_passthrough_cf_name[]; - char g_radius_outlier_cf_name[]; - char g_fast_bilateral_cf_name[]; - char g_median_cf_name[]; - char g_random_sample_cf_name[]; - char g_plane_cf_name[]; - - ///////////////////////////////////////////////////////////////////////// - typedef CloudFilterFactory2< VoxelGridCF, g_voxel_grid_cf_name> VoxelGridCFF2; - typedef CloudFilterFactory2< PassThroughCF, g_passthrough_cf_name> PassThroughCFF2; - typedef CloudFilterFactory2< RadiusOutlierCF, g_radius_outlier_cf_name> RadiusOutlierCFF2; - typedef CloudFilterFactory2< FastBilateralCF, g_fast_bilateral_cf_name> FastBilateralCFF2; - typedef CloudFilterFactory2< MedianCF, g_median_cf_name> MedianCFF2; - typedef CloudFilterFactory2< RandomSampleCF, g_random_sample_cf_name> RandomSampleCFF2; - typedef CloudFilterFactory2< PlaneCF, g_plane_cf_name> PlaneCFF2; - - } - } -} diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h deleted file mode 100644 index fa5fd1047f8..00000000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - /** \brief Window class for wizards to create new filters. */ - class FilterWindow : public QWizard - { - Q_OBJECT - - public: - /** \brief Creates a new wizard for creating a filter. The filter to be - * created can be selected from the specified list of filters. - * The supplied factories are used to create the corresponding - * filters. - */ - FilterWindow ( - std::vector & filter_factories, - std::vector & filter_list); - virtual ~FilterWindow (); - - public Q_SLOTS: - /** \brief Called if a different item in the filter list is selected. */ - virtual void itemSelected (int id); - /** \brief Called when the 'finish' button is pressed. */ - virtual void finished (); - /** \brief Called when the 'next' button is pressed. */ - virtual void next (); - - Q_SIGNALS: - /** \brief Omitted when a filter is created. */ - void filterCreated (); - - protected: - virtual void cleanupPage (int id) - { - std::cerr << "cleanup page" << std::endl; - } - - private: - /** \brief Creates the page for selecting filters. */ - void createFilterSelectionPage (); - /** \brief Fills the combo box used for selecting filters. */ - void fillFilterSelectionComboBox (QComboBox * combo_box); - - private: - /** \brief List of filter factories used to create the available filters. */ - std::vector filter_factories_; - - /** \brief Combo box that holds the names of the available filters. */ - QComboBox * filter_selection_combo_box_; - /** \brief Line edit used to specify the name of the created filter. */ - QLineEdit * filter_name_line_edit_; - - int last_added_page_id_; - - /** \brief The destination for the newly created filter. */ - std::vector * filter_list_; - - /** \brief The filter to be created. */ - CloudFilter * filter_; - }; - } - } -} diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h deleted file mode 100644 index c60ab71cfc2..00000000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - enum DeviceType - { - OPENNI_DEVICE, - FOTONIC_DEVICE - }; - - class Device - { - public: - Device (DeviceType arg_device_type) - : device_type (arg_device_type) - {} - virtual ~Device () {} - - DeviceType device_type; - }; - - class OpenNIDevice - : public Device - { - public: - OpenNIDevice () - : Device (OPENNI_DEVICE) - {} - virtual ~OpenNIDevice () {} - - int device_id; - std::string name; - std::string vendor; - std::string serial_number; - }; - - class FotonicDevice - : public Device - { - public: - FotonicDevice () - : Device (FOTONIC_DEVICE) - {} - virtual ~FotonicDevice () {} - - FZ_DEVICE_INFO device_info; - }; - - - class MainWindow : public QMainWindow - { - Q_OBJECT - - public: - static MainWindow& getInstance() { - static MainWindow theSingleton; - return theSingleton; - } - - public Q_SLOTS: - void selectedSensorChanged (int index); - void cloud_callback (const pcl::PointCloud::ConstPtr cloud); - void refresh (); - void refreshFilterList (); - - private: - // create the file menu in the menu bar - void createFileMenu (); - - // find connected devices - void findConnectedDevices (); - - private Q_SLOTS: - void addFilter (); - void updateFilter (QListWidgetItem*); - void filterSelectionChanged (); - - void moveFilterUp (); - void moveFilterDown (); - void removeFilter (); - - private: - MainWindow(); - MainWindow(const MainWindow &) : QMainWindow () {} // copy ctor hidden - MainWindow& operator=(const MainWindow &) { return (*this); } // assign op. hidden - ~MainWindow(); - - // visualization of processing chain - QListWidget * processing_list_; - - // buttons to change processing chain - QPushButton * up_ ; - QPushButton * down_; - QPushButton * remove_; - - // visualization of point clouds - QVTKWidget * qvtk_widget_; - pcl::visualization::PCLVisualizer * pcl_visualizer_; - pcl::PointCloud::ConstPtr cloud_; - - // connected devices - std::vector connected_devices_; - - // Grabber stuff - //std::vector connected_openni_devices_; - pcl::Grabber * grabber_; - pcl::apps::optronic_viewer::OpenNIGrabber * grabber_thread_; - - // filters - std::vector filter_factories_; - std::vector active_cloud_filters_; - - // mutexes - boost::mutex cloud_mutex_; - }; - } - } -} diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h deleted file mode 100644 index 0f6a8d509cc..00000000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#pragma once - -#include -#include -#include - -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - /** \brief Wrapper for the grabbing from an OpenNI device. Wrapper is used to run - * the grabbing in a separate thread (QThread). - */ - class OpenNIGrabber : public QThread - { - Q_OBJECT - - public: - /** \brief Creates a new wrapper object from the specified grabber. */ - OpenNIGrabber (pcl::Grabber * grabber); - virtual ~OpenNIGrabber (); - - /** \brief Starts the thread. */ - void run (); - - /** \brief Callback that is used to get cloud data from the grabber. */ - void cloudCallback (const pcl::PointCloud::ConstPtr & cloud); - - Q_SIGNALS: - /** \brief Omitted when a new cloud is received. */ - void cloudReceived (const pcl::PointCloud::ConstPtr cloud); - - private: - /** \brief The grabber data is received from. */ - pcl::Grabber * grabber_; - }; - - } - } -} diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h deleted file mode 100644 index 467f9ca566e..00000000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#pragma once - -#ifdef __GNUC__ -#pragma GCC system_header -#endif - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include diff --git a/apps/optronic_viewer/src/cloud_filter.cpp b/apps/optronic_viewer/src/cloud_filter.cpp deleted file mode 100644 index 19e9003b13a..00000000000 --- a/apps/optronic_viewer/src/cloud_filter.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -extern char pcl::apps::optronic_viewer::g_voxel_grid_cf_name[] = "VoxelGrid Filter"; -extern char pcl::apps::optronic_viewer::g_passthrough_cf_name[] = "PassThrough Filter"; -extern char pcl::apps::optronic_viewer::g_radius_outlier_cf_name[] = "RadiusOutlier Filter"; -extern char pcl::apps::optronic_viewer::g_fast_bilateral_cf_name[] = "Fast Bilateral Filter"; -extern char pcl::apps::optronic_viewer::g_median_cf_name[] = "Median Filter"; -extern char pcl::apps::optronic_viewer::g_random_sample_cf_name[] = "Random Sample Filter"; -extern char pcl::apps::optronic_viewer::g_plane_cf_name[] = "Plane Filter"; - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -VoxelGridCF:: -VoxelGridCF () -: filter_selection_page_ (new QWizardPage ()) -, voxel_grid_size_x_ (0.01) -, voxel_grid_size_y_ (0.01) -, voxel_grid_size_z_ (0.01) -{ - voxel_grid_size_x_label_ = new QLabel (QObject::tr ("Voxel Grid Size in X-Direction:")); - voxel_grid_size_x_line_edit_ = new QLineEdit (); - voxel_grid_size_y_label_ = new QLabel (QObject::tr ("Voxel Grid Size in Y-Direction:")); - voxel_grid_size_y_line_edit_ = new QLineEdit (); - voxel_grid_size_z_label_ = new QLabel (QObject::tr ("Voxel Grid Size in Z-Direction:")); - voxel_grid_size_z_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - voxel_grid_size_x_line_edit_->setValidator (double_validator); - voxel_grid_size_y_line_edit_->setValidator (double_validator); - voxel_grid_size_z_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << voxel_grid_size_x_; - voxel_grid_size_x_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << voxel_grid_size_y_; - voxel_grid_size_y_line_edit_->setText (QString (ss_y.str ().c_str ())); - - std::stringstream ss_z; - ss_z << voxel_grid_size_z_; - voxel_grid_size_z_line_edit_->setText (QString (ss_z.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (voxel_grid_size_x_label_); - main_layout_->addWidget (voxel_grid_size_x_line_edit_); - main_layout_->addWidget (voxel_grid_size_y_label_); - main_layout_->addWidget (voxel_grid_size_y_line_edit_); - main_layout_->addWidget (voxel_grid_size_z_label_); - main_layout_->addWidget (voxel_grid_size_z_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -VoxelGridCF:: -~VoxelGridCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -VoxelGridCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - voxel_grid_size_x_ = voxel_grid_size_x_line_edit_->text ().toFloat (); - voxel_grid_size_y_ = voxel_grid_size_y_line_edit_->text ().toFloat (); - voxel_grid_size_z_ = voxel_grid_size_z_line_edit_->text ().toFloat (); - - pcl::VoxelGrid sor; - sor.setInputCloud (cloud_in); - sor.setLeafSize (voxel_grid_size_x_, voxel_grid_size_y_, voxel_grid_size_z_); - sor.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PassThroughCF:: -PassThroughCF () -: filter_selection_page_ (new QWizardPage ()) -, filter_field_name_ ("z") -, filter_limits_min_ (0) -, filter_limits_max_ (5) -{ - filter_field_name_label_ = new QLabel (QObject::tr ("Filter Field Name:")); - filter_field_name_line_edit_ = new QLineEdit (); - filter_limits_min_label_ = new QLabel (QObject::tr ("Filter Limit - Minimum:")); - filter_limits_min_line_edit_ = new QLineEdit (); - filter_limits_max_label_ = new QLabel (QObject::tr ("Filter Limit - Maximum:")); - filter_limits_max_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - filter_limits_min_line_edit_->setValidator (double_validator); - filter_limits_max_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << filter_field_name_; - filter_field_name_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << filter_limits_min_; - filter_limits_min_line_edit_->setText (QString (ss_y.str ().c_str ())); - - std::stringstream ss_z; - ss_z << filter_limits_max_; - filter_limits_max_line_edit_->setText (QString (ss_z.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (filter_field_name_label_); - main_layout_->addWidget (filter_field_name_line_edit_); - main_layout_->addWidget (filter_limits_min_label_); - main_layout_->addWidget (filter_limits_min_line_edit_); - main_layout_->addWidget (filter_limits_max_label_); - main_layout_->addWidget (filter_limits_max_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PassThroughCF:: -~PassThroughCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -PassThroughCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - filter_field_name_ = filter_field_name_line_edit_->text ().toStdString (); - filter_limits_min_ = filter_limits_min_line_edit_->text ().toFloat (); - filter_limits_max_ = filter_limits_max_line_edit_->text ().toFloat (); - - pcl::PassThrough filter; - filter.setInputCloud (cloud_in); - filter.setFilterFieldName (filter_field_name_); - filter.setFilterLimits (filter_limits_min_, filter_limits_max_); - filter.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -RadiusOutlierCF () -: filter_selection_page_ (new QWizardPage ()) -, search_radius_ (0.05f) -, min_neighbors_in_radius_ (500) -{ - search_radius_label_ = new QLabel (QObject::tr ("Search Radius:")); - search_radius_line_edit_ = new QLineEdit (); - min_neighbors_in_radius_label_ = new QLabel (QObject::tr ("Minimum Number of Neighbors within Radius:")); - min_neighbors_in_radius_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - search_radius_line_edit_->setValidator (double_validator); - min_neighbors_in_radius_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << search_radius_; - search_radius_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << min_neighbors_in_radius_; - min_neighbors_in_radius_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (search_radius_label_); - main_layout_->addWidget (search_radius_line_edit_); - main_layout_->addWidget (min_neighbors_in_radius_label_); - main_layout_->addWidget (min_neighbors_in_radius_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -~RadiusOutlierCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - search_radius_ = search_radius_line_edit_->text ().toFloat (); - min_neighbors_in_radius_ = min_neighbors_in_radius_line_edit_->text ().toInt (); - - pcl::RadiusOutlierRemoval filter; - filter.setInputCloud (cloud_in); - filter.setRadiusSearch (search_radius_); - filter.setMinNeighborsInRadius (min_neighbors_in_radius_); - filter.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FastBilateralCF:: -FastBilateralCF () -: filter_selection_page_ (new QWizardPage ()) -, sigma_s_ (5.0f) -, sigma_r_ (0.03f) -{ - sigma_s_label_ = new QLabel (QObject::tr ("Half Size (sigma s) (Minimum: 1.0):")); - sigma_s_line_edit_ = new QLineEdit (); - sigma_r_label_ = new QLabel (QObject::tr ("Standard Deviation (sigma r) (Minimum: 0.0001):")); - sigma_r_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - sigma_s_line_edit_->setValidator (double_validator); - sigma_r_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << sigma_s_; - sigma_s_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << sigma_r_; - sigma_r_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (sigma_s_label_); - main_layout_->addWidget (sigma_s_line_edit_); - main_layout_->addWidget (sigma_r_label_); - main_layout_->addWidget (sigma_r_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FastBilateralCF:: -~FastBilateralCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FastBilateralCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - sigma_s_ = sigma_s_line_edit_->text ().toFloat (); - sigma_r_ = sigma_r_line_edit_->text ().toFloat (); - - //std::cerr << "sigma_s: " << sigma_s_ << std::endl; - //std::cerr << "sigma_r: " << sigma_r_ << std::endl; - - if (sigma_s_ <= 1.0f) - sigma_s_ = 1.0f; - if (sigma_r_ <= 0.0001f) - sigma_r_ = 0.0001f; - - pcl::FastBilateralFilter fbf; - fbf.setInputCloud (cloud_in); - fbf.setSigmaS (sigma_s_); - fbf.setSigmaR (sigma_r_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MedianCF:: -MedianCF () -: filter_selection_page_ (new QWizardPage ()) -, max_allowed_movement_ (1.0f) -, window_size_ (1) -{ - max_allowed_movement_label_ = new QLabel (QObject::tr ("Maximum Allowed Movement (Minimum: 0.0):")); - max_allowed_movement_line_edit_ = new QLineEdit (); - window_size_label_ = new QLabel (QObject::tr ("Window Size (Minimum: 1):")); - window_size_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - max_allowed_movement_line_edit_->setValidator (double_validator); - window_size_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << max_allowed_movement_; - max_allowed_movement_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << window_size_; - window_size_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (max_allowed_movement_label_); - main_layout_->addWidget (max_allowed_movement_line_edit_); - main_layout_->addWidget (window_size_label_); - main_layout_->addWidget (window_size_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MedianCF:: -~MedianCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MedianCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - max_allowed_movement_ = max_allowed_movement_line_edit_->text ().toFloat (); - window_size_ = window_size_line_edit_->text ().toInt (); - - if (max_allowed_movement_ <= 0.0f) - max_allowed_movement_ = 0.0f; - if (window_size_ < 1) - window_size_ = 1; - - pcl::MedianFilter fbf; - fbf.setInputCloud (cloud_in); - fbf.setMaxAllowedMovement (max_allowed_movement_); - fbf.setWindowSize (window_size_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RandomSampleCF:: -RandomSampleCF () -: filter_selection_page_ (new QWizardPage ()) -, seed_ (1) -, sample_ (1000) -{ - seed_label_ = new QLabel (QObject::tr ("Seed for Random Number Generator:")); - seed_line_edit_ = new QLineEdit (); - sample_label_ = new QLabel (QObject::tr ("Number of Samples drawn from the Input Cloud:")); - sample_line_edit_ = new QLineEdit (); - - QIntValidator * int_validator = new QIntValidator (); - seed_line_edit_->setValidator (int_validator); - sample_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << seed_; - seed_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << sample_; - sample_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (seed_label_); - main_layout_->addWidget (seed_line_edit_); - main_layout_->addWidget (sample_label_); - main_layout_->addWidget (sample_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RandomSampleCF:: -~RandomSampleCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -RandomSampleCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - seed_ = seed_line_edit_->text ().toFloat (); - sample_ = sample_line_edit_->text ().toInt (); - - if (sample_ < 1) - sample_ = 1; - - pcl::RandomSample fbf; - fbf.setInputCloud (cloud_in); - fbf.setSeed (seed_); - fbf.setSample (sample_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PlaneCF:: -PlaneCF () -: filter_selection_page_ (new QWizardPage ()) -, threshold_ (0.05f) -, max_iterations_ (1000) -, refinement_sigma_ (2) -, max_refinement_iterations_ (50) -, return_negative_ (false) -, cluster_tolerance_ (0.02) -, min_cluster_size_ (100) -{ - threshold_label_ = new QLabel (QObject::tr ("Threshold for plane detection:")); - threshold_line_edit_ = new QLineEdit (); - max_iterations_label_ = new QLabel (QObject::tr ("Maximum number of iterations for plane estimation:")); - max_iterations_line_edit_ = new QLineEdit (); - refinement_sigma_label_ = new QLabel (QObject::tr ("Sigma for plane parameter refinement:")); - refinement_sigma_line_edit_ = new QLineEdit (); - max_refinement_iterations_label_ = new QLabel (QObject::tr ("Maximum number of iterations for plane parameter refinement:")); - max_refinement_iterations_line_edit_ = new QLineEdit (); - return_negative_label_ = new QLabel (QObject::tr ("Invert filter (return everything except plane)?")); - return_negative_check_box_ = new QCheckBox (); - cluster_tolerance_label_ = new QLabel (QObject::tr ("Cluster tolerance for plane segmentation:")); - cluster_tolerance_line_edit_ = new QLineEdit (); - min_cluster_size_label_ = new QLabel (QObject::tr ("Minimum cluster size:")); - min_cluster_size_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - threshold_line_edit_->setValidator (double_validator); - refinement_sigma_line_edit_->setValidator (double_validator); - cluster_tolerance_line_edit_->setValidator (double_validator); - max_iterations_line_edit_->setValidator (int_validator); - max_refinement_iterations_line_edit_->setValidator (int_validator); - min_cluster_size_line_edit_->setValidator (int_validator); - - { - std::stringstream ss; - ss << threshold_; - threshold_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << max_iterations_; - max_iterations_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << refinement_sigma_; - refinement_sigma_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << max_refinement_iterations_; - max_refinement_iterations_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << cluster_tolerance_; - cluster_tolerance_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << min_cluster_size_; - min_cluster_size_line_edit_->setText (QString (ss.str ().c_str ())); - } - - if (return_negative_) - return_negative_check_box_->setCheckState (Qt::Checked); - else - return_negative_check_box_->setCheckState (Qt::Unchecked); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (threshold_label_); - main_layout_->addWidget (threshold_line_edit_); - main_layout_->addWidget (max_iterations_label_); - main_layout_->addWidget (max_iterations_line_edit_); - main_layout_->addWidget (refinement_sigma_label_); - main_layout_->addWidget (refinement_sigma_line_edit_); - main_layout_->addWidget (max_refinement_iterations_label_); - main_layout_->addWidget (max_refinement_iterations_line_edit_); - main_layout_->addWidget (return_negative_label_); - main_layout_->addWidget (return_negative_check_box_); - main_layout_->addWidget (cluster_tolerance_label_); - main_layout_->addWidget (cluster_tolerance_line_edit_); - main_layout_->addWidget (min_cluster_size_label_); - main_layout_->addWidget (min_cluster_size_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PlaneCF:: -~PlaneCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -PlaneCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - threshold_ = threshold_line_edit_->text ().toFloat (); - max_iterations_ = max_iterations_line_edit_->text ().toInt (); - refinement_sigma_ = refinement_sigma_line_edit_->text ().toFloat (); - max_refinement_iterations_ = max_refinement_iterations_line_edit_->text ().toInt (); - cluster_tolerance_ = cluster_tolerance_line_edit_->text ().toFloat (); - min_cluster_size_ = min_cluster_size_line_edit_->text ().toInt (); - - if (max_iterations_ < 0) - max_iterations_ = 0; - if (max_refinement_iterations_ < 0) - max_refinement_iterations_ = 0; - - if (cluster_tolerance_ < 0.0001) - cluster_tolerance_ = 0.0001; - - return_negative_ = return_negative_check_box_->checkState () == Qt::Checked; - - pcl::SampleConsensusModelPlane::Ptr model (new pcl::SampleConsensusModelPlane (cloud_in)); - pcl::RandomSampleConsensus sac (model, threshold_); - sac.setMaxIterations (max_iterations_); - bool res = sac.computeModel (); - - std::vector inliers; - sac.getInliers (inliers); - - if (!res || inliers.empty ()) - { - std::cerr << "no planar model found!" << std::endl; - return; - } - - sac.refineModel (refinement_sigma_, max_refinement_iterations_); - sac.getInliers (inliers); - - if (return_negative_) - { - pcl::PointIndices::Ptr everything_but_the_plane (new pcl::PointIndices ()); - std::vector indices_fullset (cloud_in->size ()); - for (int p_it = 0; p_it < static_cast (indices_fullset.size ()); ++p_it) - indices_fullset[p_it] = p_it; - - std::sort (inliers.begin (), inliers.end ()); - std::set_difference (indices_fullset.begin (), indices_fullset.end (), - inliers.begin (), inliers.end (), - inserter (everything_but_the_plane->indices, everything_but_the_plane->indices.begin ())); - - // Extract largest cluster minus the plane - std::vector cluster_indices; - pcl::EuclideanClusterExtraction ec; - ec.setClusterTolerance (cluster_tolerance_); - ec.setMinClusterSize (min_cluster_size_); - ec.setInputCloud (cloud_in); - ec.setIndices (everything_but_the_plane); - ec.extract (cluster_indices); - - if (!cluster_indices.empty ()) - { - // Convert data back - pcl::copyPointCloud (*cloud_in, cluster_indices[0].indices, *cloud_out); - } - } - else - { - pcl::copyPointCloud (*cloud_in, inliers, *cloud_out); - } -} - - - - - - diff --git a/apps/optronic_viewer/src/filter_window.cpp b/apps/optronic_viewer/src/filter_window.cpp deleted file mode 100644 index b7bd09dd1df..00000000000 --- a/apps/optronic_viewer/src/filter_window.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include - -#include -#include - -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FilterWindow:: -FilterWindow (std::vector & filter_factories, std::vector & filter_list) -: filter_factories_ (filter_factories) -, filter_selection_combo_box_ (NULL) -, filter_list_ (&filter_list) -, filter_ (NULL) -{ - this->setOption (QWizard::IndependentPages, true); - - createFilterSelectionPage (); - - filter_ = filter_factories_[0]->create (); - - QString name (filter_factories_[0]->getName ().c_str ()); - filter_name_line_edit_->setText (name); - - if (filter_factories.size () > 0) - last_added_page_id_ = this->addPage (filter_->getParameterPage ()); - - connect (this->button (FinishButton), SIGNAL (released ()),this, SLOT (finished ())); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FilterWindow:: -~FilterWindow () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -itemSelected (int id) -{ - std::cerr << "item " << id << " selected" << std::endl; - - delete filter_; - filter_ = filter_factories_[id]->create (); - - QString name (filter_factories_[id]->getName ().c_str ()); - filter_name_line_edit_->setText (name); - - int tmp = this->addPage (filter_->getParameterPage ()); - this->removePage (last_added_page_id_); - last_added_page_id_ = tmp; - this->update (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -finished () -{ - std::cerr << "finished" << std::endl; - - filter_->setName (filter_name_line_edit_->text ().toStdString ()); - filter_list_->push_back (filter_); - - emit filterCreated (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -next () -{ - std::cerr << "next" << std::endl; - this->QWizard::next (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -createFilterSelectionPage () -{ - QWizardPage * filter_selection_page = new QWizardPage (); - - QLabel * select_filter_label = new QLabel (tr ("Select Filter:")); - filter_selection_combo_box_ = new QComboBox (); - - if (filter_factories_.empty ()) - filter_selection_combo_box_->addItem (tr ("none")); - else - fillFilterSelectionComboBox (filter_selection_combo_box_); - - connect (filter_selection_combo_box_, SIGNAL (currentIndexChanged (int)),this, SLOT (itemSelected (int))); - - QLabel * filter_name_label = new QLabel (tr ("Filter Name:")); - filter_name_line_edit_ = new QLineEdit (); - - QVBoxLayout * main_layout = new QVBoxLayout (filter_selection_page); - main_layout->addWidget (select_filter_label); - main_layout->addWidget (filter_selection_combo_box_); - main_layout->addWidget (filter_name_label); - main_layout->addWidget (filter_name_line_edit_); - - this->addPage (filter_selection_page); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -fillFilterSelectionComboBox (QComboBox * combo_box) -{ - for (int factory_index = 0; factory_index < filter_factories_.size (); ++factory_index) - { - std::string name = filter_factories_[factory_index]->getName (); - - combo_box->addItem (tr (name.c_str ())); - } -} diff --git a/apps/optronic_viewer/src/main.cpp b/apps/optronic_viewer/src/main.cpp deleted file mode 100644 index d38bfada63f..00000000000 --- a/apps/optronic_viewer/src/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include - -int main( int argc, char** argv ) -{ - QApplication app( argc, argv ); - app.setOrganizationName("PCL"); - app.setApplicationName("PCL Optronic Viewer"); - - pcl::apps::optronic_viewer::MainWindow::getInstance().show(); - - return app.exec(); -} diff --git a/apps/optronic_viewer/src/main_window.cpp b/apps/optronic_viewer/src/main_window.cpp deleted file mode 100644 index ef5f6769e94..00000000000 --- a/apps/optronic_viewer/src/main_window.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MainWindow:: -MainWindow () - : grabber_ (NULL) - , grabber_thread_ (NULL) -{ - // initialize API - pcl::FotonicGrabber::initAPI (); - - - // setup filters - filter_factories_.push_back (new VoxelGridCFF2 ()); - filter_factories_.push_back (new PassThroughCFF2 ()); - filter_factories_.push_back (new RadiusOutlierCFF2 ()); - filter_factories_.push_back (new FastBilateralCFF2 ()); - filter_factories_.push_back (new MedianCFF2 ()); - filter_factories_.push_back (new RandomSampleCFF2 ()); - filter_factories_.push_back (new PlaneCFF2 ()); - - - // reset point cloud - cloud_.reset (new pcl::PointCloud ()); - - - // set window title - this->setWindowTitle ("PCL Optronic Viewer"); - - - // setup menu - this->createFileMenu (); - - - // setup widgets - QWidget * central_widget = new QWidget (this); - - QLabel * sensor_label = new QLabel (tr ("Sensor")); - QComboBox * sensor_selection_combo_box = new QComboBox (); - sensor_selection_combo_box->addItem (tr ("none")); - this->findConnectedDevices (); - for (size_t device_idx = 0; device_idx < connected_devices_.size (); ++device_idx) - { - if (connected_devices_[device_idx]->device_type == OPENNI_DEVICE) - sensor_selection_combo_box->addItem (tr (reinterpret_cast (connected_devices_[device_idx])->name.c_str ())); - if (connected_devices_[device_idx]->device_type == FOTONIC_DEVICE) - sensor_selection_combo_box->addItem (tr (reinterpret_cast (connected_devices_[device_idx])->device_info.szPath)); - } - connect (sensor_selection_combo_box, SIGNAL(activated (int)), this, SLOT(selectedSensorChanged (int))); - - processing_list_ = new QListWidget (central_widget); - connect (processing_list_, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (updateFilter (QListWidgetItem*))); - connect (processing_list_, SIGNAL (itemSelectionChanged ()), this, SLOT (filterSelectionChanged ())); - - - up_ = new QPushButton ("up"); - down_ = new QPushButton ("down"); - remove_ = new QPushButton ("remove"); - - connect (up_, SIGNAL (clicked ()), this, SLOT (moveFilterUp ())); - connect (down_, SIGNAL (clicked ()), this, SLOT (moveFilterDown ())); - connect (remove_, SIGNAL (clicked ()), this, SLOT (removeFilter ())); - - up_->setEnabled (false); - down_->setEnabled (false); - remove_->setEnabled (false); - - pcl_visualizer_ = new pcl::visualization::PCLVisualizer ("", false); - qvtk_widget_ = new QVTKWidget (central_widget); - qvtk_widget_->SetRenderWindow (pcl_visualizer_->getRenderWindow ()); - pcl_visualizer_->setupInteractor (qvtk_widget_->GetInteractor (), qvtk_widget_->GetRenderWindow ()); - qvtk_widget_->update (); - - - // setup layouts - QHBoxLayout * sensor_layout = new QHBoxLayout (); - sensor_layout->addWidget (sensor_label, 0, Qt::AlignLeft); - sensor_layout->addWidget (sensor_selection_combo_box, 1); - - QHBoxLayout * button_layout = new QHBoxLayout (); - button_layout->addWidget (up_); - button_layout->addWidget (down_); - button_layout->addWidget (remove_); - - QVBoxLayout * sensor_processing_list_layout = new QVBoxLayout (); - sensor_processing_list_layout->addLayout (sensor_layout, 0); - sensor_processing_list_layout->addWidget (processing_list_); - sensor_processing_list_layout->addLayout (button_layout, 0); - - QHBoxLayout * main_layout = new QHBoxLayout (central_widget); - main_layout->addLayout (sensor_processing_list_layout, 0); - main_layout->addWidget (qvtk_widget_, 1); - - this->resize (1024, 600); - this->setCentralWidget (central_widget); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MainWindow:: -~MainWindow () -{ - // exit Fotonic API - pcl::FotonicGrabber::exitAPI (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -createFileMenu () -{ - // File menu - QAction * exit_act = new QAction (tr ("E&xit"), this); - exit_act->setStatusTip (tr ("Closes the viewer")); - connect(exit_act, SIGNAL(triggered()), this, SLOT(close ())); - - QMenu * file_menu = this->menuBar ()->addMenu (tr ("&File")); - file_menu->addAction (exit_act); - - - // Process menu - QAction * add_filter_act = new QAction (tr ("Add &Filter"), this); - add_filter_act->setStatusTip (tr ("Adds a filter")); - connect(add_filter_act, SIGNAL (triggered ()), this, SLOT (addFilter ())); - - QMenu * process_menu = this->menuBar ()->addMenu (tr ("&Process")); - process_menu->addAction (add_filter_act); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -findConnectedDevices () -{ - connected_devices_.clear (); - - std::cerr << "Check for OpenNI devices..." << std::endl; - openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance(); - if (driver.getNumberDevices() > 0) - { - std::cerr << "Connected devices:" << std::endl; - for (unsigned device_idx = 0; device_idx < driver.getNumberDevices(); ++device_idx) - { - std::cout << " Device: " << device_idx + 1 << ", vendor: " << driver.getVendorName(device_idx) << ", product: " << driver.getProductName(device_idx) - << ", connected: " << driver.getBus(device_idx) << " @ " << driver.getAddress(device_idx) << ", serial number: \'" << driver.getSerialNumber(device_idx) << "\'" << endl; - - OpenNIDevice * device = new OpenNIDevice (); - device->device_id = device_idx + 1; - device->name = driver.getProductName (device_idx); - device->vendor = driver.getVendorName(device_idx); - device->serial_number = driver.getSerialNumber(device_idx); - - connected_devices_.push_back (device); - } - - } - else - std::cout << "No devices connected." << endl; - - - std::cerr << "Check for Fotonic devices..." << std::endl; - std::vector fotonic_devices = pcl::FotonicGrabber::enumDevices (); - for (int device_index = 0; device_index < fotonic_devices.size (); ++device_index) - { - FotonicDevice * device = new FotonicDevice (); - - device->device_info.iDeviceType = fotonic_devices[device_index].iDeviceType; - memcpy (device->device_info.szPath, fotonic_devices[device_index].szPath, sizeof (fotonic_devices[device_index].szPath[0])*512); - memcpy (device->device_info.szSerial, fotonic_devices[device_index].szSerial, sizeof (fotonic_devices[device_index].szSerial[0])*16); - memcpy (device->device_info.szShortName, fotonic_devices[device_index].szShortName, sizeof (fotonic_devices[device_index].szShortName[0])*32); - - std::cerr << "device id " << device_index << std::endl; - std::cerr << " device type: " << fotonic_devices[device_index].iDeviceType << std::endl; - std::cerr << " device path: " << fotonic_devices[device_index].szPath << std::endl; - std::cerr << " device serial: " << fotonic_devices[device_index].szSerial << std::endl; - std::cerr << " device short name: " << fotonic_devices[device_index].szShortName << std::endl; - - connected_devices_.push_back (device); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -selectedSensorChanged (int index) -{ - std::cerr << "selected sensor changed to " << index << std::endl; - - // stop old grabber - if (grabber_ != NULL) - { - if (grabber_->isRunning ()) - grabber_->stop (); - } - - // stop old grabber thread - if (grabber_thread_ != NULL) - { - disconnect (grabber_thread_, SIGNAL(cloudReceived (const pcl::PointCloud::ConstPtr)), this, SLOT(cloud_callback (const pcl::PointCloud::ConstPtr))); - grabber_thread_->terminate (); - - delete grabber_thread_; - grabber_thread_ = NULL; - } - - // delete old grabber - if (grabber_ != NULL) - { - delete grabber_; - grabber_ = NULL; - } - - if (index != 0) - { - if (connected_devices_[index-1]->device_type == OPENNI_DEVICE) - { - std::stringstream ss; - ss << "#" << reinterpret_cast (connected_devices_[index-1])->device_id; - - grabber_ = new pcl::OpenNIGrabber (ss.str ()); - - } - - if (connected_devices_[index-1]->device_type == FOTONIC_DEVICE) - { - grabber_ = new pcl::FotonicGrabber (reinterpret_cast (connected_devices_[index-1])->device_info); - } - - grabber_thread_ = new pcl::apps::optronic_viewer::OpenNIGrabber (grabber_); - grabber_thread_->start (); - connect (grabber_thread_, SIGNAL(cloudReceived (const pcl::PointCloud::ConstPtr)), this, SLOT(cloud_callback (const pcl::PointCloud::ConstPtr))); - - QTimer::singleShot (30, this, SLOT(refresh ())); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -refresh () -{ - QTime now; - now.start(); - - if (cloud_mutex_.try_lock ()) - { - // apply filters - pcl::PointCloud::ConstPtr cloud_in = cloud_; - pcl::PointCloud::Ptr cloud_out (new pcl::PointCloud ()); - for (int i = 0; i < active_cloud_filters_.size (); ++i) - { - active_cloud_filters_[i]->filter (cloud_in, cloud_out); - cloud_in = cloud_out; - cloud_out.reset (new pcl::PointCloud ()); - } - - // only update if cloud is not empty, otherwise the reset of the camera - // viewpoint won't work when initially selecting a sensor - if (!cloud_in->empty ()) - { - // visualize - if (!pcl_visualizer_->updatePointCloud (cloud_in, "OpenNICloud")) - { - pcl_visualizer_->addPointCloud (cloud_in, "OpenNICloud"); - pcl_visualizer_->resetCameraViewpoint ("OpenNICloud"); - } - } - cloud_mutex_.unlock (); - } - qvtk_widget_->GetRenderWindow ()->Render (); - - int elapsed_time = now.elapsed (); - int time = 30 - elapsed_time; - - std::cerr << "elapsed time: " << elapsed_time << std::endl; - - if (time < 0) - time = 0; - - QTimer::singleShot (time, this, SLOT(refresh ())); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -cloud_callback (const pcl::PointCloud::ConstPtr cloud) -{ - //std::cerr << "cloud received" << std::endl; - - if (cloud_mutex_.try_lock ()) - { - cloud_ = cloud; - cloud_mutex_.unlock (); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -addFilter () -{ - std::cerr << "add filter..." << std::endl; - - // open window to select new filter - pcl::apps::optronic_viewer::FilterWindow * filter_dialog = new pcl::apps::optronic_viewer::FilterWindow (filter_factories_, active_cloud_filters_); - filter_dialog->setWindowTitle (tr ("Add Filter...")); - - connect (filter_dialog, SIGNAL (filterCreated ()), this, SLOT (refreshFilterList ())); - - filter_dialog->show (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -updateFilter (QListWidgetItem * item) -{ - int id = processing_list_->row (item); - - QWizard * wizard = new QWizard (); - wizard->addPage (active_cloud_filters_[id]->getParameterPage ()); - wizard->show (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -filterSelectionChanged () -{ - std::cerr << "filter selection changed..." << std::endl; - - QList selected_items = processing_list_->selectedItems (); - - std::cerr << "number of selected items: " << selected_items.size () << std::endl; - - if (selected_items.size () != 0) - { - int row = processing_list_->row (selected_items[0]); - std::cerr << "selected filter: " << row << std::endl; - - if (row != 0) - up_->setEnabled (true); - else - up_->setEnabled (false); - - const int list_size = active_cloud_filters_.size (); - if (row != list_size-1) - down_->setEnabled (true); - else - down_->setEnabled (false); - - remove_->setEnabled (true); - } - else - { - up_->setEnabled (false); - down_->setEnabled (false); - remove_->setEnabled (false); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -moveFilterUp () -{ - std::cerr << "move filter up" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int change_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[change_id]; - active_cloud_filters_[change_id] = active_cloud_filters_[change_id-1]; - active_cloud_filters_[change_id-1] = tmp; - - refreshFilterList (); - - processing_list_->setCurrentRow (change_id-1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -moveFilterDown () -{ - std::cerr << "move filter down" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int change_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[change_id]; - active_cloud_filters_[change_id] = active_cloud_filters_[change_id+1]; - active_cloud_filters_[change_id+1] = tmp; - - refreshFilterList (); - - processing_list_->setCurrentRow (change_id+1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -removeFilter () -{ - std::cerr << "remove filter" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int remove_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[remove_id]; - active_cloud_filters_.erase (active_cloud_filters_.begin()+remove_id); - refreshFilterList (); - - cloud_mutex_.lock (); - delete tmp; - cloud_mutex_.unlock (); - - if (active_cloud_filters_.size () > remove_id) - processing_list_->setCurrentRow (remove_id); - else - processing_list_->setCurrentRow (remove_id-1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -refreshFilterList () -{ - processing_list_->clear (); - std::cerr << "filters: " << std::endl; - for (int i = 0; i < active_cloud_filters_.size (); ++i) - { - std::cerr << " " << active_cloud_filters_[i]->getName () << std::endl; - processing_list_->addItem (QString (active_cloud_filters_[i]->getName ().c_str ())); - } -} diff --git a/apps/optronic_viewer/src/openni_grabber.cpp b/apps/optronic_viewer/src/openni_grabber.cpp deleted file mode 100644 index 44ea38c0fe4..00000000000 --- a/apps/optronic_viewer/src/openni_grabber.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -OpenNIGrabber (pcl::Grabber * grabber) - : QThread () - , grabber_ (grabber) -{ - qRegisterMetaType::ConstPtr> ("pcl::PointCloud::ConstPtr"); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -~OpenNIGrabber () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -run () -{ - std::cerr << "run grabber thread..." << std::endl; - boost::function::ConstPtr & cloud) > f = - boost::bind (&pcl::apps::optronic_viewer::OpenNIGrabber::cloudCallback, this, _1); - boost::signals2::connection c1 = grabber_->registerCallback (f); - grabber_->start (); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -cloudCallback (const pcl::PointCloud::ConstPtr & cloud) -{ - //std::cerr << "[grabber thread] cloud received.." << std::endl; - emit cloudReceived (cloud); -} - - diff --git a/cmake/Modules/FindFZAPI.cmake b/cmake/Modules/FindFZAPI.cmake deleted file mode 100644 index b4de99f468b..00000000000 --- a/cmake/Modules/FindFZAPI.cmake +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Find Fotonic FZAPI -# -# This sets the following variables: -# FZAPI_FOUND - True if FZAPI was found. -# FZAPI_INCLUDE_DIRS - Directories containing the FZAPI include files. -# FZAPI_LIBRARIES - Libraries needed to use FZAPI. - -if(FZ_API_DIR) - # Find include dirs - find_path(FZAPI_INCLUDE_DIR fz_api.h - PATHS "${FZ_API_DIR}" NO_DEFAULT_PATH - DOC "Fotonic include directories") - - # Find libraries - find_library(FZAPI_LIBS fotonic_fz_api - HINTS "${FZ_API_DIR}/Release" NO_DEFAULT_PATH - DOC "Fotonic libraries") -else() - set(FZ_API_DIR "default value" CACHE FILEPATH "directory of Fotonic API") -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FZAPI DEFAULT_MSG - FZAPI_LIBS FZAPI_INCLUDE_DIRS) - diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt index 3fb117a3783..fb6bf248eed 100644 --- a/io/CMakeLists.txt +++ b/io/CMakeLists.txt @@ -121,16 +121,6 @@ endif() source_group("Image Headers" FILES ${IMAGE_INCLUDES}) source_group("Image Sources" FILES ${IMAGE_SOURCES}) -if(WITH_FZAPI) - set(FZAPI_GRABBER_INCLUDES - include/pcl/io/fotonic_grabber.h - ) - - set(FZAPI_GRABBER_SOURCES - src/fotonic_grabber.cpp - ) -endif() - if(WITH_ENSENSO) set(ENSENSO_GRABBER_INCLUDES include/pcl/io/ensenso_grabber.h @@ -234,7 +224,6 @@ set(srcs ${OPENNI2_GRABBER_SOURCES} ${IMAGE_SOURCES} ${DINAST_GRABBER_SOURCES} - ${FZAPI_GRABBER_SOURCES} ${ENSENSO_GRABBER_SOURCES} ${DAVIDSDK_GRABBER_SOURCES} ${DSSDK_GRABBER_SOURCES} @@ -257,6 +246,7 @@ set(incs "include/pcl/${SUBSYS_NAME}/boost.h" "include/pcl/${SUBSYS_NAME}/eigen.h" "include/pcl/${SUBSYS_NAME}/debayer.h" + "include/pcl/${SUBSYS_NAME}/fotonic_grabber.h" "include/pcl/${SUBSYS_NAME}/file_io.h" "include/pcl/${SUBSYS_NAME}/auto_io.h" "include/pcl/${SUBSYS_NAME}/low_level_io.h" @@ -284,7 +274,6 @@ set(incs ${OPENNI2_GRABBER_INCLUDES} ${IMAGE_INCLUDES} ${DINAST_GRABBER_INCLUDES} - ${FZAPI_GRABBER_INCLUDES} ${ENSENSO_GRABBER_INCLUDES} ${DAVIDSDK_GRABBER_INCLUDES} ${DSSDK_GRABBER_INCLUDES} diff --git a/io/include/pcl/io/fotonic_grabber.h b/io/include/pcl/io/fotonic_grabber.h index 210cfb57061..04d276a621f 100644 --- a/io/include/pcl/io/fotonic_grabber.h +++ b/io/include/pcl/io/fotonic_grabber.h @@ -37,122 +37,4 @@ #pragma once -#include -#ifdef HAVE_FZAPI - -#include -#include -#include -#include - -#include - -#include - -#include -#include - -namespace pcl -{ - struct PointXYZ; - struct PointXYZRGB; - struct PointXYZRGBA; - struct PointXYZI; - template class PointCloud; - - - /** \brief Grabber for Fotonic devices - * \author Stefan Holzer - * \ingroup io - */ - class PCL_EXPORTS FotonicGrabber : public Grabber - { - public: - - typedef enum - { - Fotonic_Default_Mode = 0, // This can depend on the device. For now all devices (PSDK, Xtion, Kinect) its VGA@30Hz - } Mode; - - //define callback signature typedefs - typedef void (sig_cb_fotonic_point_cloud) (const boost::shared_ptr >&); - typedef void (sig_cb_fotonic_point_cloud_rgb) (const boost::shared_ptr >&); - typedef void (sig_cb_fotonic_point_cloud_rgba) (const boost::shared_ptr >&); - typedef void (sig_cb_fotonic_point_cloud_i) (const boost::shared_ptr >&); - - public: - /** \brief Constructor - * \param[in] device_id ID of the device, which might be a serial number, bus@address or the index of the device. - * \param[in] depth_mode the mode of the depth stream - * \param[in] image_mode the mode of the image stream - */ - FotonicGrabber (const FZ_DEVICE_INFO& device_info, - const Mode& depth_mode = Fotonic_Default_Mode, - const Mode& image_mode = Fotonic_Default_Mode); - - /** \brief virtual Destructor inherited from the Grabber interface. It never throws. */ - virtual ~FotonicGrabber () throw (); - - /** \brief Initializes the Fotonic API. */ - static void - initAPI (); - - /** \brief Exits the Fotonic API. */ - static void - exitAPI (); - - /** \brief Searches for available devices. */ - static std::vector - enumDevices (); - - /** \brief Start the data acquisition. */ - virtual void - start (); - - /** \brief Stop the data acquisition. */ - virtual void - stop (); - - /** \brief Check if the data acquisition is still running. */ - virtual bool - isRunning () const; - - virtual std::string - getName () const; - - /** \brief Obtain the number of frames per second (FPS). */ - virtual float - getFramesPerSecond () const; - - protected: - - /** \brief On initialization processing. */ - void - onInit (const FZ_DEVICE_INFO& device_info, const Mode& depth_mode, const Mode& image_mode); - - /** \brief Sets up an OpenNI device. */ - void - setupDevice (const FZ_DEVICE_INFO& device_info, const Mode& depth_mode, const Mode& image_mode); - - /** \brief Continuously asks for data from the device and publishes it if available. */ - void - processGrabbing (); - - boost::signals2::signal* point_cloud_signal_; - //boost::signals2::signal* point_cloud_i_signal_; - boost::signals2::signal* point_cloud_rgb_signal_; - boost::signals2::signal* point_cloud_rgba_signal_; - - protected: - bool running_; - - FZ_Device_Handle_t * fotonic_device_handle_; - - boost::thread grabber_thread_; - - public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW - }; - -} // namespace pcl -#endif // HAVE_FOTONIC +#error PCL does not support FZ-API anymore. See https://github.com/PointCloudLibrary/pcl/issues/2701 for more details. diff --git a/io/src/fotonic_grabber.cpp b/io/src/fotonic_grabber.cpp deleted file mode 100644 index d86084f851b..00000000000 --- a/io/src/fotonic_grabber.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2010-2011, Willow Garage, Inc. - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#ifdef HAVE_FZAPI - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -pcl::FotonicGrabber::FotonicGrabber (const FZ_DEVICE_INFO& device_info, const Mode& depth_mode, const Mode& image_mode) - : running_ (false) -{ - // initialize device - onInit (device_info, depth_mode, image_mode); - - point_cloud_signal_ = createSignal (); - point_cloud_rgb_signal_ = createSignal (); - point_cloud_rgba_signal_ = createSignal (); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -pcl::FotonicGrabber::~FotonicGrabber () throw () -{ - stop (); - - disconnect_all_slots (); - disconnect_all_slots (); - disconnect_all_slots (); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::initAPI () -{ - FZ_Init (); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::exitAPI () -{ - FZ_Exit (); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -std::vector -pcl::FotonicGrabber::enumDevices () -{ - // enumerate devices - int num_of_devices = 32; - FZ_DEVICE_INFO * device_infos = new FZ_DEVICE_INFO[num_of_devices]; - FZ_Result result = FZ_EnumDevices2 (device_infos, &num_of_devices); - - // put found devices into vector - std::vector devices; - for (int index = 0; index < num_of_devices; ++index) - { - FZ_DEVICE_INFO device_info; - device_info.iDeviceType = device_infos[index].iDeviceType; - memcpy (device_info.iReserved, device_infos[index].iReserved, sizeof (device_infos[index].iReserved[0])*64); - memcpy (device_info.szPath, device_infos[index].szPath, sizeof (device_infos[index].szPath[0])*512); - memcpy (device_info.szSerial, device_infos[index].szSerial, sizeof (device_infos[index].szSerial[0])*16); - memcpy (device_info.szShortName, device_infos[index].szShortName, sizeof (device_infos[index].szShortName[0])*32); - - devices.push_back (device_info); - } - - return (devices); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::start () -{ - FZ_CmdRespCode_t resp; - FZ_Result res = FZ_IOCtl (*fotonic_device_handle_, CMD_DE_SENSOR_START, NULL, 0, &resp, NULL, NULL); - - running_ = true; - - grabber_thread_ = boost::thread(&pcl::FotonicGrabber::processGrabbing, this); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::stop () -{ - running_ = false; - grabber_thread_.join (); - - FZ_Close (*fotonic_device_handle_); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool -pcl::FotonicGrabber::isRunning () const -{ - return (running_); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -std::string -pcl::FotonicGrabber::getName () const -{ - return std::string ("FotonicGrabber"); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -float -pcl::FotonicGrabber::getFramesPerSecond () const -{ - //return (static_cast (device_->getDepthOutputMode ().nFPS)); - return 0.0f; -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::onInit (const FZ_DEVICE_INFO& device_info, const Mode& depth_mode, const Mode& image_mode) -{ - setupDevice (device_info, depth_mode, image_mode); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::setupDevice (const FZ_DEVICE_INFO& device_info, const Mode& depth_mode, const Mode& image_mode) -{ - // Initialize device - fotonic_device_handle_ = new FZ_Device_Handle_t (); - - unsigned int flags = 0; - - FZ_Result res; - - res = FZ_Open (device_info.szPath, flags, fotonic_device_handle_); - - // set mode (resolution, fps..) - FZ_CmdRespCode_t resp; - unsigned short mode = DE_MODE_640X480_30; - res = FZ_IOCtl (*fotonic_device_handle_, CMD_DE_SET_MODE, &mode, sizeof(mode), &resp, NULL, NULL); - - res = FZ_SetFrameDataFmt (*fotonic_device_handle_, -1, -1, -1, -1, FZ_FMT_PIXEL_PER_PLANE+FZ_FMT_COMPONENT_Z+FZ_FMT_COMPONENT_XY+FZ_FMT_COMPONENT_B); -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::FotonicGrabber::processGrabbing () -{ - char * frame_buffer = new char [640*480*8]; - - bool continue_grabbing = running_; - while (continue_grabbing) - { - FZ_Result result = FZ_FrameAvailable (*fotonic_device_handle_); - //std::cerr << "FZ_FrameAvailable: " << result << std::endl; - - if (result == FZ_Success) - { - size_t length_in_byte = 640*480*10; - FZ_FRAME_HEADER frame_header; - - result = FZ_GetFrame (*fotonic_device_handle_, &frame_header, frame_buffer, &length_in_byte); - - if (result == FZ_Success) - { - //std::cerr << "frame: " << frame_header.framecounter << std::endl; - //std::cerr << " timestamp: " << frame_header.timestamp << std::endl; - //std::cerr << " format: " << frame_header.format << std::endl; - //std::cerr << " cols: " << frame_header.ncols << std::endl; - //std::cerr << " rows: " << frame_header.nrows << std::endl; - //std::cerr << " reportedframerate: " << frame_header.reportedframerate << std::endl; - //std::cerr << " bytesperpixel: " << frame_header.bytesperpixel << std::endl; - - const int width = frame_header.ncols; - const int height = frame_header.nrows; - - pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); - cloud->resize (width*height); - cloud->width = width; - cloud->height = height; - cloud->is_dense = false; - - short * ptr = (short*) frame_buffer; - - for (int row_index = 0; row_index < height; ++row_index) - { - //if(pixelformat == FZ_PIXELFORMAT_YUV422) - { - // YUV422 - FZ_YUV422_DOUBLE_PIXEL *p = (FZ_YUV422_DOUBLE_PIXEL*)ptr; - int col = 0; - for (int col_index = 0; col_index < width/2; ++col_index) - { - pcl::PointXYZRGBA & point0 = (*cloud) (col, row_index); - ++col; - pcl::PointXYZRGBA & point1 = (*cloud) (col, row_index); - ++col; - - float r,g,b,u,v,u1,v1,uv1; - - u = p[col_index].u - 128.0f; - v = p[col_index].v - 128.0f; - v1 = 1.13983f*v; - uv1 = -0.39465f*u - 0.58060f*v; - u1 = 0.03211f*u; - - r = p[col_index].y1 + v1; - g = p[col_index].y1 + uv1; - b = p[col_index].y1 + u1; - - r = std::min (255.0f, std::max (0.0f, r)); - g = std::min (255.0f, std::max (0.0f, g)); - b = std::min (255.0f, std::max (0.0f, b)); - - point0.r = unsigned(r); - point0.g = unsigned(g); - point0.b = unsigned(b); - - r = p[col_index].y2 + v1; - g = p[col_index].y2 + uv1; - b = p[col_index].y2 + u1; - - r = std::min (255.0f, std::max (0.0f, r)); - g = std::min (255.0f, std::max (0.0f, g)); - b = std::min (255.0f, std::max (0.0f, b)); - - point1.r = unsigned(r); - point1.g = unsigned(g); - point1.b = unsigned(b); - } - - ptr += width; - } - - for (int col_index = 0; col_index < width; ++col_index) - { - pcl::PointXYZRGBA & point = (*cloud) (col_index, row_index); - - short z = *ptr; - - point.z = static_cast (z) / 1000.0f; - - ++ptr; - } - - for (int col_index = 0; col_index < width; ++col_index) - { - pcl::PointXYZRGBA & point = (*cloud) (col_index, row_index); - - short x = *ptr; - ++ptr; - - point.x = -static_cast (x) / 1000.0f; - } - - for (int col_index = 0; col_index < width; ++col_index) - { - pcl::PointXYZRGBA & point = (*cloud) (col_index, row_index); - - short y = *ptr; - ++ptr; - - point.y = static_cast (y) / 1000.0f; - } - } - - // publish cloud - if (num_slots () > 0) - { - point_cloud_rgba_signal_->operator() (cloud); - } - if (num_slots () > 0) - { - pcl::PointCloud::Ptr tmp_cloud (new pcl::PointCloud ()); - cloud->resize (width*height); - cloud->width = width; - cloud->height = height; - cloud->is_dense = false; - - pcl::copyPointCloud (*cloud, *tmp_cloud); - - point_cloud_rgb_signal_->operator() (tmp_cloud); - } - if (num_slots () > 0) - { - pcl::PointCloud::Ptr cloud_tmp (new pcl::PointCloud ()); - cloud->resize (width*height); - cloud->width = width; - cloud->height = height; - cloud->is_dense = false; - - pcl::copyPointCloud (*cloud, *cloud_tmp); - - point_cloud_signal_->operator() (cloud_tmp); - } - - } - } - else - boost::this_thread::sleep (boost::posix_time::milliseconds(1)); - - continue_grabbing = running_; - } -} - - -#endif diff --git a/pcl_config.h.in b/pcl_config.h.in index efe1b1ad65c..93602da0b30 100644 --- a/pcl_config.h.in +++ b/pcl_config.h.in @@ -32,8 +32,6 @@ #cmakedefine HAVE_CUDA 1 -#cmakedefine HAVE_FZAPI 1 - #cmakedefine HAVE_ENSENSO 1 #cmakedefine HAVE_DAVIDSDK 1