level 1
gpjzu784
楼主
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/structured_light.hpp>
#include <iostream>
#include <stdio.h>
using namespace cv;
using namespace std;
static const char* keys =
{ "{@璐村惂鐢ㄦ埛_007a2Ea馃惥 | 555| Path of the folder where the captured pattern images will be save }"
"{@proj_width |1024| Projector width }"
"{@proj_height |768 | Projector height }" };
static void help()
{
cout << "\nThis example shows how to use the \"Structured Light module\" to acquire a graycode pattern"
"\nCall (with the two cams connected):\n"
"./example_structured_light_cap_pattern <path> <proj_width> <proj_height> \n"
<< endl;
}
int main(int argc, char** argv)
{
structured_light::GrayCodePattern::Params params;
CommandLineParser parser(argc, argv, keys);
String path = parser.get<String>(0);
params.width = parser.get<int>(1);
params.height = parser.get<int>(2);
if (path.empty() || params.width < 1 || params.height < 1)
{
help();
return -1;
}
// Set up GraycodePattern with params
Ptr<structured_light::GrayCodePattern> graycode = structured_light::GrayCodePattern::create(params);
// Storage for pattern
vector<Mat> pattern;
graycode->generate(pattern);
cout << pattern.size() << " pattern images + 2 images for shadows mask computation to acquire with both cameras"
<< endl;
// Generate the all-white and all-black images needed for shadows mask computation
Mat white;
Mat black;
graycode->getImagesForShadowMasks(black, white);
pattern.push_back(white);
pattern.push_back(black);
// Setting pattern window on second monitor (the projector's one)
namedWindow("Pattern Window", WINDOW_NORMAL);
resizeWindow("Pattern Window", params.width, params.height);
moveWindow("Pattern Window", params.width + 316, -20);
setWindowProperty("Pattern Window", WND_PROP_FULLSCREEN, WINDOW_FULLSCREEN);





2020年03月24日 08点03分
1
#include <opencv2/highgui.hpp>
#include <opencv2/structured_light.hpp>
#include <iostream>
#include <stdio.h>
using namespace cv;
using namespace std;
static const char* keys =
{ "{@璐村惂鐢ㄦ埛_007a2Ea馃惥 | 555| Path of the folder where the captured pattern images will be save }"
"{@proj_width |1024| Projector width }"
"{@proj_height |768 | Projector height }" };
static void help()
{
cout << "\nThis example shows how to use the \"Structured Light module\" to acquire a graycode pattern"
"\nCall (with the two cams connected):\n"
"./example_structured_light_cap_pattern <path> <proj_width> <proj_height> \n"
<< endl;
}
int main(int argc, char** argv)
{
structured_light::GrayCodePattern::Params params;
CommandLineParser parser(argc, argv, keys);
String path = parser.get<String>(0);
params.width = parser.get<int>(1);
params.height = parser.get<int>(2);
if (path.empty() || params.width < 1 || params.height < 1)
{
help();
return -1;
}
// Set up GraycodePattern with params
Ptr<structured_light::GrayCodePattern> graycode = structured_light::GrayCodePattern::create(params);
// Storage for pattern
vector<Mat> pattern;
graycode->generate(pattern);
cout << pattern.size() << " pattern images + 2 images for shadows mask computation to acquire with both cameras"
<< endl;
// Generate the all-white and all-black images needed for shadows mask computation
Mat white;
Mat black;
graycode->getImagesForShadowMasks(black, white);
pattern.push_back(white);
pattern.push_back(black);
// Setting pattern window on second monitor (the projector's one)
namedWindow("Pattern Window", WINDOW_NORMAL);
resizeWindow("Pattern Window", params.width, params.height);
moveWindow("Pattern Window", params.width + 316, -20);
setWindowProperty("Pattern Window", WND_PROP_FULLSCREEN, WINDOW_FULLSCREEN);




