ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvInnerRect2DFinder.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // CV_DB_LIB
11 #include <ecvBox.h>
12 #include <ecvGenericPointCloud.h>
13 
16 public:
19 
21  ccBox* process(ccGenericPointCloud* cloud, unsigned char zDim = 2);
22 
23 protected:
25  bool init(ccGenericPointCloud* cloud, unsigned char zDim);
26 
28  struct Rect {
29  Rect() : x0(0), y0(0), x1(0), y1(0) {}
30  Rect(double _x0, double _y0, double _x1, double _y1)
31  : x0(_x0), y0(_y0), x1(_x1), y1(_y1) {}
32 
33  double x0, y0, x1, y1;
34 
35  inline double width() const { return x1 - x0; }
36  inline double height() const { return y1 - y0; }
37  inline double area() const { return width() * height(); }
38  };
39 
41  void findBiggestRect(const Rect& rect, unsigned startIndex);
42 
45 
49  double m_maxArea;
50 
53 
55  unsigned char m_X;
57  unsigned char m_Y;
58 };
ccBox
Box (primitive)
Definition: ecvBox.h:16
ccInnerRect2DFinder::m_X
unsigned char m_X
X dimension.
Definition: ecvInnerRect2DFinder.h:55
cloudViewer::BoundingBoxTpl::getCenter
Vector3Tpl< T > getCenter() const
Returns center.
Definition: BoundingBox.h:164
cloudViewer::GenericCloud::size
virtual unsigned size() const =0
Returns the number of points.
ccInnerRect2DFinder::Rect::y1
double y1
Definition: ecvInnerRect2DFinder.h:33
ccBBox
Bounding box structure.
Definition: ecvBBox.h:25
ccGLMatrixTpl::setTranslation
void setTranslation(const Vector3Tpl< float > &Tr)
Sets translation (float version)
Definition: ecvGLMatrixTpl.h:836
CVLog.h
ccInnerRect2DFinder::ccInnerRect2DFinder
ccInnerRect2DFinder()
Default constructor.
Definition: ecvInnerRect2DFinder.cpp:16
ecvBox.h
ccInnerRect2DFinder::Rect::height
double height() const
Definition: ecvInnerRect2DFinder.h:36
CVLog::Error
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
ccInnerRect2DFinder::m_Y
unsigned char m_Y
Y dimension.
Definition: ecvInnerRect2DFinder.h:57
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
ccInnerRect2DFinder::Rect::y0
double y0
Definition: ecvInnerRect2DFinder.h:33
Vector3Tpl< PointCoordinateType >
ccInnerRect2DFinder::m_cloud
ccGenericPointCloud * m_cloud
Associated cloud.
Definition: ecvInnerRect2DFinder.h:52
ecvGenericPointCloud.h
ccInnerRect2DFinder::Rect::area
double area() const
Definition: ecvInnerRect2DFinder.h:37
cloudViewer::BoundingBoxTpl::isValid
bool isValid() const
Returns whether bounding box is valid or not.
Definition: BoundingBox.h:203
ccInnerRect2DFinder::process
ccBox * process(ccGenericPointCloud *cloud, unsigned char zDim=2)
Finds the biggest enclosed rectangle.
Definition: ecvInnerRect2DFinder.cpp:19
ccInnerRect2DFinder::Rect::Rect
Rect()
Definition: ecvInnerRect2DFinder.h:29
ccInnerRect2DFinder::Rect::Rect
Rect(double _x0, double _y0, double _x1, double _y1)
Definition: ecvInnerRect2DFinder.h:30
ccInnerRect2DFinder::m_boundingRect
Rect m_boundingRect
Global rectangle.
Definition: ecvInnerRect2DFinder.h:44
ccInnerRect2DFinder::Rect::x0
double x0
Definition: ecvInnerRect2DFinder.h:33
ccInnerRect2DFinder::init
bool init(ccGenericPointCloud *cloud, unsigned char zDim)
Initializes internal structures.
Definition: ecvInnerRect2DFinder.cpp:52
ccGLMatrix
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
cloudViewer::GenericIndexedCloud::getPoint
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.
ccInnerRect2DFinder::Rect::width
double width() const
Definition: ecvInnerRect2DFinder.h:35
ccInnerRect2DFinder::Rect
2D rectangle
Definition: ecvInnerRect2DFinder.h:28
ccInnerRect2DFinder::findBiggestRect
void findBiggestRect(const Rect &rect, unsigned startIndex)
Internal processs.
Definition: ecvInnerRect2DFinder.cpp:100
ccInnerRect2DFinder::m_maxArea
double m_maxArea
Inner rectangle max area.
Definition: ecvInnerRect2DFinder.h:49
cloudViewer::BoundingBoxTpl::getDiagVec
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Definition: BoundingBox.h:169
ccGenericPointCloud::getOwnBB
ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
Definition: ecvGenericPointCloud.cpp:139
X
void * X
Definition: SmallVector.cpp:45
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
Tuple3Tpl::u
Type u[3]
Definition: CVGeom.h:139
ccInnerRect2DFinder
Finds a the biggets enclosed rectangle in a point cloud (2D)
Definition: ecvInnerRect2DFinder.h:15
ccInnerRect2DFinder::m_maxRect
Rect m_maxRect
Inner rectangle.
Definition: ecvInnerRect2DFinder.h:47
ccInnerRect2DFinder::Rect::x1
double x1
Definition: ecvInnerRect2DFinder.h:33
ecvInnerRect2DFinder.h