当前位置: 首页>>代码示例>>Java>>正文


Java ByteProcessor.get方法代码示例

本文整理汇总了Java中ij.process.ByteProcessor.get方法的典型用法代码示例。如果您正苦于以下问题:Java ByteProcessor.get方法的具体用法?Java ByteProcessor.get怎么用?Java ByteProcessor.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.process.ByteProcessor的用法示例。


在下文中一共展示了ByteProcessor.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detectAndTraceEdges

import ij.process.ByteProcessor; //导入方法依赖的package包/类
private void detectAndTraceEdges() {
	if (Enms == null) {
		nonMaxSuppression();
	}
	Ebin = new ByteProcessor(M, N);
	int color = 255;
	traceList = new LinkedList<List<Point>>();
	for (int v = 0; v < N; v++) {
		for (int u = 0; u < M; u++) {
			if (Enms.getf(u, v) >= params.hiThr && Ebin.get(u, v) == 0) { // unmarked edge point
				List<Point> trace = traceAndThreshold(u, v, (float) params.loThr, color);
				traceList.add(trace);
			}
		}
	}
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:17,代码来源:CannyEdgeDetector.java

示例2: 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;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:20,代码来源:ImgGlyphDescriptor.java

示例3: markSeedPoints

import ij.process.ByteProcessor; //导入方法依赖的package包/类
private static int markSeedPoints(final Region region, final ByteProcessor seedImage, final int regionId) {

        int seedCount = 0;
        for (final SubRegion subRegion : region.getSubRegions()) {
            final Roi roi = subRegion.getRoi();
            final Rectangle bounds = roi.getBounds();
            for (int y = bounds.y; y < bounds.y + bounds.height; y++) {
                for (int x = bounds.x; x < bounds.x + bounds.width; x++) {
                    if (roi.contains(x, y) && seedImage.get(x, y) == 0) {
                        seedImage.set(x, y, regionId);
                        seedCount++;
                    }
                }
            }
        }

        return seedCount;
    }
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:19,代码来源:RegionGrowingModel.java

示例4: computeVector

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * Compute the gap vector based on foreground pixels found in gap area.
 *
 * @param buf the binary buffer
 * @return the populated gap vector (in which a 1 value indicates a black pixel)
 */
public int[] computeVector (ByteProcessor buf)
{
    final Rectangle box = area.getBounds();

    for (int x = box.x, xBreak = box.x + box.width; x < xBreak; x++) {
        for (int y = box.y, yBreak = box.y + box.height; y < yBreak; y++) {
            if (area.contains(x, y)) {
                if (0 == buf.get(x, y)) {
                    populateVector(x - box.x, y - box.y);
                }
            }
        }
    }

    return vector;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:23,代码来源:CurveGap.java

示例5: getProjection

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * We use the NO_STAFF source of pixels.
 *
 * @return the projection on x-axis
 */
private IntegerFunction getProjection ()
{
    // Staff-free pixel source
    final ByteProcessor source = system.getSheet().getPicture().getSource(
            Picture.SourceKey.NO_STAFF);
    final int xMin = roi.x;
    final int xMax = (roi.x + roi.width) - 1;
    final IntegerFunction function = new IntegerFunction(xMin, xMax);

    for (int x = xMin; x <= xMax; x++) {
        short cumul = 0;

        for (int y = roi.y, yBreak = roi.y + roi.height; y < yBreak; y++) {
            if (source.get(x, y) == 0) {
                cumul++;
            }
        }

        function.setValue(x, cumul);
    }

    return function;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:29,代码来源:TimeBuilder.java

示例6: getForeCount

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * Count the number of foreground pixels in the provided image.
 *
 * @param filter the binary image
 * @return the number of foreground pixels
 */
private int getForeCount (ByteProcessor filter)
{
    final int width = filter.getWidth();
    final int height = filter.getHeight();
    int count = 0;

    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            if (filter.get(x, y) == 0) {
                count++;
            }
        }
    }

    return count;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:23,代码来源:SheetDiff.java

示例7: removeWeakPixels

import ij.process.ByteProcessor; //导入方法依赖的package包/类
public static void removeWeakPixels(ByteProcessor bp) {
	int w = bp.getWidth();
	int h = bp.getHeight();
	for (int y = 1; y < h-1; y++) {
		for (int x = 1; x < w-1; x++) {
			// Check if this is a nonzero pixel
			if (bp.get(x, y) == 0)
				continue;
			// Check nonzero neighbours
			if ((bp.get(x-1, y) == 0 && bp.get(x+1, y) == 0) ||
					(bp.get(x-1, y-1) == 0 && bp.get(x+1, y+1) == 0) ||
					(bp.get(x, y-1) == 0 && bp.get(x, y+1) == 0) ||
					(bp.get(x-1, y+1) == 0 && bp.get(x+1, y-1) == 0)) {
				// If we have 2 zero neighbours, in any direction, break the connection
				bp.set(x, y, 0);
			}
				
		}			
	}
}
 
开发者ID:qupath,项目名称:qupath,代码行数:21,代码来源:ROILabeling.java

示例8: labelsToFilledROIs

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * Convert a labelled image into a list of PolygonRois by tracing.
 * Note that labels are assumed not to contain any holes or nested ROIs; ROIs produced by this command will not contain holes.
 * Some entries in the resulting array may be null if this is not the case, or if not all labels are found.
 * Otherwise, pixels with the integer label L will belong to the Roi in the output array at entry L-1
 * 
 * @param ipLabels
 * @param n - maximum number of labels
 * @return
 */
public static PolygonRoi[] labelsToFilledROIs(ImageProcessor ipLabels, int n) {
	PolygonRoi[] rois = new PolygonRoi[n];
	int w = ipLabels.getWidth();
	int h = ipLabels.getHeight();
	ByteProcessor bpCompleted = new ByteProcessor(w, h);
	bpCompleted.setValue(255);
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			if (bpCompleted.get(x, y) != 0)
				continue;
			float val = ipLabels.getf(x, y);
			if (val > 0 && val <= n) {
				Wand wand = new Wand(ipLabels);
				wand.autoOutline(x, y, val, val, Wand.EIGHT_CONNECTED);
				PolygonRoi roi = wandToRoi(wand);
				rois[(int)val-1] = roi;
				bpCompleted.fill(roi);
			}
		}
	}
	return rois;
}
 
