Subversion Repositories Code-Repo

Compare Revisions

No changes between revisions

Ignore whitespace Rev 289 → Rev 291

/Classwork/ME5524 - Bayesian Robotics/Final Project/MainWindow.h
0,0 → 1,55
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
 
#include "GlobalDefines.h"
 
class DepthMap;
class ImageWidget;
class DepthProcessor;
class RobotControl;
class OpenNI;
 
class MainWindow : public QWidget {
Q_OBJECT
 
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
 
public slots:
void updateStatusText(const QString &);
void updateFrameText(const QString &);
void updateFPSText(const QString &);
void updateSelectionList(const QStringList &);
void imageSelectionChanged(const QString &);
void sensorConnected();
 
signals:
void changeDisplayImage(const int, const QString &);
 
protected:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
 
private:
ImageWidget *topLeftImage;
ImageWidget *topRightImage;
ImageWidget *botLeftImage;
ImageWidget *botRightImage;
 
QComboBox *topLeftSelect;
QComboBox *topRightSelect;
QComboBox *botLeftSelect;
QComboBox *botRightSelect;
 
OpenNI *openNIThread;
DepthProcessor *openNIProcessor;
 
RobotControl *robot;
 
QLabel *statusLabel;
QLabel *frameLabel;
QLabel *fpsLabel;
};
 
#endif MAINWINDOW_H
/Classwork/ME5524 - Bayesian Robotics/Final Project/OpenNI.cpp
0,0 → 1,142
#include "OpenNI.h"
 
#define CHECK_RC(rc, what) \
if (rc != XN_STATUS_OK) { \
QString error = QString(QString(what) + "failed: "); \
error += QString(xnGetStatusString(rc)); \
emit setStatusString(error); \
exit(rc); \
return; \
}
 
using namespace xn;
 
extern QSemaphore processorBuffer;
 
XnBool OpenNI::fileExists(const char *fn) {
XnBool exists;
xnOSDoesFileExist(fn, &exists);
return exists;
}
 
OpenNI::OpenNI(QObject *parent)
: QThread(parent) {
 
moveToThread(this);
}
 
OpenNI::~OpenNI() {
 
}
 
