Public Member Functions
sal3d::PeakFinder Class Reference

Vertical Software Peak Finder (Deprecated) More...

#include <PeakFinder.hpp>

List of all members.

Public Member Functions

 PeakFinder (float threshold)
 Creates a new peak finder.
 PeakFinder (const PeakFinder &finder)
 Copy constructor.
 ~PeakFinder ()
 Destructor.
float getThreshold () const
 Gets the current peak finder's threshold value.
void operator() (const sal3d::Frame &frame, sal3d::Profile &profile) const
 Fills the Profile with the values of the peak detected in the provided Frame.
PeakFinderoperator= (const PeakFinder &rhs)
 Copy assignment operator.
void setThreshold (float threshold)
 Sets the peak finder's threshold value.
int profileLength (const sal3d::Frame &frame)
 Returns the length that a Profile from the given frame will have.

Detailed Description

Vertical Software Peak Finder (Deprecated)

Deprecated:
The Vertical Peak Finder is deprecated in SAL3D. You should use the newer and faster PeakFinderH.

This class requires linking with peakfinder.lib (import library for peakfinder.dll).

This class is a software implementation of a "light stripe detection" algorithm. It allows to extract Profile objects from a set of Frame objects by finding the maximum intensity of the laser stripe in each row of a Frame. Please see Peak Detector Tool for more information about the algorithm.

The extracted information is stored in a Profile, which can be obtained from a RangeMap or created from memory. This RangeMap, or Profile, can later be used in the other modules for the calibrations, to create a COP, etc.

Here is an example of how to fill a RangeMap using the acquired Frames from a FrameGrabber, by using the PeakFinder:

 sal3d::RangeMap
 acquireRangeMap (const sal3d::FrameGrabber &grabber)
 {
     // The threshold value is used to filter the Frame.  Frame values
     // below this threshold are not considered.
     sal3d::PeakFinder finder (180.0f);
     std::auto_ptr<sal3d::RangeMap> rmap;

     grabber.grab ();
     while ( !endRangeMap () )
     {
         grabber.wait ();
         sal3d::Frame frame (grabber.frame ());
         if (rmap.get() == 0)
             rmap.reset(new sal3d::RangeMap(frame.height(), numProfiles));
         sal3d::Profile profile(rmap->getNewProfile());
         finder (frame, profile);
     }
     grabber.freeze ();

     return rmap;
 }

As with most SAL3D classes, the PeakFinder copy constructor does not copy the internal data from another PeakFinder, it just uses reference counting to know how many objects point to the same data. When no more PeakFinder objects points to the internal data it gets deleted.


Constructor & Destructor Documentation

sal3d::PeakFinder::PeakFinder ( float  threshold) [inline, explicit]

Creates a new peak finder.

Parameters:
[in]thresholdThe greyscale value to use as threshold when filtering the input frame. It means that all pixels with a value lower than this, are considered zero. This is very useful to remove noise from the acquisition.
Exceptions:
sal3d::ErrorOn error
sal3d::PeakFinder::PeakFinder ( const PeakFinder finder) [inline]

Copy constructor.

Parameters:
[in]finderThe peak finder to copy from.
Exceptions:
sal3d::ErrorOn error

Destructor.

When no more references to the object exist, it is deleted and the memory released.


Member Function Documentation

float sal3d::PeakFinder::getThreshold ( ) const [inline]

Gets the current peak finder's threshold value.

Returns:
The current threshold's value.
Exceptions:
sal3d::ErrorOn error
void sal3d::PeakFinder::operator() ( const sal3d::Frame frame,
sal3d::Profile profile 
) const [inline]

Fills the Profile with the values of the peak detected in the provided Frame.

Computes the positions of a single laser stripe (the "peak positions") for each row in frame, and stores this position in the profile.

Parameters:
[in]frameThe frame to find the laser stripe on.
[out]profileThe profile filled with the positions of the detected peaks. If there is no peak detected in a row, the value is set to 0.0f.
Exceptions:
sal3d::ErrorOn error

References sal3d::Frame::c_frame(), and sal3d::Profile::c_profile().

PeakFinder& sal3d::PeakFinder::operator= ( const PeakFinder rhs) [inline]

Copy assignment operator.

Parameters:
[in]rhsThe finder to copy to this object.
Returns:
A reference to this object.
Exceptions:
sal3d::ErrorOn error
int sal3d::PeakFinder::profileLength ( const sal3d::Frame frame) [inline]

Returns the length that a Profile from the given frame will have.

Parameters:
[in]frameA sample frame to compute the lenght that a Profile will have given any Frame of the same size.
Returns:
The length of a Profile created by using the peak finder on the given frame.

References sal3d::Frame::height().

void sal3d::PeakFinder::setThreshold ( float  threshold) [inline]

Sets the peak finder's threshold value.

Parameters:
[in]thresholdThe threshold value to set.
Exceptions:
sal3d::ErrorOn error

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