本文整理了Java中org.openimaj.math.geometry.shape.Rectangle.isInside
方法的一些代码示例,展示了Rectangle.isInside
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.isInside
方法的具体详情如下:
包路径:org.openimaj.math.geometry.shape.Rectangle
类名称:Rectangle
方法名:isInside
[英]Test if the given rectangle is inside this one.
[中]测试给定的矩形是否在此矩形内。
代码示例来源:origin: openimaj/openimaj
@Override
public boolean test(USMFStatus twitterStatus) {
if(twitterStatus.geo == null){
return false;
}
//if(geomap == null) geomap = (Map<String, Object>) twitterStatus.coordinates;
// "geo":{"type":"Point","coordinates":[51.55047862,-0.29938507]}
List<Double> geolist = new ArrayList<Double>();
geolist.add(twitterStatus.geo[0]);
geolist.add(twitterStatus.geo[1]);
Point2d pos = new Point2dImpl(geolist.get(1).floatValue(),geolist.get(0).floatValue());
return location.isInside(pos);
}
代码示例来源:origin: org.openimaj.tools/TwitterPreprocessingTool
@Override
public boolean test(USMFStatus twitterStatus) {
if(twitterStatus.geo == null){
return false;
}
//if(geomap == null) geomap = (Map<String, Object>) twitterStatus.coordinates;
// "geo":{"type":"Point","coordinates":[51.55047862,-0.29938507]}
List<Double> geolist = new ArrayList<Double>();
geolist.add(twitterStatus.geo[0]);
geolist.add(twitterStatus.geo[1]);
Point2d pos = new Point2dImpl(geolist.get(1).floatValue(),geolist.get(0).floatValue());
return location.isInside(pos);
}
代码示例来源:origin: org.openimaj/demos
private void selectArea(Rectangle rectangle) {
this.selectedArea = rectangle;
List<InterestPointData> pointsInsideRect = new ArrayList<InterestPointData>();
for (InterestPointData point : points) {
if (rectangle.isInside(point)) {
pointsInsideRect.add(point);
}
}
InterestPointVisualiser<Float[], MBFImage> visualiser = InterestPointVisualiser
.visualiseInterestPoints((MBFImage) image, pointsInsideRect);
MBFImage out = visualiser.drawPatches(RGBColour.RED, RGBColour.GREEN);
DisplayUtilities.display(out, this.displayFrame);
}
代码示例来源:origin: openimaj/openimaj
private void selectArea(Rectangle rectangle) {
this.selectedArea = rectangle;
List<InterestPointData> pointsInsideRect = new ArrayList<InterestPointData>();
for (InterestPointData point : points) {
if (rectangle.isInside(point)) {
pointsInsideRect.add(point);
}
}
InterestPointVisualiser<Float[], MBFImage> visualiser = InterestPointVisualiser
.visualiseInterestPoints((MBFImage) image, pointsInsideRect);
MBFImage out = visualiser.drawPatches(RGBColour.RED, RGBColour.GREEN);
DisplayUtilities.display(out, this.displayFrame);
}
代码示例来源:origin: org.openimaj/core-image
/**
* {@inheritDoc}
*
* @see org.openimaj.image.renderer.ImageRenderer#drawPoint(org.openimaj.math.geometry.point.Point2d,
* java.lang.Object, int)
*/
@Override
public void drawPoint(final Point2d p, final Float grey, final int size) {
if (!this.targetImage.getBounds().isInside(p))
return;
final int halfsize = (size + 1) / 2; // 3 == 2, 4 = 2, 5 = 3, 6 = 3 etc.
// TODO anti-aliased point rendering
final int x = Math.round(p.getX());
final int y = Math.round(p.getY());
final int startx = Math.max(0, x - (halfsize - 1));
final int starty = Math.max(0, y - (halfsize - 1));
final int endx = Math.min(this.targetImage.width, x + halfsize);
final int endy = Math.min(this.targetImage.height, y + halfsize);
for (int j = starty; j < endy; j++) {
for (int i = startx; i < endx; i++) {
this.targetImage.pixels[j][i] = grey;
}
}
}
代码示例来源:origin: openimaj/openimaj
/**
* {@inheritDoc}
*
* @see org.openimaj.image.renderer.ImageRenderer#drawPoint(org.openimaj.math.geometry.point.Point2d,
* java.lang.Object, int)
*/
@Override
public void drawPoint(final Point2d p, final Float grey, final int size) {
if (!this.targetImage.getBounds().isInside(p))
return;
final int halfsize = (size + 1) / 2; // 3 == 2, 4 = 2, 5 = 3, 6 = 3 etc.
// TODO anti-aliased point rendering
final int x = Math.round(p.getX());
final int y = Math.round(p.getY());
final int startx = Math.max(0, x - (halfsize - 1));
final int starty = Math.max(0, y - (halfsize - 1));
final int endx = Math.min(this.targetImage.width, x + halfsize);
final int endy = Math.min(this.targetImage.height, y + halfsize);
for (int j = starty; j < endy; j++) {
for (int i = startx; i < endx; i++) {
this.targetImage.pixels[j][i] = grey;
}
}
}
代码示例来源:origin: openimaj/openimaj
protected void detectMaxima(FImage image, Rectangle window) {
maxima = new ArrayList<Maxima>();
for (int y = borderSkip; y < image.height - borderSkip; y++) {
for (int x = borderSkip; x < image.width - borderSkip; x++) {
if (!window.isInside(new Pixel(x, y)))
continue;
final float curr = image.pixels[y][x];
if (curr > image.pixels[y - 1][x - 1]
&& curr >= image.pixels[y - 1][x]
&& curr >= image.pixels[y - 1][x + 1]
&& curr >= image.pixels[y][x - 1]
&& curr >= image.pixels[y][x + 1]
&& curr >= image.pixels[y + 1][x - 1]
&& curr >= image.pixels[y + 1][x]
&& curr >= image.pixels[y + 1][x + 1])
{
maxima.add(new Maxima(x, y, curr));
}
}
}
Collections.sort(maxima, new Comparator<Maxima>() {
@Override
public int compare(Maxima o1, Maxima o2) {
if (o1.val == o2.val)
return 0;
return o1.val < o2.val ? 1 : -1;
}
});
}
代码示例来源:origin: org.openimaj/image-local-features
protected void detectMaxima(FImage image, Rectangle window) {
maxima = new ArrayList<Maxima>();
for (int y = borderSkip; y < image.height - borderSkip; y++) {
for (int x = borderSkip; x < image.width - borderSkip; x++) {
if (!window.isInside(new Pixel(x, y)))
continue;
final float curr = image.pixels[y][x];
if (curr > image.pixels[y - 1][x - 1]
&& curr >= image.pixels[y - 1][x]
&& curr >= image.pixels[y - 1][x + 1]
&& curr >= image.pixels[y][x - 1]
&& curr >= image.pixels[y][x + 1]
&& curr >= image.pixels[y + 1][x - 1]
&& curr >= image.pixels[y + 1][x]
&& curr >= image.pixels[y + 1][x + 1])
{
maxima.add(new Maxima(x, y, curr));
}
}
}
Collections.sort(maxima, new Comparator<Maxima>() {
@Override
public int compare(Maxima o1, Maxima o2) {
if (o1.val == o2.val)
return 0;
return o1.val < o2.val ? 1 : -1;
}
});
}
代码示例来源:origin: openimaj/openimaj
Rectangle r = this.projectedRectangles.get(k);
Shape s = this.projectedShapes.get(k);
if( r.isInside(realPoint) && s.isInside(realPoint)){
double[][] transform = this.transformsInverted.get(i).getArray();
代码示例来源:origin: org.openimaj/image-processing
Rectangle r = this.projectedRectangles.get(k);
Shape s = this.projectedShapes.get(k);
if( r.isInside(realPoint) && s.isInside(realPoint)){
double[][] transform = this.transformsInverted.get(i).getArray();
代码示例来源:origin: openimaj/openimaj
if (validArea.isInside(data.transformAffine(transform.inverse())
.calculateRegularBoundingBox()))
代码示例来源:origin: org.openimaj/image-local-features
if (validArea.isInside(data.transformAffine(transform.inverse())
.calculateRegularBoundingBox()))
代码示例来源:origin: openimaj/openimaj
@Override
public double intersectionArea(Shape that, int nStepsPerDimension) {
final Rectangle overlapping = this.calculateRegularBoundingBox().overlapping(that.calculateRegularBoundingBox());
if (overlapping == null)
return 0;
if (that instanceof Rectangle) {
// Special case
return overlapping.calculateArea();
} else {
double intersection = 0;
final double step = Math.max(overlapping.width, overlapping.height) / (double) nStepsPerDimension;
double nReads = 0;
for (float x = overlapping.x; x < overlapping.x + overlapping.width; x += step) {
for (float y = overlapping.y; y < overlapping.y + overlapping.height; y += step) {
final boolean insideThis = this.isInside(new Point2dImpl(x, y));
final boolean insideThat = that.isInside(new Point2dImpl(x, y));
nReads++;
if (insideThis && insideThat) {
intersection++;
}
}
}
return (intersection / nReads) * (overlapping.width * overlapping.height);
}
}
代码示例来源:origin: openimaj/openimaj
int i = 0;
for (final Shape s : this.projectedShapes) {
if (s.calculateRegularBoundingBox().isInside(realPoint) && s.isInside(realPoint)) {
final double[][] transform = this.transformsInverted.get(i).getArray();
代码示例来源:origin: org.openimaj/demos
private void regenAndDisplay() {
double sumDistance = 0;
for (float y = 0; y < outImage.getHeight(); y++) {
for (float x = 0; x < outImage.getWidth(); x++) {
Point2dImpl point = new Point2dImpl(x, y);
Point2d distorted = getDistortedPoint(point);
if (image.getBounds().isInside(distorted)) {
Point2d undistorted = getUndistortedPoint(distorted);
sumDistance += new Line2d(point, undistorted)
.calculateLength();
}
outImage.setPixel((int) x, (int) y, image.getPixelInterp(
distorted.getX(), distorted.getY(), RGBColour.BLACK));
}
}
System.out.println("Sum difference: " + sumDistance);
if (this.outFrame == null) {
outFrame = DisplayUtilities.display(outImage);
} else {
DisplayUtilities.display(outImage, outFrame);
}
}
代码示例来源:origin: openimaj/openimaj
private void regenAndDisplay() {
double sumDistance = 0;
for (float y = 0; y < outImage.getHeight(); y++) {
for (float x = 0; x < outImage.getWidth(); x++) {
Point2dImpl point = new Point2dImpl(x, y);
Point2d distorted = getDistortedPoint(point);
if (image.getBounds().isInside(distorted)) {
Point2d undistorted = getUndistortedPoint(distorted);
sumDistance += new Line2d(point, undistorted)
.calculateLength();
}
outImage.setPixel((int) x, (int) y, image.getPixelInterp(
distorted.getX(), distorted.getY(), RGBColour.BLACK));
}
}
System.out.println("Sum difference: " + sumDistance);
if (this.outFrame == null) {
outFrame = DisplayUtilities.display(outImage);
} else {
DisplayUtilities.display(outImage, outFrame);
}
}
代码示例来源:origin: org.openimaj/image-processing
int i = 0;
for (final Shape s : this.projectedShapes) {
if (s.calculateRegularBoundingBox().isInside(realPoint) && s.isInside(realPoint)) {
final double[][] transform = this.transformsInverted.get(i).getArray();
代码示例来源:origin: openimaj/openimaj
final boolean beginInside = r.isInside(begin);
final int nInside = (beginInside ? 1 : 0) + (r.isInside(end) ? 1 : 0);
if (nInside == 2) {
return new Line2d(this.begin.copy(), this.end.copy());
代码示例来源:origin: openimaj/openimaj
Point2dImpl clickPoint = new Point2dImpl(e.getPoint().x, e.getPoint().y);
for (InterestPointData point : points) {
if (this.selectedArea.isInside(point)) {
Ellipse ellipse = point.getEllipse();
if (ellipse.isInside(clickPoint)) {
代码示例来源:origin: org.openimaj/demos
Point2dImpl clickPoint = new Point2dImpl(e.getPoint().x, e.getPoint().y);
for (InterestPointData point : points) {
if (this.selectedArea.isInside(point)) {
Ellipse ellipse = point.getEllipse();
if (ellipse.isInside(clickPoint)) {
内容来源于网络,如有侵权,请联系作者删除!