• 大小: 5.29MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-13
  • 语言: 其他
  • 标签: 图像修复  

资源简介

该代码实现了基于样例的图像修复功能。对于图像中的破损区域有很好的修复功能。

资源截图

代码片段和文件信息

#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  inpainting\Debug\inpainting.exe

     文件     515028  2014-12-17 21:28  inpainting\Debug\inpainting.ilk

     文件    1928192  2014-12-17 21:28  inpainting\Debug\inpainting.pdb

     文件       3242  2014-11-24 21:21  inpainting\inpainting\camera_Parameter.h

     文件       2406  2014-12-17 21:28  inpainting\inpainting\Debug\cl.command.1.tlog

     文件      45552  2014-12-17 21:28  inpainting\inpainting\Debug\CL.read.1.tlog

     文件       1002  2014-12-17 21:28  inpainting\inpainting\Debug\CL.write.1.tlog

     文件     464639  2014-12-17 21:28  inpainting\inpainting\Debug\Depth_inpaint.obj

     文件       1822  2014-12-17 21:28  inpainting\inpainting\Debug\inpainting.Build.CppClean.log

     文件         47  2014-12-17 21:28  inpainting\inpainting\Debug\inpainting.lastbuildstate

     文件       6490  2014-12-17 21:28  inpainting\inpainting\Debug\inpainting.log

     文件          2  2014-12-17 21:28  inpainting\inpainting\Debug\link-cvtres.read.1.tlog

     文件          2  2014-12-17 21:28  inpainting\inpainting\Debug\link-cvtres.write.1.tlog

     文件          2  2014-12-17 21:28  inpainting\inpainting\Debug\link-rc.read.1.tlog

     文件          2  2014-12-17 21:28  inpainting\inpainting\Debug\link-rc.write.1.tlog

     文件       1262  2014-12-17 21:28  inpainting\inpainting\Debug\link.command.1.tlog

     文件       3110  2014-12-17 21:28  inpainting\inpainting\Debug\link.read.1.tlog

     文件        488  2014-12-17 21:28  inpainting\inpainting\Debug\link.write.1.tlog

     文件     136101  2014-12-17 21:28  inpainting\inpainting\Debug\test.obj

     文件     145521  2014-12-17 21:28  inpainting\inpainting\Debug\upsample.obj

     文件     830464  2014-12-17 21:28  inpainting\inpainting\Debug\vc110.idb

     文件    1609728  2014-12-17 21:28  inpainting\inpainting\Debug\vc110.pdb

     文件     116239  2014-12-22 19:40  inpainting\inpainting\Depth_inpaint.cpp

     文件      12436  2014-12-22 15:26  inpainting\inpainting\Depth_inpaint.h

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

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

     文件       6379  2014-12-05 19:39  inpainting\inpainting\PriorityQueue.h

     文件       3186  2014-12-22 19:40  inpainting\inpainting\Release\cl.command.1.tlog

     文件      45264  2014-12-22 19:40  inpainting\inpainting\Release\CL.read.1.tlog

     文件       1026  2014-12-22 19:40  inpainting\inpainting\Release\CL.write.1.tlog

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

评论

共有 条评论