基于样例的图像修复


该代码实现了基于样例的图像修复功能。对于图像中的破损区域有很好的修复功能。
资源截图
代码片段和文件信息
#include “Depth_inpaint.h“
#include 
#include 
#include 
#include 
#include“camera_Parameter.h“
#include “PriorityQueue.h“
#include “upsample.h“
#include 
using namespace std;

//extern double FocalLength;
//extern double LTranslation[10];
//extern double duPrincipal[10];

Depth_inpaint::Depth_inpaint(int numint Widthint Heightint framesdouble PositionParameters res)
{
this->num=num;
this->Width=Width;
this->Height=Height;
this->SW=SW;
this->SH=SH;
this->frames=frames;

this->res=res;
this->Position=Position;
LTranslation=this->Position-this->res.Position;

SW=32;   // SH=32;
DEPTH_TH=15;

HEMASK=new unsigned char[Width*Height];
HOLE=new unsigned char[Width*Height];

for(int i=0;i<2;i++){
D[i]=new unsigned char[Width*Height*frames*3/2];
C[i]=new unsigned char[Width*Height*frames*3/2];
/*Y[i]=new unsigned char[Width*Height*frames];
U[i]=new unsigned char[Width*Height*frames];
V[i]=new unsigned char[Width*Height*frames];*/
}
}

Depth_inpaint::Depth_inpaint()
{
num=0;
Width=1024;
Height=768;
frames=2;

Position=0;
LTranslation=0;

SW=32;
SH=32;
DEPTH_TH=15;

HEMASK=new unsigned char[Width*Height];
HOLE=new unsigned char[Width*Height];

for(int i=0;i<2;i++)
{
D[i]=new unsigned char[Width*Height*frames*3/2];
C[i]=new unsigned char[Width*Height*frames*3/2];
/*Y[i]=new unsigned char[Width*Height*frames];
U[i]=new unsigned char[Width*Height*frames];
V[i]=new unsigned char[Width*Height*frames];*/
}
}

Depth_inpaint::~Depth_inpaint()
{
delete HEMASK;
delete HOLE;
for(int i=0;i<2;i++){
delete D[i];
delete C[i];
/*delete Y[i];
delete U[i];
delete V[i];*/
}
}

void Depth_inpaint::readDFile(const char *filename)
{
fopen_s(&infile_Dfilename“rb“);
fread(D[0]1frames*Width*Height*3/2*sizeof(unsigned char)infile_D);
fclose(infile_D);
}

void Depth_inpaint::readCFile(const char *filename)
{
fopen_s(&infile_Cfilename“rb“);
fread(C[0]1frames*Width*Height*3/2*sizeof(unsigned char)infile_C);
fclose(infile_C);
}

void Depth_inpaint::DoUpsample(unsigned char*& Yo unsigned char*& Yi int Width int Height)
{// int i j pel[6];
int WidthMinus1;
unsigned char* out;
unsigned char* in;

WidthMinus1 = Width-1;

for (j = 0; j < Height; j++)
{
out = &Yo[j*Width*2];
in  = &Yi[j*Width];
for(i = 0; i < Width; i++)
{
pel[0] = CLIP(i-2 0 WidthMinus1);
pel[1] = CLIP(i-1 0 WidthMinus1);
pel[2] = CLIP(i   0 WidthMinus1);
pel[3] = CLIP(i+1 0 WidthMinus1);
pel[4] = CLIP(i+2 0 WidthMinus1);
pel[5] = CLIP(i+3 0 WidthMinus1);
out[ (i)<<1   ] = in[pel[2]];                        // out[((i)<<1)+1] = CLIP( (20*(in[pel[2]]+in[pel[3]]) - 5*(in[pel[1]]+in[pel[4]]) + (in[pel[0]]+in[pel[5]]) +16)>>5 0 255 );// }
}
}

void Depth_inpaint::wri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     164864  2014-12-17 21:28  inpaintingDebuginpainting.exe

     文件     515028  2014-12-17 21:28  inpaintingDebuginpainting.ilk

     文件    1928192  2014-12-17 21:28  inpaintingDebuginpainting.pdb

     文件       3242  2014-11-24 21:21  inpaintinginpaintingcamera_Parameter.h

     文件       2406  2014-12-17 21:28  inpaintinginpaintingDebugcl.command.1.tlog

     文件      45552  2014-12-17 21:28  inpaintinginpaintingDebugCL.read.1.tlog

     文件       1002  2014-12-17 21:28  inpaintinginpaintingDebugCL.write.1.tlog

     文件     464639  2014-12-17 21:28  inpaintinginpaintingDebugDepth_inpaint.obj

     文件       1822  2014-12-17 21:28  inpaintinginpaintingDebuginpainting.Build.CppClean.log

     文件         47  2014-12-17 21:28  inpaintinginpaintingDebuginpainting.lastbuildstate

     文件       6490  2014-12-17 21:28  inpaintinginpaintingDebuginpainting.log

     文件          2  2014-12-17 21:28  inpaintinginpaintingDebuglink-cvtres.read.1.tlog

     文件          2  2014-12-17 21:28  inpaintinginpaintingDebuglink-cvtres.write.1.tlog

     文件          2  2014-12-17 21:28  inpaintinginpaintingDebuglink-rc.read.1.tlog

     文件          2  2014-12-17 21:28  inpaintinginpaintingDebuglink-rc.write.1.tlog

     文件       1262  2014-12-17 21:28  inpaintinginpaintingDebuglink.command.1.tlog

     文件       3110  2014-12-17 21:28  inpaintinginpaintingDebuglink.read.1.tlog

     文件        488  2014-12-17 21:28  inpaintinginpaintingDebuglink.write.1.tlog

     文件     136101  2014-12-17 21:28  inpaintinginpaintingDebug est.obj

     文件     145521  2014-12-17 21:28  inpaintinginpaintingDebugupsample.obj

     文件     830464  2014-12-17 21:28  inpaintinginpaintingDebugvc110.idb

     文件    1609728  2014-12-17 21:28  inpaintinginpaintingDebugvc110.pdb

     文件     116239  2014-12-22 19:40  inpaintinginpaintingDepth_inpaint.cpp

     文件      12436  2014-12-22 15:26  inpaintinginpaintingDepth_inpaint.h

     文件       5599  2014-12-05 19:39  inpaintinginpaintinginpainting.vcxproj

     文件       1550  2014-12-15 20:39  inpaintinginpaintinginpainting.vcxproj.filters

     文件       6379  2014-12-05 19:39  inpaintinginpaintingPriorityQueue.h

     文件       3186  2014-12-22 19:40  inpaintinginpaintingReleasecl.command.1.tlog

     文件      45264  2014-12-22 19:40  inpaintinginpaintingReleaseCL.read.1.tlog

     文件       1026  2014-12-22 19:40  inpaintinginpaintingReleaseCL.write.1.tlog

............此处省略33个文件信息

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

发表评论

评论列表(条)