本文整理汇总了C++中DImage::dataPointer_dbl方法的典型用法代码示例。如果您正苦于以下问题:C++ DImage::dataPointer_dbl方法的具体用法?C++ DImage::dataPointer_dbl怎么用?C++ DImage::dataPointer_dbl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImage
的用法示例。
在下文中一共展示了DImage::dataPointer_dbl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
/**Non-separable kernels are formatted as one might expect. Separable kernels
* show the two separable functions in a "+" pattern in the image.
*/
DImage DKernel2D::toDImage(){
int w, h;
DImage dst;
double *pDst;
w = 2*radiusX+1;
h = 2*radiusY+1;
dst.create(w, h, DImage::DImage_dbl_multi, 1);
pDst = dst.dataPointer_dbl(0);
if(!fSep){ // non-separable: just copy the data to the image
memcpy(pDst, rgData_dbl, sizeof(double)*w*h);
}
else{ // separable: make a "+" with the two separable 1-d kernels
memset(pDst, 0, sizeof(double)*w*h);
for(int y = 0; y < h; ++y){
pDst[y*w+w/2] = rgSep_dbl[w+y];
}
pDst += h/2*w;
for(int x = 0; x < w; ++x){
pDst[x] = rgSep_dbl[x];
}
}
return dst;
}
示例2: fprintf
///Assignment from a DImage object (creates a kernel based on srcImg contents)
const DKernel2D& DKernel2D::operator=(const DImage &srcImg){
int w, h;
DImage imgDbl;
double *pDataDbl;
double *pDataDst;
float *pDataFlt;
if((0 == (srcImg.width() & 1)) || (0 == (srcImg.height() & 1))){
fprintf(stderr, "DKernel2D::operator=() source image w,h must be odd\n");
exit(1);
}
if(1 != srcImg.numChannels()){
fprintf(stderr, "DKernel2D::operator=() source image numChannels != 1\n");
exit(1);
}
if(srcImg.getImageType() == DImage::DImage_cmplx){
fprintf(stderr, "DKernel2D::operator=() DImage_cmplx not supported\n");
exit(1);
}
srcImg.convertedImgType_(imgDbl, DImage::DImage_dbl_multi, 1);
pDataDbl = imgDbl.dataPointer_dbl();
fSep = false;
radiusX = srcImg.width() / 2;
radiusY = srcImg.height() / 2;
numSigsX = DEFAULT_NUM_SIGMAS;
numSigsY = DEFAULT_NUM_SIGMAS;
w = 2*radiusX+1;
h = 2*radiusY+1;
deleteBuffers();
allocBuffers(w, h);
pDataDst = rgData_dbl;
pDataFlt = rgData_flt;
for(int y = 0; y < h; ++y){
memcpy(pDataDst, pDataDbl, sizeof(double) * w);
for(int x = 0; x < w; ++x)
pDataFlt[x] = (float)(pDataDst[x]);
pDataDst += w;
pDataDbl += w;
pDataFlt += w;
}
return *this;
}