mirror of https://github.com/CGAL/cgal
Added Gyroviz "Remove outliers wrt cameras cone angle" algorithm.
This commit is contained in:
parent
118556d83f
commit
f13c455085
|
|
@ -19,7 +19,7 @@ CDialogOptions::CDialogOptions(CWnd* pParent /*=NULL*/)
|
|||
, m_dr_sizing(0)
|
||||
, m_contouring_value(0)
|
||||
, m_number_of_neighbours(0)
|
||||
, m_outlier_percentage(0)
|
||||
, m_threshold_percent_avg_knn_sq_dst(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,8 @@ void CDialogOptions::DoDataExchange(CDataExchange* pDX)
|
|||
CDialog::DoDataExchange(pDX);
|
||||
|
||||
// processing
|
||||
DDX_Text(pDX,IDC_EDIT_OUTLIER_PERCENTAGE,m_outlier_percentage);
|
||||
DDX_Text(pDX,IDC_EDIT_MIN_CAMERAS_CONE_ANGLE, m_min_cameras_cone_angle);
|
||||
DDX_Text(pDX,IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,m_threshold_percent_avg_knn_sq_dst);
|
||||
|
||||
DDX_Text(pDX,IDC_EDIT_SM_ANGLE,m_sm_angle);
|
||||
DDX_Text(pDX,IDC_EDIT_SM_RADIUS,m_sm_radius);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ public:
|
|||
double m_dr_sizing;
|
||||
double m_contouring_value;
|
||||
unsigned int m_number_of_neighbours;
|
||||
public:
|
||||
double m_outlier_percentage;
|
||||
double m_min_cameras_cone_angle; // Outliers threshold
|
||||
int m_threshold_percent_avg_knn_sq_dst; // Threshold corresponding to the number of points to be removed
|
||||
};
|
||||
|
|
|
|||
|
|
@ -123,8 +123,10 @@ BEGIN
|
|||
END
|
||||
POPUP "&Processing"
|
||||
BEGIN
|
||||
MENUITEM "Remove outliers", ID_PROCESSING_REMOVEOUTLIERS
|
||||
MENUITEM "Smooth using jet fitting", ID_ALGORITHMS_SMOOTHUSINGJETFITTING
|
||||
MENUITEM "Outliers Removal wrt Cameras Cone Angle (Gyroviz)", ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_CAMERAS_CONE_ANGLE
|
||||
MENUITEM "Outliers Removal wrt Distance", ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_AVG_KNN_SQ_DIST
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Smooth using Jet Fitting", ID_ALGORITHMS_SMOOTHUSINGJETFITTING
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Estimate Normals Direction by PCA", ID_ALGORITHMS_ESTIMATENORMALSBYPCA
|
||||
MENUITEM "Estimate Normals Direction by Jet Fitting", ID_ALGORITHMS_ESTIMATENORMALBYJETFITTING
|
||||
|
|
@ -464,35 +466,37 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
|
|||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG_OPTIONS DIALOGEX 0, 0, 382, 121
|
||||
IDD_DIALOG_OPTIONS DIALOGEX 0, 0, 352, 221
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Options"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,264,96,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,318,96,50,14
|
||||
GROUPBOX "Surface Mesh Generator",IDC_STATIC,126,6,114,84
|
||||
LTEXT "Angle",IDC_STATIC,138,30,24,8
|
||||
LTEXT "Radius",IDC_STATIC,138,48,24,8
|
||||
LTEXT "Distance",IDC_STATIC,138,66,30,8
|
||||
EDITTEXT IDC_EDIT_SM_ANGLE,174,27,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SM_RADIUS,174,42,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SM_DISTANCE,174,60,30,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Delaunay refinement",IDC_STATIC,246,6,132,84
|
||||
LTEXT "Shell size",IDC_STATIC,264,27,48,8
|
||||
LTEXT "Sizing",IDC_STATIC,264,45,48,8
|
||||
LTEXT "Max #Steiner",IDC_STATIC,264,63,44,8
|
||||
EDITTEXT IDC_EDIT_DR_SHELL_SIZE,318,24,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DR_SIZING,318,39,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DR_MAXV,318,57,52,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Contouring",IDC_STATIC,6,72,114,42
|
||||
LTEXT "Value",IDC_STATIC,18,96,24,8
|
||||
EDITTEXT IDC_EDIT_CONTOURING_VALUE,54,93,30,12,ES_AUTOHSCROLL
|
||||
LTEXT "# of neighbours",IDC_STATIC,12,15,51,8
|
||||
EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,70,12,30,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Processing",IDC_STATIC,6,30,114,36
|
||||
LTEXT "Outliers (%)",IDC_STATIC,18,45,54,8
|
||||
EDITTEXT IDC_EDIT_OUTLIER_PERCENTAGE,78,42,30,12,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,222,198,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,276,198,50,14
|
||||
GROUPBOX "Surface Mesh Generator",IDC_STATIC,180,90,156,96
|
||||
LTEXT "Angle",IDC_STATIC,192,114,24,8
|
||||
LTEXT "Radius",IDC_STATIC,192,138,24,8
|
||||
LTEXT "Distance",IDC_STATIC,192,162,30,8
|
||||
EDITTEXT IDC_EDIT_SM_ANGLE,294,108,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SM_RADIUS,294,132,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_SM_DISTANCE,294,156,30,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Poisson",IDC_STATIC,12,90,144,96
|
||||
LTEXT "Shell size",IDC_STATIC,30,106,48,8
|
||||
LTEXT "Sizing",IDC_STATIC,30,127,48,8
|
||||
LTEXT "Max #Steiner",IDC_STATIC,30,145,44,8
|
||||
EDITTEXT IDC_EDIT_DR_SHELL_SIZE,92,104,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DR_SIZING,92,121,30,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_DR_MAXV,92,138,52,12,ES_AUTOHSCROLL
|
||||
LTEXT "Contouring Value",IDC_STATIC,30,164,55,8
|
||||
EDITTEXT IDC_EDIT_CONTOURING_VALUE,92,161,30,12,ES_AUTOHSCROLL
|
||||
LTEXT "# of neighbours",IDC_STATIC,30,38,51,8
|
||||
EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,92,36,30,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Processing",IDC_STATIC,180,12,156,60
|
||||
LTEXT "Min Cameras Angle (Gyroviz)",IDC_STATIC,192,30,93,8
|
||||
EDITTEXT IDC_EDIT_MIN_CAMERAS_CONE_ANGLE,294,24,30,12,ES_AUTOHSCROLL
|
||||
LTEXT "Outliers % wrt distance",IDC_STATIC,192,52,102,8
|
||||
EDITTEXT IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,294,48,30,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "General",IDC_STATIC,12,12,144,60
|
||||
END
|
||||
|
||||
|
||||
|
|
@ -507,9 +511,9 @@ BEGIN
|
|||
IDD_DIALOG_OPTIONS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 375
|
||||
RIGHTMARGIN, 345
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 114
|
||||
BOTTOMMARGIN, 214
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "PoissonDoc.h"
|
||||
#include "enriched_polyhedron.h"
|
||||
#include "surface_reconstruction_read_pwc.h"
|
||||
#include "remove_outliers_wrt_camera_cone_angle_3.h"
|
||||
|
||||
// CGAL
|
||||
//Warning: crash when using #define CGAL_C2T3_USE_POLYHEDRON
|
||||
|
|
@ -82,8 +83,10 @@ BEGIN_MESSAGE_MAP(CPoissonDoc, CDocument)
|
|||
ON_UPDATE_COMMAND_UI(ID_RECONSTRUCTION_DELAUNAYREFINEMENT, OnUpdateReconstructionDelaunayRefinement)
|
||||
ON_UPDATE_COMMAND_UI(ID_ALGORITHMS_REFINEINSHELL, OnUpdateAlgorithmsRefineInShell)
|
||||
ON_UPDATE_COMMAND_UI(ID_ALGORITHMS_EXTRAPOLATENORMALS, OnUpdateAlgorithmsExtrapolateNormals)
|
||||
ON_COMMAND(ID_PROCESSING_REMOVEOUTLIERS, OnRemoveOutliers)
|
||||
ON_UPDATE_COMMAND_UI(ID_PROCESSING_REMOVEOUTLIERS, OnUpdateRemoveOutliers)
|
||||
ON_COMMAND(ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_CAMERAS_CONE_ANGLE, OnAlgorithmsOutliersRemovalWrtCamerasConeAngle)
|
||||
ON_UPDATE_COMMAND_UI(ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_CAMERAS_CONE_ANGLE, OnUpdateAlgorithmsOutliersRemovalWrtCamerasConeAngle)
|
||||
ON_COMMAND(ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_AVG_KNN_SQ_DIST, OnOutliersRemovalWrtAvgKnnSqDist)
|
||||
ON_UPDATE_COMMAND_UI(ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_AVG_KNN_SQ_DIST, OnUpdateOutliersRemovalWrtAvgKnnSqDist)
|
||||
ON_COMMAND(ID_ANALYSIS_AVERAGE_SPACING, OnAnalysisAverageSpacing)
|
||||
ON_COMMAND(ID_ONE_STEP_POISSON_RECONSTRUCTION, OnOneStepPoissonReconstruction)
|
||||
ON_UPDATE_COMMAND_UI(ID_ONE_STEP_POISSON_RECONSTRUCTION, OnUpdateOneStepPoissonReconstruction)
|
||||
|
|
@ -121,11 +124,12 @@ CPoissonDoc::CPoissonDoc()
|
|||
// Surface mesher and marching tet common options
|
||||
m_contouring_value = 0.0; // 0 by default
|
||||
|
||||
// Normal estimation options
|
||||
// K-nearest neighbours options
|
||||
m_number_of_neighbours = 7; // by default
|
||||
|
||||
// Outlier removal
|
||||
m_outlier_percentage = 10.0;
|
||||
m_min_cameras_cone_angle = 0.03; // Outliers threshold = min angle of the cameras cone
|
||||
m_threshold_percent_avg_knn_sq_dst = 10; // Threshold corresponding to the number of points to be removed
|
||||
}
|
||||
|
||||
CPoissonDoc::~CPoissonDoc()
|
||||
|
|
@ -262,6 +266,9 @@ BOOL CPoissonDoc::OnOpenDocument(LPCTSTR lpszPathName)
|
|||
prompt_message("Unable to read file");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set options for Gyroviz file
|
||||
m_number_of_neighbours = 50;
|
||||
}
|
||||
// if unknown extension
|
||||
else
|
||||
|
|
@ -502,7 +509,8 @@ void CPoissonDoc::OnEditOptions()
|
|||
dlg.m_contouring_value = m_contouring_value;
|
||||
|
||||
dlg.m_number_of_neighbours = m_number_of_neighbours;
|
||||
dlg.m_outlier_percentage = m_outlier_percentage;
|
||||
dlg.m_min_cameras_cone_angle = m_min_cameras_cone_angle;
|
||||
dlg.m_threshold_percent_avg_knn_sq_dst = m_threshold_percent_avg_knn_sq_dst;
|
||||
|
||||
if(dlg.DoModal() == IDOK)
|
||||
{
|
||||
|
|
@ -518,7 +526,8 @@ void CPoissonDoc::OnEditOptions()
|
|||
|
||||
m_number_of_neighbours = dlg.m_number_of_neighbours;
|
||||
|
||||
m_outlier_percentage = dlg.m_outlier_percentage;
|
||||
m_min_cameras_cone_angle = dlg.m_min_cameras_cone_angle;
|
||||
m_threshold_percent_avg_knn_sq_dst = dlg.m_threshold_percent_avg_knn_sq_dst;
|
||||
|
||||
UpdateAllViews(NULL);
|
||||
EndWaitCursor();
|
||||
|
|
@ -859,7 +868,7 @@ void CPoissonDoc::OnAlgorithmsMarchingTetContouring()
|
|||
CGAL_assertion(m_poisson_function != NULL);
|
||||
|
||||
BeginWaitCursor();
|
||||
status_message("Marching tet contouring (%3.1lf%%)...",m_outlier_percentage);
|
||||
status_message("Marching tet contouring (%3.1lf%%)...",m_threshold_percent_avg_knn_sq_dst);
|
||||
double init = clock();
|
||||
|
||||
m_contour.clear(); // clear previous call
|
||||
|
|
@ -1008,10 +1017,42 @@ void CPoissonDoc::OnUpdateOneStepPoissonReconstruction(CCmdUI *pCmdUI)
|
|||
OnUpdateCreatePoissonTriangulation(pCmdUI);
|
||||
}
|
||||
|
||||
void CPoissonDoc::OnRemoveOutliers()
|
||||
// Remove vertices / cameras cone's angle is low
|
||||
void CPoissonDoc::OnAlgorithmsOutliersRemovalWrtCamerasConeAngle()
|
||||
{
|
||||
BeginWaitCursor();
|
||||
status_message("Remove outliers (%3.1lf%%)...",m_outlier_percentage);
|
||||
status_message("Remove outliers / cameras cone's angle is low...");
|
||||
double init = clock();
|
||||
|
||||
// todo: use mutating version when ready
|
||||
Point_set output;
|
||||
remove_outliers_wrt_camera_cone_angle_3(
|
||||
m_points.begin(), m_points.end(),
|
||||
std::back_inserter(output),
|
||||
m_min_cameras_cone_angle);
|
||||
m_points.clear();
|
||||
std::copy(output.begin(),output.end(),std::back_inserter(m_points));
|
||||
|
||||
status_message("Remove outliers / cameras cone's angle is low...done (%lf s)", duration(init));
|
||||
update_status();
|
||||
UpdateAllViews(NULL);
|
||||
EndWaitCursor();
|
||||
}
|
||||
|
||||
void CPoissonDoc::OnUpdateAlgorithmsOutliersRemovalWrtCamerasConeAngle(CCmdUI *pCmdUI)
|
||||
{
|
||||
CGAL_assertion(m_points.begin() != m_points.end());
|
||||
bool points_have_cameras = (m_points.begin()->cameras_begin() != m_points.begin()->cameras_end());
|
||||
pCmdUI->Enable(m_edit_mode == POINT_SET && points_have_cameras);
|
||||
}
|
||||
|
||||
// Remove outliers:
|
||||
// - compute average squared distance to the K nearest neighbors,
|
||||
// - remove threshold_percent worst points.
|
||||
void CPoissonDoc::OnOutliersRemovalWrtAvgKnnSqDist()
|
||||
{
|
||||
BeginWaitCursor();
|
||||
status_message("Remove outliers wrt average squared distance to knn...");
|
||||
double init = clock();
|
||||
|
||||
// todo: use mutating version when ready
|
||||
|
|
@ -1020,18 +1061,17 @@ void CPoissonDoc::OnRemoveOutliers()
|
|||
m_points.begin(), m_points.end(),
|
||||
std::back_inserter(output),
|
||||
m_number_of_neighbours,
|
||||
m_outlier_percentage);
|
||||
|
||||
m_threshold_percent_avg_knn_sq_dst);
|
||||
m_points.clear();
|
||||
std::copy(output.begin(),output.end(),std::back_inserter(m_points));
|
||||
|
||||
status_message("Remove outliers...done (%lf s)",duration(init));
|
||||
status_message("Remove outliers wrt average squared distance to knn...done (%lf s)", duration(init));
|
||||
update_status();
|
||||
UpdateAllViews(NULL);
|
||||
EndWaitCursor();
|
||||
}
|
||||
|
||||
void CPoissonDoc::OnUpdateRemoveOutliers(CCmdUI *pCmdUI)
|
||||
void CPoissonDoc::OnUpdateOutliersRemovalWrtAvgKnnSqDist(CCmdUI *pCmdUI)
|
||||
{
|
||||
pCmdUI->Enable(m_edit_mode == POINT_SET);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,11 +118,12 @@ private:
|
|||
// Surface mesher and marching tet common options
|
||||
double m_contouring_value;
|
||||
|
||||
// Normal estimation options
|
||||
// K-nearest neighbours options
|
||||
unsigned int m_number_of_neighbours;
|
||||
|
||||
// Outlier removal
|
||||
double m_outlier_percentage;
|
||||
double m_min_cameras_cone_angle; // Outliers threshold = min angle of the cameras cone
|
||||
int m_threshold_percent_avg_knn_sq_dst; // Threshold corresponding to the number of points to be removed
|
||||
|
||||
// Public methods
|
||||
public:
|
||||
|
|
@ -214,8 +215,10 @@ public:
|
|||
afx_msg void OnUpdateReconstructionDelaunayRefinement(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateAlgorithmsRefineInShell(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateAlgorithmsExtrapolateNormals(CCmdUI *pCmdUI);
|
||||
afx_msg void OnRemoveOutliers();
|
||||
afx_msg void OnUpdateRemoveOutliers(CCmdUI *pCmdUI);
|
||||
afx_msg void OnAlgorithmsOutliersRemovalWrtCamerasConeAngle();
|
||||
afx_msg void OnUpdateAlgorithmsOutliersRemovalWrtCamerasConeAngle(CCmdUI *pCmdUI);
|
||||
afx_msg void OnOutliersRemovalWrtAvgKnnSqDist();
|
||||
afx_msg void OnUpdateOutliersRemovalWrtAvgKnnSqDist(CCmdUI *pCmdUI);
|
||||
afx_msg void OnAnalysisAverageSpacing();
|
||||
afx_msg void OnOneStepPoissonReconstruction();
|
||||
afx_msg void OnUpdateOneStepPoissonReconstruction(CCmdUI *pCmdUI);
|
||||
|
|
|
|||
|
|
@ -287,6 +287,10 @@
|
|||
RelativePath=".\MainFrm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\orient_normals_wrt_cameras_3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Point_set_3.h"
|
||||
>
|
||||
|
|
@ -307,10 +311,18 @@
|
|||
RelativePath=".\PoissonView.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\RedirectIOToConsole.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RedirectIOToConsole.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\remove_outliers_wrt_camera_cone_angle_3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h"
|
||||
>
|
||||
|
|
@ -398,10 +410,6 @@
|
|||
RelativePath="..\..\..\include\CGAL\orient_normals_minimum_spanning_tree_3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\include\CGAL\orient_normals_wrt_cameras_3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\include\CGAL\Oriented_normal_3.h"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,13 @@
|
|||
// Copyright (c) 2007-08 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Pierre Alliez and Laurent Saboret
|
||||
// Author: Laurent Saboret
|
||||
|
||||
|
||||
#ifndef CGAL_ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
#define CGAL_ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
#ifndef ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
#define ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Oriented_normal_3.h>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
/// Orient a 3D point's normal w.r.t. the position of cameras
|
||||
/// that reconstructed the point by photogrammetry.
|
||||
|
|
@ -133,7 +114,5 @@ orient_normals_wrt_cameras_3(VertexIterator first, ///< range of vertices
|
|||
}
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
#endif // ORIENT_NORMALS_WRT_CAMERAS_3_H
|
||||
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
// Author : Nader Salman
|
||||
|
||||
#ifndef REMOVE_OUTLIERS_WRT_CAMERA_CONE_ANGLE_3_H
|
||||
#define REMOVE_OUTLIERS_WRT_CAMERA_CONE_ANGLE_3_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include "Gyroviz_point_3.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
/// Compute greatest camera angle for a single point.
|
||||
///
|
||||
/// @heading Parameters:
|
||||
/// @param Kernel Geometric traits class.
|
||||
/// @param InputIterator value_type is Point_3.
|
||||
///
|
||||
/// @return computed greatest camera angle.
|
||||
template < typename Kernel, typename CameraInputIterator >
|
||||
double compute_greatest_camera_angle_3(const typename Kernel::Point_3 position, CameraInputIterator first_camera,
|
||||
CameraInputIterator beyond_camera)
|
||||
{
|
||||
// geometric types
|
||||
typedef typename Kernel::FT FT;
|
||||
typedef typename Kernel::Point_3 Point;
|
||||
typedef typename Kernel::Vector_3 Vector;
|
||||
|
||||
std::vector<Point> cameras;
|
||||
std::copy(first_camera, beyond_camera, std::back_inserter(cameras));
|
||||
|
||||
// give a score to each vertex: the score will help detecting outliers
|
||||
FT greatest_camera_angle=0, v1_v2, n_v1, n_v2, intermediate_score;
|
||||
Vector v1, v2;
|
||||
|
||||
for(int i=0; i<cameras.size()-1; ++i)
|
||||
{
|
||||
for(int j=i+1; j<cameras.size(); ++j)
|
||||
{
|
||||
v1 = cameras[i] - position;
|
||||
v2 = cameras[j] - position;
|
||||
n_v1 = sqrt(v1.squared_length());
|
||||
n_v2 = sqrt(v2.squared_length());
|
||||
v1_v2 = v1 * v2; // scalar product
|
||||
intermediate_score = acos(v1_v2/(n_v1*n_v2));
|
||||
|
||||
if(intermediate_score > greatest_camera_angle)
|
||||
greatest_camera_angle = intermediate_score;
|
||||
}
|
||||
}
|
||||
return greatest_camera_angle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Remove outliers:
|
||||
/// - compute average squared distance to the K nearest neighbors,
|
||||
/// - percentage of points to remove.
|
||||
/// This variant requires the kernel.
|
||||
///
|
||||
/// Precondition: KNN >= 2.
|
||||
///
|
||||
/// @heading Parameters:
|
||||
/// @param InputIterator value_type is Gyroviz_point.
|
||||
/// @param OutputIterator value_type is Gyroviz_point.
|
||||
/// @param Kernel Geometric traits class.
|
||||
///
|
||||
/// @return past-the-end output iterator.
|
||||
template <typename InputIterator,
|
||||
typename OutputIterator,
|
||||
typename Kernel
|
||||
>
|
||||
OutputIterator
|
||||
remove_outliers_wrt_camera_cone_angle_3(InputIterator first, ///< input points
|
||||
InputIterator beyond,
|
||||
OutputIterator output, ///< output points
|
||||
double min_cameras_cone_angle, ///< Remove vertices / cameras cone's angle < min_cameras_cone_angle
|
||||
const Kernel& /*kernel*/)
|
||||
{
|
||||
// geometric types
|
||||
typedef typename Kernel::FT FT;
|
||||
typedef typename Kernel::Point_3 Point;
|
||||
typedef Gyroviz_point_3<Kernel> Gyroviz_point_3;
|
||||
|
||||
|
||||
|
||||
// precondition: at least one element in the container.
|
||||
// to fix: should have at least three distinct points
|
||||
// but this is costly to check
|
||||
CGAL_precondition(first != beyond);
|
||||
|
||||
// precondition: at least 0
|
||||
CGAL_precondition(min_cameras_cone_angle >= 0);
|
||||
|
||||
// iterate over input points
|
||||
for(InputIterator point_it = first; point_it != beyond; point_it++)
|
||||
{
|
||||
FT greatest_camera_angle = compute_greatest_camera_angle_3<Kernel>(*point_it, point_it->cameras_begin(), point_it->cameras_end());
|
||||
if (greatest_camera_angle >= min_cameras_cone_angle)
|
||||
*output++ = *point_it;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/// Remove outliers:
|
||||
/// - compute average squared distance to the K nearest neighbors,
|
||||
/// - percentage of points to remove.
|
||||
/// This function is mutating the input point set.
|
||||
/// This variant requires the kernel.
|
||||
///
|
||||
/// Precondition: KNN >= 2.
|
||||
///
|
||||
/// @heading Parameters:
|
||||
/// @param ForwardIterator value_type is Point_3.
|
||||
/// @param Kernel Geometric traits class.
|
||||
template <typename ForwardIterator,
|
||||
typename Kernel
|
||||
>
|
||||
void
|
||||
remove_outliers_wrt_camera_cone_angle_3(ForwardIterator first, ///< input/output points
|
||||
ForwardIterator beyond,
|
||||
double min_cameras_cone_angle, ///< Remove vertices / cameras cone's angle < min_cameras_cone_angle
|
||||
const Kernel& /*kernel*/)
|
||||
{
|
||||
CGAL_precondition(false); // nyi
|
||||
}
|
||||
|
||||
|
||||
/// Remove outliers:
|
||||
/// - compute average squared distance to the K nearest neighbors,
|
||||
/// - percentage of points to remove.
|
||||
/// This variant deduces the kernel from iterator types.
|
||||
///
|
||||
/// Precondition: KNN >= 2.
|
||||
///
|
||||
/// @heading Parameters:
|
||||
/// @param InputIterator value_type is Point_3.
|
||||
/// @param OutputIterator value_type is Point_3.
|
||||
///
|
||||
/// @return past-the-end output iterator.
|
||||
template <typename InputIterator,
|
||||
typename OutputIterator
|
||||
>
|
||||
OutputIterator
|
||||
remove_outliers_wrt_camera_cone_angle_3(InputIterator first, ///< input points
|
||||
InputIterator beyond,
|
||||
OutputIterator output, ///< output points
|
||||
double min_cameras_cone_angle) ///< Remove vertices / cameras cone's angle < min_cameras_cone_angle
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
|
||||
typedef typename CGAL::Kernel_traits<Value_type>::Kernel Kernel;
|
||||
return remove_outliers_wrt_camera_cone_angle_3(first,beyond,output,min_cameras_cone_angle,Kernel());
|
||||
}
|
||||
|
||||
/// Remove outliers:
|
||||
/// - compute average squared distance to the K nearest neighbors,
|
||||
/// - percentage of points to remove.
|
||||
/// This function is mutating the input point set.
|
||||
/// This variant deduces the kernel from iterator types.
|
||||
///
|
||||
/// Precondition: KNN >= 2.
|
||||
///
|
||||
/// @heading Parameters:
|
||||
/// @param ForwardIterator value_type is Point_3.
|
||||
template <typename ForwardIterator>
|
||||
void
|
||||
remove_outliers_wrt_camera_cone_angle_3(ForwardIterator first, ///< input/output points
|
||||
ForwardIterator beyond,
|
||||
double min_cameras_cone_angle) ///< Remove vertices / cameras cone's angle < min_cameras_cone_angle
|
||||
{
|
||||
typedef typename std::iterator_traits<ForwardIterator>::value_type Value_type;
|
||||
typedef typename CGAL::Kernel_traits<Value_type>::Kernel Kernel;
|
||||
remove_outliers_wrt_camera_cone_angle_3(first,beyond,min_cameras_cone_angle,Kernel());
|
||||
}
|
||||
|
||||
|
||||
#endif // REMOVE_OUTLIERS_WRT_CAMERA_CONE_ANGLE_3_H
|
||||
|
||||
|
|
@ -18,7 +18,8 @@
|
|||
#define IDC_EDIT_DR_MAXV 1005
|
||||
#define IDC_EDIT_CONTOURING_VALUE 1006
|
||||
#define IDC_EDIT_NB_OF_NEIGHBOURS 1007
|
||||
#define IDC_EDIT_OUTLIER_PERCENTAGE 1008
|
||||
#define IDC_EDIT_MIN_CAMERAS_CONE_ANGLE 1008
|
||||
#define IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE 1010
|
||||
#define ID_RENDER_POINTS 32771
|
||||
#define ID_RENDER_NORMALS 32772
|
||||
#define ID_RENDER_DELAUNAYEDGES 32773
|
||||
|
|
@ -47,9 +48,10 @@
|
|||
#define ID_MODE_POINT_SET 32821
|
||||
#define ID_MODE_POISSON 32822
|
||||
#define ID_MODE_POISSON2 32823
|
||||
#define ID_ANALYSIS 32825
|
||||
#define ID_ANALYSIS_AVERAGESPACING 32826
|
||||
#define ID_PROCESSING_REMOVEOUTLIERS 32827
|
||||
#define ID_ANALYSIS 32824
|
||||
#define ID_ANALYSIS_AVERAGESPACING 32825
|
||||
#define ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_CAMERAS_CONE_ANGLE 32826
|
||||
#define ID_ALGORITHMS_OUTLIERS_REMOVAL_WRT_AVG_KNN_SQ_DIST 32827
|
||||
#define ID_ANALYSIS_AVERAGE_SPACING 32828
|
||||
#define ID_ONE_STEP_POISSON_RECONSTRUCTION 32829
|
||||
#define ID_RECONSTRUCTION_APSS_RECONSTRUCTION 32831
|
||||
|
|
@ -61,7 +63,7 @@
|
|||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 134
|
||||
#define _APS_NEXT_COMMAND_VALUE 32834
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_CONTROL_VALUE 1011
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue