本文整理汇总了Java中boofcv.struct.image.ImageFloat32.unsafe_get方法的典型用法代码示例。如果您正苦于以下问题:Java ImageFloat32.unsafe_get方法的具体用法?Java ImageFloat32.unsafe_get怎么用?Java ImageFloat32.unsafe_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boofcv.struct.image.ImageFloat32
的用法示例。
在下文中一共展示了ImageFloat32.unsafe_get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectEdgels
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
protected void detectEdgels( int index0 , int x0 , int y0 ,
ImageFloat32 derivX , ImageFloat32 derivY ,
ImageUInt8 binaryEdges) {
edgels.reset();
for( int y = 0; y < regionSize; y++ ) {
int index = index0 + y*binaryEdges.stride;
for( int x = 0; x < regionSize; x++ ) {
if( binaryEdges.data[index++] != 0 ) {
Edgel e = edgels.grow();
int xx = x0+x;
int yy = y0+y;
e.set(xx,yy);
float dx = derivX.unsafe_get(xx,yy);
float dy = derivY.unsafe_get(xx,yy);
e.theta = UtilAngle.atanSafe(dy, dx);
}
}
}
}
示例2: upSample
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Up-samples the input image. Doubling its size.
*/
protected static void upSample( ImageFloat32 from , ImageFloat32 to ) {
for( int y = 0; y < from.height; y++ ) {
int yy = y*2;
int xx = 0;
for( int x = 0; x < from.width; x++ ) {
float v = from.unsafe_get(x,y);
to.unsafe_set(xx, yy, v);
to.unsafe_set(xx,yy+1,v);
xx++;
to.unsafe_set(xx,yy,v);
to.unsafe_set(xx,yy+1,v);
xx++;
}
}
}
示例3: addPoint
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Adds the detected feature to the list. Interpolates the feature's location in the image and scale
* using 2nd order polynomial instead. This is a change from the paper.
*/
private void addPoint(ImageFloat32 scale0 , ImageFloat32 scale1, ImageFloat32 scale2,
short x, short y, float value, float signAdj, boolean white ) {
value *= signAdj;
float x0 = scale1.unsafe_get(x - 1, y)*signAdj;
float x2 = scale1.unsafe_get(x + 1, y)*signAdj;
float y0 = scale1.unsafe_get(x , y - 1)*signAdj;
float y2 = scale1.unsafe_get(x , y + 1)*signAdj;
float s0 = scale0.unsafe_get(x , y )*signAdj;
float s2 = scale2.unsafe_get(x , y )*signAdj;
ScalePoint p = foundPoints.grow();
// when the image is down sampled it is sampled at pixel + 1
p.x = currentPixelScale*(x + polyPeak(x0, value, x2)) + octavePixelOffset;
p.y = currentPixelScale*(y + polyPeak(y0, value, y2)) + octavePixelOffset;
p.scale = currentSigma + currentPixelScale*ss.sigma*polyPeak(s0, value, s2);
p.white = white;
}
示例4: isScaleSpaceMax
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* See if the point is a local maximum in scale-space above and below.
*
* @param c_x x-coordinate of maximum
* @param c_y y-coordinate of maximum
* @param value The maximum value it is checking
* @param signAdj Adjust the sign so that it can check for maximums
* @return
*/
private boolean isScaleSpaceMax( ImageFloat32 scale0 , ImageFloat32 scale2,
int c_x , int c_y , float value , float signAdj ) {
float v;
value *= signAdj;
for( int y = -1; y <= 1; y++ ) {
for( int x = -1; x <= 1; x++ ) {
v = scale0.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
v = scale2.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
}
}
return true;
}
示例5: showSelectedColor
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Selectively displays only pixels which have a similar hue and saturation values to what is provided.
* This is intended to be a simple example of color based segmentation. Color based segmentation can be done
* in RGB color, but is more problematic. More robust techniques can use Gaussian
* models.
*/
public static void showSelectedColor( String name , BufferedImage image , float hue , float saturation ) {
MultiSpectral<ImageFloat32> input = ConvertBufferedImage.convertFromMulti(image,null,ImageFloat32.class);
MultiSpectral<ImageFloat32> hsv = new MultiSpectral<ImageFloat32>(ImageFloat32.class,input.width,input.height,3);
// Ensure the the bands are in RGB order
ConvertBufferedImage.orderBandsIntoRGB(input,image);
// Convert into HSV
ColorHsv.rgbToHsv_F32(input,hsv);
// Pixels which are more than this different from the selected color are set to black
float maxDist2 = 0.4f*0.4f;
// Extract hue and saturation bands which are independent of intensity
ImageFloat32 H = hsv.getBand(0);
ImageFloat32 S = hsv.getBand(1);
// Adjust the relative importance of Hue and Saturation
float adjustUnits = (float)(Math.PI/2.0);
// step through each pixel and mark how close it is to the selected color
BufferedImage output = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
for( int y = 0; y < hsv.height; y++ ) {
for( int x = 0; x < hsv.width; x++ ) {
// remember Hue is an angle in radians, so simple subtraction doesn't work
float dh = UtilAngle.dist(H.unsafe_get(x,y),hue);
float ds = (S.unsafe_get(x,y)-saturation)*adjustUnits;
// this distance measure is a bit naive, but good enough for this demonstration
float dist2 = dh*dh + ds*ds;
if( dist2 <= maxDist2 ) {
output.setRGB(x,y,image.getRGB(x,y));
}
}
}
ShowImages.showWindow(output,"Showing "+name);
}
示例6: addFoundFeatures
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
private void addFoundFeatures( ImageFloat32 scale0, ImageFloat32 scale1, ImageFloat32 scale2,
QueueCorner found , boolean positive ) {
// if configured to do so, only select the features with the highest intensity
QueueCorner features;
if( sortBest != null ) {
sortBest.process(scale1,found,positive);
features = sortBest.getBestCorners();
} else {
features = found;
}
float signAdj = positive ? 1 : -1;
// precompute border for insignificant speed boost
int borderX = scale1.width-1;
int borderY = scale1.height-1;
// see if they are a local max in scale space
for( int i = 0; i < features.size; i++ ) {
Point2D_I16 p = features.data[i];
// discard points up against the image border since how it should be interpolated is undefined. plus
// this makes it easier to write faster code
if( p.x == 0 || p.y == 0 || p.x >= borderX || p.y >= borderY )
continue;
float value = scale1.unsafe_get(p.x, p.y);
if( isScaleSpaceMax(scale0,scale2,p.x,p.y,value,signAdj)
&& !isEdge(p.x,p.y) ) {
addPoint(scale0,scale1,scale2,p.x,p.y,value,signAdj,positive);
}
}
}
示例7: safeGet
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
/**
* Handle outside image pixels by extending the image.
*/
public static float safeGet( ImageFloat32 input , int x , int y ) {
if( x < 0 )
x = 0;
else if( x >= input.width )
x = input.width-1;
if( y < 0 )
y = 0;
else if( y >= input.height )
y = input.height-1;
return input.unsafe_get(x,y);
}
示例8: setNaN
import boofcv.struct.image.ImageFloat32; //导入方法依赖的package包/类
private void setNaN( ImageFloat32 image ) {
for( int y = 0; y < image.height; y++ ) {
for( int x = 0; x < image.width; x++ ) {
float v = image.unsafe_get(x,y);
if( Float.isNaN(v) || Float.isInfinite(v) ) {
image.unsafe_set(x,y,0);
}
}
}
}