MyCompile.cpp ( File view )

  • By YU 2014-05-21
  • View(s):91
  • Download(s):18
  • Point(s): 3
			#include "stdafx.h"

#include "MyCompile.h"



#include "cv.h"

#include "highgui.h"

using namespace my_namespace;



//Sb_eN9YvVP

void CMyCompile::openImages(CString path)

{


		Mat src;//
}eQvVP

		char char_path[300]={
0
};

		char dst_path[300]={
0
};

		WCHAR dst_pathtemp[300]={
0
};

		char image_type[10]="*.jpg";

		WIN32_FIND_DATA FindFileData;

		HANDLE hFind;

	

		char readPath[300]={
0
};

		WideCharToMultiByte(CP_ACP,0,(LPCTSTR)(path),-1,char_path,300,NULL,NULL);//cstring to char[]

		sprintf(dst_path,("%s\\%s"),char_path,image_type);//  _\*.jpg  >e(Wdst_path

		MultiByteToWideChar(CP_ACP,0,dst_path,-1,dst_pathtemp,300);//char[] to WCHAR[]



		hFind = FindFirstFile(dst_pathtemp, &FindFileData);//)R(u,{
N*NSpe~beN~b0R,{
N*NeN

		if (hFind != INVALID_HANDLE_VALUE) 

		{


			do

			{


				WideCharToMultiByte(CP_ACP,0,FindFileData.cFileName,-1,dst_path,300,NULL,NULL);//WCHAR to char[]

				sprintf(readPath,"%s\\%s",char_path,dst_path);

				if( (src = imread(readPath, 1)).empty())//Sb_eN1Y%RԏV

				{
	::MessageBoxA(NULL,"eQVP1Y%\gbLNN _VP!","VP1Y%",MB_OK);

				continue;

				
}

				imgs.push_back(src);	

			
} while(FindNextFile(hFind,&FindFileData));

			FindClose(hFind);

		
}


}



	//ꁨRbc

bool CMyCompile::autostitch(InputArray images, OutputArray pano)

{


		printf("\n_Yyr_cS0VP9SM0BlvsQ|0Ov:gSpev^OS...\n");

		bool state;

		state=estimateTransform(images);
		if (state!=true)
			return false;
		printf("\nv:gSpeBl㉌[b.\n");

		printf("\nVPbc0T...");
		if(composePanorama(pano)==false)

			return false;

		printf("\nVPbc0T[b!\n");

		return true;


}



	//cSyr_9SMVP(yr_9SM)

