本文整理汇总了Java中boofcv.struct.image.ImageFloat32.subimage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageFloat32.subimage方法的具体用法?Java ImageFloat32.subimage怎么用?Java ImageFloat32.subimage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boofcv.struct.image.ImageFloat32
的用法示例。
在下文中一共展示了ImageFloat32.subimage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: denoise
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Applies VisuShrink denoising to the provided multilevel wavelet transform using
* the provided threshold.
*
* @param transform Mult-level wavelet transform. Modified.
* @param numLevels Number of levels in the transform.
*/
@Override
public void denoise( ImageFloat32 transform , int numLevels ) {
int scale = UtilWavelet.computeScale(numLevels);
final int h = transform.height;
final int w = transform.width;
// width and height of scaling image
final int innerWidth = w/scale;
final int innerHeight = h/scale;
ImageFloat32 subbandHH = transform.subimage(w/2,h/2,w,h);
float sigma = UtilDenoiseWavelet.estimateNoiseStdDev(subbandHH,null);
float threshold = (float) UtilDenoiseWavelet.universalThreshold(subbandHH,sigma);
// apply same threshold to all wavelet coefficients
rule.process(transform.subimage(innerWidth,0,w,h),threshold);
rule.process(transform.subimage(0,innerHeight,innerWidth,h),threshold);
}
示例2: processBorderHorizontal
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
public static void processBorderHorizontal( ImageFloat32 orig , ImageFloat32 deriv ,
Kernel1D_F32 kernel , int border , ImageBorder_F32 borderType )
{
borderType.setImage(orig);
ConvolveJustBorder_General.horizontal(kernel, borderType , deriv , border);
ImageFloat32 origSub;
ImageFloat32 derivSub;
origSub = orig.subimage(0,0,orig.width,2);
derivSub = deriv.subimage(0,0,orig.width,2);
ConvolveImageNoBorder.horizontal(kernel,origSub,derivSub,true);
origSub = orig.subimage(0,orig.height-2,orig.width,orig.height);
derivSub = deriv.subimage(0,orig.height-2,orig.width,orig.height);
ConvolveImageNoBorder.horizontal(kernel,origSub,derivSub,true);
}
示例3: processBorderVertical
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
public static void processBorderVertical( ImageFloat32 orig , ImageFloat32 deriv ,
Kernel1D_F32 kernel , int border , ImageBorder_F32 borderType)
{
borderType.setImage(orig);
ConvolveJustBorder_General.vertical(kernel, borderType ,deriv,border);
ImageFloat32 origSub;
ImageFloat32 derivSub;
origSub = orig.subimage(0,0,2,orig.height);
derivSub = deriv.subimage(0,0,2,orig.height);
ConvolveImageNoBorder.vertical(kernel,origSub,derivSub,true);
origSub = orig.subimage(orig.width-2,0,orig.width,orig.height);
derivSub = deriv.subimage(orig.width-2,0,orig.width,orig.height);
ConvolveImageNoBorder.vertical(kernel,origSub,derivSub,true);
}
示例4: derivXX
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Test
public void derivXX() {
ImageFloat32 orig = new ImageFloat32(width,height);
ImageFloat32 integral = new ImageFloat32(width,height);
ImageMiscOps.fillUniform(orig,rand,0,20);
ImageFloat32 expected = new ImageFloat32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
IntegralImageOps.transform(orig,integral);
for( int i = 1; i <= 5; i += 2 ) {
int size = i*3;
Kernel2D_F32 kernel = createDerivXX(size);
ConvolveImageNoBorder.convolve(kernel,orig,expected);
DerivativeIntegralImage.derivXX(integral,found,size);
int r = size/2;
ImageFloat32 a = expected.subimage(r+1,r+1,expected.width-r,expected.height-r);
ImageFloat32 b = found.subimage(r+1,r+1,found.width-r,found.height-r);
BoofTesting.assertEquals(a,b,1e-2);
}
}
示例5: derivXY
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Test
public void derivXY() {
ImageFloat32 orig = new ImageFloat32(width,height);
ImageFloat32 integral = new ImageFloat32(width,height);
ImageMiscOps.fillUniform(orig,rand,0,20);
ImageFloat32 expected = new ImageFloat32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
IntegralImageOps.transform(orig,integral);
for( int i = 1; i <= 5; i += 2 ) {
int size = i*3;
Kernel2D_F32 kernel = createDerivXY(size);
ConvolveImageNoBorder.convolve(kernel,orig,expected);
DerivativeIntegralImage.derivXY(integral,found,size);
int r = size/2;
ImageFloat32 a = expected.subimage(r+1,r+1,expected.width-r,expected.height-r);
ImageFloat32 b = found.subimage(r+1,r+1,found.width-r,found.height-r);
BoofTesting.assertEquals(a,b,1e-2);
}
}
示例6: refine
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Override
public void refine(List<QuadBlob> squares,
ImageFloat32 image )
{
for( QuadBlob s : squares) {
// search the smallest side size to avoid accidentally including
// another corner in the region being considered.
// hmm if the square is at a 45 degree angle this might not work.... Oh well don't use small squares
// Also need to be careful of perspective distortion, it can cause the smallest side to be
// too short too
int searchRadius = (int)s.smallestSide-2;
if( searchRadius > 15 )
searchRadius = 15;
if( searchRadius < 3 )
searchRadius = 3;
for( int i = 0; i < 4; i++ ) {
Point2D_I32 cp = s.corners.get(i);
Point2D_F64 rp = s.subpixel.get(i);
ImageRectangle r = new ImageRectangle(cp.x- searchRadius,cp.y - searchRadius,
cp.x + searchRadius +1,cp.y+ searchRadius +1);
BoofMiscOps.boundRectangleInside(image, r);
ImageFloat32 sub = image.subimage(r.x0,r.y0,r.x1,r.y1);
alg.process(sub);
rp.x = r.x0 + (float)alg.getCorner().x;
rp.y = r.y0 + (float)alg.getCorner().y;
}
}
}
示例7: renderIntensity
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Only part of the image is processed when detecting features. This copies the detected part into
* the provided image
*
* @param wholeImage Image being written to
*/
public void renderIntensity(ImageFloat32 wholeImage) {
if( targetRect == null ) {
ImageMiscOps.fill(wholeImage,0);
} else {
ImageFloat32 found = intensityAlg.getIntensity();
ImageFloat32 out = wholeImage.subimage(targetRect.x0, targetRect.y0, targetRect.x1, targetRect.y1);
out.setTo(found);
}
}
示例8: 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);
}
}
示例9: 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);
}
}
示例10: derivYY
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
@Test
public void derivYY() {
ImageFloat32 orig = new ImageFloat32(width,height);
ImageFloat32 integral = new ImageFloat32(width,height);
ImageMiscOps.fillUniform(orig,rand,0,20);
ImageFloat32 expected = new ImageFloat32(width,height);
ImageFloat32 found = new ImageFloat32(width,height);
IntegralImageOps.transform(orig,integral);
for( int i = 1; i <= 5; i += 2 ) {
int size = i*3;
Kernel2D_F32 kernel = createDerivXX(size);
kernel = KernelMath.transpose(kernel);
ConvolveImageNoBorder.convolve(kernel,orig,expected);
DerivativeIntegralImage.derivYY(integral,found,size);
int r = size/2;
ImageFloat32 a = expected.subimage(r+1,r+1,expected.width-r,expected.height-r);
ImageFloat32 b = found.subimage(r+1,r+1,found.width-r,found.height-r);
BoofTesting.assertEquals(a,b,1e-2);
}
}
示例11: compareToNaive
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Compares output against naive algorithm. Checks for compliance with sub-images
*/
@Test
public void compareToNaive() {
ImageFloat32 inten = new ImageFloat32(30, 40);
QueueCorner naiveMin = new QueueCorner(inten.getWidth() * inten.getHeight());
QueueCorner naiveMax = new QueueCorner(inten.getWidth() * inten.getHeight());
for (int useSubImage = 0; useSubImage <= 1; useSubImage++) {
// make sure it handles sub images correctly
if (useSubImage == 1) {
ImageFloat32 larger = new ImageFloat32(inten.width + 10, inten.height + 8);
inten = larger.subimage(5, 5, inten.width + 5, inten.height + 5);
}
for (int nonMaxWidth = 3; nonMaxWidth <= 9; nonMaxWidth += 2) {
int radius = nonMaxWidth / 2;
NonMaxExtractorNaive reg = new NonMaxExtractorNaive(strict);
reg.setSearchRadius(radius);
reg.setThreshold(0.6f);
for (int i = 0; i < 10; i++) {
ImageMiscOps.fillGaussian(inten, rand, 0, 3, -100, 100);
// detect the corners
findLocalPeaks(inten, 0.6f, radius, 0);
naiveMin.reset();naiveMax.reset();
reg.process(inten, naiveMax);
PixelMath.invert(inten, inten);
reg.process(inten, naiveMin);
// check the number of corners
if( canDetectMin ) {
assertTrue(foundMinimum.size() > 0);
assertEquals(naiveMin.size(), foundMinimum.size());
checkSamePoints(naiveMin,foundMinimum);
}
if( canDetectMax ) {
assertTrue(foundMaximum.size() > 0);
assertEquals(naiveMax.size(), foundMaximum.size());
checkSamePoints(naiveMax,foundMaximum);
}
}
}
}
}
示例12: 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);
}