Home > Software engineering >  Opencv2.4.9 stitching images shows grey??????
Opencv2.4.9 stitching images shows grey??????

Time:10-12

When executed grayed out, what reason be???

CodePudding user response:

Read the pictures and display is normal, separately perform Stitcher: : the Status Status=Stitcher. Stitch (imgs, pano); Later won't appear?

CodePudding user response:

Code:


#include
#include
#include
#include
#include
using namespace std;
Using the namespace CV;
Bool try_use_gpu=true;
Vector Imgs;
String result_name="dst1. JPG";
Int main (int arg c, char * argv [])
{
Mat img1=imread (" 1. JPG ");
Mat img2=imread (" 2. JPG ");

Imshow (" p1 "img1);
Imshow (" p2 ", img2);

If (img1. Empty () | | img2. Empty ())
{
cout <"Can 't read image" & lt; return -1;
}
Imgs. Push_back (img1);
Imgs. Push_back (img2);


Stitcher Stitcher=Stitcher: : createDefault (try_use_gpu);
//use stitch functions for Mosaic
Mat pano;
Stitcher: : the Status Status=Stitcher. Stitch (imgs, pano);

if (status !=Stitcher: : OK)
{
cout <"Can 't stitch, images, and the error code=" & lt; return -1;
}
Imwrite (result_name, pano);
Mat pano2=pano. Clone ();
//display the source images, and the result image
Imshow (" panoramic images ", img2);
WaitKey (0);
return 0;
}
  • Related