本文整理汇总了Java中ij.process.ByteProcessor.invert方法的典型用法代码示例。如果您正苦于以下问题:Java ByteProcessor.invert方法的具体用法?Java ByteProcessor.invert怎么用?Java ByteProcessor.invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.ByteProcessor
的用法示例。
在下文中一共展示了ByteProcessor.invert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFeatures
import ij.process.ByteProcessor; //导入方法依赖的package包/类
@Override
public double[] getFeatures (Glyph glyph,
int interline)
{
final ByteProcessor buffer = ScaledBuffer.getBuffer(glyph, interline);
buffer.invert(); // 0 for background, 255 for foreground
// Layout: row by row
final double[] doubles = new double[length()];
int i = 0;
for (int y = 0; y < ScaledBuffer.HEIGHT; y++) {
for (int x = 0; x < ScaledBuffer.WIDTH; x++) {
doubles[i++] = buffer.get(x, y);
}
}
return doubles;
}
示例2: testInclude
import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
* Test of include method, of class RunTable.
*/
@Test
public void testInclude ()
{
System.out.println("\n+++ include");
RunTable instance = createHorizontalInstance();
System.out.println("initial:\n" + instance.dumpOf());
ByteProcessor buffer = instance.getBuffer();
buffer.invert();
GlobalFilter filter = new GlobalFilter(buffer, 127);
RunTableFactory factory = new RunTableFactory(HORIZONTAL);
RunTable that = factory.createTable(filter.filteredImage());
System.out.println("inverted:\n" + that.dumpOf());
that.dumpSequences();
instance.include(that);
System.out.println("full:\n" + instance.dumpOf());
instance.dumpSequences();
assertEquals(5, instance.getTotalRunCount());
}
示例3: clearBoundary
import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
* Starting from all white pixels (value = 255) on a ROI's boundary,
* fill the pixels with black
*
* @param bp
* @param roi
* @param clearValue
*/
public static void clearBoundary(ByteProcessor bp, Roi roi, double clearValue) {
ByteProcessor bpEdgeMask = new ByteProcessor(bp.getWidth(), bp.getHeight());
bpEdgeMask.setValue(255);
if (roi == null)
bpEdgeMask.fill();
else {
bpEdgeMask.fill(roi);
}
bpEdgeMask.filter(ByteProcessor.MIN);
bpEdgeMask.invert();
bpEdgeMask.copyBits(bp, 0, 0, Blitter.AND);
bpEdgeMask = MorphologicalReconstruction.binaryReconstruction(bpEdgeMask, bp, false);
bp.copyBits(bpEdgeMask, 0, 0, Blitter.SUBTRACT);
//
// ImagePlus imp = new ImagePlus("Edge", bp.duplicate());
// imp.setRoi(roi);
// imp.show();
// ByteProcessor bpEdgeMask = new ByteProcessor(bp.getWidth(), bp.getHeight());
// bpEdgeMask.setValue(255);
// bpEdgeMask.setLineWidth(2);
// if (roi == null)
// bpEdgeMask.draw(new Roi(0, 0, bp.getWidth(), bp.getHeight()));
// else
// bpEdgeMask.draw(roi);
// bpEdgeMask.copyBits(bp, 0, 0, Blitter.AND);
// bpEdgeMask = MorphologicalReconstruction.binaryReconstruction(bpEdgeMask, bp, false);
// bp.copyBits(bpEdgeMask, 0, 0, Blitter.SUBTRACT);
// new ImagePlus("Edge", bp.duplicate()).show();
}
示例4: erode
import ij.process.ByteProcessor; //导入方法依赖的package包/类
private void erode(ByteProcessor ip, int[][] H) {
// dilates the background
ip.invert();
dilate(ip, reflect(H));
ip.invert();
}