Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions
HuginLines Namespace Reference

Classes

class  VerticalLine
 
class  InvertedMaskAccessor
 
struct  SingleLine
 a single line extracted from image More...
 

Typedefs

typedef std::vector< VerticalLineVerticalLineVector
 
typedef std::vector< SingleLineLines
 vector of extracted lines from image More...
 

Enumerations

enum  LineStatus {
  valid_line =0, valid_line_disabled, bad_length, bad_orientation,
  bad_curvature
}
 enumeration for different line status More...
 

Functions

template<class SrcImageIterator , class SrcAccessor , class DestImage >
double resize_image (const vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, DestImage &dest, int resize_dimension)
 
vigra::BImage * detectEdges (const vigra::UInt8RGBImage &input, const double scale, const double threshold, const unsigned int resize_dimension, double &size_factor)
 detect and mark edges in an edge image using Canny's algorithm More...
 
vigra::BImage * detectEdges (const vigra::BImage &input, const double scale, const double threshold, const unsigned int resize_dimension, double &size_factor)
 
double calculate_focal_length_pixels (double focal_length, double cropFactor, double width, double height)
 
Lines findLines (vigra::BImage &edge, double length_threshold, double focal_length, double crop_factor)
 find straightish non-crossing lines find straightish non-crossing lines in an edge map using 8-neighborhood operations. More...
 
void ScaleLines (HuginLines::Lines &lines, const double scale)
 scales the given lines with given factor use in conjugation with HuginLines::detectEdges to scale the lines to image space because edge image to scaled to smaller size for faster computation More...
 
HuginBase::CPVector GetControlPoints (const SingleLine &line, const unsigned int imgNr, const unsigned int lineNr, const unsigned int numberOfCtrlPoints)
 returns a HuginBase::CPVector with cps_per_lines More...
 
vigra::Point2D GetFootpoint (const vigra::Point2D &p, const vigra::Point2D &p1, const vigra::Point2D &p2, double &u)
 
vigra::Point2D GetFootpoint (const vigra::Point2D &p, const vigra::Point2D &p1, const vigra::Point2D &p2)
 
VerticalLine FitLine (SingleLine line)
 
VerticalLineVector FilterLines (Lines lines, double roll)
 
bool SortByError (const HuginBase::ControlPoint &cp1, const HuginBase::ControlPoint &cp2)
 
template<class ImageType >
HuginBase::CPVector _getVerticalLines (const HuginBase::Panorama &pano, const unsigned int imgNr, ImageType &image, vigra::BImage &mask, const unsigned int nrLines)
 
HuginBase::CPVector GetVerticalLines (const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::UInt8RGBImage &image, vigra::BImage &mask, const unsigned int nrLines)
 searches for vertical control points in given image More...
 
HuginBase::CPVector GetVerticalLines (const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::BImage &image, vigra::BImage &mask, const unsigned int nrLines)
 
vigra::BImage edgeMap2linePts (vigra::BImage &input)
 marks line point More...
 
float ccdist (int dx, int dy)
 
float eudist (int dx, int dy)
 
float scurv (vigra::Point2D &l, vigra::Point2D &m, vigra::Point2D &r)
 
void vcurv (vigra::Point2D &l, vigra::Point2D &m, vigra::Point2D &r, float &vx, float &vy)
 
static int lineFilter (std::vector< vigra::Point2D > &pts, int lmin, double flpix, double xcen, double ycen)
 
int linePts2lineList (vigra::BImage &img, int minsize, double flPix, Lines &lines)
 converts a linePts image to a list of lines More...
 

Typedef Documentation

typedef std::vector<SingleLine> HuginLines::Lines

vector of extracted lines from image

Definition at line 50 of file LinesTypes.h.

Definition at line 231 of file FindLines.cpp.

Enumeration Type Documentation

enumeration for different line status

Enumerator
valid_line 
valid_line_disabled 
bad_length 
bad_orientation 
bad_curvature 

Definition at line 33 of file LinesTypes.h.

Function Documentation

template<class ImageType >
HuginBase::CPVector HuginLines::_getVerticalLines ( const HuginBase::Panorama pano,
const unsigned int  imgNr,
ImageType image,
vigra::BImage &  mask,
const unsigned int  nrLines 
)

Definition at line 344 of file FindLines.cpp.

