Qt fix
This commit is contained in:
parent
772bf4e9ae
commit
ef41b0c59a
2
CSV.pro
2
CSV.pro
@ -4,7 +4,7 @@
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core qml
|
||||
QT += core qml quick
|
||||
TEMPLATE = app
|
||||
|
||||
TARGET = CSV
|
||||
|
14
CSV.pro.user
14
CSV.pro.user
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.0.1, 2014-07-11T19:30:40. -->
|
||||
<!-- Written by QtCreator 3.0.1, 2014-07-12T22:47:40. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@ -53,12 +53,12 @@
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{7246c6ab-7a87-4118-a487-ab344a31d36b}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{463a2572-9a8f-4eb1-bda2-3a5ffe83025f}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andrey/workspace/Qt/build-CSV-Desktop-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andrey/workspace/build-CSV-Desktop-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@ -117,7 +117,7 @@
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andrey/workspace/Qt/build-CSV-Desktop-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andrey/workspace/build-CSV-Desktop-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@ -229,11 +229,11 @@
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CSV</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/andrey/workspace/Qt/CSV/CSV.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/andrey/workspace/ComputerVision/CSV.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CSV.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
|
||||
@ -251,7 +251,7 @@
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
|
||||
<value type="QByteArray">{35059b80-6449-4cca-8333-a4525005f807}</value>
|
||||
<value type="QByteArray">{dedf9f3d-a494-4afd-b37a-86d04bd971d6}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
|
13
Main.qml
13
Main.qml
@ -2,11 +2,20 @@ import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
Window {
|
||||
ApplicationWindow {
|
||||
id: mainWindow
|
||||
visible: true
|
||||
width: 800
|
||||
height: 600
|
||||
property string state: 'Ready'
|
||||
|
||||
statusBar: StatusBar {
|
||||
Row {
|
||||
Label {
|
||||
text: mainWindow.state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: leftColumn
|
||||
@ -141,7 +150,7 @@ Window {
|
||||
Item {
|
||||
Image {
|
||||
id: image
|
||||
source: "img/left4.png"
|
||||
source: "image://images/result"
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
|
26
main.cpp
26
main.cpp
@ -14,33 +14,25 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication a(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
SvImageProvider* imageProvider = new SvImageProvider();
|
||||
SvImageProvider imageProvider;
|
||||
|
||||
QImage imgLeft = QPixmap("img/left8.png").toImage();
|
||||
QImage imgRight = QPixmap("img/right8.png").toImage();
|
||||
QImage imgLeft("../ComputerVision/img/left8.png");
|
||||
QImage imgRight("../ComputerVision/img/right8.png");
|
||||
QImage imgStereo(imgLeft.width(), imgRight.height(), QImage::Format_RGB32);
|
||||
|
||||
SvImage left(imgLeft);
|
||||
SvImage right(imgRight);
|
||||
SvImage stereo(imgStereo);
|
||||
|
||||
imageProvider.addImage("left", &left);
|
||||
imageProvider.addImage("right", &right);
|
||||
imageProvider.addImage("result", &stereo);
|
||||
|
||||
|
||||
imageProvider->addImage("left", &left);
|
||||
imageProvider->addImage("right", &right);
|
||||
imageProvider->addImage("result", &stereo);
|
||||
|
||||
engine.addImageProvider("image", imageProvider);
|
||||
engine.addImageProvider("images", &imageProvider);
|
||||
engine.load(QUrl(QStringLiteral("qrc:///Main.qml")));
|
||||
|
||||
/*SvProcessor proc(&left, &right, &stereo, 4);
|
||||
proc.start();*/
|
||||
|
||||
|
||||
//
|
||||
|
||||
//QObject *object = component.create();
|
||||
|
||||
SvProcessor proc(&left, &right, &stereo, 1);
|
||||
proc.start();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -2,5 +2,6 @@
|
||||
<qresource prefix="/">
|
||||
<file>Main.qml</file>
|
||||
<file>img/left4.png</file>
|
||||
<file>img/right4.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -63,9 +63,7 @@ void SvImage::putPixel(int x, int y, int value)
|
||||
return;
|
||||
}
|
||||
|
||||
QColor color(value, value, value);
|
||||
|
||||
m_image->setPixel(x, y, color.rgb());
|
||||
m_image->setPixel(x, y, qRgb(value, value, value));
|
||||
}
|
||||
|
||||
unsigned int SvImage::getHeight() {
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "svimage.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class SvImageProvider : public QQuickImageProvider
|
||||
{
|
||||
protected:
|
||||
|
@ -30,7 +30,7 @@ int SvKernelV1::diff(int lx, int ly, int rx, int ry)
|
||||
color = abs(Gvalue - Rvalue) + abs(Bvalue - Gvalue);
|
||||
|
||||
return (Gvalue + Rvalue + Bvalue) +
|
||||
color * 4;
|
||||
color << 2;
|
||||
}
|
||||
|
||||
int SvKernelV1::match(int x, int y, int j)
|
||||
@ -73,7 +73,6 @@ void SvKernelV1::exec(int line)
|
||||
//dist = (abs(cursor - i));
|
||||
|
||||
tmp = match(x, line, i);
|
||||
|
||||
tmpSmoothed = tmp;// + (dist) * (1.0/diff);
|
||||
|
||||
if (tmpSmoothed < minErrorValue || minErrorValue == -1) {
|
||||
|
@ -29,13 +29,15 @@ SvProcessor::SvProcessor(SvImage* left, SvImage* right, SvImage* result, int num
|
||||
m_workers[i].setKernel(m_kernel);
|
||||
m_workers[i].moveToThread(&m_threads[i]);
|
||||
|
||||
connect(this, &SvProcessor::stopped, &m_workers[i], &SvWorker::stop);
|
||||
connect(this, &SvProcessor::started, &m_workers[i], &SvWorker::start);
|
||||
connect(&m_threads[i], &QThread::started, &m_workers[i], &SvWorker::start);
|
||||
connect(&m_workers[i], &SvWorker::finished, this, &SvProcessor::workerFinished);
|
||||
connect(&m_workers[i], &SvWorker::finished, &m_threads[i], &QThread::quit);
|
||||
connect(this, &SvProcessor::started, &m_workers[i], &SvWorker::start);
|
||||
connect(&m_threads[i], &QThread::finished, &m_threads[i], &QThread::deleteLater);
|
||||
}
|
||||
|
||||
for (i = 0; i < result->getHeight(); i++) {
|
||||
m_workers[i].addTask(i % m_numberOfWorkers);
|
||||
m_workers[i % m_numberOfWorkers].addTask(i);
|
||||
}
|
||||
}
|
||||
SvProcessor::~SvProcessor()
|
||||
@ -50,6 +52,7 @@ void SvProcessor::workerFinished(int workerId)
|
||||
|
||||
m_workersFinished++;
|
||||
if (m_workersFinished == m_numberOfWorkers) {
|
||||
qDebug() << "finished";
|
||||
emit finished(m_startTime - 0);
|
||||
}
|
||||
}
|
||||
@ -64,8 +67,6 @@ void SvProcessor::start()
|
||||
for (i = 0; i < m_numberOfWorkers; i++) {
|
||||
m_threads[i].start();
|
||||
}
|
||||
|
||||
emit started();
|
||||
}
|
||||
|
||||
void SvProcessor::stop()
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include<QObject>
|
||||
#include<QThread>
|
||||
#include<QDebug>
|
||||
|
||||
#include "svimage.h"
|
||||
#include "svworker.h"
|
||||
|
Loading…
Reference in New Issue
Block a user