本文整理汇总了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);
}
}
}
示例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];
}
}
}
示例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;
}
示例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);
}
}
示例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];
}
}
}