ImFusion SDK 4.3
SquareHoughTransform Class Reference

#include <ImFusion/Base/SquareHoughTransform.h>

Hough transform for detecting squares. More...

+ Inheritance diagram for SquareHoughTransform:

Detailed Description

Hough transform for detecting squares.

Public Member Functions

 SquareHoughTransform (const MemImage *img, const vec4i &roi=vec4i::Zero(), const vec2i &sideLengthRange=vec2i::Zero())
 Takes the image on which to perform the hough transform, the ROI in which to search (x,y,width,height) and the side length range (min,max) The image is normalized before running the hough transformation.
 
void compute (float gradientThreshold=0.1f, float gradientsAboveThreshold=0.0f)
 Run hough detection The gradient threshold is wrt.
 
std::vector< vec3i > detections (float threshold=0.95f, bool combineDuplicates=true) const
 Return all detected squares in the form [top left x, top left y, side length].
 

Protected Attributes

std::unique_ptr< const TypedImage< float > > m_inputNorm
 Normalized input image.
 
std::unique_ptr< TypedImage< float > > m_detectionMatrix
 
vec4i m_roi
 ROI in which square must be located in the format (x,y,width,height), default is entire image.
 
vec2i m_sideLengthRange
 Allowed range for the side length of the square, default is a minimum of 10 pixels and up to the image size.
 

Member Function Documentation

◆ compute()

void compute ( float gradientThreshold = 0.1f,
float gradientsAboveThreshold = 0.0f )

Run hough detection The gradient threshold is wrt.

a normalized version of the image. When maxGradientsAboveThreshold is large 0 the threshold is increased until there are this many percent of gradients left. The gradient threshold is never decreased below gradientThreshold.

◆ detections()

std::vector< vec3i > detections ( float threshold = 0.95f,
bool combineDuplicates = true ) const

Return all detected squares in the form [top left x, top left y, side length].

The score is normalized with respect to the number of pixels on the border of the square, so that an ideal square has score 1. Due to numerical accuracy even for perfect data a smaller threshold shoud be used.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close