22int GridClassifier::NUM_PIXELS_PER_HISTOGRAM_BINS = 1;
23double GridClassifier::PEAK_HALF_WIDTH = 4;
24int GridClassifier::MIN_STEP_PIXELS =
qFloor (4 * GridClassifier::PEAK_HALF_WIDTH);
29int GridClassifier::BIN_START_UNSHIFTED =
qFloor (GridClassifier::PEAK_HALF_WIDTH);
37int GridClassifier::binFromCoordinate (
double coord,
64 m_numHistogramBins = image.width() / NUM_PIXELS_PER_HISTOGRAM_BINS;
70 m_binsX =
new double [
unsigned (m_numHistogramBins)];
71 m_binsY =
new double [
unsigned (m_numHistogramBins)];
73 computeGraphCoordinateLimits (image,
79 initializeHistogramBins ();
80 populateHistogramBins (image,
86 searchStartStepSpace (isGnuplot,
95 searchStartStepSpace (isGnuplot,
104 searchCountSpace (m_binsX,
108 searchCountSpace (m_binsY,
117void GridClassifier::computeGraphCoordinateLimits (
const QImage &image,
158double GridClassifier::coordinateFromBin (
int bin,
168void GridClassifier::copyVectorToVector (
const double from [],
171 for (
int bin = 0;
bin < m_numHistogramBins;
bin++) {
186 .arg (
corr, 8,
'f', 3,
'0')
193 fileDump.open (QIODevice::WriteOnly | QIODevice::Text);
200 for (
bin = 0;
bin < m_numHistogramBins;
bin++) {
223 for (
bin = 0;
bin < m_numHistogramBins;
bin++) {
252 fileDump.open (QIODevice::WriteOnly | QIODevice::Text);
259 for (
bin = 0;
bin < m_numHistogramBins;
bin++) {
280 for (
int bin = 0;
bin < m_numHistogramBins;
bin++) {
291void GridClassifier::initializeHistogramBins ()
295 for (
int bin = 0;
bin < m_numHistogramBins;
bin++) {
301void GridClassifier::loadPicketFence (
double picketFence [],
326 for (
int bin = 0;
bin < m_numHistogramBins;
bin++) {
352void GridClassifier::populateHistogramBins (
const QImage &image,
364 for (
int x = 0; x < image.width(); x++) {
365 for (
int y = 0; y < image.height(); y++) {
380 while (posGraph.x() <
xMin) {
383 while (posGraph.x() >
xMax) {
388 int binX = binFromCoordinate (posGraph.x(),
xMin,
xMax);
389 int binY = binFromCoordinate (posGraph.y(),
yMin,
yMax);
407void GridClassifier::searchCountSpace (
double bins [],
422 for (
int count = 2; count <=
countStop; count++) {
430 correlation.correlateWithoutShift (m_numHistogramBins,
445void GridClassifier::searchStartStepSpace (
bool isGnuplot,
485 correlation.correlateWithShift (m_numHistogramBins,
536 double next = coordinateFromBin (m_numHistogramBins - 1,
const int INNER_RADIUS_MIN
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
const QString GNUPLOT_DELIMITER("\t")
log4cpp::Category * mainCat
Class for filtering image to remove unimportant information.
QRgb marginColor(const QImage *image) const
Identify the margin color of the image, which is defined as the most common color in the four margins...
bool colorCompare(QRgb rgb1, QRgb rgb2) const
See if the two color values are close enough to be considered to be the same.
Fast cross correlation between two functions.
double thetaPeriod() const
Return the period of the theta value for polar coordinates, consistent with CoordThetaUnits.
CoordsType coordsType() const
Get method for coordinates type.
double originRadius() const
Get method for origin radius in polar mode.
GridClassifier()
Single constructor.
void classify(bool isGnuplot, const QPixmap &originalPixmap, const Transformation &transformation, int &countX, double &startX, double &stepX, int &countY, double &startY, double &stepY)
Classify the specified image, and return the most probably x and y grid settings.
#define LOG4CPP_INFO_S(logger)
const QString GNUPLOT_FILE_MESSAGE