diff --git a/src/SvMain.cpp b/src/SvMain.cpp index 0f07b0b..0f0cf9c 100644 --- a/src/SvMain.cpp +++ b/src/SvMain.cpp @@ -10,7 +10,11 @@ #include "SvImage.h" #include "SvProcessorV1.h" #include "SvProcessorV2.h" -#include + +#include +#include +#include + //#include //#include //#include diff --git a/src/SvMultithreadProcessor.cpp b/src/SvMultithreadProcessor.cpp index 5c73e69..273bff9 100644 --- a/src/SvMultithreadProcessor.cpp +++ b/src/SvMultithreadProcessor.cpp @@ -36,6 +36,8 @@ void SvMultithreadProcessor::exec() { } SvMultithreadProcessor::~SvMultithreadProcessor() { - + if (m_thread.joinable()) { + m_thread.detach(); + } } diff --git a/src/SvProcessorV1.cpp b/src/SvProcessorV1.cpp index 572c32e..73a1928 100644 --- a/src/SvProcessorV1.cpp +++ b/src/SvProcessorV1.cpp @@ -62,51 +62,6 @@ int SvProcessorV1::match(int x, int y, int j) { } void SvProcessorV1::exec() { - int x, y, cursor, closest, tmp; - int minErrorValue, tmpSmoothed, matched; - int precursor, preprecursor; - int dist, diff, val, prev, preprev; - cursor = 0; - precursor = 0; - preprecursor = 0; - - for (x = 0; x < m_stereo->getWidth(); x++) { - closest = -1; minErrorValue = -1;matched=0; - minErrorValue=-1; - - val = m_left->getPixelHue(x, m_line); - - for (int i = 1; i < windowSize; i++) { - dist = (abs(cursor - i)); - - tmp = match(x, m_line, i); - - tmpSmoothed = tmp;// + (dist) * (1.0/diff); - - if (tmpSmoothed < minErrorValue || minErrorValue == -1) { - minErrorValue = tmpSmoothed; - closest = i; - matched = 1; - } else if (tmpSmoothed == minErrorValue) { - if (abs(cursor - i) < abs(cursor - closest)) { - closest = i; - matched++; - } - } - } - - if (matched == 1) { - cursor = closest; - } - - m_stereo->putPixel(x, m_line, getPixelColor(cursor)); - - preprecursor = precursor; - precursor = cursor; - - preprev = prev; - prev = val; - } }