本文整理汇总了Java中org.openimaj.image.colour.RGBColour类的典型用法代码示例。如果您正苦于以下问题:Java RGBColour类的具体用法?Java RGBColour怎么用?Java RGBColour使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RGBColour类属于org.openimaj.image.colour包,在下文中一共展示了RGBColour类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* create the test images, draw a few ellipses on the test image, initialise the IPDEngine
*/
@Before public void setup(){
image = new MBFImage(400,400,ColourSpace.RGB);
ellipseDrawn = new Ellipse(200,200,100,50,Math.PI/4);
image.fill(RGBColour.WHITE);
image.createRenderer().drawShapeFilled(ellipseDrawn, RGBColour.BLACK);
int derScale = 100;
int intScale = derScale * 3;
InterestPointDetector<?> ipd;
AbstractStructureTensorIPD aipd = new HarrisIPD(derScale,intScale);
AffineAdaption affine = new AffineAdaption(aipd,new IPDSelectionMode.Threshold(0.1f));
ipd = affine;
engine = new EllipticIPDSIFTEngine((AffineAdaption)ipd);
engine.setSelectionMode(new IPDSelectionMode.Count(2));
engine.setAcrossScales(false);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:IPDEngineTest.java
示例2: doClassify
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
private void doClassify(double[] mean) {
final HashSet<Integer> clzCount = new HashSet<Integer>();
clzCount.addAll(classes);
if (points.size() > 0 && clzCount.size() == 2) {
final double[] p1 = new double[] { 0, 0 };
p1[1] = (float) classifier.computeHyperplanePoint(0);
final double[] p2 = new double[] { 1, 0 };
p2[1] = (float) classifier.computeHyperplanePoint(1);
image.drawLine(projectPoint(p1), projectPoint(p2), 3, RGBColour.BLACK);
imageComp.setImage(bimg = ImageUtilities.createBufferedImageForDisplay(image, bimg));
guess.setText(this.classType.getItemAt(classifier.predict(mean)));
return;
}
guess.setText("unknown");
}
开发者ID:jonhare,项目名称:ecs-summer-school-vision-lecture,代码行数:21,代码来源:LinearClassifierDemo.java
示例3: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
final FImage image = ImageUtilities.readF(new File("/Users/jsh2/Desktop/test-images/A7K9ZlZCAAA9VoL.jpg"));
final CLMFaceDetector detector = new CLMFaceDetector();
final List<Rectangle> rects = detector.getConfiguration().faceDetector.detect(image);
final MBFImage img = new MBFImage(image.clone(), image.clone(), image.clone());
for (final Rectangle r : rects) {
r.scaleCentroid(1.2f);
img.drawShape(r, RGBColour.RED);
}
DisplayUtilities.display(img);
final List<CLMDetectedFace> faces = detector.detectFaces(image, rects);
final CLMAligner aligner = new CLMAligner();
DisplayUtilities.display(aligner.align(faces.get(0)));
}
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:CLMAlignerTest.java
示例4: beforeUpdate
import org.openimaj.image.colour.RGBColour; //导入依赖的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);
}
}
}
开发者ID:jonhare,项目名称:ecs-summer-school-vision-lecture,代码行数:18,代码来源:StickyFeaturesDemo.java
示例5: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
public static void main(String[] args) throws VideoCaptureException {
final SWTTextDetector detector = new SWTTextDetector();
detector.getOptions().direction = SWTTextDetector.Direction.LightOnDark;
VideoDisplay.createVideoDisplay(new VideoCapture(640, 480)).addVideoListener(new VideoDisplayAdapter<MBFImage>()
{
@Override
public void beforeUpdate(MBFImage frame) {
if (frame == null)
return;
detector.analyseImage(frame.flatten());
for (final LineCandidate line : detector.getLines()) {
frame.drawShape(line.getRegularBoundingBox(), RGBColour.RED);
for (final WordCandidate wc : line.getWords()) {
frame.drawShape(wc.getRegularBoundingBox(), RGBColour.BLUE);
for (final LetterCandidate lc : wc.getLetters())
frame.drawShape(lc.getRegularBoundingBox(), RGBColour.GREEN);
}
}
}
});
}
开发者ID:openimaj,项目名称:openimaj,代码行数:27,代码来源:SWTVideoTest.java
示例6: beforeUpdate
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
@Override
public void beforeUpdate(MBFImage frame) {
if(learnMode){
System.out.println("Adding frame");
if(this.learningFrames.size()>5)
this.learningFrames.remove(0);
this.learningFrames.add(frame.process(new PolygonExtractionProcessor<Float[],MBFImage>(this.polygonListener.getPolygon(),RGBColour.BLACK)));
}
if(viewMode){
FImage guess = this.hmodel.classifyImage(frame).normalise();
FImage greyFrame = Transforms.calculateIntensity(frame);
for(int y = 0; y < guess.height; y++){
for(int x = 0; x < guess.width; x++){
if(guess.pixels[y][x] < 0.1){
Float greyP = greyFrame.getPixel(x, y);
frame.setPixel(x, y, new Float[]{greyP,greyP,greyP});
}
}
}
}
this.polygonListener.drawPoints(frame);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:VideoPixelHistogram.java
示例7: AxisRenderer3D
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* Default constructor sets some default axis values
*/
public AxisRenderer3D()
{
Float[] c = RGBColour.WHITE;
this.config.getRenderingConfig().setColour( new float[]{ c[0], c[1], c[2] } );
c = RGBColour.GRAY;
this.config.getRenderingConfig().setMajorTickColour( new float[]{ c[0], c[1], c[2] } );
this.config.getRenderingConfig().setMajorGridColour( new float[]{ c[0], c[1], c[2] } );
this.config.getRenderingConfig().setMinorTickColour( new float[]{ c[0], c[1], c[2] } );
c = new Float[] {0.3f,0.3f,0.3f};
this.config.getRenderingConfig().setMinorGridColour( new float[]{ c[0], c[1], c[2] } );
this.config.getRenderingConfig().setMajorTickLength( 0.04 );
this.config.getRenderingConfig().setMinorTickLength( 0.01 );
this.config.getRenderingConfig().setMajorTickSpacing( 1 );
this.config.getRenderingConfig().setMinorTickSpacing( 0.5 );
this.config.getRenderingConfig().setThickness( 3 );
this.config.getRenderingConfig().setMajorTickThickness( 1 );
this.config.getRenderingConfig().setMinorTickThickness( 0.5 );
this.textRenderer = new TextRenderer( new Font( "SansSerif", Font.BOLD, 36 ) );
}
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:AxisRenderer3D.java
示例8: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
public static void main( String[] args ) {
//Create an image
MBFImage image = new MBFImage(320,70, ColourSpace.RGB);
//Fill the image with white
image.fill(RGBColour.WHITE);
//Render some test into the image
image.drawText("Hello World", 10, 60, HersheyFont.CURSIVE, 50, RGBColour.BLACK);
//Apply a Gaussian blur
image.processInplace(new FGaussianConvolve(2f));
//Display the image
DisplayUtilities.display(image);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:17,代码来源:App.java
示例9: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
MathMLFontRenderer<Float[]> rend = new MathMLFontRenderer<Float[]>();
String mathML = "x = 2\\mathrm{wang}wang" ;
MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);
img.fill(RGBColour.WHITE);
MBFImageRenderer renderer = img.createRenderer();
MathMLFontStyle<Float[]> style = new MathMLFontStyle<Float[]>(new MathMLFont(), RGBColour.WHITE);
style.setColour(RGBColour.RED);
style.setFontSize(30);
rend.renderText(renderer, mathML, 0, 100, style);
DisplayUtilities.display(img);
MathMLFontRenderer<Float> rendf = new MathMLFontRenderer<Float>();
FImage imgf = new FImage(300, 300);
imgf.fill(0f);
FImageRenderer rendererf = imgf.createRenderer();
MathMLFontStyle<Float> stylef = new MathMLFontStyle<Float>(new MathMLFont(), 0.5f);
stylef.setFontSize(30);
rendf.renderText(rendererf, mathML, 0, 100, stylef);
DisplayUtilities.display(imgf);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:MathMLFontRenderer.java
示例10: keyTyped
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
@Override
public void keyTyped(KeyEvent event) {
System.out.println("Got a key");
if (event.getKeyChar() == 'c') {
drawingPanel.fill(RGBColour.WHITE);
System.out.println("Modelling mode started");
this.mode = MODE.MODEL;
this.calibrationPointIndex = 0;
homographyPoints.clear();
this.homography = new HomographyModel();
System.out.println("CURRENTLY EXPECTING POINT: "
+ this.calibrationPoints.get(this.calibrationPointIndex).firstObject());
}
if (event.getKeyChar() == 'd' && this.homographyPoints.size() > 4) {
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:DigitalWhiteboard.java
示例11: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
public static void main(String[] args) {
final MBFImage image = new MBFImage(400, 400, ColourSpace.RGB);
final MBFImageRenderer renderer = image.createRenderer();
image.fill(RGBColour.BLACK);
final List<Ellipse> ellipses = new ArrayList<Ellipse>();
ellipses.add(new Ellipse(200, 100, 10, 8, Math.PI / 4));
ellipses.add(new Ellipse(200, 300, 5, 3, -Math.PI / 4));
ellipses.add(new Ellipse(100, 300, 3, 5, -Math.PI / 3));
for (final Ellipse ellipse : ellipses) {
renderer.drawShapeFilled(ellipse, RGBColour.WHITE);
}
final LOCKY locky = new LOCKY();
locky.findInterestPoints(image.flatten());
final List<EllipticInterestPointData> pts = locky.getInterestPoints();
for (final EllipticInterestPointData pt : pts) {
image.drawShape(pt.getEllipse(), RGBColour.RED);
}
DisplayUtilities.display(image);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:LOCKY.java
示例12: drawModel
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* Draw the model onto the image
*
* @param image
* The image to draw onto
* @param drawTriangles
* Whether to draw the triangles
* @param drawConnections
* Whether to draw the connections
* @param drawPoints
* Whether to draw the points
* @param drawSearchArea
* Whether to draw the search area
* @param drawBounds
* Whether to draw the bounds
*/
public void drawModel(final MBFImage image, final boolean drawTriangles,
final boolean drawConnections, final boolean drawPoints,
final boolean drawSearchArea, final boolean drawBounds)
{
for (int fc = 0; fc < this.model.trackedFaces.size(); fc++) {
final MultiTracker.TrackedFace f = this.model.trackedFaces.get(fc);
if (drawSearchArea) {
// Draw the search area size
final Rectangle r = f.lastMatchBounds.clone();
r.scaleCentroid(this.searchAreaSize);
image.createRenderer().drawShape(r, RGBColour.YELLOW);
}
// Draw the face model
CLMFaceTracker.drawFaceModel(image, f, drawTriangles, drawConnections, drawPoints,
drawSearchArea, drawBounds, this.triangles, this.connections, this.scale,
this.boundingBoxColour, this.meshColour, this.connectionColour,
this.pointColour);
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:38,代码来源:CLMFaceTracker.java
示例13: debugLines
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* Helper function to display the image with lines
*
* @param i
* @param hl
* @param tf
* @param title
* @param lines
*/
private void debugLines(final FImage i, final Matrix tf, final String title,
final Collection<Line2d> lines)
{
// Create an image showing where the lines are
final MBFImage output = new MBFImage(i.getWidth(),
i.getHeight(), 3);
final MBFImageRenderer r = output.createRenderer(); // RenderHints.ANTI_ALIASED
// );
r.drawImage(i, 0, 0);
for (final Line2d l : lines)
{
final Line2d l2 = l.transform(tf).lineWithinSquare(output.getBounds());
// l2 can be null if it doesn't intersect with the image
if (l2 != null)
{
System.out.println(l2);
r.drawLine(l2, 2, RGBColour.RED);
}
}
DisplayUtilities.display(output, title);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:34,代码来源:SkewCorrector.java
示例14: keyPressed
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
@Override
public synchronized void keyPressed(KeyEvent key) {
if (key.getKeyCode() == KeyEvent.VK_SPACE) {
this.videoFrame.togglePause();
} else if (key.getKeyChar() == 'c' && this.polygonListener.getPolygon().getVertices().size() > 2) {
mode = Mode.START_LOOKING;
} else if (key.getKeyChar() == 'd' && this.polygonListener.getPolygon().getVertices().size() > 2) {
final Polygon p = this.polygonListener.getPolygon().clone();
this.polygonListener.reset();
overlayFrame = this.capture.getCurrentFrame().process(
new PolygonExtractionProcessor<Float[], MBFImage>(p, RGBColour.BLACK));
}
else if (key.getKeyChar() == 'r') {
this.mode = Mode.NONE;
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:VideoKLTSIFT.java
示例15: displayQueryResults
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
*
* @param resource
* @return The displayed image
* @throws Exception
*/
public static MBFImage displayQueryResults(final URL resource) throws Exception
{
System.out.println("----------- QUERYING ----------- ");
final FImage fi = ImageUtilities.readF(resource);
final PersonMatcher pm = new PersonMatcher(new File(PersonMatcher.RECOGNISER_FILE));
final List<? extends IndependentPair<? extends DetectedFace, ScoredAnnotation<String>>> l = pm.query(fi);
final MBFImage m = new MBFImage(fi.getWidth(), fi.getHeight(), 3);
m.addInplace(fi);
int count = 1;
for (final IndependentPair<? extends DetectedFace, ScoredAnnotation<String>> i : l)
{
final Rectangle b = i.firstObject().getBounds();
m.drawShape(b, RGBColour.RED);
final String name = count + " : " +
(i.secondObject() == null ? "Unknown" : i.secondObject().annotation);
m.drawText(name, (int) b.x, (int) b.y,
HersheyFont.TIMES_MEDIUM, 12, RGBColour.GREEN);
count++;
}
DisplayUtilities.display(m);
return m;
}
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:PersonMatcher.java
示例16: MSEREllipseFinder
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* Construct demo
*/
public MSEREllipseFinder() {
final MBFImage image = new MBFImage(400, 400, ColourSpace.RGB);
final MBFImageRenderer renderer = image.createRenderer();
image.fill(RGBColour.WHITE);
final List<Ellipse> ellipses = new ArrayList<Ellipse>();
ellipses.add(new Ellipse(200, 100, 100, 80, Math.PI / 4));
ellipses.add(new Ellipse(200, 300, 50, 30, -Math.PI / 4));
ellipses.add(new Ellipse(100, 300, 30, 50, -Math.PI / 3));
for (final Ellipse ellipse : ellipses) {
renderer.drawShapeFilled(ellipse, RGBColour.BLACK);
}
final MSERFeatureGenerator mser = new MSERFeatureGenerator(MomentFeature.class);
final List<Component> features = mser.generateMSERs(Transforms
.calculateIntensityNTSC(image));
for (final Component c : features) {
final MomentFeature feature = c.getFeature(MomentFeature.class);
renderer.drawShape(feature.getEllipse(2), RGBColour.RED);
renderer.drawShape(feature.getEllipse(2)
.calculateOrientedBoundingBox(), RGBColour.GREEN);
}
DisplayUtilities.display(image);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:29,代码来源:MSEREllipseFinder.java
示例17: update
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
private static void update() {
rotation += Math.PI/30;
// int dx = 100;
// int dy = 100;
// float x = (float) (Math.cos(rotation) * dx + Math.sin(rotation) * dy);
// float y = (float) (-Math.sin(rotation) * dx + Math.cos(rotation) * dy);
Matrix rotMat = TransformUtilities.rotationMatrixAboutPoint(rotation, ellipse.calculateCentroid().getX(), ellipse.calculateCentroid().getY());
// Matrix transMat = TransformUtilities.translateMatrix(x, y);
Matrix scaleMat = TransformUtilities.scaleMatrix(Math.abs(0.5 * Math.cos(rotation)) + 1, Math.abs(0.5 * Math.sin(rotation))+ 1);
Matrix scaledTrans = scaleMat.times(TransformUtilities.translateMatrix(-ellipse.calculateCentroid().getX(), -ellipse.calculateCentroid().getY()));
scaledTrans = TransformUtilities.translateMatrix(ellipse.calculateCentroid().getX(), ellipse.calculateCentroid().getY()).times(scaledTrans);
Matrix transform = Matrix.identity(3, 3);
transform = rotMat.times(transform);
// transform = transMat.times(transform);
// transform = scaledTrans.times(transform);
image.fill(RGBColour.BLACK);
image.createRenderer().drawShapeFilled(ellipse.transformAffine(transform), RGBColour.RED);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:TestShapeTransforms.java
示例18: main
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
/**
* Simple test program
*
* @param args
* @throws MalformedURLException
* @throws IOException
*/
public static void main(String[] args) throws MalformedURLException, IOException {
final FastChessboardDetector fcd = new FastChessboardDetector(9, 6);
final VideoDisplay<MBFImage> vd = VideoDisplay.createVideoDisplay(new VideoCapture(640,
480));
vd.setCalculateFPS(true);
vd.addVideoListener(new VideoDisplayAdapter<MBFImage>() {
@Override
public void beforeUpdate(MBFImage frame) {
fcd.analyseImage(frame.flatten());
frame.drawText(fcd.result + "", 100, 100, HersheyFont.FUTURA_LIGHT,
20, RGBColour.RED);
System.out.println(vd.getDisplayFPS());
}
});
}
开发者ID:openimaj,项目名称:openimaj,代码行数:23,代码来源:FastChessboardDetector.java
示例19: drawToImage
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
@Override
public void drawToImage(MBFImage image) {
final List<Touch> toDraw = this.getDrawingPoints();
// if(this.touchScreen.cameraConfig instanceof
// TriangleCameraConfig){
// ((TriangleCameraConfig)this.touchScreen.cameraConfig).drawTriangles(image);
//
// }
for (final Touch touch : toDraw) {
// Point2d trans =
// point2d.transform(this.touchScreen.cameraConfig.homography);
final Circle trans = this.touchScreen.cameraConfig.transformTouch(touch);
if (trans != null)
image.drawShapeFilled(trans, RGBColour.BLUE);
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:TouchTableScreen.java
示例20: beforeUpdate
import org.openimaj.image.colour.RGBColour; //导入依赖的package包/类
@Override
public synchronized void beforeUpdate(MBFImage frame) {
this.currentFrame = frame.flatten();
engine.track(frame);
engine.drawModel(frame, true, true, true, true, true);
if (recogniser != null && recogniser.listPeople().size() >= 1) {
for (final CLMDetectedFace f : detectFaces()) {
final List<ScoredAnnotation<String>> name = recogniser.annotate(f);
if (name.size() > 0) {
final Point2d r = f.getBounds().getTopLeft();
frame.drawText(name.get(0).annotation, r, HersheyFont.ROMAN_SIMPLEX, 15, RGBColour.GREEN);
}
}
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:VideoFaceRecognition.java
注:本文中的org.openimaj.image.colour.RGBColour类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论