本文整理汇总了Java中org.openimaj.image.MBFImage.internalAssign方法的典型用法代码示例。如果您正苦于以下问题:Java MBFImage.internalAssign方法的具体用法?Java MBFImage.internalAssign怎么用?Java MBFImage.internalAssign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.MBFImage
的用法示例。
在下文中一共展示了MBFImage.internalAssign方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertColours
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Convert the colour space of an image, maintaining three bands so it can
* be displayed
*
* @param frame
* @param colourSpace
*/
public static void convertColours(MBFImage frame, ColourSpace colourSpace) {
// update the frame from the camera by converting to the selected colour
// space before display
final MBFImage cvt = colourSpace.convert(frame);
// if the converted image has fewer than 3 bands, add more so it can be
// displayed as RGB.
if (cvt.numBands() == 1) {
// this makes a three-band grey-level image, where all the bands are
// the same
cvt.bands.add(cvt.getBand(0).clone());
cvt.bands.add(cvt.getBand(0).clone());
} else if (cvt.numBands() == 2) {
// this adds a third zero band to a two-band image
cvt.bands.add(new FImage(cvt.getWidth(), cvt.getHeight()));
}
// this sets the frame to the colour converted version
frame.internalAssign(cvt);
}
示例2: doTutorial
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void doTutorial(MBFImage toDraw) {
final MBFImage space = ColourSpace.convert(toDraw, ColourSpace.CIE_Lab);
if (cluster == null)
cluster = clusterPixels(space);
if (cluster == null)
return;
final float[][] centroids = cluster.getCentroids();
final ExactFloatAssigner assigner = new ExactFloatAssigner(cluster);
for (int y = 0; y < space.getHeight(); y++) {
for (int x = 0; x < space.getWidth(); x++) {
final float[] pixel = space.getPixelNative(x, y);
final int centroid = assigner.assign(pixel);
space.setPixelNative(x, y, centroids[centroid]);
}
}
toDraw.internalAssign(ColourSpace.convert(space, ColourSpace.RGB));
}
示例3: beforeUpdate
import org.openimaj.image.MBFImage; //导入方法依赖的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});
// }
//
// }
// }
frame.internalAssign(new MBFImage(new FImage[]{guess, guess, guess}));
}
this.polygonListener.drawPoints(frame);
}
示例4: drawDebug
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawDebug(MBFImage image, FImage greyFrame) {
this.polygonListener.drawPoints(image);
final MBFImageRenderer renderer = image.createRenderer();
if (this.initialShape != null) {
renderer.drawPolygon(initialShape, RGBColour.RED);
}
if (this.initialFeatures != null) {
image.internalAssign(MatchingUtilities.drawMatches(image, this.findAllMatchedPairs(), RGBColour.WHITE));
final Matrix esitmatedModel = this.estimateModel();
if (esitmatedModel != null)
{
final Polygon newPolygon = initialShape.transform(esitmatedModel);
renderer.drawPolygon(newPolygon, RGBColour.GREEN);
if (fl.countRemainingFeatures() < nOriginalFoundFeatures * 0.5) {
reinitTracker();
initTracking(greyFrame, newPolygon);
}
}
estimateMovement();
}
}
示例5: beforeUpdate
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void beforeUpdate(MBFImage frame) {
panLabel.setText(String.format("Pan = %04d", pan.getPW()));
tiltLabel.setText(String.format("Tilt = %04d", tilt.getPW()));
final MBFImage outframe = frame.clone();
if (doFaces) {
processFaces(frame, outframe);
}
if (doCounting) {
processCount(frame, outframe);
}
frame.internalAssign(outframe);
}
示例6: drawKeypoints
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawKeypoints(MBFImage frame) {
final MBFImage capImg = frame;
final LocalFeatureList<InterestPointKeypoint<InterestPointData>> kpl = engine.findFeatures(Transforms
.calculateIntensityNTSC(capImg));
this.featureClickListener.setImage(kpl, frame.clone());
final KeypointVisualizer<Float[], MBFImage> kpv = new KeypointVisualizer<Float[], MBFImage>(capImg, kpl);
final InterestPointVisualiser<Float[], MBFImage> ipv = InterestPointVisualiser.visualiseKeypoints(
kpv.drawPatches(null, RGBColour.GREEN), kpl);
frame.internalAssign(ipv.drawPatches(RGBColour.GREEN, RGBColour.BLUE));
}
示例7: drawOverlay
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawOverlay(MBFImage image) {
final ProjectionProcessor<Float[], MBFImage> proc = new ProjectionProcessor<Float[], MBFImage>();
image.accumulateWith(proc);
final Matrix model = this.estimateModel();
if (model != null) {
proc.setMatrix(model);
this.overlayFrame.accumulateWith(proc);
}
image.internalAssign(proc.performProjection());
}
示例8: updateNextFrame
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @see org.openimaj.video.AnimatedVideo#updateNextFrame(org.openimaj.image.Image)
*/
@Override
protected void updateNextFrame( final MBFImage frame )
{
this.visualisationImpl.updateVis();
frame.internalAssign( this.visualisationImpl.getVisualisationImage() );
}
示例9: doTutorial
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void doTutorial(MBFImage toDraw) {
LocalFeatureList<Keypoint> feats = dog.findFeatures(toDraw.flatten());
KeypointVisualizer<Float[],MBFImage> vis = new KeypointVisualizer<Float[],MBFImage>(toDraw, feats);
toDraw.internalAssign(vis.drawCenter(RGBColour.RED));
}
示例10: updateNextFrame
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
protected void updateNextFrame(final MBFImage frame) {
frame.internalAssign(this.create());
}