开发者ID:qupath,项目名称:qupath,代码行数:33,代码来源:ROILabeling.java

示例9: labelsToFilledRoiList

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * Convert a labelled image into a list of PolygonRois by tracing.
 * 
 * Unlike labelsToFilledROIs, the order in which ROIs are returned is arbitrary.
 * 
 * Also, the multiple Rois may be created for the same label, if unconnected regions are used.
 * 
 * @param ipLabels
 * @param n - maximum number of labels
 * @return
 */
public static List<PolygonRoi> labelsToFilledRoiList(final ImageProcessor ipLabels, final boolean conn8) {
	List<PolygonRoi> rois = new ArrayList<>();
	int w = ipLabels.getWidth();
	int h = ipLabels.getHeight();
	ByteProcessor bpCompleted = new ByteProcessor(w, h);
	bpCompleted.setValue(255);
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			if (bpCompleted.get(x, y) != 0)
				continue;
			float val = ipLabels.getf(x, y);
			if (val > 0) {
				Wand wand = new Wand(ipLabels);
				wand.autoOutline(x, y, val, val, conn8 ? Wand.EIGHT_CONNECTED : Wand.FOUR_CONNECTED);
				PolygonRoi roi = wandToRoi(wand);
				rois.add(roi);
				bpCompleted.fill(roi);
			}
		}
	}
	return rois;
}
 
开发者ID:qupath,项目名称:qupath,代码行数:34,代码来源:ROILabeling.java

示例10: getThreshold

