資源簡介
welsh經(jīng)典算法實現(xiàn)C++代碼
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?“util.h“
#include?“myalgorithm.h“
using?namespace?std;
using?namespace?cv;
using?namespace?mycode;
int?main()
{
IplImage*?first?=?cvLoadImage(“test2.jpg“CV_LOAD_IMAGE_COLOR); //參考圖像;
IplImage*?second?=?cvLoadImage(“test1.jpg“CV_LOAD_IMAGE_COLOR); //目標圖像;
if(second->nChannels?==?1)
{
cvCvtColor(secondsecondCV_GRAY2RGB);
}
IplImage*?firstLab?=?cvCreateImage(cvGetSize(first)first->depthfirst->nChannels);
IplImage*?secondLab?=?cvCreateImage(cvGetSize(second)second->depthsecond->nChannels);
IplImage*?secondLabClone?=?cvCreateImage(cvGetSize(second)second->depthsecond->nChannels);
cvCvtColor(firstfirstLabCV_BGR2Lab);
cvCvtColor(secondsecondLabCV_BGR2Lab);
/*colormap(secondLabfirstLab); *///亮度映射;
colorchange(firstLab);
colorchange(secondLab);
cout<<“Colormap?Done!“<
secondLabClone?=?cvCloneImage(secondLab);
vector?references;
references?=?getreference(firstLab); //得到參考點;
cout<<“Reference?selecting?Done!“<
sort(references.begin()references.end()comparepix); //按照weight排序;
cout<<“Sorting?Done“<
for(int?i?=?0information?=?1coutinf?=?0;iheight;i++coutinf++)
{
uchar*?ptr?=?(uchar*)(secondLab->imageData+i*secondLab->widthStep);
if(coutinf?==?secondLabClone->height/10)
{
coutinf?=?0;
cout<<“proceeding----“< information++;
}
for(int?j=0;jwidth;j++)
{
float?weight?=?getstatis(ijsecondLabClone);
int?index?=?getindex(referencesweight);
ptr[3*j+1]?=?references[index].a;
ptr[3*j+2]?=?references[index].b;
}
}
normalizeimage(secondLab);
cvCvtColor(secondLabsecondLabCloneCV_Lab2BGR);
cout<<“Done“<
cvShowImage(“output“secondLabClone);
cvWaitKey(0);
cvReleaseImage(&first);
cvReleaseImage(&second);
cvReleaseImage(&firstLab);
cvReleaseImage(&secondLab);
cvReleaseImage(&secondLabClone);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-08-01?16:33??MyCvt\
?????目錄???????????0??2016-08-01?16:03??MyCvt\MyCvt\
?????文件????????2126??2016-06-23?21:54??MyCvt\MyCvt\MyCvt.cpp
?????文件????????4074??2016-08-01?16:03??MyCvt\MyCvt\MyCvt.vcxproj
?????文件????????1337??2016-08-01?16:03??MyCvt\MyCvt\MyCvt.vcxproj.filters
?????文件?????????143??2016-06-03?19:57??MyCvt\MyCvt\MyCvt.vcxproj.user
?????文件??????479286??2016-06-01?20:02??MyCvt\MyCvt\creek.jpg
?????文件??????270916??2016-05-06?21:10??MyCvt\MyCvt\grass.jpg
?????文件????????3138??2016-06-23?09:54??MyCvt\MyCvt\myalgorithm.h
?????文件?????????991??2016-08-01?16:33??MyCvt\MyCvt\otheralgorithm.h
?????文件??????249862??2016-06-01?20:02??MyCvt\MyCvt\rill.jpg
?????文件???????70709??2016-06-01?16:57??MyCvt\MyCvt\src.jpg
?????文件???????31547??2016-06-01?16:57??MyCvt\MyCvt\tar.jpg
?????文件???????23938??2005-08-09?11:00??MyCvt\MyCvt\test1.jpg
?????文件???????15141??2005-08-09?11:00??MyCvt\MyCvt\test2.jpg
?????文件?????????393??2016-08-01?16:33??MyCvt\MyCvt\util.h
?????文件?????????113??2016-08-01?16:33??MyCvt\MyCvt\values.h
?????目錄???????????0??2016-06-13?11:30??MyCvt\MyCvt\x64\
?????目錄???????????0??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\
?????文件???????35572??2016-08-01?16:02??MyCvt\MyCvt\x64\Debug\CL.read.1.tlog
?????文件????????1618??2016-08-01?16:02??MyCvt\MyCvt\x64\Debug\CL.write.1.tlog
?????文件?????????406??2016-06-13?11:30??MyCvt\MyCvt\x64\Debug\MyCvt.exe.em
?????文件?????????472??2016-06-13?11:30??MyCvt\MyCvt\x64\Debug\MyCvt.exe.em
?????文件?????????381??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\MyCvt.exe.intermediate.manifest
?????文件??????????83??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\MyCvt.lastbuildstate
?????文件????????2404??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\MyCvt.log
?????文件??????558332??2016-08-01?16:02??MyCvt\MyCvt\x64\Debug\MyCvt.obj
?????文件?????????210??2016-06-13?11:30??MyCvt\MyCvt\x64\Debug\MyCvt_manifest.rc
?????文件????????1422??2016-08-01?16:02??MyCvt\MyCvt\x64\Debug\cl.command.1.tlog
?????文件???????????2??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\li
?????文件???????????2??2016-08-01?16:03??MyCvt\MyCvt\x64\Debug\li
............此處省略83個文件信息
評論
共有 條評論