qCC version 2.13.alpha (Qt) - 31 May 2022
Main CloudCompare application (GUI & command line)
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Isolines< T > Class Template Reference

#include <ccIsolines.h>

Collaboration diagram for Isolines< T >:
Collaboration graph
[legend]

Public Member Functions

 Isolines (int w, int h)
 Default constructor.
 
void setThreshold (T t)
 Sets isoline value to trace.
 
int find (const T *in)
 Find isolines.
 
int getNumContours () const
 Returns the number of found contours.
 
int getContourLength (int contour) const
 Returns the length of a given contour.
 
bool isContourClosed (int contour) const
 Returns whether a given contour is closed or not.
 
void getContourPoint (int contour, size_t index, double &x, double &y) const
 Returns the given point (x,y) of a given contour.
 
double measureArea (int contour) const
 Measures the area delineated by a given contour.
 
double measurePerimeter (int contour) const
 Measures the perimeter of a given contour.
 
void createOnePixelBorder (T *in, T borderval) const
 Creates a single pixel, 0-valued border around the grid.
 
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
 
enum  Edges {
  NONE = -1 , TOP = 0 , RIGHT = 1 , BOTTOM = 2 ,
  LEFT = 3
}
 Entry/exit edges.
 

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.
 
double LERP (T A, T B) const
 LERP between two values.
 
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
 
m_threshold
 

Detailed Description

template<typename T>
class Isolines< T >

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.

Member Function Documentation

◆ preCodeImage()

template<typename T >
void Isolines< T >::preCodeImage ( const T *  in)
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.


The documentation for this class was generated from the following file: