Wondercoll
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Typedefs | Functions | Variables
cvhough.cpp File Reference
#include "_cv.h"
#include "_cvlist.h"

Classes

struct  CvLinePolar
 

Macros

#define halfPi   ((float)(CV_PI*0.5))
 
#define Pi   ((float)CV_PI)
 
#define a0   0 /*-4.172325e-7f*/ /*(-(float)0x7)/((float)0x1000000); */
 
#define a1   1.000025f /*((float)0x1922253)/((float)0x1000000)*2/Pi; */
 
#define a2   -2.652905e-4f /*(-(float)0x2ae6)/((float)0x1000000)*4/(Pi*Pi); */
 
#define a3   -0.165624f /*(-(float)0xa45511)/((float)0x1000000)*8/(Pi*Pi*Pi); */
 
#define a4   -1.964532e-3f /*(-(float)0x30fd3)/((float)0x1000000)*16/(Pi*Pi*Pi*Pi); */
 
#define a5   1.02575e-2f /*((float)0x191cac)/((float)0x1000000)*32/(Pi*Pi*Pi*Pi*Pi); */
 
#define a6   -9.580378e-4f /*(-(float)0x3af27)/((float)0x1000000)*64/(Pi*Pi*Pi*Pi*Pi*Pi); */
 
#define _sin(x)   ((((((a6*(x) + a5)*(x) + a4)*(x) + a3)*(x) + a2)*(x) + a1)*(x) + a0)
 
#define _cos(x)   _sin(halfPi - (x))
 
#define hough_cmp_gt(l1, l2)   (aux[l1] > aux[l2])
 
#define _POINT(row, column)   (image_src[(row)*step+(column)])
 

Typedefs

typedef struct CvLinePolar CvLinePolar
 

Functions

 CV_FUNCNAME ("icvHoughLinesStandard")
 
 CV_ASSERT (CV_IS_MAT(img)&&CV_MAT_TYPE(img->type)==CV_8UC1)
 
 CV_CALL (accum=(int *) cvAlloc(sizeof(accum[0])*(numangle+2)*(numrho+2)))
 
 CV_CALL (sort_buf=(int *) cvAlloc(sizeof(accum[0])*numangle *numrho))
 
 CV_CALL (tabSin=(float *) cvAlloc(sizeof(tabSin[0])*numangle))
 
 CV_CALL (tabCos=(float *) cvAlloc(sizeof(tabCos[0])*numangle))
 
 memset (accum, 0, sizeof(accum[0])*(numangle+2)*(numrho+2))
 
 for (ang=0, n=0;n< numangle;ang+=theta, n++)
 
 for (i=0;i< height;i++) for(j=0
 
 icvHoughSortDescent32s (sort_buf, total, accum)
 
CV_IMPL CvSeqcvHoughLines2 (CvArr *src_image, void *lineStorage, int method, double rho, double theta, int threshold, double param1, double param2)
 
CV_IMPL CvSeqcvHoughCircles (CvArr *src_image, void *circle_storage, int method, double dp, double min_dist, double param1, double param2, int min_radius, int max_radius)
 

Variables

static float rho
 
static float float theta
 
static float float int threshold
 
static float float int CvSeqlines
 
static float float int CvSeq int linesMax
 
intsort_buf =0
 
floattabSin = 0
 
floattabCos = 0
 
 __BEGIN__
 
const ucharimage = img->data.ptr
 
int step = img->step
 
int width = img->cols
 
int height = img->rows
 
int numangle = cvRound(CV_PI / theta)
 
int numrho = cvRound(((width + height) * 2 + 1) / rho)
 
int total = 0
 
float ang
 
int r
 
int n
 
int i
 
int j
 
float irho = 1 / rho
 
double scale = 1./(numrho+2)
 
j< width;j++){if(image[i *step+j]!=0)
for(n=0;n< numangle;n++){r=cvRound(j
*tabCos[n]+i *tabSin[n]);r+=(numrho-1)/2;accum[(n+1)*(numrho+2)+r+1]++;}}for(r=0;r
< numrho;r++) for(n=0;n
< numangle;n++){int base=(n+1)*(numrho+2)+r+1;if(accum[base] >
threshold &&accum[base] >
accum[base-1]&&accum[base] >
=accum[base+1]&&accum[base] >
accum &&[base-numrho-2] 
accum [base]
 
 __END__
 

Macro Definition Documentation

#define _cos (   x)    _sin(halfPi - (x))
#define _POINT (   row,
  column 
)    (image_src[(row)*step+(column)])
#define _sin (   x)    ((((((a6*(x) + a5)*(x) + a4)*(x) + a3)*(x) + a2)*(x) + a1)*(x) + a0)
#define a0   0 /*-4.172325e-7f*/ /*(-(float)0x7)/((float)0x1000000); */
#define a1   1.000025f /*((float)0x1922253)/((float)0x1000000)*2/Pi; */
#define a2   -2.652905e-4f /*(-(float)0x2ae6)/((float)0x1000000)*4/(Pi*Pi); */
#define a3   -0.165624f /*(-(float)0xa45511)/((float)0x1000000)*8/(Pi*Pi*Pi); */
#define a4   -1.964532e-3f /*(-(float)0x30fd3)/((float)0x1000000)*16/(Pi*Pi*Pi*Pi); */
#define a5   1.02575e-2f /*((float)0x191cac)/((float)0x1000000)*32/(Pi*Pi*Pi*Pi*Pi); */
#define a6   -9.580378e-4f /*(-(float)0x3af27)/((float)0x1000000)*64/(Pi*Pi*Pi*Pi*Pi*Pi); */
#define halfPi   ((float)(CV_PI*0.5))
#define hough_cmp_gt (   l1,
  l2 
)    (aux[l1] > aux[l2])
#define Pi   ((float)CV_PI)