void OpenNI::run() {
 
XnStatus nRetVal = XN_STATUS_OK;
Context context;
ScriptNode scriptNode;
EnumerationErrors errors;
 
// Check if the config file exists
const char *fn = NULL;
if (fileExists(CONFIG_XML_PATH)) fn = CONFIG_XML_PATH;
else if (fileExists(CONFIG_XML_PATH_LOCAL)) fn = CONFIG_XML_PATH_LOCAL;
else {
QString error = QString("Could not find " + QString(CONFIG_XML_PATH) + " nor " + QString(CONFIG_XML_PATH_LOCAL));
emit setStatusString(error);
exit(XN_STATUS_ERROR);
return;
}
// Load the config file
nRetVal = context.InitFromXmlFile(fn, scriptNode, &errors);
 
// Check to see if a sensor is connected
if (nRetVal == XN_STATUS_NO_NODE_PRESENT) {
XnChar strError[1024];
errors.ToString(strError, 1024);
emit setStatusString(QString(strError));
exit(nRetVal);
return;
} else if (nRetVal != XN_STATUS_OK) {
QString error = QString("Open failed: " + QString(xnGetStatusString(nRetVal)));
emit setStatusString(error);
exit(nRetVal);
return;
}
 
// Connect to the attached sensor
DepthGenerator depth;
nRetVal = context.FindExistingNode(XN_NODE_TYPE_DEPTH, depth);
CHECK_RC(nRetVal, "Find depth generator");
 
// Pull FPS and depth data
XnFPSData xnFPS;
nRetVal = xnFPSInit(&xnFPS, 180);
CHECK_RC(nRetVal, "FPS Init");
 
DepthMetaData depthMD;
 
short min = 9999, max = 0;
 
// If this point is reached, notify that the sensor is ready
emit sensorConnected();
 
while (1) {
// Ensure that the processing queue isnt too long
processorBuffer.acquire(1);
 
// Wait for an updated frame from the sensor
nRetVal = context.WaitOneUpdateAll(depth);
if (nRetVal != XN_STATUS_OK) {
QString error = QString("UpdateData failed: " + QString(xnGetStatusString(nRetVal)));
emit setStatusString(error);
break;
}
 
// Mark the frame (for determining FPS)
xnFPSMarkFrame(&xnFPS);
 
// Grab the depth data
depth.GetMetaData(depthMD);
 
// Grab the size and FOV of the sensor
int X = depthMD.XRes();
int Y = depthMD.YRes();
 
XnFieldOfView fov;
depth.GetFieldOfView(fov);
 
emit setFOV(fov.fHFOV, fov.fVFOV);
 
// Show the size/FOV/FPS/frame
QString status = "Res: " + QString::number(X) + " x " + QString::number(Y);
//status += " / FoV (rad): " + QString::number(fov.fHFOV) + " (H) " + QString::number(fov.fVFOV) + " (V)";
min = qMin(min, (short)depthMD(depthMD.XRes() / 2, depthMD.YRes() / 2));
max = qMax(max, (short)depthMD(depthMD.XRes() / 2, depthMD.YRes() / 2));
 
status += " / Center: " + QString::number(depthMD(depthMD.XRes() / 2, depthMD.YRes() / 2));
status += " / Min: " + QString::number(min) + " / Max: " + QString::number(max);
emit setStatusString(status);
emit setFPSString(QString::number(xnFPSCalc(&xnFPS)));
emit setFrameString(QString::number(depthMD.FrameID()));
 
// Allocate a new cv::Mat
cv::Mat depthData = cv::Mat(Y_RES, X_RES, CV_16UC1);
 
// Save the depth data (mirrored horizontally)
ushort *p;
for (int y = 0; y < Y; ++y) {
p = depthData.ptr<ushort>(y);
for (int x = 0; x < X; ++x) {
short pixel = depthMD.Data()[(y * X) + (X - x - 1)];
p[x] = pixel;
}
}
 
// Send the depth data for processing
emit processDepthData(depthData);
}
 
depth.Release();
scriptNode.Release();
context.Release();
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/OpenNI.h
0,0 → 1,35
#ifndef OPENNI_H
#define OPENNI_H
 
#include "GlobalDefines.h"
#include <QThread>
 
#include <XnOpenNI.h>
#include <XnLog.h>
#include <XnCppWrapper.h>
#include <XnFPSCalculator.h>
 
#define CONFIG_XML_PATH "./SensorConfig.xml"
#define CONFIG_XML_PATH_LOCAL "SensorConfig.xml"
 
class OpenNI : public QThread {
Q_OBJECT
 
public:
OpenNI(QObject *parent = 0);
~OpenNI();
void run();
 
signals:
void sensorConnected();
void setStatusString(const QString &);
void setFrameString(const QString &);
void setFPSString(const QString &);
void processDepthData(const cv::Mat &);
void setFOV(float width, float height);
 
private:
XnBool fileExists(const char *fn);
};
 
#endif // OPENNI_H
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.v12.suo
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.v12.suo
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Classwork/ME5524 - Bayesian Robotics/Final Project/SensorConfig.xml
0,0 → 1,57
<OpenNI>
<Licenses>
<!-- Add application-specific licenses here
<License vendor="vendor" key="key"/>
-->
</Licenses>
<Log writeToConsole="false" writeToFile="false">
<!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
<LogLevel value="3"/>
<Masks>
<Mask name="ALL" on="true"/>
</Masks>
<Dumps>
</Dumps>
</Log>
<ProductionNodes>
<!-- Uncomment following line, in order to run from a recording
<Recording file="sampleRec.oni" />
-->
<!-- Set global mirror -->
<GlobalMirror on="true"/>
<!-- Create a depth node and give it a name alias (useful if referenced ahead in this script) -->
<Node type="Depth" name="MyDepth">
<Query>
<!-- Uncomment to filter by vendor name, product name, etc.
<Vendor>MyVendor inc.</Vendor>
<Name>MyProduct</Name>
<MinVersion>1.2.3.4</MinVersion>
<Capabilities>
<Capability>Cropping</Capability>
</Capabilities>
-->
</Query>
<Configuration>
<!-- Uncomment to set requested mode
<MapOutputMode xRes="640" yRes="480" FPS="30"/>
-->
<!-- Uncomment to override global mirror
<Mirror on="false" />
-->
</Configuration>
</Node>
<!-- Create an image node. If it fails, continue anyway. -->
<Node type="Image" stopOnError="false" />
 
<!-- Uncomment nodes from here if you need them.
<Node type="Audio" />
<Node type="User" />
<Node type="Hands" />
<Node type="Gesture" />
<Node type="Scene" />
-->
</ProductionNodes>
</OpenNI>
/Classwork/ME5524 - Bayesian Robotics/Final Project/DepthProcessor.cpp
0,0 → 1,459
#include "DepthProcessor.h"
 
// Limit the processing buffer to X frames
QSemaphore processorBuffer(3);
 
DepthProcessor::DepthProcessor(QObject *parent)
: QThread(parent) {
 
moveToThread(this);
 
topLeftImage = NULL;
topRightImage = NULL;
botLeftImage = NULL;
botRightImage = NULL;
 
rawDepthImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
lastValidData16 = cv::Mat(Y_RES, X_RES, CV_16UC1, cv::Scalar(0));
lastValidDepthImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
lastValidProcessed = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
 
fgMaskMOG = cv::Mat(Y_RES, X_RES, CV_8UC1);
movementMaskImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
fgMaskTmp = cv::Mat(Y_RES, X_RES, CV_32FC1);
fgMaskRaw = cv::Mat(Y_RES, X_RES, CV_8UC1);
movementMaskRawImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
fgMaskAverage = cv::Mat(Y_RES, X_RES, CV_8UC1);
movementMaskAverageImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
pMOG = new cv::BackgroundSubtractorMOG2(BACKGROUND_SUBTRACTOR_HISTORY, BACKGROUND_SUBTRACTOR_NMIXTURES, false);
 
rawHorizonImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
lastValidHorizonImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
overlayHorizonImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
 
depthHorizon = QVector<float>(X_RES);
rawDepthHorizon = QVector<float>(X_RES);
 
movementMaskHorizon = QVector<int>(X_RES);
 
movementPointsImage = QImage(X_RES, Y_RES, QImage::Format_ARGB32);
movementPointsMat = cv::Mat(Y_RES, X_RES, CV_8UC3);
//params.thresholdStep = 20;
//params.minThreshold = 50;
//params.minThreshold = 500;
params.minDistBetweenBlobs = BLOB_MIN_DISTANCE;
params.minArea = BLOB_MIN_AREA;
params.maxArea = BLOB_MAX_AREA;
params.filterByColor = false;
params.filterByCircularity = false;
params.filterByConvexity = false;
params.filterByInertia = false;
params.filterByArea = true;
blobDetector = new cv::SimpleBlobDetector(params);
}
 
DepthProcessor::~DepthProcessor() {
 
}
 
void DepthProcessor::setFOV(float width, float height) {
fovWidth = width;
fovHeight = height;
}
 
/**
* Change the image to display on the main GUI
*/
void DepthProcessor::setDisplayImage(const int pane, const QString &image) {
switch (pane) {
case 0:
if (image == "Raw Depth")
topLeftImage = &rawDepthImage;
else if (image == "Last Valid Depth")
topLeftImage = &lastValidDepthImage;
else if (image == "Movement Mask Raw Depth")
topLeftImage = &movementMaskRawImage;
else if (image == "Movement Mask Average Depth")
topLeftImage = &movementMaskAverageImage;
else if (image == "Processed Depth")
topLeftImage = &lastValidProcessed;
else if (image == "Raw Depth Horizon")
topLeftImage = &rawHorizonImage;
else if (image == "Last Valid Horizon")
topLeftImage = &lastValidHorizonImage;
else if (image == "Overlay Horizon")
topLeftImage = &overlayHorizonImage;
else if (image == "Movement Map")
topLeftImage = &movementPointsImage;
break;
case 1:
if (image == "Raw Depth")
topRightImage = &rawDepthImage;
else if (image == "Last Valid Depth")
topRightImage = &lastValidDepthImage;
else if (image == "Movement Mask Raw Depth")
topRightImage = &movementMaskRawImage;
else if (image == "Movement Mask Average Depth")
topRightImage = &movementMaskAverageImage;
else if (image == "Processed Depth")
topRightImage = &lastValidProcessed;
else if (image == "Raw Depth Horizon")
topRightImage = &rawHorizonImage;
else if (image == "Last Valid Horizon")
topRightImage = &lastValidHorizonImage;
else if (image == "Overlay Horizon")
topRightImage = &overlayHorizonImage;
else if (image == "Movement Map")
topRightImage = &movementPointsImage;
break;
case 2:
if (image == "Raw Depth")
botLeftImage = &rawDepthImage;
else if (image == "Last Valid Depth")
botLeftImage = &lastValidDepthImage;
else if (image == "Movement Mask Raw Depth")
botLeftImage = &movementMaskRawImage;
else if (image == "Movement Mask Average Depth")
botLeftImage = &movementMaskAverageImage;
else if (image == "Processed Depth")
botLeftImage = &lastValidProcessed;
else if (image == "Raw Depth Horizon")
botLeftImage = &rawHorizonImage;
else if (image == "Last Valid Horizon")
botLeftImage = &lastValidHorizonImage;
else if (image == "Overlay Horizon")
botLeftImage = &overlayHorizonImage;
else if (image == "Movement Map")
botLeftImage = &movementPointsImage;
break;
case 3:
if (image == "Raw Depth")
botRightImage = &rawDepthImage;
else if (image == "Last Valid Depth")
botRightImage = &lastValidDepthImage;
else if (image == "Movement Mask Raw Depth")
botRightImage = &movementMaskRawImage;
else if (image == "Movement Mask Average Depth")
botRightImage = &movementMaskAverageImage;
else if (image == "Processed Depth")
botRightImage = &lastValidProcessed;
else if (image == "Raw Depth Horizon")
botRightImage = &rawHorizonImage;
else if (image == "Last Valid Horizon")
botRightImage = &lastValidHorizonImage;
else if (image == "Overlay Horizon")
botRightImage = &overlayHorizonImage;
else if (image == "Movement Map")
botRightImage = &movementPointsImage;
break;
default:
break;
}
}
 
/**
* Updates the main GUI
*/
void DepthProcessor::updateImages() {
emit setImageTopLeft(*topLeftImage);
emit setImageTopRight(*topRightImage);
emit setImageBotLeft(*botLeftImage);
emit setImageBotRight(*botRightImage);
}
 
/**
* Here we process the raw data from the sensor
*/
void DepthProcessor::processDepthData(const cv::Mat &data) {
// The 16-bit raw image is passed in via a pointer
rawData16 = data;
 
// Save a pixel as valid data if it is != 0
for (int y = 0; y < Y_RES; y++) {
for (int x = 0; x < X_RES; x++) {
if (rawData16.ptr<ushort>(y)[x] != 0) {
lastValidData16.ptr<ushort>(y)[x] = rawData16.ptr<ushort>(y)[x];
}
}
}
 
// Apply a 5-pixel wide median filter to the data for noise removal
//cv::medianBlur(lastValidData16, lastValidData16, 5);
 
// Execute a background subtraction to obtain moving objects
pMOG->operator()(lastValidData16, fgMaskMOG, -1);
 
fgMaskMOG.copyTo(fgMaskRaw);
 
// Erode then dilate the mask to remove noise
//cv::erode(fgMaskMOG, fgMaskMOG, cv::Mat());
//cv::dilate(fgMaskMOG, fgMaskMOG, cv::Mat());
// Alternative:
int kernelSize = 9;
cv::Mat kernel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(kernelSize, kernelSize));
// Morphological opening (remove small objects from foreground)
cv::morphologyEx(fgMaskMOG, fgMaskMOG, cv::MORPH_OPEN, kernel);
// Morphological closing (fill small holes in the foreground)
cv::morphologyEx(fgMaskMOG, fgMaskMOG, cv::MORPH_CLOSE, kernel);
 
// Average the moving mask's values and shrink it by a bit to remove edges
cv::accumulateWeighted(fgMaskMOG, fgMaskTmp, 0.5);
cv::convertScaleAbs(fgMaskTmp, fgMaskAverage);
cv::erode(fgMaskAverage, fgMaskAverage, kernel);
 
// Get the closest distance in the specified range that is not 0 and convert to inches
for (int x = 0; x < X_RES; x++) {
ushort min = 9999;
ushort rawMin = 9999;
for (int y = VFOV_MIN; y < VFOV_MAX; y++) {
if (lastValidData16.ptr<ushort>(y)[x] != 0)
min = qMin(min, lastValidData16.ptr<ushort>(y)[x]);
rawMin = qMin(rawMin, rawData16.ptr<ushort>(y)[x]);
}
 
// Convert the raw distance values to distance in inches
// Distance (inches) = (raw distance - 13.072) / 25.089;
depthHorizon[x] = (min - 13.072) / 25.089;
rawDepthHorizon[x] = (rawMin - 13.072) / 25.089;
}
 
// Mark the points of detected movements in the movement mask if the threshold is exceeded
for (int x = 0; x < X_RES; x++) {
int moved = 0;
for (int y = VFOV_MIN; y < VFOV_MAX; y++) {
if (fgMaskAverage.ptr<uchar>(y)[x] >= FG_MASK_THRESHOLD)
moved = 1;
}
movementMaskHorizon[x] = moved;
}
 
// Draw all images
drawDepthImages();
drawFOVImages();
 
// Update GUI with selected image
updateImages();
 
processorBuffer.release(1);
}
 
