Vertical Software Peak Finder (Deprecated) More...
#include <PeakFinder.hpp>
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. | |
| PeakFinder & | operator= (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. | |
Vertical Software Peak Finder (Deprecated)
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.
| sal3d::PeakFinder::PeakFinder | ( | float | threshold | ) | [inline, explicit] |
Creates a new peak finder.
| [in] | threshold | The 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. |
| sal3d::Error | On error |
| sal3d::PeakFinder::PeakFinder | ( | const PeakFinder & | finder | ) | [inline] |
Copy constructor.
| [in] | finder | The peak finder to copy from. |
| sal3d::Error | On error |
| sal3d::PeakFinder::~PeakFinder | ( | ) | [inline] |
Destructor.
When no more references to the object exist, it is deleted and the memory released.
| float sal3d::PeakFinder::getThreshold | ( | ) | const [inline] |
Gets the current peak finder's threshold value.
| sal3d::Error | On 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.
| [in] | frame | The frame to find the laser stripe on. |
| [out] | profile | The 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. |
| sal3d::Error | On error |
References sal3d::Frame::c_frame(), and sal3d::Profile::c_profile().
| PeakFinder& sal3d::PeakFinder::operator= | ( | const PeakFinder & | rhs | ) | [inline] |
Copy assignment operator.
| [in] | rhs | The finder to copy to this object. |
| sal3d::Error | On error |
| int sal3d::PeakFinder::profileLength | ( | const sal3d::Frame & | frame | ) | [inline] |
Returns the length that a Profile from the given frame will have.
| [in] | frame | A sample frame to compute the lenght that a Profile will have given any Frame of the same size. |
References sal3d::Frame::height().
| void sal3d::PeakFinder::setThreshold | ( | float | threshold | ) | [inline] |
Sets the peak finder's threshold value.
| [in] | threshold | The threshold value to set. |
| sal3d::Error | On error |
by
1.7.6.1