本文整理汇总了Java中boofcv.struct.image.ImageFloat32.reshape方法的典型用法代码示例。如果您正苦于以下问题:Java ImageFloat32.reshape方法的具体用法?Java ImageFloat32.reshape怎么用?Java ImageFloat32.reshape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boofcv.struct.image.ImageFloat32
的用法示例。
在下文中一共展示了ImageFloat32.reshape方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hessian_F32
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Compares hessian intensity against a naive implementation
*/
@Test
public void hessian_F32() {
ImageFloat32 original = new ImageFloat32(width,height);
ImageFloat32 integral = new ImageFloat32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
ImageFloat32 expected = new ImageFloat32(width,height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original,integral);
int size = 9;
for( int skip = 1; skip <= 4; skip++ ) {
found.reshape(width/skip,height/skip);
expected.reshape(width/skip,height/skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral,skip,size,expected);
IntegralImageFeatureIntensity.hessian(integral,skip,size,found);
BoofTesting.assertEquals(expected,found, 1e-4f);
}
}
示例2: hessian_S32
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Compares hessian intensity against a naive implementation
*/
@Test
public void hessian_S32() {
ImageSInt32 original = new ImageSInt32(width,height);
ImageSInt32 integral = new ImageSInt32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
ImageFloat32 expected = new ImageFloat32(width,height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original,integral);
int size = 9;
for( int skip = 1; skip <= 4; skip++ ) {
found.reshape(width/skip,height/skip);
expected.reshape(width/skip,height/skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral,skip,size,expected);
IntegralImageFeatureIntensity.hessian(integral,skip,size,found);
BoofTesting.assertEquals(expected,found, 1e-4f);
}
}
示例3: computeDerivatives
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Computes the image derivative for each layer in the pyramid.
*/
public void computeDerivatives() {
int maxScales = actualOctaves*numScales;
for( int i = 0; i < maxScales; i++ ) {
ImageFloat32 input = scale[i];
ImageFloat32 dx = derivX[i];
ImageFloat32 dy = derivY[i];
dx.reshape(input.width,input.height);
dy.reshape(input.width,input.height);
gradient.process(input,dx,dy);
}
}
示例4: inner_F32
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Compares the inner() function against the output from the naive function.
*/
@Test
public void inner_F32() {
ImageFloat32 original = new ImageFloat32(width,height);
ImageFloat32 integral = new ImageFloat32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
ImageFloat32 expected = new ImageFloat32(width,height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original,integral);
int size = 9;
int r = size/2+1;
r++;
for( int skip = 1; skip <= 4; skip++ ) {
found.reshape(width/skip,height/skip);
expected.reshape(width/skip,height/skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral,skip,size,expected);
ImplIntegralImageFeatureIntensity.hessianInner(integral,skip,size,found);
int w = found.width;
int h = found.height;
ImageFloat32 f = found.subimage(r+1,r+1,w-r,h-r);
ImageFloat32 e = expected.subimage(r+1,r+1,w-r,h-r);
BoofTesting.assertEquals(e,f, 1e-4f);
}
}
示例5: inner_S32
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Compares the inner() function against the output from the naive function.
*/
@Test
public void inner_S32() {
ImageSInt32 original = new ImageSInt32(width,height);
ImageSInt32 integral = new ImageSInt32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
ImageFloat32 expected = new ImageFloat32(width,height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original,integral);
int size = 9;
int r = size/2+1;
r++;
for( int skip = 1; skip <= 4; skip++ ) {
found.reshape(width/skip,height/skip);
expected.reshape(width/skip,height/skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral,skip,size,expected);
ImplIntegralImageFeatureIntensity.hessianInner(integral,skip,size,found);
int w = found.width;
int h = found.height;
ImageFloat32 f = found.subimage(r+1,r+1,w-r,h-r);
ImageFloat32 e = expected.subimage(r+1,r+1,w-r,h-r);
BoofTesting.assertEquals(e,f, 1e-4f);
}
}
示例6: process
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Override
public void process(ImageSInt16 derivX, ImageSInt16 derivY, ImageFloat32 intensity ) {
InputSanityCheck.checkSameShape(derivX, derivY, intensity);
int w = derivX.width;
int h = derivX.height;
imgXX.reshape(w,h);
imgYY.reshape(w,h);
imgXY.reshape(w,h);
temp.reshape(w,h);
intensity.reshape(w,h);
int index = 0;
for( int y = 0; y < h; y++ ) {
int indexX = derivX.startIndex + derivX.stride*y;
int indexY = derivY.startIndex + derivY.stride*y;
for( int x = 0; x < w; x++ , index++ ) {
int dx = derivX.data[indexX++];
int dy = derivY.data[indexY++];
imgXX.data[index] = dx*dx;
imgYY.data[index] = dy*dy;
imgXY.data[index] = dx*dy;
}
}
// apply the the Gaussian weights
blur(imgXX,temp);
blur(imgYY,temp);
blur(imgXY,temp);
index = 0;
for( int y = 0; y < h; y++ ) {
for( int x = 0; x < w; x++ , index++ ) {
totalXX = imgXX.data[index];
totalYY = imgYY.data[index];
totalXY = imgXY.data[index];
intensity.data[index] = computeResponse();
}
}
}
示例7: process
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Override
public void process(ImageFloat32 derivX, ImageFloat32 derivY, ImageFloat32 intensity ) {
InputSanityCheck.checkSameShape(derivX,derivY,intensity);
int w = derivX.width;
int h = derivX.height;
imgXX.reshape(w,h);
imgYY.reshape(w,h);
imgXY.reshape(w,h);
temp.reshape(w,h);
intensity.reshape(w,h);
int index = 0;
for( int y = 0; y < h; y++ ) {
int indexX = derivX.startIndex + derivX.stride*y;
int indexY = derivY.startIndex + derivY.stride*y;
for( int x = 0; x < w; x++ , index++ ) {
float dx = derivX.data[indexX++];
float dy = derivY.data[indexY++];
imgXX.data[index] = dx*dx;
imgYY.data[index] = dy*dy;
imgXY.data[index] = dx*dy;
}
}
// apply the the Gaussian weights
blur(imgXX,temp);
blur(imgYY,temp);
blur(imgXY,temp);
index = 0;
for( int y = 0; y < h; y++ ) {
for( int x = 0; x < w; x++ , index++ ) {
totalXX = imgXX.data[index];
totalYY = imgYY.data[index];
totalXY = imgXY.data[index];
intensity.data[index] = computeResponse();
}
}
}
示例8: inverseN
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* <p>Performs a level N inverse fast wavelet transform (FWT).</p>
*
* <p>To save memory the input image is used to store intermediate results and is modified.</p>
*
* @param desc Description of the inverse wavelet.
* @param input Input wavelet transform and is used as internal workspace. Modified.
* @param output Reconstruction of original image. Modified.
* @param storage Optional storage image. Should be the same size as the input image. If null then
* an image is declared internally.
* @param numLevels Number of levels in the transform.
* @param minValue Minimum allowed pixel value
* @param maxValue Maximum allowed pixel value
*/
public static void inverseN( WaveletDescription<WlCoef_F32> desc ,
ImageFloat32 input , ImageFloat32 output ,
ImageFloat32 storage,
int numLevels ,
float minValue , float maxValue)
{
if( numLevels == 1 ) {
inverse1(desc,input,output, storage,minValue,maxValue);
return;
}
UtilWavelet.checkShape(desc.getForward(),output,input,numLevels);
storage = InputSanityCheck.checkDeclare(input, storage);
// modify the shape of a temporary image not the original
storage = storage.subimage(0,0,input.width,input.height);
int width,height;
int scale = UtilWavelet.computeScale(numLevels);
width = input.width/scale;
height = input.height/scale;
width += width%2;
height += height%2;
ImageFloat32 levelIn = input.subimage(0,0,width,height);
ImageFloat32 levelOut = output.subimage(0,0,width,height);
storage.reshape(width,height);
inverse1(desc,levelIn,levelOut, storage,-Float.MAX_VALUE,Float.MAX_VALUE);
for( int i = numLevels-1; i >= 1; i-- ) {
// copy the decoded segment into the input
levelIn.setTo(levelOut);
if( i > 1 ) {
scale /= 2;
width = input.width/scale;
height = input.height/scale;
width += width%2;
height += height%2;
storage.reshape(width,height);
levelIn = input.subimage(0,0,width,height);
levelOut = output.subimage(0,0,width,height);
} else {
levelIn = input;
levelOut = output;
}
storage.reshape(levelIn.width,levelIn.height);
inverse1(desc,levelIn,levelOut, storage,-Float.MAX_VALUE,Float.MAX_VALUE);
}
if( minValue != -Float.MAX_VALUE && maxValue != Float.MAX_VALUE )
PixelMath.boundImage(output,minValue,maxValue);
}