welsh颜色迁移


welsh经典算法实现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  MyCvtMyCvt
     文件        2126  2016-06-23 21:54  MyCvtMyCvtMyCvt.cpp
     文件        4074  2016-08-01 16:03  MyCvtMyCvtMyCvt.vcxproj
     文件        1337  2016-08-01 16:03  MyCvtMyCvtMyCvt.vcxproj.filters
     文件         143  2016-06-03 19:57  MyCvtMyCvtMyCvt.vcxproj.user
     文件      479286  2016-06-01 20:02  MyCvtMyCvtcreek.jpg
     文件      270916  2016-05-06 21:10  MyCvtMyCvtgrass.jpg
     文件        3138  2016-06-23 09:54  MyCvtMyCvtmyalgorithm.h
     文件         991  2016-08-01 16:33  MyCvtMyCvtotheralgorithm.h
     文件      249862  2016-06-01 20:02  MyCvtMyCvt
ill.jpg
     文件       70709  2016-06-01 16:57  MyCvtMyCvtsrc.jpg
     文件       31547  2016-06-01 16:57  MyCvtMyCvt ar.jpg
     文件       23938  2005-08-09 11:00  MyCvtMyCvt est1.jpg
     文件       15141  2005-08-09 11:00  MyCvtMyCvt est2.jpg
     文件         393  2016-08-01 16:33  MyCvtMyCvtutil.h
     文件         113  2016-08-01 16:33  MyCvtMyCvtvalues.h
     目录           0  2016-06-13 11:30  MyCvtMyCvtx64
     目录           0  2016-08-01 16:03  MyCvtMyCvtx64Debug
     文件       35572  2016-08-01 16:02  MyCvtMyCvtx64DebugCL.read.1.tlog
     文件        1618  2016-08-01 16:02  MyCvtMyCvtx64DebugCL.write.1.tlog
     文件         406  2016-06-13 11:30  MyCvtMyCvtx64DebugMyCvt.exe.embed.manifest
     文件         472  2016-06-13 11:30  MyCvtMyCvtx64DebugMyCvt.exe.embed.manifest.res
     文件         381  2016-08-01 16:03  MyCvtMyCvtx64DebugMyCvt.exe.intermediate.manifest
     文件          83  2016-08-01 16:03  MyCvtMyCvtx64DebugMyCvt.lastbuildstate
     文件        2404  2016-08-01 16:03  MyCvtMyCvtx64DebugMyCvt.log
     文件      558332  2016-08-01 16:02  MyCvtMyCvtx64DebugMyCvt.obj
     文件         210  2016-06-13 11:30  MyCvtMyCvtx64DebugMyCvt_manifest.rc
     文件        1422  2016-08-01 16:02  MyCvtMyCvtx64Debugcl.command.1.tlog
     文件           2  2016-08-01 16:03  MyCvtMyCvtx64Debuglink-cvtres.read.1.tlog
     文件           2  2016-08-01 16:03  MyCvtMyCvtx64Debuglink-cvtres.write.1.tlog
............此处省略83个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)