public static void processBorderVertical(GrayF32 orig , GrayF32 deriv , Kernel1D_F32 kernel , ImageBorder_F32 borderType) { borderType.setImage(orig); ConvolveJustBorder_General_SB.vertical(kernel, borderType ,deriv ); GrayF32 origSub; GrayF32 derivSub; origSub = orig.subimage(0,0,2,orig.height, null); derivSub = deriv.subimage(0,0,2,orig.height, null); ConvolveImageNoBorder.vertical(kernel,origSub,derivSub); origSub = orig.subimage(orig.width-2,0,orig.width,orig.height, null); derivSub = deriv.subimage(orig.width-2,0,orig.width,orig.height, null); ConvolveImageNoBorder.vertical(kernel,origSub,derivSub); }
public static void processBorderHorizontal(GrayF32 orig , GrayF32 deriv , Kernel1D_F32 kernel , ImageBorder_F32 borderType ) { borderType.setImage(orig); ConvolveJustBorder_General_SB.horizontal(kernel, borderType , deriv ); GrayF32 origSub; GrayF32 derivSub; origSub = orig.subimage(0,0,orig.width,2, null); derivSub = deriv.subimage(0,0,orig.width,2, null); ConvolveImageNoBorder.horizontal(kernel,origSub,derivSub); origSub = orig.subimage(0,orig.height-2,orig.width,orig.height, null); derivSub = deriv.subimage(0,orig.height-2,orig.width,orig.height, null); ConvolveImageNoBorder.horizontal(kernel,origSub,derivSub); }
@Override public void denoise(GrayF32 transform , int numLevels ) { int w = transform.width; int h = transform.height; // compute the noise variance using the HH_1 subband noiseVariance = UtilDenoiseWavelet.estimateNoiseStdDev(transform.subimage(w/2,h/2,w,h, null),null); noiseVariance *= noiseVariance; // System.out.println("Noise Variance: "+noiseVariance); performShrinkage(transform,numLevels); } }
@Override public void denoise(GrayF32 transform , int numLevels ) { int w = transform.width; int h = transform.height; // compute the noise variance using the HH_1 subband noiseSigma = UtilDenoiseWavelet.estimateNoiseStdDev(transform.subimage(w/2,h/2,w,h, null),null); // System.out.println("Noise sigma: "+noiseSigma); performShrinkage(transform,numLevels); } }
@Override protected boolean processSquare(GrayF32 gray, Result result , double edgeInside, double edgeOutside) { GrayU8 binary = foundBinary.grow(); int off = (gray.width-binary.width)/2; gray.subimage(off, off, gray.width - off, gray.width - off, grayNoBorder); threshold.process(grayNoBorder, binary); return true; }
/** * 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(GrayF32 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; GrayF32 subbandHH = transform.subimage(w/2,h/2,w,h, null); 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, null),threshold); rule.process(transform.subimage(0,innerHeight,innerWidth,h, null),threshold); } }
gray.subimage(off,off,off+binary.width,off+binary.width,grayNoBorder);
@Override protected boolean processSquare(GrayF32 gray, Result result, double edgeInside, double edgeOutside) { int off = (gray.width - binaryInner.width) / 2; gray.subimage(off, off, off + binaryInner.width, off + binaryInner.width, grayNoBorder); // convert input image into binary number double threshold = (edgeInside+edgeOutside)/2; findBitCounts(grayNoBorder,threshold); if (thresholdBinaryNumber()) { if( verbose ) System.out.println(" can't threshold binary, ambiguous"); return false; } // adjust the orientation until the black corner is in the lower left if (rotateUntilInLowerCorner(result)) { if( verbose ) System.out.println(" rotate to corner failed"); return false; } result.which = extractNumeral(); result.lengthSide = lengthSide; //printClassified(); return true; }
currDesc.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpInput.setImage(image); interpInput.region(srcX0, srcY0, subimage);
feature.desc.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpInput.setImage(image); interpInput.region(srcX0, srcY0, subimage); feature.derivX.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpDeriv.setImage(derivX); interpDeriv.region(srcX0, srcY0, subimage); feature.derivY.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpDeriv.setImage(derivY); interpDeriv.region(srcX0, srcY0, subimage);
storage = InputSanityCheck.checkDeclare(input, storage); storage = storage.subimage(0,0,input.width,input.height, null); storage.subImage = false; height += height%2; GrayF32 levelIn = input.subimage(0,0,width,height, null); GrayF32 levelOut = output.subimage(0,0,width,height, null); storage.reshape(width,height); inverse1(desc,levelIn,levelOut, storage,-Float.MAX_VALUE,Float.MAX_VALUE); levelIn = input.subimage(0,0,width,height, null); levelOut = output.subimage(0,0,width,height, null); } else { levelIn = input;
int y0 = match.getBorderY0(); int y1 = imageHeight - (template.height - y0); intensity = intensity.subimage(x0, y0, x1, y1, null); } else { offsetX = match.getBorderX0();