/**
* Generate a visualization of the depth data
*/
void DepthProcessor::drawDepthImages() {
// Convert raw data to images to be displayed
for (int y = 0; y < Y_RES; ++y) {
for (int x = 0; x < X_RES; ++x) {
// rawDepthImage
rawDepthImage.setPixel(x, y, qRgb(rawData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR / 2),
rawData16.ptr<ushort>(y)[x] / SCALE_DIVISOR, rawData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR * 2)));
 
// lastValidDepthImage
lastValidDepthImage.setPixel(x, y, qRgb(lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR / 2),
lastValidData16.ptr<ushort>(y)[x] / SCALE_DIVISOR, lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR * 2)));
 
// lastValidProcessed
if (fgMaskMOG.ptr<uchar>(y)[x] == 0) {
lastValidProcessed.setPixel(x, y, qRgba(lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR / 2),
lastValidData16.ptr<ushort>(y)[x] / SCALE_DIVISOR, lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR * 2), 150));
} else {
lastValidProcessed.setPixel(x, y, qRgb(lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR / 2),
lastValidData16.ptr<ushort>(y)[x] / SCALE_DIVISOR, lastValidData16.ptr<ushort>(y)[x] / (SCALE_DIVISOR * 2)));
}
 
// movementMaskImage
movementMaskRawImage.setPixel(x, y, qRgb(fgMaskRaw.ptr<uchar>(y)[x], fgMaskRaw.ptr<uchar>(y)[x], fgMaskRaw.ptr<uchar>(y)[x]));
 
// movementMaskAverageImage
movementMaskAverageImage.setPixel(x, y, qRgb(fgMaskAverage.ptr<uchar>(y)[x], fgMaskAverage.ptr<uchar>(y)[x], fgMaskAverage.ptr<uchar>(y)[x]));
}
}
 
// Draw lines indicating the FOV zones
QPainter imagePainter;
 
imagePainter.begin(&rawDepthImage);
imagePainter.setPen(QPen(COLOR_DEPTH_FOV, 1));
imagePainter.drawLine(0, VFOV_MIN, X_RES, VFOV_MIN);
imagePainter.drawLine(0, VFOV_MAX, X_RES, VFOV_MAX);
imagePainter.end();
 
imagePainter.begin(&lastValidDepthImage);
imagePainter.setPen(QPen(COLOR_DEPTH_FOV, 1));
imagePainter.drawLine(0, VFOV_MIN, X_RES, VFOV_MIN);
imagePainter.drawLine(0, VFOV_MAX, X_RES, VFOV_MAX);
imagePainter.end();
 
imagePainter.begin(&lastValidProcessed);
imagePainter.setPen(QPen(COLOR_DEPTH_FOV, 1));
imagePainter.setBrush(QBrush(COLOR_DEPTH_FOV_FILL));
imagePainter.drawLine(0, VFOV_MIN, X_RES, VFOV_MIN);
imagePainter.drawLine(0, VFOV_MAX, X_RES, VFOV_MAX);
imagePainter.drawRect(0, 0, X_RES, VFOV_MIN);
imagePainter.drawRect(0, VFOV_MAX, X_RES, Y_RES);
imagePainter.end();
}
 
