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


Java FImage.internalAssign方法代码示例

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


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

示例1: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final float[] tmp = new float[support.size()];
	final FImage tmpImage = new FImage(image.width, image.height);

	for (int y = 0; y < image.height; y++) {
		for (int x = 0; x < image.width; x++) {
			int count = 0;

			for (final Pixel sp : support) {
				final int xx = x + sp.x;
				final int yy = y + sp.y;

				if (xx >= 0 && xx < image.width - 1 && yy >= 0 && yy < image.height - 1) {
					tmp[count++] = image.pixels[yy][xx];
				}
			}

			tmpImage.pixels[y][x] = FloatArrayStatsUtils.median(tmp, 0, count);
		}
	}
	image.internalAssign(tmpImage);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:MedianFilter.java

示例2: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final FImage tmpImage = new FImage(image.width, image.height);
	float min;
	float max;

	for (int y = 0; y < image.height; y++) {
		for (int x = 0; x < image.width; x++) {
			min = Float.MAX_VALUE;
			max = -Float.MAX_VALUE;
			for (final Pixel sp : support) {
				final int xx = x + sp.x;
				final int yy = y + sp.y;

				if (xx >= 0 && xx < image.width - 1 && yy >= 0 && yy < image.height - 1) {
					min = Math.min(min, image.pixels[yy][xx]);
					max = Math.max(max, image.pixels[yy][xx]);
				}
			}

			tmpImage.pixels[y][x] = max - min;
		}
	}
	image.internalAssign(tmpImage);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:LocalContrastFilter.java

