Skip to content
Snippets Groups Projects
Commit a3bb7381 authored by yliu2's avatar yliu2
Browse files

histogram commit

parent 27f06728
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
#include <QDialog>
#include <QFormLayout>
#include <QComboBox>
#include <QMessageBox>
#include <QDoubleSpinBox>
#include <QDialogButtonBox>
#include <QApplication>
......@@ -47,6 +48,20 @@ void ColorimetryOp::operator()(const imagein::Image*, const std::map<const image
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
QColor color = dialog->getColor();
if(code!=QDialog::Accepted) return;
/*Pop-up a warning window if the input value of width or height equals to 0*/
if( dialog->getWidth()==0 || dialog->getHeight()==0 ){
QMessageBox *msgBox;
msgBox = new QMessageBox(QString(qApp->translate("ColorimetryOp","Warning")),
QString(qApp->translate("ColorimetryOp", "Empty image generation is not allowed")),
QMessageBox::Warning,
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::NoRole | QMessageBox::Escape,
0);
msgBox->show();
return;
}
Image* resImg = new Image(dialog->getWidth(), dialog->getHeight(), 3);
for(unsigned int j = 0; j < resImg->getHeight(); ++j) {
for(unsigned int i = 0; i < resImg->getWidth(); ++i) {
......
......@@ -74,8 +74,8 @@ Image* HistogramOp::equalize( const Image *img ) {
Image* resImg = new Image(img->getWidth(), img->getHeight(), img->getNbChannels());
for(unsigned int c = 0; c < img->getNbChannels(); ++c) {
CumulatedHistogram hist_sum = CumulatedHistogram(*img, c);
imagein::Rectangle rect;
CumulatedHistogram hist_sum = CumulatedHistogram(*img, c, rect);
double Dm = 255; // number of levels in output image
for(unsigned int j = 0; j < img->getHeight(); j++) {
for(unsigned int i = 0; i < img->getWidth(); i++) {
......
......@@ -17,6 +17,7 @@
* along with ImageINSA. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QDialog>
#include <QMessageBox>
#include <QFormLayout>
#include <QRadioButton>
#include <QGroupBox>
......@@ -113,6 +114,19 @@ void RandomImgOp::operator()(const imagein::Image*, const std::map<const imagein
return;
}
/*Pop-up a warning window if the required value of width or height equals to 0*/
if( widthBox->value()==0 || heightBox->value()==0 ){
QMessageBox *msgBox;
msgBox = new QMessageBox(QString(qApp->translate("RandomImgOp","Warning")),
QString(qApp->translate("RandomImgOp", "Empty image generation is not allowed")),
QMessageBox::Warning,
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::NoRole | QMessageBox::Escape,
0);
msgBox->show();
return;
}
if(intButton->isChecked()) {
Image* resImg = new Image(widthBox->value(), heightBox->value(), channelBox->value());
......
......@@ -20,6 +20,7 @@
#include "SinusSynthesisOp.h"
#include "../Tools.h"
#include <QDialog>
#include <QMessageBox>
#include <QFormLayout>
#include <QComboBox>
#include <QSpinBox>
......@@ -89,6 +90,18 @@ void SinusSynthesisOp::operator()(const imagein::Image*, const std::map<const im
if(code!=QDialog::Accepted) return;
/*Pop-up a warning window if the required image size equals to 0*/
if( sizeBox->value()==0 ){
QMessageBox *msgBox;
msgBox = new QMessageBox(QString(qApp->translate("SinusSynthesisOp","Warning")),
QString(qApp->translate("SinusSynthesisOp", "Image size can not be zero")),
QMessageBox::Warning,
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::NoRole | QMessageBox::Escape,
0);
msgBox->show();
return;
}
GrayscaleImage* resImg = new GrayscaleImage(sizeBox->value(), sizeBox->value());
double angle = angleBox->value();
......
......@@ -42,13 +42,11 @@
# either expressed or implied, of the FreeBSD Project.
#=============================================================================
FILE(GLOB Qwt6_GLOB_PATH /usr/qwt* /usr/local/qwt* /usr/include/qwt* /usr/lib/qt4/include/qwt* /usr/lib64/qt4/include/qwt* )
find_path ( QWT_INCLUDE_DIR
NAMES qwt_plot.h
PATHS ${QT_INCLUDE_DIR} ${Qwt6_GLOB_PATH}
HINTS ${QT_INCLUDE_DIR}
PATH_SUFFIXES include
PATH_SUFFIXES qwt qwt-qt3 qwt-qt4 qwt-qt5
)
set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} )
......@@ -83,8 +81,7 @@ endif ()
find_library ( QWT_LIBRARY
NAMES qwt qwt-qt3 qwt-qt4 qwt-qt5
HINTS ${QT_LIBRARY_DIR} ${Qwt6_GLOB_PATH}
PATH_SUFFIXES lib
HINTS ${QT_LIBRARY_DIR}
)
set ( QWT_LIBRARIES ${QWT_LIBRARY} )
......@@ -109,7 +106,7 @@ endif ()
mark_as_advanced (
QWT_LIBRARY
QWT_LIBRARY
QWT_LIBRARIES
QWT_INCLUDE_DIR
QWT_INCLUDE_DIRS
......@@ -118,4 +115,4 @@ mark_as_advanced (
QWT_PATCH_VERSION
QWT_VERSION_STRING
QWT_ROOT_DIR
)
\ No newline at end of file
)
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