read multiple images from folder and concat, display images in single window opencv c++, visual studio 2010
Hi,I' m new to opencv c++, I need to concat multiple images and display it in single window. Here the source code i hv done,I m reading images from folder and resizing images to thumbnail size,Now i want to concat thumbnail sized multile images and copy into Big Image(Mat image). But my source code, multiple images are not concatinating, What's wrong with the code?..Pls help me...
FILE* f;
using namespace cv;
using namespace std;
int main()
{
IplImage *desimg,*srcimg;
Mat output,src,tumbnail1;
srcimg=cvLoadImage("E:\\images\\img\\b1.jpg",1);
output=cvCreateMat(srcimg->width,srcimg->height,3);
//load multiple images....................
//File finding objects
struct _finddata_t c_file;
long hFile;
int value_max,value,height,width;
char imageDirectory[] = "E:\\images\\img";
char imageFileType[] = "jpg";
char fullImagePath[1000];
char buffer[1000];
sprintf(buffer,"%s\\*.%s", imageDirectory, imageFileType);
hFile = _findfirst( buffer, &c_file );
/*Check to make sure that there are files in directory*/
if( hFile == -1L )
printf( "No %s files in current directory!\n", imageFileType );
else
{
// List all files in directory
printf( "Listing of files:\n" );
// Loop through all images of imageFileType
do
{
// Show file name
printf( "\nOpening File: %s \n", c_file.name);
sprintf(fullImagePath,"%s\\%s", imageDirectory, c_file.name);
// Load image
desimg = cvLoadImage(fullImagePath);
Mat src1=cv::cvarrToMat(desimg); //convert ipl img to mat
Mat src2=cv::cvarrToMat(srcimg);
cv::Mat tumbnails2;
tumbnail1=cvCreateMat(src1.rows/10,src1.cols/10,3);
tumbnails2=cvCreateMat(src2.rows/10,src2.cols/10,3);
cv::resize(src1, tumbnails2,tumbnails2.size());
cv::resize(src2, tumbnail1,tumbnail1.size());
//tumbnails1.push_back(tumbnails2);
vconcat(tumbnail1,tumbnails2,output);
} while( _findnext( hFile, &c_file ) == 0 );
// Close file finder object
_findclose( hFile );
}
imshow("concatenation of multiple images",output);
waitKey(0);
return 0;
}