Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
PointMatchAlgorithm Class Reference

Algorithm returning a list of points that match the specified point. More...

#include <PointMatchAlgorithm.h>

Collaboration diagram for PointMatchAlgorithm:
Collaboration graph

Public Member Functions

 PointMatchAlgorithm (bool isGnuplot)
 Single constructor.
 
QList< QPointfindPoints (const QList< PointMatchPixel > &samplePointPixels, const QImage &imageProcessed, const DocumentModelPointMatch &modelPointMatch, const Points &pointsExisting)
 Find points that match the specified sample point pixels. They are sorted by best-to-worst match.
 

Detailed Description

Algorithm returning a list of points that match the specified point.

This returns a list of matches, from best to worst. This is executed in a separate QThread so the gui thread is not blocked

Definition at line 26 of file PointMatchAlgorithm.h.

Constructor & Destructor Documentation

◆ PointMatchAlgorithm()

PointMatchAlgorithm::PointMatchAlgorithm ( bool isGnuplot)

Single constructor.

Definition at line 27 of file PointMatchAlgorithm.cpp.

27 :
28 m_isGnuplot (isGnuplot)
29{
30 LOG4CPP_INFO_S ((*mainCat)) << "PointMatchAlgorithm::PointMatchAlgorithm";
31}
log4cpp::Category * mainCat
Definition Logger.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

Member Function Documentation

◆ findPoints()

QList< QPoint > PointMatchAlgorithm::findPoints ( const QList< PointMatchPixel > & samplePointPixels,
const QImage & imageProcessed,
const DocumentModelPointMatch & modelPointMatch,
const Points & pointsExisting )

Find points that match the specified sample point pixels. They are sorted by best-to-worst match.

Definition at line 218 of file PointMatchAlgorithm.cpp.

222{
223 LOG4CPP_INFO_S ((*mainCat)) << "PointMatchAlgorithm::findPoints"
224 << " samplePointPixels=" << samplePointPixels.count();
225
226 // Use larger arrays for computations, if necessary, to improve fft performance
227 int originalWidth = imageProcessed.width();
228 int originalHeight = imageProcessed.height();
229 int width = optimizeLengthForFft(originalWidth);
230 int height = optimizeLengthForFft(originalHeight);
231
232 // The untransformed (unprimed) and transformed (primed) storage arrays can be huge for big pictures, so minimize
233 // the number of allocated arrays at every point in time
234 double *image, *sample, *convolution;
236
237 // Compute convolution=F(-1){F(image)*F(*)(sample)}
239 loadImage(imageProcessed,
240 modelPointMatch,
242 width,
243 height,
244 &image,
245 &imagePrime);
246 loadSample(samplePointPixels,
247 width,
248 height,
249 &sample,
255 computeConvolution(imagePrime,
257 width,
258 height,
262
263 if (m_isGnuplot) {
264
265 dumpToGnuplot(image,
266 width,
267 height,
268 "image.gnuplot");
269 dumpToGnuplot(sample,
270 width,
271 height,
272 "sample.gnuplot");
273 dumpToGnuplot(convolution,
274 width,
275 height,
276 "convolution.gnuplot");
277 }
278
279 // Assemble local maxima, where each is the maxima centered in a region
280 // having a width of sampleWidth and a height of sampleHeight
282 assembleLocalMaxima(convolution,
284 width,
285 height);
287
288 // Copy sorted match points to output
290 PointMatchList::iterator itr;
291 for (itr = listCreated.begin(); itr != listCreated.end(); itr++) {
292
294 pointsCreated.push_back (triplet.point ());
295
296 // Current order of maxima would be fine if they never overlapped. However, they often overlap so as each
297 // point is pulled off the list, and its pixels are removed from the image, we might consider updating all
298 // succeeding maxima here if those maximax overlap the just-removed maxima. The maxima list is kept
299 // in descending order according to correlation value
300 }
301
302 releaseImageArray(image);
303 releasePhaseArray(imagePrime);
304 releaseImageArray(sample);
305 releasePhaseArray(samplePrime);
306 releaseImageArray(convolution);
307
308 return pointsCreated;
309}
const int INNER_RADIUS_MIN
QList< PointMatchTriplet > PointMatchList
Representation of one matched point as produced from the point match algorithm.

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