Skip to content
Snippets Groups Projects
Commit edf02c1a authored by Sacha Percot-Tétu's avatar Sacha Percot-Tétu
Browse files

Added the inverse hough operation

parent f86e86ed
No related branches found
No related tags found
No related merge requests found
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InverseHoughDialog.h"
#include "ui_InverseHoughDialog.h"
InverseHoughDialog::InverseHoughDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::InverseHoughDialog)
{
ui->setupUi(this);
}
InverseHoughDialog::~InverseHoughDialog()
{
delete ui;
}
int InverseHoughDialog::getSize() const {
return ui->sizeBox->value();
}
int InverseHoughDialog::getThreshodl() const {
return ui->thresholdBox->value();
}
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INVERSEHOUGHDIALOG_H
#define INVERSEHOUGHDIALOG_H
#include <QDialog>
namespace Ui {
class InverseHoughDialog;
}
class InverseHoughDialog : public QDialog
{
Q_OBJECT
public:
explicit InverseHoughDialog(QWidget *parent = 0);
~InverseHoughDialog();
int getSize() const;
int getThreshodl() const;
private:
Ui::InverseHoughDialog *ui;
};
#endif // INVERSEHOUGHDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InverseHoughDialog</class>
<widget class="QDialog" name="InverseHoughDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>279</width>
<height>113</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Reconstructed image size : </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sizeBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65536</number>
</property>
<property name="singleStep">
<number>128</number>
</property>
<property name="value">
<number>256</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Reconstruction threshold : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="thresholdBox">
<property name="maximum">
<number>65536</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>InverseHoughDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>InverseHoughDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InverseHoughOp.h"
#include <QApplication>
#include "Transforms.h"
#include "InverseHoughDialog.h"
using namespace std;
using namespace imagein;
InverseHoughOp::InverseHoughOp() : DoubleOperation(qApp->translate("Operations", "Houghman inverse transform").toStdString())
{
}
bool InverseHoughOp::needCurrentImg() const {
return true;
}
void InverseHoughOp::operator()(const imagein::Image_t<double>* img, const std::map<const imagein::Image_t<double>*, std::string>&) {
InverseHoughDialog* dialog = new InverseHoughDialog(QApplication::activeWindow());
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
if(code!=QDialog::Accepted) return;
Image* resImg2;
Transforms::hough2_inverse(img, &resImg2, dialog->getSize(), dialog->getThreshodl());
outImage(resImg2, qApp->translate("Hough", "Hough inverse transform").toStdString());
}
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INVERSEHOUGHOP_H
#define INVERSEHOUGHOP_H
#include <Operation.h>
class InverseHoughOp : public DoubleOperation
{
public:
InverseHoughOp();
void operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&);
bool needCurrentImg() const;
};
#endif // INVERSEHOUGHOP_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment