From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Master/Computer Vision/Praktikum1/StereoVision.h | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Master/Computer Vision/Praktikum1/StereoVision.h (limited to 'Master/Computer Vision/Praktikum1/StereoVision.h') 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 +#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 findCorrespPointsPMF(BV::ImageRGB&,BV::ImageRGB&); + static std::vector 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&,std::vector&); + static void findEdges(BV::Image&,BV::Image&,std::vector&,std::vector&); + 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&); +}; -- cgit v1.2.3