/**
* Draws the given vector of points onto an image (projected across an arc)
*/
void DepthProcessor::drawDistanceFOV(QImage &image, QVector<float> &data) {
QPainter painter;
painter.begin(&image);
 
// Draw the FOV for the raw data
painter.translate(X_RES / 2, Y_RES);
// Rotate the canvas, draw all distances, then restore original coordinates
painter.rotate(-90 - qRadiansToDegrees(fovWidth / 2));
for (int x = 0; x < X_RES; x++) {
painter.rotate(qRadiansToDegrees(fovWidth / X_RES));
painter.setPen(QPen(COLOR_DEPTH_POINT, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawPoint(data[x], 0);
painter.setPen(QPen(COLOR_DEPTH_BACKGROUND, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawLine(QPoint(data[x], 0), QPoint(400, 0));
}
 
painter.end();
}
 
/**
* Draws the sensor's FOV onto the image
*/
void DepthProcessor::drawSensorFOV(QImage &image) {
QPainter painter;
painter.begin(&image);
 
// Draw the sensor's FOV
painter.translate(X_RES / 2, Y_RES);
painter.setPen(QPen(COLOR_FOV, 2, Qt::DashLine));
painter.rotate(-90 - qRadiansToDegrees(fovWidth / 2));
painter.drawLine(0, 0, X_RES, 0);
painter.rotate(qRadiansToDegrees(fovWidth));
painter.drawLine(0, 0, X_RES, 0);
 
painter.end();
}
 
/**
* Generate a horizontal visualization of the depth data
*/
void DepthProcessor::drawFOVImages() {
// Draw the raw FOV
rawHorizonImage.fill(Qt::white);
drawDistanceFOV(rawHorizonImage, rawDepthHorizon);
drawSensorFOV(rawHorizonImage);
 
// Draw the last valid data FOV
lastValidHorizonImage.fill(Qt::white);
drawDistanceFOV(lastValidHorizonImage, depthHorizon);
drawSensorFOV(lastValidHorizonImage);
 
// Draw only the movement points along with results of blob detection
movementPointsImage.fill(Qt::white);
drawMovementZones(movementPointsImage, depthHorizon);
convertQImageToMat3C(movementPointsImage, movementPointsMat);
blobDetector->detect(movementPointsMat, blobKeypoints);
std::vector<cv::Point2f> points;
for (int i = 0; i < blobKeypoints.size(); i++) {
points.push_back(cv::Point2f(blobKeypoints[i].pt.x, blobKeypoints[i].pt.y));
}
movementObjects = movementTracker.update(points);
drawKeyPoints(movementPointsImage, blobKeypoints);
drawMovingObjects(movementPointsImage, movementObjects);
drawSensorFOV(movementPointsImage);
 
// Draw the overlay of movements onto static objects
overlayHorizonImage.fill(Qt::white);
drawDistanceFOV(overlayHorizonImage, depthHorizon);
drawMovementZones(overlayHorizonImage, depthHorizon);
drawKeyPoints(overlayHorizonImage, blobKeypoints);
drawMovingObjects(overlayHorizonImage, movementObjects);
drawSensorFOV(overlayHorizonImage);
}
 
/**
* Draws the zones of detected movement on the map
*/
void DepthProcessor::drawMovementZones(QImage &image, QVector<float> &data) {
QPainter painter;
painter.begin(&image);
 
// Draw the FOV for the raw data
painter.translate(X_RES / 2, Y_RES);
// Rotate the canvas, draw all distances, then restore original coordinates
painter.rotate(-90 - qRadiansToDegrees(fovWidth / 2));
painter.setPen(QPen(COLOR_MOVEMENT_ZONE, 20, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
for (int x = 0; x < X_RES; x++) {
painter.rotate(qRadiansToDegrees(fovWidth / X_RES));
if (movementMaskHorizon[x] == 1)
painter.drawPoint(data[x], 0);
}
 
painter.end();
}
 
/**
* Draws the set of keypoints on the image
*/
void DepthProcessor::drawKeyPoints(QImage &image, std::vector<cv::KeyPoint> &points) {
QPainter painter;
painter.begin(&image);
 
painter.setPen(QPen(COLOR_KEYPOINT, 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
for (int i = 0; i < points.size(); i++) {
painter.drawPoint(points[i].pt.x, points[i].pt.y);
}
 
painter.end();
}
 
/**
* Draws the moving objects along with its ID, velocity, and angle of predicted movement
*/
void DepthProcessor::drawMovingObjects(QImage &image, std::vector<MOVING_OBJECT> &objects) {
QPainter painter;
painter.begin(&image);
 
for (int i = 0; i < objects.size(); i++) {
QPoint initPoint = QPoint(objects[i].predicted_pt.x, objects[i].predicted_pt.y);
// Calculate the line to draw to indicate object movement velocity and angle
float velocity_x = initPoint.x() + (objects[i].velocity * cos(objects[i].angle)) * VELOCITY_MULTIPLIER;
float velocity_y = initPoint.y() + (objects[i].velocity * sin(objects[i].angle)) * VELOCITY_MULTIPLIER;
QPointF predPoint = QPointF(velocity_x, velocity_y);
// Draw the object's estimated position
painter.setPen(QPen(COLOR_EST_POSITION, 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawPoint(initPoint);
// Draw the object's ID
painter.drawText(initPoint.x() + 3, initPoint.y() - 3, QString::number(objects[i].ID));
// Draw the line indicating object's movement velocity and angle
painter.setPen(QPen(COLOR_EST_POSITION, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawLine(initPoint, predPoint);
// Draw the object's running average
painter.setPen(QPen(COLOR_EST_AVGERAGE, 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawPoint(objects[i].historyAvg.x, objects[i].historyAvg.y);
}
 
painter.end();
}
 
void DepthProcessor::convertMatToQImage3C(cv::Mat &mat, QImage &image) {
uchar *ptr;
for (int y = 0; y < Y_RES; y++) {
ptr = mat.ptr<uchar>(y);
for (int x = 0; x < X_RES; x++) {
image.setPixel(x, y, qRgb(ptr[x], ptr[x], ptr[x]));
}
}
}
 
void DepthProcessor::convertQImageToMat3C(QImage &image, cv::Mat &mat) {
for (int y = 0; y < Y_RES; y++) {
for (int x = 0; x < X_RES; x++) {
cv::Vec3b &pixel = mat.at<cv::Vec3b>(y, x);
QColor pixColor(image.pixel(x, y));
pixel.val[0] = pixColor.blue();
pixel.val[1] = pixColor.green();
pixel.val[2] = pixColor.red();
}
}
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/DepthProcessor.h
0,0 → 1,118
#ifndef DEPTHPROCESSOR_H
#define DEPTHPROCESSOR_H
 
#include "GlobalDefines.h"
 
// Divisor for visualizing the depth image (16->8 bits)
#define SCALE_DIVISOR 16
 
// Field of view to generate horizontal map from
#define VFOV_MIN 100
#define VFOV_MAX 140
 
// Threshold for moving object recognition
#define FG_MASK_THRESHOLD 220
 
// Parameters for the background subtractor
#define BACKGROUND_SUBTRACTOR_HISTORY 150
#define BACKGROUND_SUBTRACTOR_NMIXTURES 1
 
// Parameters for blob detection
#define BLOB_MIN_DISTANCE 30
#define BLOB_MIN_AREA 20
#define BLOB_MAX_AREA 9999
 
// Multiplier for velocity line indicator
#define VELOCITY_MULTIPLIER 5
 
// Indicator colors
#define COLOR_DEPTH_FOV QColor(255, 255, 255, 100)
#define COLOR_DEPTH_FOV_FILL QColor(0, 0, 0, 100)
#define COLOR_DEPTH_POINT QColor(0, 0, 255, 255)
#define COLOR_DEPTH_BACKGROUND QColor(255, 0, 0, 10)
#define COLOR_FOV QColor(0, 0, 0, 100)
#define COLOR_MOVEMENT_ZONE QColor(255, 0, 0, 5)
#define COLOR_KEYPOINT QColor(255, 255, 0, 200)
#define COLOR_EST_POSITION QColor(0, 0, 255, 200)
#define COLOR_EST_AVGERAGE QColor(0, 255, 0, 200)
 
class DepthProcessor : public QThread
{
Q_OBJECT
 
public:
DepthProcessor(QObject *parent = 0);
~DepthProcessor();
 
public slots:
void setFOV(float width, float height);
void setDisplayImage(const int, const QString &);
void processDepthData(const cv::Mat &);
 
signals:
void setImageTopLeft(const QImage &);
void setImageTopRight(const QImage &);
void setImageBotLeft(const QImage &);
void setImageBotRight(const QImage &);
 
private:
// Pointer to images to be displayed on the GUI
QImage *topLeftImage;
QImage *topRightImage;
QImage *botLeftImage;
QImage *botRightImage;
void updateImages();
 
void drawDepthImages();
void drawFOVImages();
 
void drawDistanceFOV(QImage &, QVector<float> &);
void drawSensorFOV(QImage &image);
void drawMovementZones(QImage &, QVector<float> &);
void drawKeyPoints(QImage &image, std::vector<cv::KeyPoint> &);
void drawMovingObjects(QImage &, std::vector<MOVING_OBJECT> &);
 
void convertMatToQImage3C(cv::Mat &, QImage &);
void convertQImageToMat3C(QImage &, cv::Mat &);
 
float fovWidth;
float fovHeight;
 
cv::Mat rawData16; // Raw 16-bit sensor data
QImage rawDepthImage; // Image of --^
cv::Mat lastValidData16; // Last known valid 16-bit data
QImage lastValidDepthImage; // Image of --^
QImage lastValidProcessed; // Processed image with overlay
cv::Mat fgMaskMOG; // Mask of detected movements
QImage movementMaskImage; // Image of --^
cv::Mat fgMaskTmp; // Temporary buffer for averaging mask values
cv::Mat fgMaskRaw; // Raw values for movement mask
QImage movementMaskRawImage; // Image of --^
cv::Mat fgMaskAverage; // Weighted average of mask values
QImage movementMaskAverageImage; // Image of --^
cv::Ptr<cv::BackgroundSubtractor> pMOG; // Background subtractor
 
QImage rawHorizonImage; // 2D image showing depth points (raw)
QImage lastValidHorizonImage; // 2D image showing depth points
QImage overlayHorizonImage; // 2D image with all overlays
 
QVector<float> rawDepthHorizon; // Depth points in inches (raw)
QVector<float> depthHorizon; // Depth points in inches
 
QVector<int> movementMaskHorizon; // 1D condensed movement mask
 
cv::Mat movementPointsMat; // Image showing object movement zones
QImage movementPointsImage; // Image of --^
cv::SimpleBlobDetector::Params params; // Parameters for blob detection
cv::Ptr<cv::FeatureDetector> blobDetector; // Blob detector
std::vector<cv::KeyPoint> blobKeypoints; // Keypoints from blob detector
 
MovingPointTracker movementTracker; // Movement tracker
std::vector<MOVING_OBJECT> movementObjects; // Results from movement tracker
 
};
 
#endif // DEPTHPROCESSOR_H
/Classwork/ME5524 - Bayesian Robotics/Final Project/GlobalDefines.h
0,0 → 1,14
#pragma once
 
#define X_RES 320
#define Y_RES 240
 
#include <QtWidgets>
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\video\background_segm.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\features2d\features2d.hpp>
 
#include "KalmanFilter.h"
#include "MovingPointTracker.h"
/Classwork/ME5524 - Bayesian Robotics/Final Project/ImageWidget.cpp
0,0 → 1,62
#include "ImageWidget.h"
 
ImageWidget::ImageWidget(QWidget *parent)
: QWidget(parent) {
 
pixmapOffset = QPoint();
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
}
 
ImageWidget::~ImageWidget() {
 
}
 
void ImageWidget::setSize(int x, int y) {
widgetSize = QSize(x, y);
}
 
void ImageWidget::setText(QString str) {
initText = str;
}
 
QSize ImageWidget::minimumSizeHint() const {
return widgetSize;
}
 
QSize ImageWidget::sizeHint() const {
return widgetSize;
}
 
void ImageWidget::paintEvent(QPaintEvent *) {
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
 
// Draw a border around this widget
painter.save();
painter.setRenderHint(QPainter::Antialiasing, false);
painter.setPen(palette().dark().color());
painter.setBrush(Qt::NoBrush);
painter.drawRect(QRect(0, 0, width() - 1, height() - 1));
painter.restore();
 
// Set default image
if (pixmap.isNull()) {
painter.setPen(Qt::black);
painter.drawText(rect(), Qt::AlignCenter, initText);
return;
}
 
// Display the saved image
painter.drawPixmap(pixmapOffset, pixmap);
}
 
void ImageWidget::updateImage(const QImage &image) {
if (&image == NULL)
pixmap = QPixmap(0, 0);
else {
// Save the received image as a QPixmap
pixmap = QPixmap::fromImage(image);
update();
}
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/ImageWidget.h
0,0 → 1,31
#ifndef IMAGEWIDGET_H
#define IMAGEWIDGET_H
 
#include "GlobalDefines.h"
 
class ImageWidget : public QWidget {
Q_OBJECT
 
public:
ImageWidget(QWidget *parent = 0);
~ImageWidget();
 
void setSize(int, int);
void setText(QString);
 
public slots:
void updateImage(const QImage &);
 
protected:
void paintEvent(QPaintEvent *event);
QSize minimumSizeHint() const;
QSize sizeHint() const;
 
private:
QSize widgetSize;
QString initText;
QPixmap pixmap;
QPoint pixmapOffset;
};
 
#endif // IMAGEWIDGET_H
/Classwork/ME5524 - Bayesian Robotics/Final Project/KalmanFilter.cpp
0,0 → 1,58
#include "KalmanFilter.h"
 
KalmanFilter::KalmanFilter(float x, float y) {
filter = cv::KalmanFilter(4, 2, 0);
 
// Intialization of KF... what do these values represent??
filter.transitionMatrix = *(cv::Mat_<float>(4, 4) << 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1);
measurement = cv::Mat_<float>::zeros(2, 1);
measurement(0) = x;
measurement(1) = y;
 
filter.statePre.at<float>(0) = x;
filter.statePre.at<float>(1) = y;
filter.statePre.at<float>(2) = 0;
filter.statePre.at<float>(3) = 0;
 
filter.statePost.at<float>(0) = x;
filter.statePost.at<float>(1) = y;
filter.statePost.at<float>(2) = 0;
filter.statePost.at<float>(3) = 0;
 
cv::setIdentity(filter.measurementMatrix);
// Process noise covariance matrix, adjust for faster convergence but more noise
cv::setIdentity(filter.processNoiseCov, cv::Scalar::all(PROCESS_NOISE_VARIANCE));
// Measurement noise covariance matrix
cv::setIdentity(filter.measurementNoiseCov, cv::Scalar::all(MEASUREMENT_NOISE_VARIANCE));
// Posteriori error estimate covariance matrix
cv::setIdentity(filter.errorCovPost, cv::Scalar::all(ESTIMATE_ERROR_VARIANCE));
}
 
KalmanFilter::~KalmanFilter() {
 
}
 
cv::Point KalmanFilter::predict() {
// First predict, to update the internal statePre variable
prediction = filter.predict();
predictedPoint = cv::Point(prediction.at<float>(0), prediction.at<float>(1));
 
// Ensure that filter doesnt get stuck if no corrections are made
filter.statePre.copyTo(filter.statePost);
filter.errorCovPre.copyTo(filter.errorCovPost);
 
return predictedPoint;
}
 
cv::Point KalmanFilter::correct(float x, float y) {
measurement(0) = x;
measurement(1) = y;
 
// Update with specified values
estimation = filter.correct(measurement);
estimatedPoint = cv::Point(estimation.at<float>(0), estimation.at<float>(1));
measuredPoint = cv::Point(measurement(0), measurement(1));
 
return estimatedPoint;
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/KalmanFilter.h
0,0 → 1,26
#pragma once
 
#include <opencv2\video\tracking.hpp>
 
#define PROCESS_NOISE_VARIANCE 0.005
#define MEASUREMENT_NOISE_VARIANCE 10
#define ESTIMATE_ERROR_VARIANCE 0.1
 
class KalmanFilter {
public:
KalmanFilter(float, float);
~KalmanFilter();
 
cv::Point predict();
cv::Point correct(float, float);
 
private:
cv::KalmanFilter filter;
cv::Mat_<float> measurement;
cv::Mat prediction;
cv::Mat estimation;
cv::Point predictedPoint;
cv::Point estimatedPoint;
cv::Point measuredPoint;
};
 
/Classwork/ME5524 - Bayesian Robotics/Final Project/MainWindow.cpp
0,0 → 1,186
#include "MainWindow.h"
#include "ImageWidget.h"
#include "OpenNI.h"
#include "DepthProcessor.h"
#include "RobotControl.h"
 
#include <QtWidgets>
 
MainWindow::MainWindow(QWidget *parent)
: QWidget(parent) {
 
// Create the widgets that go on the GUI
statusLabel = new QLabel();
statusLabel->setFixedHeight(statusLabel->sizeHint().height());
statusLabel->setText("Initializing OpenNI...");
 
frameLabel = new QLabel();
frameLabel->setFixedHeight(frameLabel->sizeHint().height());
frameLabel->setText("Frame: ??");
 
fpsLabel = new QLabel();
fpsLabel->setFixedHeight(fpsLabel->sizeHint().height());
fpsLabel->setText("FPS: ??");
 
topLeftImage = new ImageWidget();
topLeftImage->setSize(X_RES, Y_RES);
topLeftImage->setText("Initializing OpenNI...");
topRightImage = new ImageWidget();
topRightImage->setSize(X_RES, Y_RES);
topRightImage->setText("Initializing OpenNI...");
botLeftImage = new ImageWidget();
botLeftImage->setSize(X_RES, Y_RES);
botLeftImage->setText("Initializing OpenNI...");
botRightImage = new ImageWidget();
botRightImage->setSize(X_RES, Y_RES);
botRightImage->setText("Initializing OpenNI...");
 
topLeftSelect = new QComboBox();
topLeftSelect->setFocusPolicy(Qt::NoFocus);
topRightSelect = new QComboBox();
topRightSelect->setFocusPolicy(Qt::NoFocus);
botLeftSelect = new QComboBox();
botLeftSelect->setFocusPolicy(Qt::NoFocus);
botRightSelect = new QComboBox();
botRightSelect->setFocusPolicy(Qt::NoFocus);
QStringList imageList;
imageList.append("Raw Depth");
imageList.append("Last Valid Depth");
imageList.append("Movement Mask Raw Depth");
imageList.append("Movement Mask Average Depth");
imageList.append("Processed Depth");
imageList.append("Movement Map");
imageList.append("Raw Depth Horizon");
imageList.append("Last Valid Horizon");
imageList.append("Overlay Horizon");
updateSelectionList(imageList);
 
// Initialize the widgets for controlling the robot
robot = new RobotControl();
 
// Add all GUI widgets to a layout
QGridLayout *mainLayout = new QGridLayout();
mainLayout->addWidget(statusLabel, 0, 0, 1, 3);
mainLayout->addWidget(frameLabel, 0, 5, 1, 1, Qt::AlignRight);
mainLayout->addWidget(fpsLabel, 0, 6, 1, 1, Qt::AlignRight);
 
mainLayout->addWidget(topLeftSelect, 1, 0, 1, 3);
mainLayout->addWidget(topLeftImage, 2, 0, 1, 3);
 
mainLayout->addWidget(topRightSelect, 1, 4, 1, 3);
mainLayout->addWidget(topRightImage, 2, 4, 1, 3);
 
mainLayout->addWidget(botLeftSelect, 3, 0, 1, 3);
mainLayout->addWidget(botLeftImage, 4, 0, 1, 3);
 
mainLayout->addWidget(botRightSelect, 3, 4, 1, 3);
mainLayout->addWidget(botRightImage, 4, 4, 1, 3);
 
 
mainLayout->addWidget(robot, 5, 0, 1, 7);
 
setLayout(mainLayout);
 
setWindowTitle("RGBD Depth Map");
 
// Initialize the threads for pulling and processing depth data
openNIThread = new OpenNI();
openNIProcessor = new DepthProcessor();
 
connect(topLeftSelect, SIGNAL(activated(QString)), this, SLOT(imageSelectionChanged(QString)));
connect(topRightSelect, SIGNAL(activated(QString)), this, SLOT(imageSelectionChanged(QString)));
connect(botLeftSelect, SIGNAL(activated(QString)), this, SLOT(imageSelectionChanged(QString)));
connect(botRightSelect, SIGNAL(activated(QString)), this, SLOT(imageSelectionChanged(QString)));
 
connect(openNIThread, SIGNAL(setStatusString(QString)), this, SLOT(updateStatusText(QString)));
connect(openNIThread, SIGNAL(setFrameString(QString)), this, SLOT(updateFrameText(QString)));
connect(openNIThread, SIGNAL(setFPSString(QString)), this, SLOT(updateFPSText(QString)));
connect(openNIThread, SIGNAL(processDepthData(cv::Mat)), openNIProcessor, SLOT(processDepthData(cv::Mat)));
connect(openNIThread, SIGNAL(sensorConnected()), this, SLOT(sensorConnected()));
connect(openNIProcessor, SIGNAL(setImageTopLeft(QImage)), topLeftImage, SLOT(updateImage(QImage)));
connect(openNIProcessor, SIGNAL(setImageTopRight(QImage)), topRightImage, SLOT(updateImage(QImage)));
connect(openNIProcessor, SIGNAL(setImageBotLeft(QImage)), botLeftImage, SLOT(updateImage(QImage)));
connect(openNIProcessor, SIGNAL(setImageBotRight(QImage)), botRightImage, SLOT(updateImage(QImage)));
connect(openNIThread, SIGNAL(setFOV(float, float)), openNIProcessor, SLOT(setFOV(float, float)));
connect(this, SIGNAL(changeDisplayImage(int, QString)), openNIProcessor, SLOT(setDisplayImage(int, QString)));
 
// Start the thread for processing depth data from the sensor
openNIProcessor->start(QThread::HighPriority);
// Start the thread for reading depth data from the sensor
openNIThread->start();
 
setFixedSize(this->sizeHint());
}
 
MainWindow::~MainWindow() {
delete(topLeftImage);
delete(topRightImage);
delete(botLeftImage);
delete(botRightImage);
 
delete(topLeftSelect);
delete(topRightSelect);
delete(botLeftSelect);
delete(botRightSelect);
 
delete(robot);
 
delete(statusLabel);
delete(frameLabel);
delete(fpsLabel);
 
openNIThread->terminate();
openNIProcessor->terminate();
}
 
void MainWindow::updateStatusText(const QString &string) {
statusLabel->setText(string);
}
 
void MainWindow::updateFrameText(const QString &string) {
frameLabel->setText("Frame: " + string);
}
 
void MainWindow::updateFPSText(const QString &string) {
fpsLabel->setText("FPS: " + string);
}
 
void MainWindow::updateSelectionList(const QStringList &list) {
topLeftSelect->addItems(list);
topRightSelect->addItems(list);
botLeftSelect->addItems(list);
botRightSelect->addItems(list);
}
 
void MainWindow::imageSelectionChanged(const QString &str) {
if (sender() == topLeftSelect) {
emit changeDisplayImage(0, str);
} else if (sender() == topRightSelect) {
emit changeDisplayImage(1, str);
} else if (sender() == botLeftSelect) {
emit changeDisplayImage(2, str);
} else if (sender() == botRightSelect) {
emit changeDisplayImage(3, str);
}
}
 
void MainWindow::sensorConnected() {
emit changeDisplayImage(0, "Raw Depth");
emit changeDisplayImage(1, "Raw Depth Horizon");
emit changeDisplayImage(2, "Processed Depth");
emit changeDisplayImage(3, "Overlay Horizon");
topLeftSelect->setCurrentIndex(0);
topRightSelect->setCurrentIndex(6);
botLeftSelect->setCurrentIndex(4);
botRightSelect->setCurrentIndex(8);
}
 
void MainWindow::keyPressEvent(QKeyEvent *event) {
// Send keypress events to the robot handing code
robot->handleKeyPress(event);
}
 
void MainWindow::keyReleaseEvent(QKeyEvent *event) {
// Send keypress events to the robot handing code
robot->handleKeyRelease(event);
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/MainWindow.qrc
0,0 → 1,4
<RCC>
<qresource prefix="QT_RGBD">
</qresource>
</RCC>
/Classwork/ME5524 - Bayesian Robotics/Final Project/MovingPointTracker.cpp
0,0 → 1,87
#include "MovingPointTracker.h"
 
MovingPointTracker::MovingPointTracker() {
active_objects = 0;
nextID = 0;
}
 
 
MovingPointTracker::~MovingPointTracker() {
 
}
 
float MovingPointTracker::pointDistance(cv::Point2f &pt1, cv::Point2f &pt2) {
cv::Point2f diff = pt1 - pt2;
return cv::sqrt(diff.x * diff.x + diff.y * diff.y);
}
 
std::vector<MOVING_OBJECT> MovingPointTracker::update(std::vector<cv::Point2f> points) {
// Mark each existing object as invalid
for (int i = 0; i < objects.size(); i++) {
objects[i].valid = false;
}
 
std::vector<MOVING_OBJECT> newObjects;
 
// For each point, determine if it is an extension of an existing object
for (int i = 0; i < points.size(); i++) {
bool found = false;
int index;
for (index = 0; index < objects.size(); index++) {
// Find the first object within the distance threshold
// TODO: calculate all distances and use the closest one
// TODO: handle case where multiple objects are merged into one
if (pointDistance(points[i], objects[index].last_known_pt) < OBJECT_DISTANCE_THRESHOLD) {
found = true;
break;
}
}
if (found) {
// If a match was found, update the object
objects[index].valid = true;
// Predict the next point using the Kalman filter
objects[index].filter->predict();
objects[index].last_known_pt = points[i];
objects[index].predicted_pt = objects[index].filter->correct(points[i].x, points[i].y);
// Calculate the running average
objects[index].history.push_front(objects[index].predicted_pt);
if (objects[index].history.size() > HISTORY_DEPTH)
objects[index].history.pop_back();
float avgX = 0, avgY = 0;
for (std::list<cv::Point2f>::iterator it = objects[index].history.begin(); it != objects[index].history.end(); it++) {
avgX += (*it).x;
avgY += (*it).y;
}
avgX /= objects[index].history.size();
avgY /= objects[index].history.size();
objects[index].historyAvg = cv::Point2f(avgX, avgY);
// Calculate the updated velocity and angle
objects[index].velocity = pointDistance(objects[index].predicted_pt, objects[index].historyAvg);
cv::Point2f diff = objects[index].predicted_pt - objects[index].historyAvg;
objects[index].angle = atan2(diff.y, diff.x);
} else {
// If no matches were found, create a new object
MOVING_OBJECT newObject;
newObject.ID = nextID;
nextID++;
newObject.last_known_pt = points[i];
newObject.predicted_pt = points[i];
newObject.velocity = 0;
newObject.angle = 0;
newObject.filter = new KalmanFilter(points[i].x, points[i].y);
newObject.historyAvg = cv::Point2f(0, 0);
newObjects.push_back(newObject);
}
}
 
// If an object is invalid at this point, remove it
//std::vector<MOVING_OBJECT> newObjects;
for (int i = 0; i < objects.size(); i++) {
if (objects[i].valid) {
newObjects.push_back(objects[i]);
}
}
objects = newObjects;
 
return objects;
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/MovingPointTracker.h
0,0 → 1,38
#pragma once
 
#include "GlobalDefines.h"
 
// Distance before two points are considered separate objects
#define OBJECT_DISTANCE_THRESHOLD 20
// Length of the history to store
#define HISTORY_DEPTH 10
 
class KalmanFilter;
 
typedef struct {
int ID;
cv::Point2f last_known_pt;
cv::Point2f predicted_pt;
float velocity;
float angle;
KalmanFilter *filter;
bool valid;
std::list<cv::Point2f> history;
cv::Point2f historyAvg;
} MOVING_OBJECT;
 
class MovingPointTracker {
public:
MovingPointTracker();
~MovingPointTracker();
 
std::vector<MOVING_OBJECT> update(std::vector<cv::Point2f>);
 
private:
float pointDistance(cv::Point2f &, cv::Point2f &);
 
int nextID;
int active_objects;
std::vector<MOVING_OBJECT> objects;
};
 
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.sln
0,0 → 1,31

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QT_RGBD", "QT_RGBD.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.ActiveCfg = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.Build.0 = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Qt5Version = msvc2013_64_opengl
EndGlobalSection
EndGlobal
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.vcxproj
0,0 → 1,338
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(OPENCV_DIR)\..\..\include;$(BOOST_ROOT);$(OPEN_NI_INCLUDE);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>$(OPENCV_DIR)\lib;$(OPEN_NI_LIB64);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IncludePath>$(OPENCV_DIR)\..\..\include;$(BOOST_ROOT);$(OPEN_NI_INCLUDE);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>$(OPENCV_DIR)\lib;$(OPEN_NI_LIB64);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtOpenGL;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5OpenGLd.lib;opengl32.lib;glu32.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtOpenGL;$(QTDIR)\include\QtSerialPort;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>openNI64.lib;qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5OpenGLd.lib;opengl32.lib;glu32.lib;Qt5Widgetsd.lib;Qt5SerialPort.lib;opencv_core249d.lib;opencv_imgproc249d.lib;opencv_highgui249d.lib;opencv_ml249d.lib;opencv_video249d.lib;opencv_features2d249d.lib;opencv_calib3d249d.lib;opencv_objdetect249d.lib;opencv_contrib249d.lib;opencv_legacy249d.lib;opencv_flann249d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtOpenGL;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5OpenGL.lib;opengl32.lib;glu32.lib;Qt5Widgets.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtOpenGL;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSerialPort;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>openNI64.lib;qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5OpenGL.lib;opengl32.lib;glu32.lib;Qt5Widgets.lib;Qt5SerialPort.lib;opencv_core249.lib;opencv_imgproc249.lib;opencv_highgui249.lib;opencv_ml249.lib;opencv_video249.lib;opencv_features2d249.lib;opencv_calib3d249.lib;opencv_objdetect249.lib;opencv_contrib249.lib;opencv_legacy249.lib;opencv_flann249.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DepthProcessor.cpp" />
<ClCompile Include="ImageWidget.cpp" />
<ClCompile Include="GeneratedFiles\Debug\moc_DepthProcessor.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_ImageWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_MainWindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_OpenNI.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_RobotControl.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\qrc_MainWindow.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_DepthProcessor.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_ImageWidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_MainWindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_OpenNI.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_RobotControl.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="kalman.cpp" />
<ClCompile Include="KalmanFilter.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MovingPointTracker.cpp" />
<ClCompile Include="OpenNI.cpp" />
<ClCompile Include="RobotControl.cpp" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MainWindow.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing MainWindow.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing MainWindow.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing MainWindow.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing MainWindow.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSerialPort"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MainWindow.qrc">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(FullPath);%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="OpenNI.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing OpenNI.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing OpenNI.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing OpenNI.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing OpenNI.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSerialPort"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="ImageWidget.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing ImageWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing ImageWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing ImageWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing ImageWidget.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSerialPort"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="DepthProcessor.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing DepthProcessor.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing DepthProcessor.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing DepthProcessor.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing DepthProcessor.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSerialPort"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="RobotControl.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing RobotControl.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing RobotControl.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtSerialPort" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing RobotControl.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing RobotControl.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSerialPort"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GlobalDefines.h" />
<ClInclude Include="KalmanFilter.h" />
<ClInclude Include="MovingPointTracker.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_Win32="msvc2013_64_opengl" Qt5Version_x0020_x64="msvc2013_64_opengl" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
</Project>
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.vcxproj.filters
0,0 → 1,130
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;cxx;c;def</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h</Extensions>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>moc;h;cpp</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
<Filter Include="Generated Files\Debug">
<UniqueIdentifier>{e35d722f-fe5e-4999-9ceb-fe6bb51d1490}</UniqueIdentifier>
<Extensions>cpp;moc</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
<Filter Include="Generated Files\Release">
<UniqueIdentifier>{f210df86-77e1-4b50-81c3-dfddd774e4b9}</UniqueIdentifier>
<Extensions>cpp;moc</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\qrc_MainWindow.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_MainWindow.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_MainWindow.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="MainWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="OpenNI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_OpenNI.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_OpenNI.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="DepthProcessor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_DepthProcessor.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_DepthProcessor.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="RobotControl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_RobotControl.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_RobotControl.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_ImageWidget.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_ImageWidget.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="ImageWidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="kalman.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="KalmanFilter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MovingPointTracker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MainWindow.qrc">
<Filter>Resource Files</Filter>
</CustomBuild>
<CustomBuild Include="MainWindow.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="OpenNI.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="DepthProcessor.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="RobotControl.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="ImageWidget.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GlobalDefines.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="KalmanFilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MovingPointTracker.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.vcxproj.user
0,0 → 1,11
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QTDIR>C:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QTDIR>C:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>
/Classwork/ME5524 - Bayesian Robotics/Final Project/QT_RGBD.vcxproj.vspscc
0,0 → 1,14
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "4"
"EXCLUDED_FILE0" = "GeneratedFiles\\ui_qt_rgbd.h"
"EXCLUDED_FILE1" = "GeneratedFiles\\Debug\\moc_qt_rgbd.cpp"
"EXCLUDED_FILE2" = "GeneratedFiles\\qrc_qt_rgbd.cpp"
"EXCLUDED_FILE3" = "GeneratedFiles\\Release\\moc_qt_rgbd.cpp"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/RobotControl.cpp
0,0 → 1,215
#include "RobotControl.h"
 
RobotControl::RobotControl(QWidget *parent)
: QWidget(parent)
{
connected = false;
 
connectBtn = new QPushButton();
connectBtn->setText("Connect");
connectBtn->setFocusPolicy(Qt::NoFocus);
 
refreshBtn = new QPushButton();
refreshBtn->setText("Refresh");
refreshBtn->setFocusPolicy(Qt::NoFocus);
 
statusLabel = new QLabel();
statusLabel->setText("Status: Disconnected");
 
speedLabel = new QLabel();
speedLabel->setText("Speed (0-255):");
 
speedBox = new QSpinBox();
speedBox->setRange(0, 255);
speedBox->setValue(255);
speedBox->setSingleStep(51);
speedBox->setFocusPolicy(Qt::NoFocus);
 
portSelect = new QComboBox();
portSelect->setFocusPolicy(Qt::NoFocus);
refreshPorts();
 
port = new QSerialPort();
 
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(connectBtn);
layout->addWidget(portSelect);
layout->addWidget(refreshBtn);
layout->addWidget(statusLabel);
layout->addStretch();
layout->addWidget(speedLabel);
layout->addWidget(speedBox);
setLayout(layout);
connect(connectBtn, SIGNAL(pressed()), this, SLOT(toggleConnect()));
connect(refreshBtn, SIGNAL(pressed()), this, SLOT(refreshPorts()));
 
}
 
RobotControl::~RobotControl()
{
port->close();
delete(connectBtn);
delete(refreshBtn);
delete(statusLabel);
delete(portSelect);
delete(port);
}
 
void RobotControl::refreshPorts() {
ports = QSerialPortInfo::availablePorts();
portSelect->clear();
for (int i = 0; i < ports.size(); i++) {
portSelect->addItem(ports[i].portName());
}
}
 
void RobotControl::toggleConnect() {
if (!connected) {
port->setPortName(portSelect->currentText());
if (!port->open(QIODevice::ReadWrite)) {
port->close();
statusLabel->setText("Status: Unable to Connect");
} else {
port->setBaudRate(QSerialPort::Baud115200);
port->setDataBits(QSerialPort::Data8);
port->setParity(QSerialPort::NoParity);
port->setFlowControl(QSerialPort::NoFlowControl);
port->setStopBits(QSerialPort::OneStop);
statusLabel->setText("Status: Connected");
connectBtn->setText("Disconnect");
refreshBtn->setEnabled(false);
portSelect->setEnabled(false);
connected = true;
}
} else {
port->close();
statusLabel->setText("Status: Disconnected");
connectBtn->setText("Connect");
refreshBtn->setEnabled(true);
portSelect->setEnabled(true);
connected = false;
}
}
 
void RobotControl::handleKeyPress(QKeyEvent *event) {
if (connected) {
if (!event->isAutoRepeat()) {
switch (event->key()) {
case Qt::Key_W:
case Qt::Key_Up:
moveForward = true;
break;
case Qt::Key_S:
case Qt::Key_Down:
moveBackward = true;
break;
case Qt::Key_A:
case Qt::Key_Left:
turnLeft = true;
break;
case Qt::Key_D:
case Qt::Key_Right:
turnRight = true;
break;
}
 
processMove();
}
}
}
 
void RobotControl::handleKeyRelease(QKeyEvent *event) {
if (connected) {
if (!event->isAutoRepeat()) {
switch (event->key()) {
case Qt::Key_W:
case Qt::Key_Up:
moveForward = false;
break;
case Qt::Key_S:
case Qt::Key_Down:
moveBackward = false;
break;
case Qt::Key_A:
case Qt::Key_Left:
turnLeft = false;
break;
case Qt::Key_D:
case Qt::Key_Right:
turnRight = false;
break;
}
 
processMove();
}
}
}
 
void RobotControl::processMove() {
char buffer[4];
 
// 0x01 = Reset
// 0x02 = Left Forward
// 0x03 = Left Backward
// 0x04 = Right Forward
// 0x05 = Right Backward
 
char speed = speedBox->value();
 
if (connected) {
if (moveForward) {
if (turnLeft) {
buffer[0] = 0x02;
buffer[1] = 0x00;
buffer[2] = 0x04;
buffer[3] = speed;
} else if (turnRight) {
buffer[0] = 0x02;
buffer[1] = speed;
buffer[2] = 0x04;
buffer[3] = 0x00;
} else {
buffer[0] = 0x02;
buffer[1] = speed;
buffer[2] = 0x04;
buffer[3] = speed;
}
} else if (moveBackward) {
if (turnLeft) {
buffer[0] = 0x03;
buffer[1] = 0x00;
buffer[2] = 0x05;
buffer[3] = speed;
} else if (turnRight) {
buffer[0] = 0x03;
buffer[1] = speed;
buffer[2] = 0x05;
buffer[3] = 0x00;
} else {
buffer[0] = 0x03;
buffer[1] = speed;
buffer[2] = 0x05;
buffer[3] = speed;
}
} else if (turnLeft) {
buffer[0] = 0x03;
buffer[1] = speed;
buffer[2] = 0x04;
buffer[3] = speed;
} else if (turnRight) {
buffer[0] = 0x02;
buffer[1] = speed;
buffer[2] = 0x05;
buffer[3] = speed;
} else {
buffer[0] = 0x02;
buffer[1] = 0x00;
buffer[2] = 0x04;
buffer[3] = 0x00;
}
port->write(buffer, 4);
port->flush();
}
}
/Classwork/ME5524 - Bayesian Robotics/Final Project/RobotControl.h
0,0 → 1,43
#ifndef ROBOTCONTROL_H
#define ROBOTCONTROL_H
 
#include "GlobalDefines.h"
#include <QSerialPort>
#include <QSerialPortInfo>
 
class RobotControl : public QWidget
{
Q_OBJECT
 
public:
RobotControl(QWidget *parent = 0);
~RobotControl();
 
void handleKeyPress(QKeyEvent *event);
void handleKeyRelease(QKeyEvent *event);
 
public slots:
void refreshPorts();
void toggleConnect();
 
private:
void processMove();
 
bool connected;
bool moveForward;
bool moveBackward;
bool turnLeft;
bool turnRight;
 
QPushButton *connectBtn;
QPushButton *refreshBtn;
QLabel *statusLabel;
QLabel *speedLabel;
QSpinBox *speedBox;
QComboBox *portSelect;
 
QSerialPort *port;
QList<QSerialPortInfo> ports;
};
 
#endif // ROBOTCONTROL_H
/Classwork/ME5524 - Bayesian Robotics/Final Project/kalman.cpp
0,0 → 1,56
//#include "opencv2/highgui/highgui.hpp"
//#include "opencv2/video/tracking.hpp"
//#include <Windows.h>
//#include "KalmanFilter.h"
//
//#define drawCross( center, color, d ) \
// line(img, cv::Point(center.x - d, center.y - d), cv::Point(center.x + d, center.y + d), color, 2, CV_AA, 0); \
// line(img, cv::Point(center.x + d, center.y - d), cv::Point(center.x - d, center.y + d), color, 2, CV_AA, 0)
//
//using namespace std;
//
//int main() {
//
// char code = (char)-1;
// POINT mousePos;
// GetCursorPos(&mousePos);
//
// KalmanFilter KF(mousePos.x, mousePos.y);
//
// // Image to show mouse tracking
// cv::Mat img(600, 800, CV_8UC3);
// vector<cv::Point> mousev, kalmanv;
// mousev.clear();
// kalmanv.clear();
//
// while (1) {
// KF.predict();
//
// // Get mouse point
// GetCursorPos(&mousePos);
//
// cv::Point measPt = cv::Point(mousePos.x, mousePos.y);
// cv::Point statePt = KF.correct(mousePos.x, mousePos.y);
//
// // plot points
// imshow("mouse kalman", img);
// img = cv::Scalar::all(0);
//
// mousev.push_back(measPt);
// kalmanv.push_back(statePt);
// drawCross(statePt, cv::Scalar(255, 255, 255), 5);
// drawCross(measPt, cv::Scalar(0, 0, 255), 5);
//
// for (int i = 0; i < mousev.size() - 1; i++)
// line(img, mousev[i], mousev[i + 1], cv::Scalar(255, 255, 0), 1);
//
// for (int i = 0; i < kalmanv.size() - 1; i++)
// line(img, kalmanv[i], kalmanv[i + 1], cv::Scalar(0, 155, 255), 1);
//
// code = (char)cv::waitKey(100);
// if (code > 0)
// break;
// }
//
// return 0;
//}
/Classwork/ME5524 - Bayesian Robotics/Final Project/main.cpp
0,0 → 1,15
#include "MainWindow.h"
 
Q_DECLARE_METATYPE(cv::Mat);
 
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow window;
window.show();
 
qRegisterMetaType<cv::Mat>();
qRegisterMetaType<QImage>();
qRegisterMetaType<QVector<QVector<short>>>();
 
return app.exec();
}