import ij.process.ByteProcessor; //导入方法依赖的package包/类
@Override
public ByteProcessor getThreshold(ByteProcessor I) {
	final int M = I.getWidth();
	final int N = I.getHeight();
	ByteProcessor Imin = (ByteProcessor) I.duplicate();
	ByteProcessor Imax = (ByteProcessor) I.duplicate();

	RankFilters rf = new RankFilters();
	rf.rank(Imin, params.radius, RankFilters.MIN);
	rf.rank(Imax, params.radius, RankFilters.MAX);

	int q = (params.bgMode == BackgroundMode.DARK) ? 256 : 0;
	ByteProcessor Q = new ByteProcessor(M, N);

	for (int v = 0; v < N; v++) {
		for (int u = 0; u < M; u++) {
			int gMin = Imin.get(u, v);
			int gMax = Imax.get(u, v);
			int c = gMax - gMin;
			if (c >= params.cmin)
				Q.set(u, v, (gMin + gMax) / 2);
			else
				Q.set(u, v, q);
		}
	}
	return Q;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:28,代码来源:BernsenThresholder.java

示例11: threshold

import ij.process.ByteProcessor; //导入方法依赖的package包/类
public void threshold(ByteProcessor bp, ByteProcessor Q) {
	final int w = bp.getWidth();
	final int h = bp.getHeight();
	for (int v = 0; v < h; v++) {
		for (int u = 0; u < w; u++) {
			int p = bp.get(u, v);
			int q = Q.get(u, v);
			bp.set(u, v, (p <= q) ? 0 : 255);
		}
	}
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:12,代码来源:AdaptiveThresholder.java

示例12: getPaddedPixel

import ij.process.ByteProcessor; //导入方法依赖的package包/类
protected int getPaddedPixel(ByteProcessor bp, int u, int v) {
	final int w = bp.getWidth();
	final int h = bp.getHeight();
	if (u < 0)
		u = 0;
	else if (u >= w)
		u = w - 1;
	if (v < 0)
		v = 0;
	else if (v >= h)
		v = h - 1;
	return bp.get(u, v);
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:14,代码来源:AdaptiveThresholder.java

示例13: getLine

import ij.process.ByteProcessor; //导入方法依赖的package包/类
protected double[] getLine(ByteProcessor bp, int v) {
	double[] line = new double[bp.getWidth()];
	for (int u = 0; u < line.length; u++) {
		line[u] = bp.get(u, v);
	}
	return line;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:8,代码来源:AdaptiveThresholder.java

示例14: thinOnce

import ij.process.ByteProcessor; //导入方法依赖的package包/类
private int thinOnce(ByteProcessor ip, byte[][] D) {
	int M = ip.getWidth();
	int N = ip.getHeight();
	int nd = 0;
	for (byte p = 1; p <= 2; p++) {	// make 2 passes
		int n = 0;
		for (int u = 0; u < M; u++) {
			for (int v = 0; v < N; v++) {
				D[u][v] = 0;
				if (ip.get(u, v) > 0) {
					int c = getNeighborhoodIndex(ip, u, v);
					byte q = Q[c];
					// if (deleteCode == 1 || deleteCode == 3)
					if ((p & q) != 0) {
						D[u][v] = 1;
						n = n + 1;
					}
				}
			}
		}			
		if (n > 0) {
			deleteMarked(ip, D);
			nd = nd + n;
		}
	}
	return nd;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:28,代码来源:BinaryMorphologyFilter.java

示例15: hasGray

import ij.process.ByteProcessor; //导入方法依赖的package包/类
/**
 * Check whether the provided source has at least a gray pixel.
 *
 * @param source the source to inspect
 * @return true if at least one pixel is neither black nor white
 */
private boolean hasGray (ByteProcessor source)
{
    for (int i = source.getPixelCount() - 1; i >= 0; i--) {
        int val = source.get(i);

        if ((val != 0) && (val != 255)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:19,代码来源:BinaryStep.java


注:本文中的ij.process.ByteProcessor.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。