示例3: convolve

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void convolve(FImage image) {
	final int kh = kernel.height;
	final int kw = kernel.width;
	final int hh = kh / 2;
	final int hw = kw / 2;
	final FImage clone = image.newInstance(image.width, image.height);
	for (int y = hh; y < image.height - (kh - hh); y++) {
		for (int x = hw; x < image.width - (kw - hw); x++) {
			float sum = 0;
			for (int j = 0, jj = kh - 1; j < kh; j++, jj--) {
				for (int i = 0, ii = kw - 1; i < kw; i++, ii--) {
					final int rx = x + i - hw;
					final int ry = y + j - hh;

					sum += image.pixels[ry][rx] * kernel.pixels[jj][ii];
				}
			}
			clone.pixels[y][x] = sum;
		}
	}
	image.internalAssign(clone);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:FConvolution.java

示例4: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	FImage newimage = image.newInstance(width, height);
	
	for (int y=0; y<height; y++)
		for (int x=0; x<width; x++)
			newimage.pixels[y][x] = image.getPixelInterp(x*scale, y*scale);
	
	image.internalAssign(newimage);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:11,代码来源:BilinearInterpolation.java

示例5: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final FImage newimage = image.newInstance(width, height);

	final float[][] working = new float[4][4];

	for (int y = 0; y < height; y++)
		for (int x = 0; x < width; x++)
			newimage.pixels[y][x] = ImageInterpolation.InterpolationType.BICUBIC.interpolate(x * scale, y * scale,
					image, working);

	image.internalAssign(newimage);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:14,代码来源:BicubicInterpolation.java

示例6: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final FImage tmp = image.process(new FGaussianConvolve(sigma));

	final float[][] tpix = tmp.pixels;
	final float[][] ipix = image.pixels;
	for (int y = 0; y < image.height; y++)
		for (int x = 0; x < image.width; x++)
			tpix[y][x] = ipix[y][x] < (tpix[y][x] - offset) ? 0f : 1f;

	image.internalAssign(tmp);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:13,代码来源:AdaptiveLocalThresholdGaussian.java

示例7: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final FImage tmp = image.process(new AverageBoxFilter(sizeX, sizeY));

	final float[][] tpix = tmp.pixels;
	final float[][] ipix = image.pixels;
	for (int y = 0; y < image.height; y++)
		for (int x = 0; x < image.width; x++)
			tpix[y][x] = ipix[y][x] < (tpix[y][x] - offset) ? 0f : 1f;

	image.internalAssign(tmp);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:13,代码来源:AdaptiveLocalThresholdMean.java

示例8: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final FImage tmp = image.process(new MedianFilter(FilterSupport.createBlockSupport(sizeX, sizeY)));

	final float[][] tpix = tmp.pixels;
	final float[][] ipix = image.pixels;
	for (int y = 0; y < image.height; y++)
		for (int x = 0; x < image.width; x++)
			tpix[y][x] = ipix[y][x] < (tpix[y][x] - offset) ? 0f : 1f;

	image.internalAssign(tmp);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:13,代码来源:AdaptiveLocalThresholdMedian.java

示例9: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	if (blockWidth >= 1 && blockHeight >= 1) {
		maxHorizontalSym(image, blockWidth);
		maxVerticalSym(image, blockWidth);
	} else {
		final FImage tmpImage = new FImage(image.width, image.height);

		for (int y = 0; y < image.height; y++) {
			for (int x = 0; x < image.width; x++) {
				float max = -Float.MAX_VALUE;

				for (final Pixel sp : support) {
					final int xx = x + sp.x;
					final int yy = y + sp.y;

					if (xx >= 0 && xx < image.width - 1 && yy >= 0 && yy < image.height - 1) {
						max = Math.max(max, image.pixels[yy][xx]);
					}
				}

				tmpImage.pixels[y][x] = max;
			}
		}
		image.internalAssign(tmpImage);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:MaxFilter.java

示例10: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	if (blockWidth >= 1 && blockHeight >= 1) {
		minHorizontalSym(image, blockWidth);
		minVerticalSym(image, blockWidth);
	} else {
		final FImage tmpImage = new FImage(image.width, image.height);

		for (int y = 0; y < image.height; y++) {
			for (int x = 0; x < image.width; x++) {
				float min = Float.MAX_VALUE;

				for (final Pixel sp : support) {
					final int xx = x + sp.x;
					final int yy = y + sp.y;

					if (xx >= 0 && xx < image.width && yy >= 0 && yy < image.height) {
						min = Math.min(min, image.pixels[yy][xx]);
					}
				}

				tmpImage.pixels[y][x] = min;
			}
		}
		image.internalAssign(tmpImage);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:MinFilter.java

示例11: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	FImage blur1 = image.process(filter1);
	FImage blur2 = image.process(filter2);
	
	image.internalAssign(blur1.subtractInplace(blur2));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:8,代码来源:DifferenceOfGaussian.java

示例12: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.openimaj.image.processor.ImageProcessor#processImage(org.openimaj.image.Image)
 */
@Override
public void processImage(FImage image)
{
	// Find which regions might be text
	final FImage fmap = textRegionDetection(image);

	// Process the feature map
	processFeatureMap(fmap, image);

	// The output process image is the feature map
	image.internalAssign(fmap);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:LiuSamarabanduTextExtractorBasic.java

示例13: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final SummedAreaTable sat = new SummedAreaTable(image);
	final FImage output = new FImage(image.width, image.height);

	for (int vote = 0; vote < maxVotes; vote++) {
		// First step
		int widthR = (int) Math.pow(2, rng.nextIntFromTo(rangeMin, rangeMax));
		int heightR = (int) Math.pow(2, rng.nextIntFromTo(rangeMin, rangeMax));
		int xR = rng.nextIntFromTo(0, image.width - widthR);
		int yR = rng.nextIntFromTo(0, image.height - heightR);

		// Second step
		while (widthR > 2 && heightR > 2) {
			final int hw = widthR / 2;
			final int hh = heightR / 2;

			final float[] r = {
					sat.calculateArea(xR, yR, xR + hw, yR + hh),
					sat.calculateArea(xR + hw, yR, xR + widthR, yR + hh),
					sat.calculateArea(xR, yR + hh, xR + hw, yR + heightR),
					sat.calculateArea(xR + hw, yR + hh, xR + widthR, yR + heightR),
			};

			final int[] f = ArrayUtils.indexSort(r);
			if (r[f[3]] == r[f[2]])
				break;

			final int maxIdx = ArrayUtils.maxIndex(r);

			widthR = hw;
			heightR = hh;
			if (maxIdx == 1) {
				xR = xR + hw;
			} else if (maxIdx == 2) {
				yR = yR + hh;
			} else if (maxIdx == 3) {
				xR = xR + hw;
				yR = yR + hh;
			}
		}

		// Third step
		final int xLoc = Math.round(xR + widthR / 2);
		final int yLoc = Math.round(yR + heightR / 2);
		output.pixels[yLoc][xLoc]++;
	}

	output.processInplace(new FGaussianConvolve(sigma));
	image.internalAssign(output.normalise());
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:52,代码来源:BrightnessClusteringTransform.java

示例14: internalDoubleSize

import org.openimaj.image.FImage; //导入方法依赖的package包/类
protected static void internalDoubleSize(FImage image) {
	image.internalAssign(doubleSize(image));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:4,代码来源:ResizeProcessor.java

示例15: internalHalfSize

import org.openimaj.image.FImage; //导入方法依赖的package包/类
protected static void internalHalfSize(FImage image) {
	image.internalAssign(halfSize(image));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:4,代码来源:ResizeProcessor.java


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