Latest
This commit is contained in:
parent
c16c0f15cf
commit
c7be57824a
@ -10,7 +10,11 @@
|
||||
#include "SvImage.h"
|
||||
#include "SvProcessorV1.h"
|
||||
#include "SvProcessorV2.h"
|
||||
#include <thread>
|
||||
|
||||
#include <iostream>
|
||||
#include <system_error>
|
||||
#include <unistd.h>
|
||||
|
||||
//#include <pcl/point_cloud.h>
|
||||
//#include <pcl/point_types.h>
|
||||
//#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
@ -36,6 +36,8 @@ void SvMultithreadProcessor::exec() {
|
||||
}
|
||||
|
||||
SvMultithreadProcessor::~SvMultithreadProcessor() {
|
||||
|
||||
if (m_thread.joinable()) {
|
||||
m_thread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user