本文整理汇总了Java中boofcv.struct.image.ImageFloat32类的典型用法代码示例。如果您正苦于以下问题:Java ImageFloat32类的具体用法?Java ImageFloat32怎么用?Java ImageFloat32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageFloat32类属于boofcv.struct.image包,在下文中一共展示了ImageFloat32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
super.init(config);
File file = new File(GR.getGoldenDir(), goldenFileName);
try {
rnd = new Random(repeats);
InputStream inImageStream = MTTestResourceManager.openFileAsInputStream(file.getPath());
ImageUInt8 inImage = UtilImageIO.loadPGM_U8(inImageStream, (ImageUInt8) null);
ImageFloat32 convImage = ConvertImage.convert(inImage,
(ImageFloat32) null);
levels = 4;
denoiser = FactoryImageDenoise.waveletBayes(ImageFloat32.class,
levels, 0, 255);
noisy = convImage.clone();
denoisy = convImage.clone();
} catch (IOException e) {
throw new GoldenFileNotFoundException(file, this.getClass());
}
}
示例2: init
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
super.init(config);
File file = new File(GR.getGoldenDir(), goldenFileName);
try {
rnd = new Random(repeats);
InputStream inImageStream = MTTestResourceManager.openFileAsInputStream(file.getPath());
ImageUInt8 inImage = UtilImageIO.loadPGM_U8(inImageStream, (ImageUInt8) null);
ImageFloat32 convImage = ConvertImage.convert(inImage, (ImageFloat32) null);
levels = 4;
denoiser = FactoryImageDenoise.waveletSure(ImageFloat32.class, levels, 0, 255);
noisy = convImage.clone();
denoisy = convImage.clone();
} catch (IOException e) {
throw new GoldenFileNotFoundException(file, this.getClass());
}
}
示例3: init
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
super.init(config);
File file = new File(GR.getGoldenDir(), goldenFileName);
try {
InputStream inImageStream = MTTestResourceManager.openFileAsInputStream(file.getPath());
ImageUInt8 inImage = UtilImageIO.loadPGM_U8(inImageStream, (ImageUInt8) null);
image = ConvertImage.convert(inImage, (ImageFloat32) null);
ImageUInt8 bin = new ImageUInt8(image.width, image.height);
double mean = ImageStatistics.mean(image);
ThresholdImageOps.threshold(image, bin, (float) mean, true);
filtered = BinaryImageOps.erode8(bin, 1, null);
filtered = BinaryImageOps.dilate8(filtered, 1, null);
} catch (IOException e) {
throw new GoldenFileNotFoundException(file, this.getClass());
}
}
示例4: init
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
super.init(config);
File file = new File(GR.getGoldenDir(), goldenFileName);
try {
rnd = new Random(repeats);
InputStream inImageStream = MTTestResourceManager.openFileAsInputStream(file.getPath());
ImageUInt8 inImage = UtilImageIO.loadPGM_U8(inImageStream, (ImageUInt8) null);
ImageFloat32 convImage = ConvertImage.convert(inImage,
(ImageFloat32) null);
levels = 4;
denoiser = FactoryImageDenoise.waveletVisu(ImageFloat32.class,
levels, 0, 255);
noisy = convImage.clone();
denoisy = convImage.clone();
} catch (IOException e) {
throw new GoldenFileNotFoundException(file, this.getClass());
}
}
示例5: ParticleFlowTracker
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
public ParticleFlowTracker(IParticleConstructorDestructor<ParticleType> particleConstructorDestructor, Vector2d<Integer> imageSize, int imageDownscaleFactor, Mutex particleMutex) {
this.particleConstructorDestructor = particleConstructorDestructor;
this.imageDownscaleFactor = imageDownscaleFactor;
this.imageSize = imageSize;
this.particleMutex = particleMutex;
denseFlow =
// FactoryDenseOpticalFlow.flowKlt(null, 6, ImageFloat32.class, null);
// FactoryDenseOpticalFlow.region(null,ImageFloat32.class);
// FactoryDenseOpticalFlow.hornSchunck(20, 1000, ImageFloat32.class);
// FactoryDenseOpticalFlow.hornSchunckPyramid(null,ImageFloat32.class);
FactoryDenseOpticalFlow.broxWarping(null, ImageFloat32.class);
// scaled down because the flow is computational expensive
previous = new ImageFloat32(imageSize.x/imageDownscaleFactor, imageSize.y/imageDownscaleFactor);
current = new ImageFloat32(imageSize.x/imageDownscaleFactor, imageSize.y/imageDownscaleFactor);
flow = new ImageFlow(previous.width, previous.height);
final int spatialAccelerationCellsX = 500;
final int spatialAccelerationCellsY = 300;
trackingParticleAcceleration = new SpatialAcceleration<>(spatialAccelerationCellsX, spatialAccelerationCellsY, (float)imageSize.x, (float)imageSize.y );
setupSamplePositions();
}
示例6: main
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
public static void main(String args[]) {
imgInt8 = new ImageUInt8(imgWidth, imgHeight);
imgFloat32 = new ImageFloat32(imgWidth, imgHeight);
Random rand = new Random(234);
ImageMiscOps.fillUniform(imgInt8, rand, 0, 100);
ImageMiscOps.fillUniform(imgFloat32, rand, 0, 200);
System.out.println("========= Profile Image Size " + imgWidth + " x " + imgHeight + " ==========");
System.out.println();
ProfileOperation.printOpsPerSec(new Bilinear_Safe_F32(), TEST_TIME);
ProfileOperation.printOpsPerSec(new Bilinear_UnSafe_F32(), TEST_TIME);
ProfileOperation.printOpsPerSec(new NearestNeighbor_Safe_F32(), TEST_TIME);
ProfileOperation.printOpsPerSec(new BilinearConvolution_Safe_F32(), TEST_TIME);
ProfileOperation.printOpsPerSec(new Polynomial_Safe_F32(), TEST_TIME);
}
示例7: nv21ToMultiYuv_F32
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
public static void nv21ToMultiYuv_F32(byte[] dataNV, int yStride, int uvStride, MultiSpectral<ImageFloat32> output) {
ImageFloat32 Y = output.getBand(0);
ImageFloat32 U = output.getBand(1);
ImageFloat32 V = output.getBand(2);
nv21ToGray(dataNV, yStride, Y);
int startUV = yStride*output.height;
for( int row = 0; row < output.height; row++ ) {
int indexUV = startUV + (row/2)*(2*uvStride);
int indexOut = output.startIndex + row*output.stride;
for( int col = 0; col < output.width; col++ , indexOut++ ) {
U.data[indexOut] = (dataNV[ indexUV ]&0xFF)-128;
V.data[indexOut] = (dataNV[ indexUV + 1 ]&0xFF)-128;
indexUV += 2*(col&0x1);
}
}
}
示例8: various
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Several basic functionality tests
*/
public void various() {
Helper detector = new Helper();
detector.maximum = true;
GeneralToInterestPoint<ImageFloat32,ImageFloat32> alg =
new GeneralToInterestPoint<ImageFloat32,ImageFloat32>(detector,2.5, ImageFloat32.class,ImageFloat32.class);
alg.detect(input);
assertEquals(6,alg.getNumberOfFeatures());
for( int i = 0; i < alg.getNumberOfFeatures(); i++) {
assertEquals(2.5, alg.getScale(i),1e-8);
assertEquals(0, alg.getOrientation(i),1e-8);
}
assertEquals(1, detector.calledProcess);
assertEquals(6, detector.getMaximums().size);
}
示例9: discretizeDirection4
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Test
public void discretizeDirection4() {
ImageFloat32 angle = new ImageFloat32(5,5);
angle.set(0,0,(float)(3*Math.PI/8+0.01));
angle.set(1,0,(float)(3*Math.PI/8-0.01));
angle.set(2,0,(float)(Math.PI/4));
angle.set(3,0,(float)(Math.PI/8+0.01));
angle.set(4,0,(float)(Math.PI/8-0.01));
angle.set(0,1,(float)(-3*Math.PI/8+0.01));
angle.set(1,1,(float)(-3*Math.PI/8-0.01));
ImageSInt8 d = new ImageSInt8(5,5);
GradientToEdgeFeatures.discretizeDirection4(angle,d);
assertEquals(2,d.get(0,0));
assertEquals(1,d.get(1,0));
assertEquals(1,d.get(2,0));
assertEquals(1,d.get(3,0));
assertEquals(0,d.get(4,0));
assertEquals(-1,d.get(0,1));
assertEquals(2,d.get(1,1));
}
示例10: setActiveAlgorithm
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Override
public void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
if( workImage == null )
return;
GeneralFeatureIntensity<T,D> intensity = (GeneralFeatureIntensity<T,D>)cookie;
deriv.setInput(workImage);
D derivX = deriv.getDerivative(true);
D derivY = deriv.getDerivative(false);
D derivXX = deriv.getDerivative(true,true);
D derivYY = deriv.getDerivative(false,false);
D derivXY = deriv.getDerivative(true,false);
intensity.process(workImage,derivX,derivY,derivXX,derivYY,derivXY);
ImageFloat32 featureImg = intensity.getIntensity();
VisualizeImageData.colorizeSign(featureImg,temp, ImageStatistics.maxAbs(featureImg));
gui.setBufferedImage(temp);
gui.repaint();
gui.requestFocusInWindow();
}
示例11: subbandAbsVal
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Computes the absolute value of each element in the subband image are places it into
* 'coef'
*/
public static float[] subbandAbsVal(ImageFloat32 subband, float[] coef ) {
if( coef == null ) {
coef = new float[subband.width*subband.height];
}
int i = 0;
for( int y = 0; y < subband.height; y++ ) {
int index = subband.startIndex + subband.stride*y;
int end = index + subband.width;
for( ;index < end; index++ ) {
coef[i++] = Math.abs(subband.data[index]);
}
}
return coef;
}
示例12: process
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Performs hysteresis thresholding using the provided lower and upper thresholds.
*
* @param intensity Intensity image after edge non-maximum suppression has been applied. Modified.
* @param direction 4-direction image. Not modified.
* @param lower Lower threshold.
* @param upper Upper threshold.
*/
public void process( ImageFloat32 intensity , ImageSInt8 direction , float lower , float upper ) {
InputSanityCheck.checkSameShape(intensity, direction);
// set up internal data structures
this.intensity = intensity;
this.direction = direction;
this.lower = lower;
queuePoints.reset();
contours.clear();
// step through each pixel in the image
for( int y = 0; y < intensity.height; y++ ) {
int indexInten = intensity.startIndex + y*intensity.stride;
for( int x = 0; x < intensity.width; x++ , indexInten++ ) {
// start a search if a pixel is found that's above the threshold
if( intensity.data[indexInten] >= upper ) {
trace( x,y,indexInten);
}
}
}
}
示例13: main
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
public static void main( String args[] ) {
VisualizePyramidDiscreteApp<ImageFloat32> app = new VisualizePyramidDiscreteApp<ImageFloat32>(ImageFloat32.class);
List<PathLabel> inputs = new ArrayList<PathLabel>();
inputs.add(new PathLabel("lena","../data/evaluation/standard/lena512.bmp"));
inputs.add(new PathLabel("boat","../data/evaluation/standard/boat.png"));
inputs.add(new PathLabel("fingerprint","../data/evaluation/standard/fingerprint.png"));
app.setInputList(inputs);
// wait for it to process one image so that the size isn't all screwed up
while( !app.getHasProcessedImage() ) {
Thread.yield();
}
ShowImages.showWindow(app,"Image Discrete Pyramid");
}
示例14: undoRadialDistortion
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
private void undoRadialDistortion(BufferedImage image) {
ConvertBufferedImage.convertFromMulti(image, origMS, ImageFloat32.class);
for( int i = 0; i < origMS.getNumBands(); i++ ) {
ImageFloat32 in = origMS.getBand(i);
ImageFloat32 out = correctedMS.getBand(i);
undoRadial.apply(in,out);
}
if( correctedMS.getNumBands() == 3 )
ConvertBufferedImage.convertTo(correctedMS,undistorted);
else if( correctedMS.getNumBands() == 1 )
ConvertBufferedImage.convertTo(correctedMS.getBand(0),undistorted);
else
throw new RuntimeException("What kind of image has "+correctedMS.getNumBands()+"???");
}
示例15: direction
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
static public void direction( ImageSInt16 derivX , ImageSInt16 derivY , ImageFloat32 angle )
{
final int w = derivX.width;
final int h = derivY.height;
for( int y = 0; y < h; y++ ) {
int indexX = derivX.startIndex + y*derivX.stride;
int indexY = derivY.startIndex + y*derivY.stride;
int indexA = angle.startIndex + y*angle.stride;
int end = indexX + w;
for( ; indexX < end; indexX++ , indexY++ , indexA++ ) {
int dx = derivX.data[indexX];
int dy = derivY.data[indexY];
// compute the angle while avoiding divided by zero errors
angle.data[indexA] = dx == 0 ? (float)(Math.PI/2.0) : (float)Math.atan((double)dy/(double)dx);
}
}
}