本文整理汇总了Java中org.openimaj.image.colour.ColourSpace.RGB属性的典型用法代码示例。如果您正苦于以下问题:Java ColourSpace.RGB属性的具体用法?Java ColourSpace.RGB怎么用?Java ColourSpace.RGB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openimaj.image.colour.ColourSpace
的用法示例。
在下文中一共展示了ColourSpace.RGB属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
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);
}
示例2: makeVideo
AnimatedVideo<MBFImage> makeVideo(final Scene scene) {
return new AnimatedVideo<MBFImage>(new MBFImage(500, 500, ColourSpace.RGB)) {
float angle = 0;
@Override
protected void updateNextFrame(MBFImage frame) {
frame.fill(RGBColour.BLACK);
scene.renderOrtho(
Simple3D.euler2Rot(Math.PI / 4, angle, 0),
frame);
angle += (2 * Math.PI / 360);
if (angle >= Math.PI * 2)
angle -= 2 * Math.PI;
}
};
}
示例3: drawPoints
private static void drawPoints(Stream<IndependentPair<double[], PerceptronClass>> dataStream, Line2d line) {
final MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);
img.drawLine(line, 3, RGBColour.BLUE);
for (final IndependentPair<double[], PerceptronClass> pointClass : dataStream) {
final double[] pc = pointClass.firstObject();
final Point2dImpl point = new Point2dImpl((float) pc[0], (float) pc[1]);
final PerceptronClass cls = pointClass.getSecondObject();
switch (cls) {
case TRUE:
img.drawShapeFilled(new Circle(point, 5), RGBColour.GREEN);
break;
case FALSE:
img.drawShape(new Circle(point, 5), 3, RGBColour.RED);
break;
case NONE:
throw new RuntimeException("NOPE");
}
}
DisplayUtilities.displayName(img, "random");
}
示例4: setup
/**
* 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);
}
示例5: MBFImageConverter
public MBFImageConverter(
final IPixelFormat.Type pictureType, final int pictureWidth,
final int pictureHeight, final int imageWidth, final int imageHeight)
{
super(pictureType, pictureWidth, pictureHeight, imageWidth, imageHeight);
this.bimg.img = new MBFImage(imageWidth, imageHeight, ColourSpace.RGB);
this.buffer = new byte[imageWidth * imageHeight * 3];
}
示例6: KinectRGBVideoStream
/**
* Construct with a reference to the controller
*
* @param controller
* The controller
*/
public KinectRGBVideoStream(KinectController controller) {
super(controller);
fps = 30;
width = 640;
height = 480;
frame = new MBFImage(width, height, ColourSpace.RGB);
callback = new RGBVideoCallback(this);
}
示例7: RGBVideoCallback
public RGBVideoCallback(KinectStream<MBFImage> stream) {
super(stream);
final Pointer<freenect_device> device = stream.controller.device;
libfreenectLibrary.freenect_set_video_mode_proxy(device, freenect_resolution.FREENECT_RESOLUTION_MEDIUM,
freenect_video_format.FREENECT_VIDEO_RGB);
buffer = ByteBuffer.allocateDirect(libfreenectLibrary.freenect_get_video_buffer_size(device));
libfreenectLibrary.freenect_set_video_buffer(device, Pointer.pointerToBuffer(buffer));
nextFrame = new MBFImage(stream.width, stream.height, ColourSpace.RGB);
libfreenectLibrary.freenect_set_video_callback(device, toPointer());
libfreenectLibrary.freenect_start_video(device);
}
示例8: displayEllipsesZoomed
@SuppressWarnings("unused")
private static void displayEllipsesZoomed(Ellipse ellipse1, Ellipse ellipse2) {
final int zoomHeight = 400;
final int zoomWidth = 400;
final int midzoomx = zoomWidth / 2;
final int midzoomy = zoomHeight / 2;
final double e1Radius = getRadius(ellipse1, 1);
final double scale = (zoomWidth * 0.50) / e1Radius;
final Matrix scaleMatrix = TransformUtilities.scaleMatrixAboutPoint(
1 / scale, 1 / scale, 0, 0);
final MBFImage zoomed = new MBFImage(zoomWidth, zoomHeight, ColourSpace.RGB);
Matrix translateE1 = Matrix.identity(3, 3);
translateE1 = translateE1.times(TransformUtilities
.translateToPointMatrix(new Point2dImpl(0, 0), new Point2dImpl(
midzoomx, midzoomy)));
translateE1 = translateE1.times(scaleMatrix);
translateE1 = translateE1.times(TransformUtilities
.translateToPointMatrix(ellipse1.calculateCentroid(),
new Point2dImpl(0, 0)));
final Ellipse expandedTranslated1 = ellipse1.transformAffine(translateE1);
final Ellipse expandedTranslated2 = ellipse2.transformAffine(translateE1);
zoomed.drawShape(expandedTranslated1, RGBColour.RED);
zoomed.drawShape(expandedTranslated2, RGBColour.BLUE);
DisplayUtilities.displayName(zoomed, "zoomed image");
System.out.println();
}
示例9: renderLayoutInfo
/**
* Render ALL the content boxes to a new image in the given color
* @param color Color
* @return new image illustrating ALL content boxes
*/
public MBFImage renderLayoutInfo(Float[] color) {
int w = browser.getWidth();
int h = browser.getHeight();
//Pixel p = LayoutUtils.renderSize(page.mainFrame());
MBFImage image = new MBFImage(w, h, ColourSpace.RGB);
return renderLayoutInfo(image, color);
}
示例10: renderToImage
/**
* Get a render of the page as an image
* @param width
* @param height
* @return Rendered page image
*/
public MBFImage renderToImage(int width, int height) {
QWebElement ele = webframe.documentElement();
if (ele == null) return null;
QSize size = ele.geometry().size();
if (size.width() < width) width = size.width();
if (size.height() < height) height = size.height();
if (width <= 0 || height <= 0)
return null;
QImage image = new QImage(new QSize(width, height), QImage.Format.Format_ARGB32_Premultiplied);
QPainter p = new QPainter(image);
p.setRenderHint(QPainter.RenderHint.Antialiasing, false);
p.setRenderHint(QPainter.RenderHint.TextAntialiasing, false);
p.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform, false);
ele.render(p);
p.end();
MBFImage mbfimage = new MBFImage(width, height, ColourSpace.RGB);
FImage rf = mbfimage.bands.get(0);
FImage gf = mbfimage.bands.get(1);
FImage bf = mbfimage.bands.get(2);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
int rgb = image.pixel(x, y);
int r = ((rgb >> 16) & 0xff);
int g = ((rgb >> 8) & 0xff);
int b = ((rgb) & 0xff);
rf.pixels[y][x] = r / 255f;
gf.pixels[y][x] = g / 255f;
bf.pixels[y][x] = b / 255f;
}
}
return mbfimage;
}
示例11: read
@Override
public MBFImage read(byte[] record) {
final MBFImage image = new MBFImage(width, height, ColourSpace.RGB);
final float[][] r = image.getBand(0).pixels;
final float[][] g = image.getBand(1).pixels;
final float[][] b = image.getBand(2).pixels;
for (int y = 0, j = 0; y < height; y++) {
for (int x = 0; x < width; x++, j++) {
r[y][x] = ImageUtilities.BYTE_TO_FLOAT_LUT[record[j] & 0xff];
g[y][x] = ImageUtilities.BYTE_TO_FLOAT_LUT[record[j + height * width] & 0xff];
b[y][x] = ImageUtilities.BYTE_TO_FLOAT_LUT[record[j + 2 * height * width] & 0xff];
}
}
return image;
}
示例12: displayEllipsesFull
@SuppressWarnings("unused")
private void displayEllipsesFull(Ellipse ellipse1, Ellipse ellipse2) {
final MBFImage debugDisplay = new MBFImage(this.imageWidth, this.imageHeight,
ColourSpace.RGB);
debugDisplay.drawShape(ellipse1, RGBColour.RED);
debugDisplay.drawShape(ellipse2, RGBColour.BLUE);
debugDisplay
.drawShape(
ellipse2.calculateRegularBoundingBox().union(
ellipse1.calculateRegularBoundingBox()),
RGBColour.BLUE);
DisplayUtilities.displayName(debugDisplay, "debug display full");
}
示例13: main
public static void main(String[] args) throws MalformedURLException, IOException {
// Load the image
FImage img = ImageUtilities.readF(new URL("file:///Users/ss/Desktop/Barack-Obama-02.jpg"));
img.processInplace(new ResizeProcessor(640, 480));
MBFImage mbfAll = new MBFImage(img.width*3, img.height, ColourSpace.RGB);
MBFImage mbf;
// A simple Haar-Cascade face detector
HaarCascadeDetector det1 = new HaarCascadeDetector();
DetectedFace face1 = det1.detectFaces(img).get(0);
mbf = MBFImage.createRGB(img);
new SimpleDetectedFaceRenderer().drawDetectedFace(mbf,10,face1);
mbfAll.drawImage(mbf, 0, 0);
// Get the facial keypoints
FKEFaceDetector det2 = new FKEFaceDetector();
KEDetectedFace face2 = det2.detectFaces(img).get(0);
mbf = MBFImage.createRGB(img);
new KEDetectedFaceRenderer().drawDetectedFace(mbf,10,face2);
mbfAll.drawImage(mbf, img.width, 0);
// With the CLM Face Model
CLMFaceDetector det3 = new CLMFaceDetector();
CLMDetectedFace face3 = det3.detectFaces(img).get(0);
mbf = MBFImage.createRGB(img);
new CLMDetectedFaceRenderer().drawDetectedFace(mbf,10,face3);
mbfAll.drawImage(mbf, img.width*2, 0);
mbfAll.processInplace(new ResizeProcessor(320,240));
DisplayUtilities.display(mbfAll);
ImageUtilities.write(mbfAll, new File("/Users/ss/Desktop/barack-detected.png"));
}
示例14: startSession
protected synchronized boolean startSession(int requestedWidth, int requestedHeight, double requestedFPS) {
final int millisPerFrame = requestedFPS == 0 ? 0 : (int) (1000.0 / requestedFPS);
if (grabber.startSession(requestedWidth, requestedHeight, millisPerFrame)) {
width = grabber.getWidth();
height = grabber.getHeight();
frame = new MBFImage(width, height, ColourSpace.RGB);
isStopped = false;
return true;
}
return false;
}
示例15: drawTriangles
/**
* @return draw the triangles generated from the data
*/
public MBFImage drawTriangles() {
final MBFImage img = new MBFImage((int) width, (int) height, ColourSpace.RGB);
for (final Triangle tri : this.dataTriangles.triToData.keySet()) {
img.drawShape(tri.transform(TransformUtilities.scaleMatrix(width, height)), RGBColour.RED);
}
return img;
}