本文整理汇总了Java中org.openimaj.image.MBFImage.drawPoint方法的典型用法代码示例。如果您正苦于以下问题:Java MBFImage.drawPoint方法的具体用法?Java MBFImage.drawPoint怎么用?Java MBFImage.drawPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.MBFImage
的用法示例。
在下文中一共展示了MBFImage.drawPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeUpdate
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void beforeUpdate(MBFImage frame) {
final FImage currentFrame = frame.flatten();
if (firstframe) {
tracker.selectGoodFeatures(currentFrame);
firstframe = false;
} else {
tracker.trackFeatures(prevFrame, currentFrame);
tracker.replaceLostFeatures(currentFrame);
}
this.prevFrame = currentFrame.clone();
for (final Feature f : tracker.getFeatureList()) {
if (f.val >= 0) {
frame.drawPoint(f, RGBColour.GREEN, 5);
}
}
}
示例2: plot2d
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
MBFImage plot2d(double[][] data) {
final MBFImage img = new MBFImage(500, 500, ColourSpace.RGB);
img.drawLine(img.getWidth() / 2, img.getHeight() - 50, img.getWidth() / 2, 50, 3, RGBColour.RED);
img.drawLine(img.getWidth() / 2 - 10, 70, img.getWidth() / 2, 50, 3, RGBColour.RED);
img.drawLine(img.getWidth() / 2 + 10, 70, img.getWidth() / 2, 50, 3, RGBColour.RED);
img.drawText("EV2", img.getWidth() / 2 - 80, 70, HersheyFont.ROMAN_DUPLEX, 40, RGBColour.RED);
img.drawLine(50, img.getHeight() / 2, img.getWidth() - 50, img.getHeight() / 2, 3, RGBColour.RED);
img.drawLine(img.getWidth() - 70, img.getHeight() / 2 + 10, img.getWidth() - 50, img.getHeight() / 2, 3,
RGBColour.RED);
img.drawLine(img.getWidth() - 70, img.getHeight() / 2 - 10, img.getWidth() - 50, img.getHeight() / 2, 3,
RGBColour.RED);
img.drawText("EV1", img.getWidth() - 70, img.getHeight() / 2 + 50, HersheyFont.ROMAN_DUPLEX, 40, RGBColour.RED);
for (final double[] d : data) {
img.drawPoint(new Point2dImpl(img.getWidth() / 2 - (float) d[0], img.getHeight() / 2 - (float) d[1]),
RGBColour.GREEN, 3);
}
return img;
}
示例3: plot1d
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
MBFImage plot1d(double[][] data) {
final MBFImage img = new MBFImage(500, 500, ColourSpace.RGB);
img.drawLine(50, img.getHeight() / 2, img.getWidth() - 50, img.getHeight() / 2, 3, RGBColour.RED);
img.drawLine(img.getWidth() - 70, img.getHeight() / 2 + 10, img.getWidth() - 50, img.getHeight() / 2, 3,
RGBColour.RED);
img.drawLine(img.getWidth() - 70, img.getHeight() / 2 - 10, img.getWidth() - 50, img.getHeight() / 2, 3,
RGBColour.RED);
img.drawText("EV1", img.getWidth() - 70, img.getHeight() / 2 + 50, HersheyFont.ROMAN_DUPLEX, 40, RGBColour.RED);
for (final double[] d : data) {
img.drawPoint(new Point2dImpl(img.getWidth() / 2 - (float) d[0], img.getHeight() / 2),
RGBColour.GREEN, 3);
}
return img;
}
示例4: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
final List<PointList> pointData = loadData();
final PointListConnections plc = loadConnections();
final List<FImage> images = loadImages();
System.out.println(pointData.size());
System.out.println(images.size());
final Float[][] cols = new Float[pointData.get(0).size()][];
for (int i = 0; i < cols.length; i++)
cols[i] = RGBColour.randomColour();
for (int j = 0; j < pointData.size(); j++) {
final PointList pl = pointData.get(j);
final MBFImage img = images.get(j).toRGB();
final List<Line2d> lines = plc.getLines(pl);
img.drawLines(lines, 1, RGBColour.RED);
for (int i = 0; i < pl.size(); i++) {
final Point2d pt = pl.get(i);
img.drawPoint(pt, cols[i], 3);
}
DisplayUtilities.display(img);
}
}
示例5: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Testing
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
FImage image = ImageUtilities.readF(new File("/Users/jsh2/Desktop/image.png"));
FImage template = image.extractROI(100, 100, 100, 100);
image.fill(0f);
image.drawImage(template, 100, 100);
TemplateMatcher matcher = new TemplateMatcher(template, Mode.CORRELATION);
matcher.setSearchBounds(new Rectangle(100,100,200,200));
image.analyseWith(matcher);
DisplayUtilities.display(matcher.responseMap.normalise());
MBFImage cimg = image.toRGB();
for (FValuePixel p : matcher.getBestResponses(10)) {
System.out.println(p);
cimg.drawPoint(p, RGBColour.RED, 1);
}
cimg.drawShape(matcher.getSearchBounds(), RGBColour.BLUE);
cimg.drawShape(new Rectangle(100,100,100,100), RGBColour.GREEN);
DisplayUtilities.display(cimg);
}
示例6: renderOrtho
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void renderOrtho(Matrix transform, int tx, int ty, MBFImage image) {
final Point2dImpl pt1 = projectOrtho(transform.times(pt));
pt1.x += tx;
pt1.y += ty;
pt1.y = image.getHeight() - pt1.y;
image.drawPoint(pt1, colour, size);
}
示例7: createFeature
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public DoubleFV createFeature(final MBFImage image) {
if (this.rabc == null) {
try {
final ByteCentroidsResult clusterer = IOUtils.read(Mode.class
.getResourceAsStream("/org/openimaj/demos/codebooks/random-100-highfield-codebook.voc"),
ByteCentroidsResult.class);
this.rabc = new ExactByteAssigner(clusterer);
this.fv = new DoubleFV(clusterer.numClusters());
this.engine.getOptions().setDoubleInitialImage(false);
} catch (final IOException e) {
e.printStackTrace();
}
}
FImage img = Transforms.calculateIntensity(image);
img = ResizeProcessor.halfSize(img);
final List<Keypoint> keys = this.engine.findFeatures(img);
for (final Keypoint keypoint : keys) {
image.drawPoint(new Point2dImpl(keypoint.x * 2f, keypoint.y * 2f), RGBColour.RED, 3);
}
Arrays.fill(this.fv.values, 0);
for (final Keypoint k : keys) {
this.fv.values[this.rabc.assign(k.ivec)]++;
}
return this.fv;
}
示例8: updateImage
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void updateImage() {
final int imageId = (int) imageSpinner.getModel().getValue();
final MBFImage img = images.get(imageId).toRGB();
for (final Pixel p : pointData[imageId]) {
if (p != null) {
img.drawPoint(p, RGBColour.RED, 9);
}
}
ic.setImage(ImageUtilities.createBufferedImage(img));
}
示例9: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, NotConvergedException {
final List<Point2dImpl> modelPoints = loadModelPoints();
final List<List<Point2dImpl>> points = loadImagePoints();
final List<List<? extends IndependentPair<? extends Point2d, ? extends Point2d>>> pointMatches =
new ArrayList<List<? extends IndependentPair<? extends Point2d, ? extends Point2d>>>();
for (int i = 0; i < points.size(); i++) {
final List<IndependentPair<Point2dImpl, Point2dImpl>> data =
IndependentPair.pairList(modelPoints, points.get(i));
pointMatches.add(data);
}
final CameraCalibrationZhang calib = new CameraCalibrationZhang(pointMatches, 640, 480);
// final CameraCalibrationZhang calib = new
// CameraCalibration(pointMatches);
System.out.println(calib.getIntrisics());
System.out.println(calib.calculateError());
final MBFImage img = new MBFImage(640, 480);
for (int i = 0; i < pointMatches.get(0).size(); i++) {
final Point2d model = pointMatches.get(0).get(i).firstObject();
final Point2d observed = pointMatches.get(0).get(i).secondObject();
final Point2d proj = calib.getCameras().get(0).project(model);
img.drawPoint(proj, RGBColour.RED, 1);
img.drawPoint(observed, RGBColour.GREEN, 1);
}
DisplayUtilities.display(img);
final FImage img1 = ImageUtilities.readF(new URL(
"http://research.microsoft.com/en-us/um/people/zhang/Calib/Calibration/CalibIm1.gif"));
DisplayUtilities.display(img1);
final FImage img2 = calib.getIntrisics().undistort(img1);
DisplayUtilities.display(img2);
}
示例10: drawLabels
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawLabels(MBFImage ret, TernaryParams params) {
final int padding = (Integer) params.getTyped(TernaryParams.PADDING);
final List<IndependentPair<TernaryData, String>> labels = params.getTyped(TernaryParams.LABELS);
final Map<? extends Attribute, Object> typed = params.getTyped(TernaryParams.LABEL_FONT);
final FontStyle<Float[]> fs = FontStyle.parseAttributes(typed, ret.createRenderer());
final Float[] labelBackground = params.getTyped(TernaryParams.LABEL_BACKGROUND);
final Float[] labelBorder = params.getTyped(TernaryParams.LABEL_BORDER);
final int labelPadding = (Integer) params.getTyped(TernaryParams.LABEL_PADDING);
final FontRenderer<Float[], FontStyle<Float[]>> fontRenderer = fs.getRenderer(ret.createRenderer());
if (labels != null) {
for (final IndependentPair<TernaryData, String> labelPoint : labels) {
final TernaryData ternaryData = labelPoint.firstObject();
final Point2d point = ternaryData.asPoint();
point.setX(point.getX() * width + padding);
point.setY(height - (point.getY() * width) + padding);
final Point2d p = point.copy();
if (point.getY() < height / 2) {
point.setY(point.getY() - 10);
}
else {
point.setY(point.getY() + 35);
}
final Rectangle rect = fontRenderer.getBounds(labelPoint.getSecondObject(), (int) point.getX(),
(int) point.getY(), fs);
rect.x -= labelPadding;
rect.y -= labelPadding;
rect.width += labelPadding * 2;
rect.height += labelPadding * 2;
if (labelBackground != null) {
ret.drawShapeFilled(rect, labelBackground);
}
if (labelBorder != null) {
ret.drawShape(rect, labelBorder);
}
ret.drawText(labelPoint.getSecondObject(), point, fs);
ret.drawPoint(p, RGBColour.RED, (int) ternaryData.value);
}
}
}
示例11: draw
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void draw( final MBFImage vis, final int xoffset,
final int yoffset, final PointList pl )
{
for( final Point2d p : pl )
{
final Point2d pp = new Point2dImpl( p );
p.translate( xoffset, yoffset );
vis.drawPoint( pp, RGBColour.RED, 2 );
}
}
示例12: drawDetectedFace
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void drawDetectedFace(MBFImage image, int thickness, KEDetectedFace f) {
Rectangle bounds = f.getBounds();
image.drawShape(bounds,thickness, boundingBoxColour);
FacialKeypoint[] kp = f.getKeypoints();
for (FacialKeypoint facialKeypoint : kp) {
Point2dImpl position = facialKeypoint.position.clone();
position.translate(bounds.x, bounds.y);
image.drawPoint(position,pointColour,thickness);
}
}
示例13: drawTarget
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawTarget(MBFImage image, Point2d point) {
image.drawPoint(point, RGBColour.RED, 10);
}
示例14: drawFaceModel
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawFaceModel(MBFImage image, Matrix shape, Matrix visi, Rectangle bounds)
{
final int n = shape.getRowDimension() / 2;
if (drawBounds && bounds != null)
image.createRenderer().drawShape(bounds,
boundingBoxColour);
if (drawTriangles) {
// Draw triangulation
for (int i = 0; i < triangles.length; i++) {
if (visi.get(triangles[i][0], 0) == 0 ||
visi.get(triangles[i][1], 0) == 0 ||
visi.get(triangles[i][2], 0) == 0)
continue;
final Triangle t = new Triangle(
new Point2dImpl(
(float) (shape.get(triangles[i][0], 0) + bounds.x) / scale,
(float) (shape.get(triangles[i][0] + n, 0) + bounds.y) / scale),
new Point2dImpl(
(float) (shape.get(triangles[i][1], 0) + bounds.x) / scale,
(float) (shape.get(triangles[i][1] + n, 0) + bounds.y) / scale),
new Point2dImpl(
(float) (shape.get(triangles[i][2], 0) + bounds.x) / scale,
(float) (shape.get(triangles[i][2] + n, 0) + bounds.y) / scale)
);
image.drawShape(t, thickness, meshColour);
}
}
if (drawConnections) {
// draw connections
for (int i = 0; i < connections[0].length; i++) {
if (visi.get(connections[0][i], 0) == 0
|| visi.get(connections[1][i], 0) == 0)
continue;
image.drawLine(
new Point2dImpl(
(float) (shape.get(connections[0][i], 0) + bounds.x) / scale,
(float) (shape.get(connections[0][i] + n, 0) + bounds.y) / scale),
new Point2dImpl(
(float) (shape.get(connections[1][i], 0) + bounds.x) / scale,
(float) (shape.get(connections[1][i] + n, 0) + bounds.y) / scale),
thickness, connectionColour);
}
}
if (drawPoints) {
// draw points
for (int i = 0; i < n; i++) {
if (visi.get(i, 0) == 0)
continue;
image.drawPoint(
new Point2dImpl(
((float) shape.get(i, 0) + bounds.x) / scale,
((float) shape.get(i + n, 0) + bounds.y) / scale),
pointColour, thickness);
}
}
}
示例15: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String args[]){
int centerx = 200;
int centery = 200;
Ellipse e1 = new Ellipse(centerx,centery,30,20,Math.PI/4f);
Polygon e1Box = e1.calculateOrientedBoundingBox();
MBFImage e1Image = new MBFImage(400,400,ColourSpace.RGB);
MBFImage e2Image = new MBFImage(400,400,ColourSpace.RGB);
e1Image.drawShape(e1, RGBColour.RED);
e1Image.drawShape(e1Box, RGBColour.BLUE);
Matrix rot = TransformUtilities.rotationMatrixAboutPoint(Math.PI/2f,centerx,centery);
Matrix scale = TransformUtilities.scaleMatrixAboutPoint(2.0, 3.0,centerx,centery);
Matrix move = TransformUtilities.translateMatrix(100,100);
Matrix transform = Matrix.identity(3,3);
transform = transform.times(move);
transform = transform.times(scale);
transform = transform.times(rot);
Point2d e2Pos = e1.transform(transform).calculateCentroid();
e2Image.drawPoint(e2Pos, RGBColour.GREEN, 3);
Matrix mrot = TransformUtilities.rotationMatrixAboutPoint(0.4, (int)(e2Pos.getX()), (int)(e2Pos.getY()));
Matrix mscale = TransformUtilities.scaleMatrixAboutPoint(1.02, 1.01,(int)e2Pos.getX(),(int)e2Pos.getY());
Matrix mmove = TransformUtilities.translateMatrix(-2,-2);
Matrix pert = Matrix.identity(3, 3);
pert = pert.times(mmove);
pert = pert.times(mrot);
pert = pert.times(mscale);
e2Image.drawShape(e1Box.transform(pert.times(transform)), RGBColour.BLUE);
e2Image.drawShape(e1.transform(pert.times(transform)), RGBColour.RED);
e2Image.drawShape(e1Box.transform(transform), RGBColour.GREEN);
e2Image.drawShape(e1.transform(transform), RGBColour.ORANGE);
Shape e2Untransform = e1.transform(pert.times(transform)).transform(transform.inverse());
e1Image.drawShape(e2Untransform, RGBColour.GREEN);
e1Image.drawPoint(e2Untransform.calculateCentroid(), RGBColour.GREEN, 3);
ArrayList<Ellipse> e1List = new ArrayList<Ellipse>();
e1List.add(e1);
ArrayList<Ellipse> e2List = new ArrayList<Ellipse>();
e2List.add(e1.transformAffine(pert.times(transform)));
RepeatabilityExperiment exp = new RepeatabilityExperiment(e1Image,e2Image,e1List,e2List,transform,1);
System.out.println(Arrays.toString(exp.doExperiment()));
DisplayUtilities.display(e1Image, "Untransformed image");
JFrame w2 = DisplayUtilities.display(e2Image, "Transformed image");
w2.setBounds(400, 0, 400, 400);
}