mirror of
https://github.com/zebrajr/opencv.git
synced 2026-01-15 12:15:17 +00:00
Update Samples
This commit is contained in:
committed by
sturkmen72
parent
9ef5373776
commit
f73395122c
@@ -13,14 +13,14 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
//! [load]
|
||||
CommandLineParser parser(argc, argv,
|
||||
"{@img1 | ../data/graf1.png | input image 1}"
|
||||
"{@img2 | ../data/graf3.png | input image 2}"
|
||||
"{@homography | ../data/H1to3p.xml | homography matrix}");
|
||||
Mat img1 = imread(parser.get<String>("@img1"), IMREAD_GRAYSCALE);
|
||||
Mat img2 = imread(parser.get<String>("@img2"), IMREAD_GRAYSCALE);
|
||||
"{@img1 | graf1.png | input image 1}"
|
||||
"{@img2 | graf3.png | input image 2}"
|
||||
"{@homography | H1to3p.xml | homography matrix}");
|
||||
Mat img1 = imread( samples::findFile( parser.get<String>("@img1") ), IMREAD_GRAYSCALE);
|
||||
Mat img2 = imread( samples::findFile( parser.get<String>("@img2") ), IMREAD_GRAYSCALE);
|
||||
|
||||
Mat homography;
|
||||
FileStorage fs(parser.get<String>("@homography"), FileStorage::READ);
|
||||
FileStorage fs( samples::findFile( parser.get<String>("@homography") ), FileStorage::READ);
|
||||
fs.getFirstTopLevelNode() >> homography;
|
||||
//! [load]
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ void computeC2MC1(const Mat &R1, const Mat &tvec1, const Mat &R2, const Mat &tve
|
||||
void decomposeHomography(const string &img1Path, const string &img2Path, const Size &patternSize,
|
||||
const float squareSize, const string &intrinsicsPath)
|
||||
{
|
||||
Mat img1 = imread(img1Path);
|
||||
Mat img2 = imread(img2Path);
|
||||
Mat img1 = imread( samples::findFile( img1Path) );
|
||||
Mat img2 = imread( samples::findFile( img2Path) );
|
||||
|
||||
vector<Point2f> corners1, corners2;
|
||||
bool found1 = findChessboardCorners(img1, patternSize, corners1);
|
||||
@@ -69,7 +69,7 @@ void decomposeHomography(const string &img1Path, const string &img2Path, const S
|
||||
vector<Point3f> objectPoints;
|
||||
calcChessboardCorners(patternSize, squareSize, objectPoints);
|
||||
|
||||
FileStorage fs(intrinsicsPath, FileStorage::READ);
|
||||
FileStorage fs( samples::findFile( intrinsicsPath ), FileStorage::READ);
|
||||
Mat cameraMatrix, distCoeffs;
|
||||
fs["camera_matrix"] >> cameraMatrix;
|
||||
fs["distortion_coefficients"] >> distCoeffs;
|
||||
@@ -154,9 +154,9 @@ void decomposeHomography(const string &img1Path, const string &img2Path, const S
|
||||
|
||||
const char* params
|
||||
= "{ help h | | print usage }"
|
||||
"{ image1 | ../data/left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | ../data/left01.jpg | path to the desired chessboard image }"
|
||||
"{ intrinsics | ../data/left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ image1 | left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | left01.jpg | path to the desired chessboard image }"
|
||||
"{ intrinsics | left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ width bw | 9 | chessboard width }"
|
||||
"{ height bh | 6 | chessboard height }"
|
||||
"{ square_size | 0.025 | chessboard square size }";
|
||||
|
||||
@@ -65,8 +65,8 @@ void computeC2MC1(const Mat &R1, const Mat &tvec1, const Mat &R2, const Mat &tve
|
||||
void homographyFromCameraDisplacement(const string &img1Path, const string &img2Path, const Size &patternSize,
|
||||
const float squareSize, const string &intrinsicsPath)
|
||||
{
|
||||
Mat img1 = imread(img1Path);
|
||||
Mat img2 = imread(img2Path);
|
||||
Mat img1 = imread( samples::findFile( img1Path ) );
|
||||
Mat img2 = imread( samples::findFile( img2Path ) );
|
||||
|
||||
//! [compute-poses]
|
||||
vector<Point2f> corners1, corners2;
|
||||
@@ -82,7 +82,7 @@ void homographyFromCameraDisplacement(const string &img1Path, const string &img2
|
||||
vector<Point3f> objectPoints;
|
||||
calcChessboardCorners(patternSize, squareSize, objectPoints);
|
||||
|
||||
FileStorage fs(intrinsicsPath, FileStorage::READ);
|
||||
FileStorage fs( samples::findFile( intrinsicsPath ), FileStorage::READ);
|
||||
Mat cameraMatrix, distCoeffs;
|
||||
fs["camera_matrix"] >> cameraMatrix;
|
||||
fs["distortion_coefficients"] >> distCoeffs;
|
||||
@@ -170,9 +170,9 @@ void homographyFromCameraDisplacement(const string &img1Path, const string &img2
|
||||
|
||||
const char* params
|
||||
= "{ help h | | print usage }"
|
||||
"{ image1 | ../data/left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | ../data/left01.jpg | path to the desired chessboard image }"
|
||||
"{ intrinsics | ../data/left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ image1 | left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | left01.jpg | path to the desired chessboard image }"
|
||||
"{ intrinsics | left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ width bw | 9 | chessboard width }"
|
||||
"{ height bh | 6 | chessboard height }"
|
||||
"{ square_size | 0.025 | chessboard square size }";
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace
|
||||
{
|
||||
void basicPanoramaStitching(const string &img1Path, const string &img2Path)
|
||||
{
|
||||
Mat img1 = imread(img1Path);
|
||||
Mat img2 = imread(img2Path);
|
||||
Mat img1 = imread( samples::findFile( img1Path ) );
|
||||
Mat img2 = imread( samples::findFile( img2Path ) );
|
||||
|
||||
//! [camera-pose-from-Blender-at-location-1]
|
||||
Mat c1Mo = (Mat_<double>(4,4) << 0.9659258723258972, 0.2588190734386444, 0.0, 1.5529145002365112,
|
||||
@@ -67,9 +67,9 @@ void basicPanoramaStitching(const string &img1Path, const string &img2Path)
|
||||
}
|
||||
|
||||
const char* params
|
||||
= "{ help h | | print usage }"
|
||||
"{ image1 | ../data/Blender_Suzanne1.jpg | path to the first Blender image }"
|
||||
"{ image2 | ../data/Blender_Suzanne2.jpg | path to the second Blender image }";
|
||||
= "{ help h | | print usage }"
|
||||
"{ image1 | Blender_Suzanne1.jpg | path to the first Blender image }"
|
||||
"{ image2 | Blender_Suzanne2.jpg | path to the second Blender image }";
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
@@ -19,8 +19,8 @@ Scalar randomColor( RNG& rng )
|
||||
|
||||
void perspectiveCorrection(const string &img1Path, const string &img2Path, const Size &patternSize, RNG &rng)
|
||||
{
|
||||
Mat img1 = imread(img1Path);
|
||||
Mat img2 = imread(img2Path);
|
||||
Mat img1 = imread( samples::findFile(img1Path) );
|
||||
Mat img2 = imread( samples::findFile(img2Path) );
|
||||
|
||||
//! [find-corners]
|
||||
vector<Point2f> corners1, corners2;
|
||||
@@ -68,8 +68,8 @@ void perspectiveCorrection(const string &img1Path, const string &img2Path, const
|
||||
|
||||
const char* params
|
||||
= "{ help h | | print usage }"
|
||||
"{ image1 | ../data/left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | ../data/left01.jpg | path to the desired chessboard image }"
|
||||
"{ image1 | left02.jpg | path to the source chessboard image }"
|
||||
"{ image2 | left01.jpg | path to the desired chessboard image }"
|
||||
"{ width bw | 9 | chessboard width }"
|
||||
"{ height bh | 6 | chessboard height }";
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void calcChessboardCorners(Size boardSize, float squareSize, vector<Point3f>& co
|
||||
void poseEstimationFromCoplanarPoints(const string &imgPath, const string &intrinsicsPath, const Size &patternSize,
|
||||
const float squareSize)
|
||||
{
|
||||
Mat img = imread(imgPath);
|
||||
Mat img = imread( samples::findFile( imgPath) );
|
||||
Mat img_corners = img.clone(), img_pose = img.clone();
|
||||
|
||||
//! [find-chessboard-corners]
|
||||
@@ -69,7 +69,7 @@ void poseEstimationFromCoplanarPoints(const string &imgPath, const string &intri
|
||||
//! [compute-object-points]
|
||||
|
||||
//! [load-intrinsics]
|
||||
FileStorage fs(intrinsicsPath, FileStorage::READ);
|
||||
FileStorage fs( samples::findFile( intrinsicsPath ), FileStorage::READ);
|
||||
Mat cameraMatrix, distCoeffs;
|
||||
fs["camera_matrix"] >> cameraMatrix;
|
||||
fs["distortion_coefficients"] >> distCoeffs;
|
||||
@@ -126,8 +126,8 @@ void poseEstimationFromCoplanarPoints(const string &imgPath, const string &intri
|
||||
|
||||
const char* params
|
||||
= "{ help h | | print usage }"
|
||||
"{ image | ../data/left04.jpg | path to a chessboard image }"
|
||||
"{ intrinsics | ../data/left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ image | left04.jpg | path to a chessboard image }"
|
||||
"{ intrinsics | left_intrinsics.yml | path to camera intrinsics }"
|
||||
"{ width bw | 9 | chessboard width }"
|
||||
"{ height bh | 6 | chessboard height }"
|
||||
"{ square_size | 0.025 | chessboard square size }";
|
||||
|
||||
@@ -11,15 +11,15 @@ using std::cout;
|
||||
using std::endl;
|
||||
|
||||
const char* keys =
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | ../data/box.png | Path to input image 1. }"
|
||||
"{ input2 | ../data/box_in_scene.png | Path to input image 2. }";
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | box.png | Path to input image 1. }"
|
||||
"{ input2 | box_in_scene.png | Path to input image 2. }";
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CommandLineParser parser( argc, argv, keys );
|
||||
Mat img1 = imread( parser.get<String>("input1"), IMREAD_GRAYSCALE );
|
||||
Mat img2 = imread( parser.get<String>("input2"), IMREAD_GRAYSCALE );
|
||||
Mat img1 = imread( samples::findFile( parser.get<String>("input1") ), IMREAD_GRAYSCALE );
|
||||
Mat img2 = imread( samples::findFile( parser.get<String>("input2") ), IMREAD_GRAYSCALE );
|
||||
if ( img1.empty() || img2.empty() )
|
||||
{
|
||||
cout << "Could not open or find the image!\n" << endl;
|
||||
|
||||
@@ -12,8 +12,8 @@ using std::endl;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CommandLineParser parser( argc, argv, "{@input | ../data/box.png | input image}" );
|
||||
Mat src = imread( parser.get<String>( "@input" ), IMREAD_GRAYSCALE );
|
||||
CommandLineParser parser( argc, argv, "{@input | box.png | input image}" );
|
||||
Mat src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_GRAYSCALE );
|
||||
if ( src.empty() )
|
||||
{
|
||||
cout << "Could not open or find the image!\n" << endl;
|
||||
|
||||
@@ -11,15 +11,15 @@ using std::cout;
|
||||
using std::endl;
|
||||
|
||||
const char* keys =
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | ../data/box.png | Path to input image 1. }"
|
||||
"{ input2 | ../data/box_in_scene.png | Path to input image 2. }";
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | box.png | Path to input image 1. }"
|
||||
"{ input2 | box_in_scene.png | Path to input image 2. }";
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CommandLineParser parser( argc, argv, keys );
|
||||
Mat img1 = imread( parser.get<String>("input1"), IMREAD_GRAYSCALE );
|
||||
Mat img2 = imread( parser.get<String>("input2"), IMREAD_GRAYSCALE );
|
||||
Mat img1 = imread( samples::findFile( parser.get<String>("input1") ), IMREAD_GRAYSCALE );
|
||||
Mat img2 = imread( samples::findFile( parser.get<String>("input2") ), IMREAD_GRAYSCALE );
|
||||
if ( img1.empty() || img2.empty() )
|
||||
{
|
||||
cout << "Could not open or find the image!\n" << endl;
|
||||
|
||||
@@ -13,15 +13,15 @@ using std::cout;
|
||||
using std::endl;
|
||||
|
||||
const char* keys =
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | ../data/box.png | Path to input image 1. }"
|
||||
"{ input2 | ../data/box_in_scene.png | Path to input image 2. }";
|
||||
"{ help h | | Print help message. }"
|
||||
"{ input1 | box.png | Path to input image 1. }"
|
||||
"{ input2 | box_in_scene.png | Path to input image 2. }";
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CommandLineParser parser( argc, argv, keys );
|
||||
Mat img_object = imread( parser.get<String>("input1"), IMREAD_GRAYSCALE );
|
||||
Mat img_scene = imread( parser.get<String>("input2"), IMREAD_GRAYSCALE );
|
||||
Mat img_object = imread( samples::findFile( parser.get<String>("input1") ), IMREAD_GRAYSCALE );
|
||||
Mat img_scene = imread( samples::findFile( parser.get<String>("input2") ), IMREAD_GRAYSCALE );
|
||||
if ( img_object.empty() || img_scene.empty() )
|
||||
{
|
||||
cout << "Could not open or find the image!\n" << endl;
|
||||
|
||||
Reference in New Issue
Block a user