summaryrefslogtreecommitdiffstats
path: root/Master/Computer Vision/Praktikum1/StereoVision.h
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Computer Vision/Praktikum1/StereoVision.h
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Computer Vision/Praktikum1/StereoVision.h')
-rw-r--r--Master/Computer Vision/Praktikum1/StereoVision.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/Master/Computer Vision/Praktikum1/StereoVision.h b/Master/Computer Vision/Praktikum1/StereoVision.h
new file mode 100644
index 0000000..1ccb96a
--- /dev/null
+++ b/Master/Computer Vision/Praktikum1/StereoVision.h
@@ -0,0 +1,72 @@
+#pragma once
+
+#include <vector>
+#include "abstring.h"
+#include "bvimagergb.h"
+#include "bvrgbpixel.h"
+#include "bvfilters.h"
+#include "vraibolabmodule.h"
+
+#define DISP_DIST_THRESHOLD 20
+#define MAX_DISP_GRADIENT 1.0
+#define ERROR_DISP_GRADIENT 1000.0
+#define MAX_COLOR_DIFF 5
+#define MAX_LUM_DIFF 10.0
+
+struct candidate {
+ unsigned xLeft;
+ unsigned xRight;
+ double propapilityCounter;
+ bool isAssigned;
+ bool operator== (const candidate& other) const {
+ return (xLeft == other.xLeft && xRight == other.xRight);
+ }
+ bool operator== (const candidate* other) const {
+ return (xLeft == other->xLeft && xRight == other->xRight);
+ }
+};
+
+struct candidatePair {
+ candidate* firstCand;
+ candidate* secondCand;
+ double disparityGradient;
+ bool isAssigned;
+ bool isDeleted;
+ //long pairNum;
+ double candidateDistance;
+ bool operator== (const candidatePair& other) const {
+ return ( (firstCand == other.firstCand) && (secondCand == other.secondCand) );
+ }
+ bool hasCandidate(const candidate& other) const {
+ return (*firstCand == other) || (*secondCand == other);
+ }
+ bool hasCandidate(const candidate* other) const {
+ return (*firstCand == *other) || (*secondCand == *other);
+ }
+ candidatePair() {}
+ candidatePair(const candidatePair& other) {
+ firstCand = other.firstCand;
+ secondCand = other.secondCand;
+ disparityGradient = other.disparityGradient;
+ isAssigned = other.isAssigned;
+ isDeleted = other.isDeleted;
+ //pairNum = other.pairNum;
+ candidateDistance = other.candidateDistance;
+ }
+};
+
+class StereoVision
+{
+public:
+ StereoVision(void);
+ ~StereoVision(void);
+ static std::vector<candidate*> findCorrespPointsPMF(BV::ImageRGB&,BV::ImageRGB&);
+ static std::vector<candidate*> findCorrespPointsPMF(BV::Image&,BV::Image&);
+ static long getDisparityDifference(const unsigned&,const unsigned&,const unsigned&,const unsigned&);
+private:
+ static void findEdges(BV::ImageRGB&,BV::ImageRGB&,std::vector<unsigned>&,std::vector<unsigned>&);
+ static void findEdges(BV::Image&,BV::Image&,std::vector<unsigned>&,std::vector<unsigned>&);
+ static double getCyclopDistanceEpipolar(const unsigned&,const unsigned&,const unsigned&,const unsigned&);
+ static double getDisparityGradient(const unsigned&,const unsigned&,const unsigned&,const unsigned&);
+ static bool arePixelSimilar(const BV::RGBPixel&,const BV::RGBPixel&);
+};