Typedef Documentation

typedef struct CvLinePolar CvLinePolar

Function Documentation

CV_ASSERT ( CV_IS_MAT(img)&&CV_MAT_TYPE(img->type = =CV_8UC1)
CV_CALL ( accum  = (int *) cvAlloc(sizeof(accum[0])*(numangle+2)*(numrho+2)))
CV_CALL ( sort_buf  = (int *) cvAlloc(sizeof(accum[0])*numangle *numrho))
CV_CALL ( tabSin  = (float *) cvAlloc(sizeof(tabSin[0])*numangle))
CV_CALL ( tabCos  = (float *) cvAlloc(sizeof(tabCos[0])*numangle))
CV_FUNCNAME ( "icvHoughLinesStandard"  )
CV_IMPL CvSeq* cvHoughCircles ( CvArr src_image,
void *  circle_storage,
int  method,
double  dp,
double  min_dist,
double  param1,
double  param2,
int  min_radius,
int  max_radius 
)
CV_IMPL CvSeq* cvHoughLines2 ( CvArr src_image,
void *  lineStorage,
int  method,
double  rho,
double  theta,
int  threshold,
double  param1,
double  param2 
)
for ( ang  = 0)
for ( )
pure virtual
icvHoughSortDescent32s ( sort_buf  ,
total  ,
accum   
)
memset ( accum  ,
,
sizeof(accum[0])*(numangle+2)*(numrho+2)   
)

Variable Documentation

__BEGIN__
__END__
cvFree & accum
Initial value:
= accum[base + numrho + 2] )
sort_buf[total++] = base
float ang
height = img->rows
int i
image = img->data.ptr
float irho = 1 / rho
int j
float float int CvSeq* lines
linesMax
Initial value:
{
int *accum = 0
const char const char int int int const void const void int const void int const void void int *ldc const char const char int * n
numangle = cvRound(CV_PI / theta)
numrho = cvRound(((width + height) * 2 + 1) / rho)
int r
float rho
scale = 1./(numrho+2)
cvFree & sort_buf =0
cvFree & tabCos = 0
cvFree & tabSin = 0
float float theta
float float int threshold
int total = 0
width = img->cols