本文整理汇总了Java中boofcv.struct.image.ImageFloat32类的典型用法代码示例。如果您正苦于以下问题:Java ImageFloat32类的具体用法?Java ImageFloat32怎么用?Java ImageFloat32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageFloat32类属于boofcv.struct.image包,在下文中一共展示了ImageFloat32类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
}
开发者ID:android-workloads,项目名称:JACWfA,代码行数:20,代码来源:DenoiseBayes.java
示例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());
}
}
开发者ID:android-workloads,项目名称:JACWfA,代码行数:18,代码来源:DenoiseSure.java
示例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());
}
}
开发者ID:android-workloads,项目名称:JACWfA,代码行数:19,代码来源:FitEllipse.java
示例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());
}
}
开发者ID:android-workloads,项目名称:JACWfA,代码行数:21,代码来源:DenoiseVisu.java
示例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();
}
开发者ID:PtrMan,项目名称:symVision,代码行数:27,代码来源:ParticleFlowTracker.java
示例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);
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:18,代码来源:BenchmarkInterpolatePixel.java
示例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);
}
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:23,代码来源:ImplConvertNV21.java
示例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);
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:21,代码来源:TestGeneralToInterestPoint.java
示例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));
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:24,代码来源:TestGradientToEdgeFeatures.java
示例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();
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:24,代码来源:IntensityPointFeatureApp.java
示例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;
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:21,代码来源:UtilDenoiseWavelet.java
示例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);
}
}
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:31,代码来源:HysteresisEdgeTracePoints.java
示例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");
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:18,代码来源:VisualizePyramidDiscreteApp.java
示例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()+"???");
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:17,代码来源:CalibratedImageGridPanel.java
示例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);
}
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:21,代码来源:ImplGradientToEdgeFeatures.java
示例16: drawRectangles
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Helper function will is finds matches and displays the results as colored rectangles
*/
private static void drawRectangles(Graphics2D g2,
ImageFloat32 image, ImageFloat32 template,
int expectedMatches) {
List<Match> found = findMatches(image, template, expectedMatches);
int r = 2;
int w = template.width + 2 * r;
int h = template.height + 2 * r;
g2.setStroke(new BasicStroke(3));
for (Match m : found) {
// the return point is the template's top left corner
int x0 = m.x - r;
int y0 = m.y - r;
int x1 = x0 + w;
int y1 = y0 + h;
g2.drawLine(x0, y0, x1, y0);
g2.drawLine(x1, y0, x1, y1);
g2.drawLine(x1, y1, x0, y1);
g2.drawLine(x0, y1, x0, y0);
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:27,代码来源:ExampleTemplateMatching.java
示例17: basicTest
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Basis tests to see if it computes the expected pyramid
*/
@Test
public void basicTest() {
ImageFloat32 input = new ImageFloat32(40,80);
ImageMiscOps.fillUniform(input, rand, -20, 50);
PyramidDiscreteAverage<ImageFloat32> alg = new PyramidDiscreteAverage<ImageFloat32>(ImageFloat32.class,true,1,2,4);
alg.process(input);
// request was made use a reference to the input image
assertTrue(input == alg.getLayer(0));
float expected = (input.get(0,0) + input.get(0,1) + input.get(1,0) + input.get(1,1))/4;
assertEquals(expected,alg.getLayer(1).get(0,0),1e-4);
ImageFloat32 layer = alg.getLayer(1);
expected = (layer.get(0,0) + layer.get(0,1) + layer.get(1,0) + layer.get(1,1))/4;
assertEquals(expected,alg.getLayer(2).get(0,0),1e-4);
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:23,代码来源:TestPyramidDiscreteAverage.java
示例18: scaleSanityCheck
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
@Test
public void scaleSanityCheck() {
ImageFloat32 input = new ImageFloat32(width,height);
ImageFloat32 output = new ImageFloat32(width/2,height/2);
GImageMiscOps.fillUniform(input, rand, 0, 100);
DistortImageOps.scale(input, output, TypeInterpolate.BILINEAR);
double error = 0;
for( int y = 0; y < output.height; y++ ) {
for( int x = 0; x < output.width; x++ ) {
double e = input.get(x*2,y*2)-output.get(x,y);
error += Math.abs(e);
}
}
assertTrue(error / (output.width * output.height) < 0.1);
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:TestDistortImageOps.java
示例19: process_F32_naive
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* See if the same results are returned by ImageByte2D equivalent
*/
@Test
public void process_F32_naive() {
for( int offY = 0; offY < 3; offY++ ) {
for( int offX = 0; offX < 3; offX++ ) {
int w = width+offX; int h = height+offY;
ImageFloat32 img = new ImageFloat32(w, h);
ImageMiscOps.fillUniform(img, rand, 0f, 255f);
ImageFloat32 derivX = new ImageFloat32(w, h);
ImageFloat32 derivY = new ImageFloat32(w, h);
ImageFloat32 derivX2 = new ImageFloat32(w, h);
ImageFloat32 derivY2 = new ImageFloat32(w, h);
GradientSobel_Naive.process(img, derivX2, derivY2);
GradientSobel_Outer.process_F32(img, derivX, derivY);
BoofTesting.assertEquals(derivX2, derivX, 1e-4f);
BoofTesting.assertEquals(derivY2, derivY, 1e-4f);
}
}
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:26,代码来源:TestGradientSobel_Outer.java
示例20: refineSubpixel
import boofcv.struct.image.ImageFloat32; //导入依赖的package包/类
/**
* Computes a feature location to sub-pixel accuracy by fitting a 2D quadratic polynomial
* to corner intensities.
* <p/>
* Through experimentation the mean instead of a quadratic fit was found to produce a better
* result. Most papers seem to recommend using the quadratic.
*
* @param pt Point in image coordinates
* @param x0 intensity image x offset
* @param y0 intensity image y offset
* @param intensity Intensity image
* @return Sub-pixel point location
*/
private Point2D_F64 refineSubpixel(Point2D_F64 pt,
int x0, int y0,
ImageFloat32 intensity) {
int r = radius + 3;
ImageRectangle area = new ImageRectangle((int) (pt.x - r - x0), (int) (pt.y - r - y0),
(int) (pt.x + r - x0 + 1), (int) (pt.y + r + 1 - y0));
BoofMiscOps.boundRectangleInside(intensity, area);
// sample feature intensity values in the local region
float meanX = 0, meanY = 0, sum = 0;
for (int i = area.y0; i < area.y1; i++) {
for (int j = area.x0; j < area.x1; j++) {
float value = intensity.get(j, i);
meanX += j * value;
meanY += i * value;
sum += value;
}
}
meanX /= sum;
meanY /= sum;
return new Point2D_F64(x0 + meanX, y0 + meanY);
}
开发者ID:intrack,项目名称:BoofCV-master,代码行数:38,代码来源:DetectChessCalibrationPoints.java
注:本文中的boofcv.struct.image.ImageFloat32类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论