From 29e744fadfbb7445f8c7f05a252b5ca63265feb1 Mon Sep 17 00:00:00 2001 From: dmayerich Date: Wed, 6 Mar 2013 11:11:22 -0600 Subject: [PATCH] Added QT dialog box files for distortion maps. --- distortiondialog.ui | 32 ++++++++++++++++++++++++++++++++ qtDistortionDialog.cpp | 12 ++++++++++++ qtDistortionDialog.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 0 deletions(-) create mode 100644 distortiondialog.ui create mode 100644 qtDistortionDialog.cpp create mode 100644 qtDistortionDialog.h diff --git a/distortiondialog.ui b/distortiondialog.ui new file mode 100644 index 0000000..e89667a --- /dev/null +++ b/distortiondialog.ui @@ -0,0 +1,32 @@ + + + DistortionDialogClass + + + + 0 + 0 + 400 + 300 + + + + Distortion Map + + + + + 300 + 250 + 87 + 27 + + + + Compute + + + + + + diff --git a/qtDistortionDialog.cpp b/qtDistortionDialog.cpp new file mode 100644 index 0000000..0f6a0aa --- /dev/null +++ b/qtDistortionDialog.cpp @@ -0,0 +1,12 @@ +#include "qtDistortionDialog.h" + +qtDistortionDialog::qtDistortionDialog(QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags) +{ + ui.setupUi(this); +} + +qtDistortionDialog::~qtDistortionDialog() +{ + updating = false; +} diff --git a/qtDistortionDialog.h b/qtDistortionDialog.h new file mode 100644 index 0000000..7d25207 --- /dev/null +++ b/qtDistortionDialog.h @@ -0,0 +1,84 @@ +#ifndef DISTORTIONDIALOG_H +#define DISTORTIONDIALOG_H + +#include +#include +#include +#include +#include +#include +#include +#include "ui_distortiondialog.h" +#include "globals.h" + +extern QGraphicsScene* distortionScene; +extern QGraphicsView* distortionWindow; +extern QGraphicsPixmapItem* pixmapItem; + +class qtDistortionDialog : public QDialog +{ + Q_OBJECT + +public: + qtDistortionDialog(QWidget *parent = 0, Qt::WFlags flags = 0); + ~qtDistortionDialog(); + bool updating; + +private: + Ui::DistortionDialogClass ui; + +public slots: + void on_btnComputeDistortionMap_clicked(){ + + int steps = 100; + + //delete the pixmap if one previously existed + if(pixmapItem != NULL) + delete(pixmapItem); + + //create an image + QImage image(steps, steps, QImage::Format_RGB888); + + QColor color(255, 255, 0); + + + //compute the distortion map + float* distortionMap = (float*)malloc(sizeof(float) * steps * steps); + DistortionMap(distortionMap, steps); + + //compute the extrema + float minDistortion = 99999; + float maxDistortion = distortionMap[0]; + for(int i=1; i 0) + minDistortion = distortionMap[i]; + if(distortionMap[i] > maxDistortion) + maxDistortion = distortionMap[i]; + } + cout<addItem(pixmapItem); + distortionWindow->show(); + + + } +}; + +#endif -- libgit2 0.21.4