#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&); };