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


Java FImage.getRows方法代码示例

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


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

示例1: process

import org.openimaj.image.FImage; //导入方法依赖的package包/类
private void process(FImage image) {
	final int cs = image.getCols();
	final int rs = image.getRows();

	phase = new FImage(cs, rs);
	magnitude = new FImage(cs, rs);

	final FloatFFT_2D fft = new FloatFFT_2D(rs, cs);
	final float[][] prepared = prepareData(image.pixels, rs, cs, centre);

	fft.complexForward(prepared);

	for (int y = 0; y < rs; y++) {
		for (int x = 0; x < cs; x++) {
			final float re = prepared[y][x * 2];
			final float im = prepared[y][1 + x * 2];

			phase.pixels[y][x] = (float) Math.atan2(im, re);
			magnitude.pixels[y][x] = (float) Math.sqrt(re * re + im * im);
		}
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:23,代码来源:FourierTransform.java

示例2: process

import org.openimaj.image.FImage; //导入方法依赖的package包/类
private void process(FImage image) {
	final int cs = image.getCols();
	final int rs = image.getRows();

	real = new FImage(cs, rs);
	imaginary = new FImage(cs, rs);

	final FloatFFT_2D fft = new FloatFFT_2D(rs, cs);
	final float[][] prepared = FourierTransform.prepareData(image.pixels, rs, cs, centre);

	fft.complexForward(prepared);

	for (int y = 0; y < rs; y++) {
		for (int x = 0; x < cs; x++) {
			real.pixels[y][x] = prepared[y][x * 2];
			imaginary.pixels[y][x] = prepared[y][1 + x * 2];
		}
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:FourierTransformComplex.java

示例3: convolvePrepared

import org.openimaj.image.FImage; //导入方法依赖的package包/类
/**
 * Convolve an image with a pre-prepared frequency domain filter. The filter
 * must have the same height as the image and twice the width (to account
 * for the imaginary components). Real and imaginary components should be
 * interlaced across the rows.
 * 
 * @param image
 *            The image to convolve
 * @param filter
 *            the prepared frequency domain filter
 * @param centered
 *            true if the prepared filter has the highest frequency in the
 *            centre.
 * @return convolved image
 */
public static FImage convolvePrepared(FImage image, FImage filter, boolean centered) {
	final int cols = image.getCols();
	final int rows = image.getRows();

	final FloatFFT_2D fft = new FloatFFT_2D(rows, cols);

	final float[][] preparedImage =
			FourierTransform.prepareData(image.pixels, rows, cols, centered);
	fft.complexForward(preparedImage);

	final float[][] preparedKernel = filter.pixels;

	for (int y = 0; y < rows; y++) {
		for (int x = 0; x < cols; x++) {
			final float reImage = preparedImage[y][x * 2];
			final float imImage = preparedImage[y][1 + x * 2];

			final float reKernel = preparedKernel[y][x * 2];
			final float imKernel = preparedKernel[y][1 + x * 2];

			final float re = reImage * reKernel - imImage * imKernel;
			final float im = reImage * imKernel + imImage * reKernel;

			preparedImage[y][x * 2] = re;
			preparedImage[y][1 + x * 2] = im;
		}
	}

	fft.complexInverse(preparedImage, true);

	final FImage out = new FImage(cols, rows);
	FourierTransform.unprepareData(preparedImage, out, centered);
	return out;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:50,代码来源:FourierConvolve.java

示例4: analyseImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void analyseImage(FImage in) {
	responses = new FImage[filters.length];

	final FImage image = in.padding(paddingX, paddingY);
	final int cols = image.getCols();
	final int rows = image.getRows();

	if (fft == null || preparedFilters == null || preparedFilters[0].length != rows
			|| preparedFilters[0][0].length != 2 * cols)
	{
		fft = new FloatFFT_2D(rows, cols);
		preparedFilters = new float[filters.length][][];
		tmpImage = new float[rows][cols * 2];

		for (int i = 0; i < preparedFilters.length; i++) {
			final float[][] preparedKernel = FourierTransform.prepareData(filters[i].kernel, rows, cols, false);
			fft.complexForward(preparedKernel);
			preparedFilters[i] = preparedKernel;
		}
	}

	final float[][] preparedImage = FourierTransform.prepareData(image.pixels, rows, cols, false);
	fft.complexForward(preparedImage);

	for (int i = 0; i < preparedFilters.length; i++) {
		responses[i] = convolve(cols, rows, preparedImage, preparedFilters[i]);
		responses[i] = responses[i].extractROI(2 * paddingX, 2 * paddingY,
				responses[i].width - 2 * paddingX,
				responses[i].height - 2 * paddingY);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:FilterBank.java

示例5: processImage

import org.openimaj.image.FImage; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	int cs = image.getCols();
	int rs = image.getRows();
	FloatFFT_2D fft = new FloatFFT_2D(rs,cs);
	float[][] prepared = new float[rs][cs*2];
	for(int r = 0; r < rs ; r++){
		for(int c = 0; c < cs; c++){
			prepared[r][c*2] = image.pixels[r][c];
			prepared[r][1 + c*2] = 0;
		}
	}
	fft.complexForward(prepared);
	for(int y = 0; y < rs; y++){
		for(int x = 0; x < cs; x++){
			double xcos = Math.cos(2 * Math.PI * ((float)x/cs));
			double ycos = Math.cos(2 * Math.PI * ((float)y/rs));
			float multiply = (float) Math.exp(sigma2 * (xcos + ycos - 2));
			prepared[y][x*2] = prepared[y][x*2] * multiply;
			prepared[y][1 + x*2] = prepared[y][1 + x*2] * multiply;
		}
	}
	fft.complexInverse(prepared, true);
	for(int r = 0; r < rs ; r++){
		for(int c = 0; c < cs; c++){
			image.pixels[r][c] = prepared[r][c*2];
		}
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:FDiscGausConvolve.java


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