![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <ecvIsolines.h>
Public Member Functions | |
| Isolines (int w, int h) | |
| Default constructor. More... | |
| void | setThreshold (T t) |
| Sets isoline value to trace. More... | |
| int | find (const T *in) |
| Find isolines. More... | |
| int | getNumContours () const |
| Returns the number of found contours. More... | |
| int | getContourLength (int contour) const |
| Returns the length of a given contour. More... | |
| bool | isContourClosed (int contour) const |
| Returns whether a given contour is closed or not. More... | |
| void | getContourPoint (int contour, size_t index, double &x, double &y) const |
| Returns the given point (x,y) of a given contour. More... | |
| double | measureArea (int contour) const |
| Measures the area delineated by a given contour. More... | |
| double | measurePerimeter (int contour) const |
| Measures the perimeter of a given contour. More... | |
| void | createOnePixelBorder (T *in, T borderval) const |
| Creates a single pixel, 0-valued border around the grid. More... | |
| double | getContourX (int contour, int v) const |
| double | getContourY (int contour, int v) const |
| double | measureCurvature (int contour, int i) const |
| void | findAreas (int window, std::vector< double > &tips) |
| void | findRoundedCorners (int window, std::vector< double > &tips) |
| int | getMaxContour () const |
| bool | computeBoundingBoxes () |
| double | getBBMinX (int contour) const |
| double | getBBMaxX (int contour) const |
| double | getBBMinY (int contour) const |
| double | getBBMaxY (int contour) const |
| bool | contains (int k, double x, double y) const |
| bool | containsContour (int k1, int k2) |
| bool | containsBoundingBox (int k, double minx, double miny, double maxx, double maxy) const |
| bool | contains (const std::vector< double > &polyx, const std::vector< double > &polyy, double x, double y) const |
| bool | bbIntersect (int k1, int k2) const |
| bool | bbContainsBB (int k1, int k2) const |
| double | bbArea (int k) const |
| double | getBBCenterX (int k) const |
| double | getBBCenterY (int k) const |
Protected Types | |
| enum | ConfigurationCodes { CASE0 = 0, CASE1 = 1, CASE2 = 2, CASE3 = 3, CASE4 = 4, CASE5 = 5, CASE6 = 6, CASE7 = 7, CASE8 = 8, CASE9 = 9, CASE10 = 10, CASE11 = 11, CASE12 = 12, CASE13 = 13, CASE14 = 14, CASE15 = 15, VISITED = 16 } |
| 2x2 cell configuration codes More... | |
| enum | Edges { NONE = -1, TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3 } |
| Entry/exit edges. More... | |
Protected Member Functions | |
| void | preCodeImage (const T *in) |
| Computes a code for each group of 4x4 cells. More... | |
| void | endContour (bool closed, bool alternatePath) |
| int | findIsolines (const T *in) |
| Searches image for contours from topleft to bottomright corners. More... | |
| double | LERP (T A, T B) const |
| LERP between two values. More... | |
| int | getLastIndex () const |
| void | setContourX (int contour, int v, double x) |
| void | setContourY (int contour, int v, double y) |
| int | getValidIndex (int contour, int v) const |
| double | measureArea (int contour, int first, int last) const |
| double | measureMeanX (int contour) const |
| double | measureMeanY (int contour) const |
| double | measurePerimeter (int contour, int first, int last) const |
| double | measureNormalX (int contour, int i) const |
| double | measureNormalY (int contour, int i) const |
| double | measureNormalY (int contour, int first, int last) const |
| double | measureNormalX (int contour, int first, int last) const |
| double | measureAngleChange (int contour, int first, int last) const |
| int | ixy (int x, int y) const |
| double | measureDistance (int contour, int first, int second) const |
| double | measureLength (int contour, int i) const |
| double | measureAngle (int contour, int i) const |
Static Protected Member Functions | |
| static int | wrap (int i, int lo, int hi) |
Protected Attributes | |
| std::vector< double > | m_minx |
| std::vector< double > | m_miny |
| std::vector< double > | m_maxx |
| std::vector< double > | m_maxy |
| std::vector< int > | m_cd |
| std::vector< double > | m_contourX |
| std::vector< double > | m_contourY |
| std::vector< int > | m_contourLength |
| std::vector< int > | m_contourOrigin |
| std::vector< int > | m_contourIndexes |
| std::vector< bool > | m_contourClosed |
| int | m_w |
| int | m_h |
| int | m_numContours |
| T | m_threshold |
Transcription of FindIsolines.java for C++
Fast implementation of marching squares
AUTHOR: Murphy Stein, Greg Borenstein New York University CREATED: Jan-Sept 2012 MODIFIED: Dec 2014 (DGM)
LICENSE: BSD
Copyright (c) 2012 New York University. All rights reserved.
Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by New York Univserity. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED `‘AS IS’' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. This is a fast implementation of the marching squares algorithm for finding isolines (lines of equal color) in an image.
|
protected |
|
protected |
Default constructor.
References Isolines< T >::m_cd.
|
inline |
|
inline |
|
inline |
References Isolines< T >::getBBMaxX(), Isolines< T >::getBBMaxY(), Isolines< T >::getBBMinX(), and Isolines< T >::getBBMinY().
Referenced by Isolines< T >::containsContour().
|
inline |
|
inline |
|
inline |
References Isolines< T >::getContourLength(), Isolines< T >::getContourX(), Isolines< T >::getContourY(), x, and y.
Referenced by Isolines< T >::containsBoundingBox(), and Isolines< T >::containsContour().
|
inline |
References Isolines< T >::contains().
|
inline |
|
inline |
Creates a single pixel, 0-valued border around the grid.
Referenced by ccRasterizeTool::generateContours().
|
inlineprotected |
|
inline |
Find isolines.
Referenced by ccRasterizeTool::generateContours().
|
inline |
|
inlineprotected |
Searches image for contours from topleft to bottomright corners.
|
inline |
|
inline |
References Isolines< T >::getBBMaxX(), and Isolines< T >::getBBMinX().
|
inline |
References Isolines< T >::getBBMaxY(), and Isolines< T >::getBBMinY().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the length of a given contour.
References Isolines< T >::m_contourLength.
Referenced by Isolines< T >::computeBoundingBoxes(), Isolines< T >::contains(), Isolines< T >::findAreas(), Isolines< T >::findRoundedCorners(), ccRasterizeTool::generateContours(), Isolines< T >::getContourPoint(), Isolines< T >::getMaxContour(), Isolines< T >::measureArea(), Isolines< T >::measureMeanX(), Isolines< T >::measureMeanY(), and Isolines< T >::measurePerimeter().
|
inline |
Returns the given point (x,y) of a given contour.
References Isolines< T >::getContourLength(), Isolines< T >::getContourX(), Isolines< T >::getContourY(), x, and y.
|
inline |
References Isolines< T >::m_contourLength, Isolines< T >::m_contourOrigin, Isolines< T >::m_contourX, and Isolines< T >::wrap().
Referenced by Isolines< T >::contains(), ccRasterizeTool::generateContours(), Isolines< T >::getContourPoint(), Isolines< T >::measureAngle(), Isolines< T >::measureArea(), Isolines< T >::measureDistance(), Isolines< T >::measureMeanX(), and Isolines< T >::measureNormalY().
|
inline |
References Isolines< T >::m_contourLength, Isolines< T >::m_contourOrigin, Isolines< T >::m_contourY, and Isolines< T >::wrap().
Referenced by Isolines< T >::contains(), ccRasterizeTool::generateContours(), Isolines< T >::getContourPoint(), Isolines< T >::measureAngle(), Isolines< T >::measureArea(), Isolines< T >::measureDistance(), Isolines< T >::measureMeanY(), and Isolines< T >::measureNormalX().
|
inlineprotected |
|
inline |
References Isolines< T >::getContourLength(), and Isolines< T >::m_numContours.
|
inline |
Returns the number of found contours.
References Isolines< T >::m_numContours.
Referenced by Isolines< T >::computeBoundingBoxes(), and Isolines< T >::getLastIndex().
|
inlineprotected |
|
inline |
Returns whether a given contour is closed or not.
References Isolines< T >::m_contourClosed.
Referenced by ccRasterizeTool::generateContours().
|
inlineprotected |
References Isolines< T >::m_w, x, and y.
|
inlineprotected |
LERP between two values.
References Isolines< T >::m_threshold.
|
inlineprotected |
References Isolines< T >::getContourX(), and Isolines< T >::getContourY().
Referenced by Isolines< T >::measureCurvature().
|
inlineprotected |
|
inline |
Measures the area delineated by a given contour.
References Isolines< T >::getContourLength().
Referenced by Isolines< T >::findAreas(), and Isolines< T >::findRoundedCorners().
|
inlineprotected |
|
inline |
References Isolines< T >::measureAngle(), and Isolines< T >::measureLength().
|
inlineprotected |
References Isolines< T >::getContourX(), and Isolines< T >::getContourY().
Referenced by Isolines< T >::measurePerimeter().
|
inlineprotected |
References Isolines< T >::m_contourLength, Isolines< T >::m_contourOrigin, Isolines< T >::m_contourX, Isolines< T >::m_contourY, and Isolines< T >::wrap().
Referenced by Isolines< T >::measureCurvature(), Isolines< T >::measureNormalX(), Isolines< T >::measureNormalY(), and Isolines< T >::measurePerimeter().
|
inlineprotected |
References Isolines< T >::getContourLength(), and Isolines< T >::getContourX().
|
inlineprotected |
References Isolines< T >::getContourLength(), and Isolines< T >::getContourY().
|
inlineprotected |
References Isolines< T >::measureNormalX().
|
inlineprotected |
References Isolines< T >::getContourY(), and Isolines< T >::measureLength().
Referenced by Isolines< T >::measureNormalX().
|
inlineprotected |
References Isolines< T >::measureNormalY().
|
inlineprotected |
References Isolines< T >::getContourX(), and Isolines< T >::measureLength().
Referenced by Isolines< T >::measureNormalY().
|
inline |
Measures the perimeter of a given contour.
References Isolines< T >::getContourLength().
Referenced by Isolines< T >::findRoundedCorners().
|
inlineprotected |
|
inlineprotected |
Computes a code for each group of 4x4 cells.
The code depends only on whether each of four corners is above or below threshold.
|
inlineprotected |
|
inlineprotected |
|
inline |
Sets isoline value to trace.
References Isolines< T >::m_threshold.
Referenced by ccRasterizeTool::generateContours().
|
inlinestaticprotected |
|
protected |
Referenced by Isolines< T >::Isolines().
|
protected |
Referenced by Isolines< T >::endContour(), and Isolines< T >::isContourClosed().
|
protected |
Referenced by Isolines< T >::endContour().
|
protected |
|
protected |
Referenced by Isolines< T >::computeBoundingBoxes(), Isolines< T >::endContour(), Isolines< T >::getContourX(), Isolines< T >::getContourY(), Isolines< T >::getLastIndex(), Isolines< T >::getValidIndex(), Isolines< T >::measureLength(), Isolines< T >::setContourX(), and Isolines< T >::setContourY().
|
protected |
|
protected |
|
protected |
Referenced by Isolines< T >::findAreas(), and Isolines< T >::findRoundedCorners().
|
protected |
Referenced by Isolines< T >::computeBoundingBoxes(), and Isolines< T >::getBBMaxX().
|
protected |
Referenced by Isolines< T >::computeBoundingBoxes(), and Isolines< T >::getBBMaxY().
|
protected |
Referenced by Isolines< T >::computeBoundingBoxes(), and Isolines< T >::getBBMinX().
|
protected |
Referenced by Isolines< T >::computeBoundingBoxes(), and Isolines< T >::getBBMinY().
|
protected |
|
protected |
Referenced by Isolines< T >::LERP(), and Isolines< T >::setThreshold().
|
protected |
Referenced by Isolines< T >::findAreas(), Isolines< T >::findRoundedCorners(), and Isolines< T >::ixy().