References HuginBase::Panorama::addCtrlPoint(), HuginBase::Panorama::addImage(), HuginBase::CalculateCPStatisticsError::calcCtrlPntsErrorStats(), HuginBase::SrcPanoImage::calcFocalLength(), HuginBase::PTools::Transform::createTransform(), DEG_TO_RAD, HuginBase::SrcPanoImage::deleteAllMasks(), vigra_ext::destImageRange(), detectEdges(), HuginBase::PanoramaOptions::EQUIRECTANGULAR, HuginBase::ControlPoint::error, FilterLines(), findLines(), HuginBase::Panorama::getCtrlPoints(), HuginBase::SrcPanoImage::getHeight(), HuginBase::PanoramaOptions::getHeight(), HuginBase::Panorama::getImage(), HuginBase::CalculateFitPanorama::getResultHeight(), HuginBase::CalculateFitPanorama::getResultHorizontalFOV(), HuginBase::PanoramaOptions::getROI(), HuginBase::Panorama::getSrcImage(), HuginBase::PanoramaOptions::getVFOV(), HuginBase::SrcPanoImage::getWidth(), HuginBase::ControlPoint::image1Nr, HuginBase::ControlPoint::image2Nr, vigra_ext::INTERP_CUBIC, vigra_ext::ROIImage< RemapImage, AlphaImage >::m_image, vigra_ext::ROIImage< RemapImage, AlphaImage >::m_mask, celeste::max(), MAX_RESIZE_DIM, celeste::min(), HuginBase::ControlPoint::mode, HuginBase::PTools::optimize(), HuginBase::PanoramaOptions::outputExposureValue, HuginBase::BaseSrcPanoImage::RECTILINEAR, HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage(), hugin_utils::roundi(), HuginBase::PanoramaAlgorithm::run(), HuginBase::PanoramaOptions::setHeight(), HuginBase::PanoramaOptions::setHFOV(), HuginBase::Panorama::setOptimizeVector(), HuginBase::Panorama::setOptions(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::setPanoImage(), HuginBase::PanoramaOptions::setProjection(), HuginBase::PanoramaOptions::setWidth(), SortByError(), hugin_utils::sqr(), vigra_ext::srcImage(), vigra_ext::srcImageRange(), HuginBase::PTools::Transform::transformImgCoord(), HuginBase::ControlPoint::X, HuginBase::ControlPoint::x1, HuginBase::ControlPoint::x2, HuginBase::ControlPoint::y1, and HuginBase::ControlPoint::y2.

Referenced by GetVerticalLines().

double HuginLines::calculate_focal_length_pixels ( double  focal_length,
double  cropFactor,
double  width,
double  height 
)

Definition at line 100 of file FindLines.cpp.

Referenced by findLines().

float HuginLines::ccdist ( int  dx,
int  dy 
)
inline

Definition at line 271 of file FindN8Lines.cpp.

References celeste::max(), and celeste::min().

Referenced by linePts2lineList().

IMPEX vigra::BImage * HuginLines::detectEdges ( const vigra::UInt8RGBImage &  input,
const double  scale,
const double  threshold,
const unsigned int  resize_dimension,
double &  size_factor 
)

detect and mark edges in an edge image using Canny's algorithm

Parameters
inputinput image, on which the algorithm should run
scalescale factor in pixel (precondition: scale > 0)
thresholdthreshold for edge detection algorithm (precondition: threshold > 0)
resize_dimensionmaximum dimension on which the algorithm should work
size_factorcontains the scale factor for transform from edge image to input image
Returns
image with the marked edges

Definition at line 76 of file FindLines.cpp.

References vigra_ext::destImage(), resize_image(), and vigra_ext::srcImageRange().

Referenced by _getVerticalLines(), and LensCalFrame::OnFindLines().

IMPEX vigra::BImage * HuginLines::detectEdges ( const vigra::BImage &  input,
const double  scale,
const double  threshold,
const unsigned int  resize_dimension,
double &  size_factor 
)

Definition at line 88 of file FindLines.cpp.

References vigra_ext::destImage(), resize_image(), and vigra_ext::srcImageRange().

vigra::BImage HuginLines::edgeMap2linePts ( vigra::BImage &  input)

marks line point

Parameters
inputinput image (should be black edges on white background)
Returns
image with marked lines (background = 0, end points = 1, interior points = 2)

Definition at line 43 of file FindN8Lines.cpp.

References vigra::omp::copyImage(), celeste::line, N8_bg, N8_end, and N8_mid.

Referenced by findLines().

float HuginLines::eudist ( int  dx,
int  dy 
)
inline

Definition at line 278 of file FindN8Lines.cpp.

VerticalLineVector HuginLines::FilterLines ( Lines  lines,
double  roll 
)
IMPEX HuginLines::Lines HuginLines::findLines ( vigra::BImage &  edge,
double  length_threshold,
double  focal_length,
double  crop_factor 
)

find straightish non-crossing lines find straightish non-crossing lines in an edge map using 8-neighborhood operations.

(Points on the edges of the image cannot be line points).

Parameters
edgeedge image (e.g. created with HuginLines::detectEdges
length_thresholdminimum length of a line, given in ratio to longest images dimension (0<length_threshold<1)
focal_lengthfocal length of the lens (used for estimate which curvature the lines can have)
crop_factorcrop factor of the camera/lens
Returns
the found lines as HuginLines::Lines, contains also the invalid lines (e.g. too short, too curved), use Lines[].status to get result

Definition at line 115 of file FindLines.cpp.

References calculate_focal_length_pixels(), edgeMap2linePts(), and linePts2lineList().

Referenced by _getVerticalLines(), and LensCalFrame::OnFindLines().

VerticalLine HuginLines::FitLine ( SingleLine  line)
IMPEX HuginBase::CPVector HuginLines::GetControlPoints ( const SingleLine &  line,
const unsigned int  imgNr,
const unsigned int  lineNr,
const unsigned int  numberOfCtrlPoints 
)

returns a HuginBase::CPVector with cps_per_lines

Parameters
lineline from which the control points should be created
imgNrnumber of the image in the HuginBase::Panorama class
lineNrnumber of the line to be created (must be >=3, line 1 and 2 are horizontal and vertical lines)
numberOfCtrlPointsnumber of control points to create
Returns
HuginBase::CPVector with all control points

Definition at line 141 of file FindLines.cpp.

References HuginLines::SingleLine::line.

Referenced by LensCalFrame::GetPanorama().

vigra::Point2D HuginLines::GetFootpoint ( const vigra::Point2D &  p,
const vigra::Point2D &  p1,
const vigra::Point2D &  p2,
double &  u 
)
vigra::Point2D HuginLines::GetFootpoint ( const vigra::Point2D &  p,
const vigra::Point2D &  p1,
const vigra::Point2D &  p2 
)

Definition at line 167 of file FindLines.cpp.

References GetFootpoint().

IMPEX HuginBase::CPVector HuginLines::GetVerticalLines ( const HuginBase::Panorama pano,
const unsigned int  imgNr,
vigra::UInt8RGBImage &  image,
vigra::BImage &  mask,
const unsigned int  nrLines 
)

searches for vertical control points in given image

Parameters
panopanorama object in which is searched
imgNrnumber of image in which should be searched
imagevigra image in which should be searched
nrLinemaximal number of lines to return
Returns
HuginBase::CPVector with all vertical control points

Definition at line 574 of file FindLines.cpp.

References _getVerticalLines().

Referenced by LoadGrayImageAndFindLines(), and LoadImageAndFindLines().

IMPEX HuginBase::CPVector HuginLines::GetVerticalLines ( const HuginBase::Panorama pano,
const unsigned int  imgNr,
vigra::BImage &  image,
vigra::BImage &  mask,
const unsigned int  nrLines 
)

Definition at line 579 of file FindLines.cpp.

References _getVerticalLines().

static int HuginLines::lineFilter ( std::vector< vigra::Point2D > &  pts,
int  lmin,
double  flpix,
double  xcen,
double  ycen 
)
static

Definition at line 316 of file FindN8Lines.cpp.

Referenced by linePts2lineList().

int HuginLines::linePts2lineList ( vigra::BImage &  img,
int  minsize,
double  flPix,
Lines &  lines 
)

converts a linePts image to a list of lines

Parameters
imglineimage
minsizeminimum length of line given in
flPixfocal length in pixel (determines the maximal allowed curvature of the line)
linesdetected lines
Returns
number of detected lines

Definition at line 395 of file FindN8Lines.cpp.

References bad_curvature, bad_length, bad_orientation, ccdist(), HuginLines::SingleLine::line, celeste::line, lineFilter(), N8_bg, N8_end, HuginLines::SingleLine::status, and valid_line.

Referenced by findLines().

template<class SrcImageIterator , class SrcAccessor , class DestImage >
double HuginLines::resize_image ( const vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
DestImage &  dest,
int  resize_dimension 
)

Definition at line 39 of file FindLines.cpp.

References vigra::omp::copyImage(), vigra_ext::destImage(), and vigra_ext::destImageRange().

Referenced by detectEdges().

IMPEX void HuginLines::ScaleLines ( Lines &  lines,
const double  scale 
)

scales the given lines with given factor use in conjugation with HuginLines::detectEdges to scale the lines to image space because edge image to scaled to smaller size for faster computation

Definition at line 130 of file FindLines.cpp.

Referenced by ImageLineList::ScaleLines().

float HuginLines::scurv ( vigra::Point2D &  l,
vigra::Point2D &  m,
vigra::Point2D &  r 
)
inline

Definition at line 287 of file FindN8Lines.cpp.

bool HuginLines::SortByError ( const HuginBase::ControlPoint cp1,
const HuginBase::ControlPoint cp2 
)

Definition at line 322 of file FindLines.cpp.

References HuginBase::ControlPoint::error.

Referenced by _getVerticalLines().

void HuginLines::vcurv ( vigra::Point2D &  l,
vigra::Point2D &  m,
vigra::Point2D &  r,
float &  vx,
float &  vy 
)
inline

Definition at line 296 of file FindN8Lines.cpp.