本文整理汇总了Java中org.openimaj.image.MBFImage.drawPoints方法的典型用法代码示例。如果您正苦于以下问题:Java MBFImage.drawPoints方法的具体用法?Java MBFImage.drawPoints怎么用?Java MBFImage.drawPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.MBFImage
的用法示例。
在下文中一共展示了MBFImage.drawPoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTutorial
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void doTutorial(MBFImage toDraw) {
List<KEDetectedFace> faces = this.detector.detectFaces(toDraw.flatten());
for (KEDetectedFace detectedFace : faces) {
Rectangle b = detectedFace.getBounds();
Point2dImpl bp = new Point2dImpl(b.x,b.y);
toDraw.drawShape(b, RGBColour.RED);
FacialKeypoint[] kpts = detectedFace.getKeypoints();
List<Point2d> fpts = new ArrayList<Point2d>();
for(FacialKeypoint kpt : kpts){
Point2dImpl p = kpt.position;
p.translate(bp);
fpts.add(p);
}
toDraw.drawPoints(fpts, RGBColour.GREEN, 3);
}
}
示例2: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Main method
*
* @param args
* ignored
* @throws IOException
* if image can't be loaded
*/
public static void main(String[] args) throws IOException {
final FImage chessboard = ImageUtilities.readF(new URL("http://www.ugcs.caltech.edu/~rajan/REPORT/camera.jpg"));
final HoughLines hlines = new HoughLines(1.f);
chessboard.process(new CannyEdgeDetector()).analyseWith(hlines);
final List<Line2d> lines = hlines.getBestLines(50);
final List<Point2d> intersections = new ArrayList<Point2d>();
for (final Line2d inner : lines) {
for (final Line2d outer : lines) {
if (inner == outer)
continue;
final IntersectionResult intersect = inner.getIntersection(outer);
if (intersect.type == IntersectionType.INTERSECTING) {
intersections.add(intersect.intersectionPoint);
}
}
}
// draw result
final MBFImage chessboardC = chessboard.toRGB();
chessboardC.drawLines(lines, 1, RGBColour.RED);
chessboardC.drawPoints(intersections, RGBColour.GREEN, 3);
DisplayUtilities.display(chessboardC);
}
示例3: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) throws VideoCaptureException {
final VideoCapture vc = new VideoCapture(320, 240);
final JFrame frame = DisplayUtilities.displaySimple(vc.getNextFrame(), "capture");
final ConnectedComponentLabeler ccl = new ConnectedComponentLabeler(ConnectMode.CONNECT_4);
while (true) {
final MBFImage cimg = vc.getNextFrame();
final FImage gimg = cimg.flatten();
gimg.processInplace(new OtsuThreshold());
// gimg.threshold(0.4f);
ccl.analyseImage(gimg);
final ConnectedComponent hand = findBiggest(ccl.getComponents());
cimg.drawPoints(hand, RGBColour.WHITE, 1);
if (hand != null) {
Polygon poly = hand.toPolygon();
poly = poly.reduceVertices(3);
final Polygon chull = poly.calculateConvexHull();
final List<ConvexityDefect> defects = ConvexityDefect.findDefects(poly, chull);
// for (final ConvexityDefect cd : defects) {
// cimg.drawShapeFilled(cd.getTriangle(), RGBColour.MAGENTA);
// }
final List<Point2d> tips = findTips(defects);
final Point2d centroid = poly.calculateCentroid();
System.out.println(centroid);
for (final Point2d pt : tips) {
cimg.drawLine(centroid, pt, RGBColour.RED);
cimg.drawShape(new Circle(pt, 5), RGBColour.CYAN);
}
cimg.drawPolygon(poly, 1, RGBColour.RED);
cimg.drawPolygon(chull, 1, RGBColour.BLUE);
}
DisplayUtilities.display(cimg, frame);
}
}