本文整理汇总了C++中DImage::copyData方法的典型用法代码示例。如果您正苦于以下问题:C++ DImage::copyData方法的具体用法?C++ DImage::copyData怎么用?C++ DImage::copyData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImage
的用法示例。
在下文中一共展示了DImage::copyData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDxs
//--------------------------------------------------------------------------------------------------------
// function to compute dx, dy and dt for motion estimation
//--------------------------------------------------------------------------------------------------------
void OpticalFlow::getDxs(DImage &imdx, DImage &imdy, DImage &imdt, const DImage &im1, const DImage &im2)
{
//double gfilter[5]={0.01,0.09,0.8,0.09,0.01};
//double gfilter[5]={0.02,0.11,0.74,0.11,0.02};
//double gfilter[5]={0,0,1,0,0};
if(1)
{
//DImage foo,Im;
//Im.Add(im1,im2);
//Im.Multiplywith(0.5);
////foo.imfilter_hv(Im,gfilter,2,gfilter,2);
//Im.dx(imdx,true);
//Im.dy(imdy,true);
//imdt.Subtract(im2,im1);
DImage Im;
// im1.imfilter_hv(Im1,gfilter,2,gfilter,2);
// im2.imfilter_hv(Im2,gfilter,2,gfilter,2);
// Im.copyData(Im1);
// Im.Multiplywith(0.4);
// Im.Add(Im2,0.6);
//Im.Multiplywith(0.5);
//Im1.copyData(im1);
//Im2.copyData(im2);
Im.copyData(im2);
Im.dx(imdx,true);
Im.dy(imdy,true);
imdt.Subtract(im2,im1);
}
else
{
// Im1 and Im2 are the smoothed version of im1 and im2
// DImage Im1,Im2;
//
// im1.imfilter_hv(Im1,gfilter,2,gfilter,2);
// im2.imfilter_hv(Im2,gfilter,2,gfilter,2);
//Im1.copyData(im1);
//Im2.copyData(im2);
// Im2.dx(imdx,true);
// Im2.dy(imdy,true);
// imdt.Subtract(Im2,Im1);
}
imdx.setDerivative();
imdy.setDerivative();
imdt.setDerivative();
}
示例2: if
//---------------------------------------------------------------------------------------
// function to convert image to feature image
//---------------------------------------------------------------------------------------
void OpticalFlow::im2feature(DImage &imfeature, const DImage &im)
{
int width=im.width();
int height=im.height();
int nchannels=im.nchannels();
if(nchannels==1)
{
imfeature.allocate(im.width(),im.height(),3);
DImage imdx,imdy;
im.dx(imdx,true);
im.dy(imdy,true);
_FlowPrecision* data=imfeature.data();
for(int i=0;i<height;i++)
for(int j=0;j<width;j++)
{
int offset=i*width+j;
data[offset*3]=im.data()[offset];
data[offset*3+1]=imdx.data()[offset];
data[offset*3+2]=imdy.data()[offset];
}
}
else if(nchannels==3)
{
DImage grayImage;
im.desaturate(grayImage);
imfeature.allocate(im.width(),im.height(),5);
DImage imdx,imdy;
grayImage.dx(imdx,true);
grayImage.dy(imdy,true);
_FlowPrecision* data=imfeature.data();
for(int i=0;i<height;i++)
for(int j=0;j<width;j++)
{
int offset=i*width+j;
data[offset*5]=grayImage.data()[offset];
data[offset*5+1]=imdx.data()[offset];
data[offset*5+2]=imdy.data()[offset];
data[offset*5+3]=im.data()[offset*3+1]-im.data()[offset*3];
data[offset*5+4]=im.data()[offset*3+1]-im.data()[offset*3+2];
}
}
else
imfeature.copyData(im);
}