head	1.5;
access;
symbols;
locks; strict;
comment	@// @;


1.5
date	95.01.08.22.11.03;	author rjj;	state Exp;
branches;
next	1.4;

1.4
date	94.07.23.02.51.05;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	94.07.21.04.56.22;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	94.07.15.05.59.03;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	94.07.07.04.11.37;	author rjj;	state Exp;
branches;
next	;


desc
@First cut at the Hough line detection algorithm.
@


1.5
log
@Added standard header, changed format of some comments for readibility.
@
text
@// hough.h              Section: 10.3, Line Detection using the Hough Transform
//      Copyright 1994, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.

#ifndef _hough_h_
#define _hough_h_

#include "BitDI.h"
#include "UcharDI.h"
#include "IntDI.h"
#include "ClosureDT.h"

///////////////////////////////////////////////////////////////////////////
// Hough()
// This function simply creates a HoughTemplate based on the parameters
//    it is given, and then returns the template sum.
// Note that the accumulator image size will actually have
//    2*positive_rows_requested + 1  rows, and
//    columns_requested              columns

IA_Image<IA_Point<int>,int>
Hough( const IA_Image<IA_Point<int>,IA_Bit>,
       unsigned int positive_rows_requested,
       unsigned int columns_requested );


///////////////////////////////////////////////////////////////////////////
// class HoughTemplate
// This class is based on a ClosureDT<UDI> rather than a ClosureDT<BDI>.
// This is because the Hough algorithm essentially requires the
//    definition of the template over a BDI, but the iac++ library
//    can not sum such a template.  It can however, sum a template
//    based on UDI images.
// Hence this implementation claims to be based on a UDI.

class HoughTemplate: public IA_ClosureDT<IA_Image<IA_Point<int>,u_char> > {
private:
    IA_Image<IA_Point<int>,IA_Bit>  b;  // Can not sum BDI
    double rows;                        // Spans interval [-R,+R]
    double cols;                        // Spans interval [0,pi)

    IA_Point<int> * ipa;  // Work array of IntPoints, length = cols
    IA_Point<int> b_inf;  // b.domain().inf(), we calcuate once here.
    double *sines, *cosines;  // Used to speed up calculations

public:

    const double R; // This may be seen, but not modified

    HoughTemplate( const IA_Image<IA_Point<int>,IA_Bit> & b_,
		   unsigned int positive_rows_requested,
		   unsigned int cols_requested );

    HoughTemplate( const HoughTemplate & );  // Need because we alloc memory

    ~HoughTemplate();

    IA_Image<IA_Point<int>,u_char>
    operator() ( const IA_Point<int> &) const;

    IA_ClosureDT<IA_Image<IA_Point<int>,u_char> > *
    clone_self() const;
};
#endif
@


1.4
log
@Checking in this version before adding additional functionality that
  will calculate the 'reverse' hough, to see what lines were found.
@
text
@d1 1
a1 1
// hough.h              Section: 10.3
a12 1

a26 1

d38 3
a40 3
    IA_Image<IA_Point<int>,IA_Bit> b;  // Can not sum BDI
    double rows;   // Spans interval [-R,+R]
    double cols;   // Spans interval [0,pi)
a63 1

@


1.3
log
@Added speedup enhancement of co/sines[].
@
text
@a17 4
// The return value  R  is the same R as calculated in the HoughTemplate,
//    and represents the  rho  interval.  This value is
//    needed by any routine that wants to interpret the Hough image
//    as calcuated by this function.
d25 1
a25 2
       unsigned int columns_requested,
       double & R );
@


1.2
log
@This version seems to work, but is not real fast.
  There are still some debug stmts left, but I'm putting
  the file under rcs before working with it further.
@
text
@a7 1

d51 1
a51 1
//    double *sines, *cosines;  // Used to speed up calculations
@


1.1
log
@Initial revision
@
text
@d15 12
d29 4
a32 1
       unsigned int rows, unsigned int columns, double epsilon );
d35 9
d46 8
a53 3
    IA_Image<IA_Point<int>,u_char> b;  // Can not sum BDI
    int rows, cols, R;
    double epsilon;
d56 2
d59 6
a64 3
		   unsigned int rows_,
		   unsigned int cols_,
		   double epsilon_ );
d70 1
a70 3
    clone_self() const {
	return new HoughTemplate( *this );
    }
@
