-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test and refactor(testInterzoneSinusFourGrayscalePattern.cpp/testShif…
…tGrayCodePattern.cpp): add precies test and refactor src/cameras/. 1. create precise test images by blender. 2. add simulation test case for interzonSinusFourGrayscaePattern and shiftGraycodePattern. 3. dived src/cameras folder to mono/bino/trinocular folder.
- Loading branch information
1 parent
f4848df
commit 1b62f85
Showing
50 changed files
with
527 additions
and
68 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/cameras/binoocularCamer.cpp → src/cameras/binocular/binoocularCamer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/cameras/binocular/binosInterzoneSinusFourGrayscalePattern.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include "binosInterzoneSinusFourGrayscalePattern.h" | ||
|
||
#include "../algorithm/algorithm.h" | ||
|
||
using namespace cv; | ||
|
||
namespace slmaster { | ||
namespace cameras { | ||
|
||
static BinoInterzoneSinusFourGrayscalePattern::Params params__; | ||
|
||
BinoInterzoneSinusFourGrayscalePattern::BinoInterzoneSinusFourGrayscalePattern() {} | ||
|
||
bool BinoInterzoneSinusFourGrayscalePattern::generate( | ||
std::vector<cv::Mat> &imgs) const { | ||
algorithm::InterzoneSinusFourGrayscalePattern::Params params; | ||
params.width = params__.width_; | ||
params.height = params__.height_; | ||
params.nbrOfPeriods = params__.cycles_; | ||
params.horizontal = params__.horizontal_; | ||
params.maxCost = params__.maxCost_; | ||
params.minDisparity = params__.minDisparity_; | ||
params.maxDisparity = params__.maxDisparity_; | ||
params.confidenceThreshold = params__.confidenceThreshold_; | ||
params.shiftTime = params__.shiftTime_; | ||
|
||
return algorithm::InterzoneSinusFourGrayscalePattern::create(params) | ||
->generate(imgs); | ||
} | ||
|
||
std::shared_ptr<Pattern> BinoInterzoneSinusFourGrayscalePattern::create(const Params& params) { | ||
params__ = params; | ||
|
||
return std::make_shared<BinoInterzoneSinusFourGrayscalePattern>(); | ||
} | ||
|
||
bool BinoInterzoneSinusFourGrayscalePattern::decode( | ||
const std::vector<std::vector<cv::Mat>> &patternImages, | ||
cv::Mat &disparityMap, const bool isGpu) const { | ||
CV_Assert(patternImages.size() >= 2); | ||
|
||
#ifdef OPENCV_WITH_CUDA_MODULE | ||
if (isGpu) { | ||
/* | ||
algorithm::SinusCompleGrayCodePatternGPU::Params params; | ||
params.shiftTime = params__.shiftTime_; | ||
params.confidenceThreshold = params__.confidenceThreshold_; | ||
params.costMinDiff = params__.costMinDiff_; | ||
params.maxCost = params__.maxCost_; | ||
params.height = params__.height_; | ||
params.width = params__.width_; | ||
params.nbrOfPeriods = params__.cycles_; | ||
params.horizontal = params__.horizontal_; | ||
params.minDisparity = params__.minDisparity_; | ||
params.maxDisparity = params__.maxDisparity_; | ||
auto pattern = algorithm::SinusCompleGrayCodePatternGPU::create(params); | ||
return pattern->decode(patternImages, disparityMap, | ||
algorithm::SINUSOIDAL_COMPLEMENTARY_GRAY_CODE_GPU); | ||
*/ | ||
return false; | ||
} | ||
#endif | ||
|
||
algorithm::InterzoneSinusFourGrayscalePattern::Params params; | ||
params.shiftTime = params__.shiftTime_; | ||
params.width = params__.width_; | ||
params.height = params__.height_; | ||
params.nbrOfPeriods = params__.cycles_; | ||
params.horizontal = params__.horizontal_; | ||
params.maxCost = params__.maxCost_; | ||
params.minDisparity = params__.minDisparity_; | ||
params.maxDisparity = params__.maxDisparity_; | ||
params.confidenceThreshold = params__.confidenceThreshold_; | ||
|
||
auto pattern = algorithm::InterzoneSinusFourGrayscalePattern::create(params); | ||
return pattern->decode( | ||
patternImages, disparityMap, cv::noArray(), cv::noArray(), | ||
algorithm::SINUSOIDAL_COMPLEMENTARY_GRAY_CODE); | ||
} | ||
} // namespace cameras | ||
} // namespace slmaster |
50 changes: 50 additions & 0 deletions
50
src/cameras/binocular/binosInterzoneSinusFourGrayscalePattern.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @file binoSInterzoneSinusFourGrayscalePattern.h | ||
* @author Evans Liu (1369215984@qq.com) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-04-15 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef __BINOS_INTERZONE_SINUS_FOUR_GRAYSCALE_PATTERN_H_ | ||
#define __BINOS_INTERZONE_SINUS_FOUR_GRAYSCALE_PATTERN_H_ | ||
|
||
#include "../../common.h" | ||
#include "../pattern.h" | ||
|
||
namespace slmaster { | ||
namespace cameras { | ||
class SLMASTER_API BinoInterzoneSinusFourGrayscalePattern : public Pattern { | ||
public: | ||
struct SLMASTER_API Params { | ||
Params() | ||
: width_(1920), height_(1080), shiftTime_(3), cycles_(16), | ||
horizontal_(false), confidenceThreshold_(5.f), minDisparity_(0), | ||
maxDisparity_(300), maxCost_(0.1f), costMinDiff_(0.0001f) {} | ||
int width_; | ||
int height_; | ||
int shiftTime_; | ||
int cycles_; | ||
bool horizontal_; | ||
float confidenceThreshold_; | ||
int minDisparity_; | ||
int maxDisparity_; | ||
float maxCost_; | ||
float costMinDiff_; | ||
}; | ||
|
||
BinoInterzoneSinusFourGrayscalePattern(); | ||
virtual bool generate(IN std::vector<cv::Mat> &imgs) const override final; | ||
virtual bool | ||
decode(IN const std::vector<std::vector<cv::Mat>> &patternImages, | ||
OUT cv::Mat &disparityMap, IN const bool isGpu) const override final; | ||
static std::shared_ptr<Pattern> create(const Params& params); | ||
private: | ||
}; | ||
} // namespace cameras | ||
} // namespace slmaster | ||
|
||
#endif // __BINOS_INTERZONE_SINUS_FOUR_GRAYSCALE_PATTERN_H_ |
2 changes: 1 addition & 1 deletion
2
...meras/binosSinusCompleGrayCodePattern.cpp → ...cular/binosSinusCompleGrayCodePattern.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.