bool CMyCompile::matchImages()
{

		imgs_=imgs;
		if ((int)imgs_.size() < 2)
		{

			printf("fYvVGr!\n");
			return false;
		
}

		work_scale = 1;
		seam_work_aspect = 1;
		seam_scale = 1;
		bool is_work_scale_set = false;
		bool is_seam_scale_set = false;
		Mat full_img, img;
		features_.resize(imgs_.size());
		seam_est_imgs_.resize(imgs_.size());
		seam_est_imgs_mytestmatch.resize(imgs_.size());
		full_img_sizes_.resize(imgs_.size());

		printf("Finding features...");
#if ENABLE_LOG
		int64 t = getTickCount();
#else
		int64 t0=getTickCount();
		int64 t=0;
#endif

		Scalar ss;
		int pointNum(0);
		ss.val[0]=255;

		ss.val[1]=255;

		ss.val[2]=255;
		int testsize=imgs_.size();
		int ii=0;
		for (size_t i = 0; i < imgs_.size(); ++i)
		{

			full_img = imgs_[i];
			full_img_sizes_[i] = full_img.size();

			if (registr_resol < 0)
			{

				img = full_img;
				work_scale = 1;
				is_work_scale_set = true;
			
}
			else
			{

				if (!is_work_scale_set)
				{

					work_scale = min(1.0, sqrt(registr_resol * 1e6 / full_img.size().area()));
					//work_scale=1.0;
					is_work_scale_set = true;
				
}
				resize(full_img, img, Size(), work_scale, work_scale);
				seam_est_imgs_mytestmatch[i] = img.clone();
			
}
			if (!is_seam_scale_set)
			{

				seam_scale = min(1.0, sqrt(seam_est_resol * 1e6 / full_img.size().area()));
				seam_work_aspect = seam_scale / work_scale;
			    //seam_scale=1;
				is_seam_scale_set = true;
			
}

			if (rois_.empty())
			{

				(*features_finder)(img, features_[i]);
			
}
			else
			{

				vector<Rect> rois(rois_[i].size());
				for (size_t j = 0; j < rois_[i].size(); ++j)
				{

					Point tl(cvRound(rois_[i][j].x * work_scale), cvRound(rois_[i][j].y * work_scale));
					Point br(cvRound(rois_[i][j].br().x * work_scale), cvRound(rois_[i][j].br().y * work_scale));
					rois[j] = Rect(tl, br);
				
}
				(*features_finder)(img, features_[i], rois);
			
}
			features_[i].img_idx = (int)i;
			fprintf(stdout,"\nFeatures in image %d: %d", i+1, features_[i].keypoints.size());
			//hlhKm0Rvyr_p

			for (pointNum=0;pointNum<features_[i].keypoints.size();pointNum++)

			{


				KeyPoint p=features_[i].keypoints.at(pointNum);

				CvPoint pCenter=p.pt;

				circle(img,pCenter,3,ss,2);

				char dd;itoa(pointNum,&dd,10);

				//putText(img,&dd,pCenter,1,1,CV_RGB(255,0,255));

			
}//hl~_g

			//KmՋ9SMe  (uvNx
			//imshow("cSvyr_p",img);

			//if(ii==0)
			//	imwrite("c:\\1010.jpg",img);
			//else
			//	imwrite("c:\\0101.jpg",img);
			
			ii++;
			//str1.ReleaseBuffer(str,img);
			//waitKey(0);
			resize(full_img, img, Size(), seam_scale, seam_scale);
			seam_est_imgs_[i] = img.clone();
	
		
}

		// Do it to save memory
		features_finder->collectGarbage();
		full_img.release();
		img.release();
		t=getTickCount() - t0;
		fprintf(stdout,"\nFinding features, time:%f s\n",((t) / getTickFrequency()));

		printf("\nPairwise matching:");
#if ENABLE_LOG
		t = getTickCount();
#endif

		(*features_matcher)(features_, pairwise_matches_, matching_mask);//(WMatchPairsBody̑
		features_matcher->collectGarbage();
		t=(getTickCount() - t0)-t;
		fprintf(stdout,"\nPairwise matching, time:%f sec",((t) / getTickFrequency()));

		// Leave only images we are sure are from the same panorama
		indices_ = my_namespace::leaveBiggestComponent(features_, pairwise_matches_, (float)conf_thresh);
		vector<Mat> seam_est_imgs_subset;
		vector<Mat> imgs_subset;
		vector<Size> full_img_sizes_subset;
		for (size_t i = 0; i < indices_.size(); ++i)
		{

			imgs_subset.push_back(imgs_[indices_[i]]);
			seam_est_imgs_subset.push_
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 3

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
autostitch.aps17.46 kB28-02-13 07:50
autostitch.cpp1.53 kB05-11-13 09:50
autostitch.h39.00 B10-12-12 20:48
autostitch.rc1.34 kB10-12-12 20:48
autostitch.vcproj5.58 kB05-11-13 09:52
autostitch.vcproj.HUANG.shui.user1.37 kB09-06-13 09:26
autostitch.vcproj.lenovo-PC.lenovo.user1.38 kB15-12-12 21:35
autostitch.vcproj.SHUI.shui.user1.37 kB05-11-13 09:58
autostitch.vcproj.WIN-B5OD78NL8FV.Administrator.user1.39 kB25-07-13 08:10
autostitch.vcproj.WM-20120911FOZO.shui.user1.39 kB17-12-12 08:38
autostitch.vcproj.WM-20140502VVLE.Administrator.user1.39 kB09-05-14 15:37
confidence.txt90.59 kB25-07-13 10:02
confidence14da.txt6.31 kB25-06-13 18:51
confidence200.txt1.92 MB23-06-13 23:18
confidence5.txt1.37 kB24-06-13 14:02
autostitch.pch32.25 MB05-11-13 09:54
BuildLog.htm77.02 kB05-11-13 09:54
stdafx.obj999.54 kB05-11-13 09:54
vc90.idb315.00 kB05-11-13 09:54
vc90.pdb2.55 MB05-11-13 09:54
Jacbion.xml60.00 B25-07-13 18:23
match.txt4.73 kB25-07-13 10:02
match.xml108.03 kB25-07-13 10:02
match14da.txt1.61 kB25-06-13 19:01
match200.txt8.56 kB24-06-13 08:25
match5.txt212.00 B24-06-13 15:00
match_features.txt5.16 kB25-07-13 10:02
match_features01.txt4.85 kB24-06-13 21:36
match_features14da.txt360.76 kB25-06-13 18:51
mat_xml.xml30.00 kB21-06-13 10:17
MyCompile.cpp71.44 kB27-07-13 14:30
MyCompile.h3.08 kB25-06-13 21:38
mydetector.cpp49.80 kB05-11-13 09:54
mydetector.h8.91 kB15-07-13 19:14
precomp.h2.47 kB28-07-12 06:59
qian.xml48.31 kB25-07-13 18:23
ReadMe.txt1.63 kB10-12-12 20:48
Resource.h393.00 B10-12-12 20:48
result14.00 B97% 14-07-13
result.jpg2.23 MB09-07-13 19:35
result0.jpg2.54 MB30-05-13 11:05
result00.jpg680.30 kB31-05-13 20:12
result10.jpg56.18 kB31-05-13 14:29
result10_.jpg59.45 kB31-05-13 14:35
result14.jpg1.63 MB22-06-13 12:22
result141.jpg748.67 kB25-06-13 18:57
result18.jpg77.57 kB17-06-13 18:26
result19.jpg322.94 kB19-06-13 03:36
result2.jpg1.69 MB30-05-13 18:21
result21.jpg483.43 kB30-05-13 19:12
result26.jpg375.77 kB15-07-13 13:32
<result27>0.00 B96% 24-07-13
result27.jpg2.23 MB15-07-13 20:02
result30.jpg2.52 MB24-07-13 19:25
resultff.jpg28.84 kB31-05-13 14:40
resultguangsu.jpg402.75 kB21-06-13 10:17
resultmulti.jpg366.37 kB30-05-13 16:39
result冲投影.jpg298.42 kB21-06-13 11:05
stdafx.cpp215.00 B10-12-12 20:48
stdafx.h813.00 B10-12-12 20:48
targetver.h1.00 kB10-12-12 20:48
TestFuc.cpp847.00 B23-05-13 10:54
TestFuc.h248.00 B07-05-13 09:01
transform.xml60.00 B25-07-13 18:23
result.jpg598.37 kB24-05-13 08:22
Thumbs.db12.50 kB31-05-13 09:46
发大水.jpg294.10 kB24-05-13 21:51
没有强行赋值.jpg363.02 kB24-05-13 10:37
<重投影>0.00 B99% 24-05-13
autostitch.ncb17.58 MB09-05-14 15:37
autostitch.sln896.00 B10-12-12 20:48
autostitch.suo138.00 kB09-05-14 15:37
<autostitch.ilk>0.00 B27-07-13 14:30
confidence.txt5.91 kB13-07-13 10:22
Jacbion.xml60.00 B22-06-13 08:20
match.txt1.34 kB13-07-13 10:22
match.xml13.32 kB13-07-13 10:22
match_features.txt21.78 kB13-07-13 10:22
mat_xml.xml1.14 MB21-06-13 09:54
qian.xml13.34 kB22-06-13 08:20
result.jpg1.11 kB22-06-13 08:20
result5.jpg297.38 kB21-06-13 09:54
<transform.xml>0.00 B13-07-13 10:12
readme.txt192.00 B24-05-13 14:11
<Debug>0.00 B11-01-14 07:12
<拼接结果>0.00 B11-01-14 07:12
<autostitch>0.00 B11-01-14 07:12
<Debug>0.00 B11-01-14 07:12
<autostitch_0610>0.00 B09-05-14 15:35
...
Sponsored links

MyCompile.cpp (34.39 MB)

Need 3 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D