本文整理汇总了Java中org.openimaj.image.MBFImage.processInplace方法的典型用法代码示例。如果您正苦于以下问题:Java MBFImage.processInplace方法的具体用法?Java MBFImage.processInplace怎么用?Java MBFImage.processInplace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.MBFImage
的用法示例。
在下文中一共展示了MBFImage.processInplace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Main method
*
* @param args
*/
public static void main(String[] args) {
// Create an image
final 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: main
import org.openimaj.image.MBFImage; //导入方法依赖的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);
}
示例3: extractFeatures
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public List<? extends FeatureVectorProvider<? extends FeatureVector>> extractFeatures(File imageFile) throws IOException {
MBFImage image = ImageUtilities.readMBF(imageFile);
if(image.getWidth() < 50){
throw new IOException("image too small,skipping");
}
image.processInplace(new ResizeProcessor(150));
hm.estimateModel(image);
FeatureVectorProvider<FeatureVector> fvp = new FeatureVectorProvider<FeatureVector>() {
@Override
public FeatureVector getFeatureVector() {
return hm.toSingleHistogram();
}
};
List<FeatureVectorProvider<FeatureVector>> ret = new ArrayList<FeatureVectorProvider<FeatureVector>>();
ret.add(fvp);
return ret ;
}
示例4: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
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"));
}
示例5: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
final MBFImage sourceC = ImageUtilities.readMBF(monaLisaSource);
final MBFImage targetC = ImageUtilities.readMBF(monaLisaTarget);
final FImage source = sourceC.flatten();
final FImage target = targetC.flatten();
final DoGSIFTEngine eng = new DoGSIFTEngine();
final LocalFeatureList<Keypoint> sourceFeats = eng.findFeatures(source);
final LocalFeatureList<Keypoint> targetFeats = eng.findFeatures(target);
final HomographyModel model = new HomographyModel();
final SingleImageTransferResidual2d<HomographyModel> errorModel = new SingleImageTransferResidual2d<HomographyModel>();
final RANSAC<Point2d, Point2d, HomographyModel> ransac = new RANSAC<Point2d, Point2d, HomographyModel>(model,
errorModel, 5f, 1500, new RANSAC.BestFitStoppingCondition(), true);
final ConsistentLocalFeatureMatcher2d<Keypoint> matcher = new ConsistentLocalFeatureMatcher2d<Keypoint>(
new FastBasicKeypointMatcher<Keypoint>(8));
matcher.setFittingModel(ransac);
matcher.setModelFeatures(sourceFeats);
matcher.findMatches(targetFeats);
final Matrix boundsToPoly = model.getTransform().inverse();
final Shape s = source.getBounds().transform(boundsToPoly);
targetC.drawShape(s, 10, RGBColour.BLUE);
final MBFImage matches = MatchingUtilities.drawMatches(sourceC, targetC, matcher.getMatches(), RGBColour.RED);
matches.processInplace(new ResizeProcessor(640, 480));
DisplayUtilities.display(matches);
ImageUtilities.write(matches, new File("/Users/ss/Desktop/keypoint-match-example.png"));
}
示例6: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Main method
*
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// Load the image
final MBFImage image = ImageUtilities.readMBF(new URL("http://static.openimaj.org/media/tutorial/sinaface.jpg"));
// Print colour space
System.out.println(image.colourSpace);
// Display the image
DisplayUtilities.display(image);
DisplayUtilities.display(image.getBand(0), "Red Channel");
// Set blue and green pixels to black, and draw
final MBFImage clone = image.clone();
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
clone.getBand(1).pixels[y][x] = 0;
clone.getBand(2).pixels[y][x] = 0;
}
}
DisplayUtilities.display(clone);
// Find edges
image.processInplace(new CannyEdgeDetector());
DisplayUtilities.display(image);
// Draw some stuff
image.drawShapeFilled(new Ellipse(700f, 450f, 20f, 10f, 0f), RGBColour.WHITE);
image.drawShapeFilled(new Ellipse(650f, 425f, 25f, 12f, 0f), RGBColour.WHITE);
image.drawShapeFilled(new Ellipse(600f, 380f, 30f, 15f, 0f), RGBColour.WHITE);
image.drawShapeFilled(new Ellipse(500f, 300f, 100f, 70f, 0f), RGBColour.WHITE);
image.drawText("OpenIMAJ is", 425, 300, HersheyFont.ASTROLOGY, 20, RGBColour.BLACK);
image.drawText("Awesome", 425, 330, HersheyFont.ASTROLOGY, 20, RGBColour.BLACK);
DisplayUtilities.display(image);
}
示例7: wrap
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Wrap a {@link SinglebandImageProcessor} for {@link FImage}s in a
* {@link ImageProcessor} for {@link MBFImage}s.
*
* @param proc
* the processor to wrap
* @return the wrapped processor
*/
public static ImageProcessor<MBFImage> wrap(final SinglebandImageProcessor<Float, FImage> proc)
{
return new ImageProcessor<MBFImage>() {
@Override
public void processImage(MBFImage image) {
image.processInplace(proc);
}
};
}
示例8: doTutorial
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void doTutorial(MBFImage toDraw) {
toDraw.processInplace(new CannyEdgeDetector());
}
示例9: main
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Build a mosaic
*
* @param args
* ignored
* @throws IOException
*/
public static void main(String args[]) throws IOException {
final ResizeProcessor rp = new ResizeProcessor(800, 600);
final DoGSIFTEngine engine = new DoGSIFTEngine();
final MBFImage imageMiddle = ImageUtilities.readMBF(new File("data/trento-view-1.jpg"));
imageMiddle.processInplace(rp);
final FImage workingImageMiddle = Transforms.calculateIntensityNTSC(imageMiddle);
final LocalFeatureList<Keypoint> middleKP = engine.findFeatures(workingImageMiddle);
final ConsistentLocalFeatureMatcher2d<Keypoint> matcher =
new ConsistentLocalFeatureMatcher2d<Keypoint>(new FastBasicKeypointMatcher<Keypoint>(8));
final HomographyModel model = new HomographyModel();
final RANSAC<Point2d, Point2d, HomographyModel> modelFitting =
new RANSAC<Point2d, Point2d, HomographyModel>(model,
new SingleImageTransferResidual2d<HomographyModel>(), 8.0, 1600,
new RANSAC.BestFitStoppingCondition(), true);
matcher.setFittingModel(modelFitting);
matcher.setModelFeatures(middleKP);
final ProjectionProcessor<Float[], MBFImage> ptp = new ProjectionProcessor<Float[], MBFImage>();
imageMiddle.accumulateWith(ptp);
final MBFImage imageRight = ImageUtilities.readMBF(new File("data/trento-view-0.jpg"));
imageRight.processInplace(rp);
final FImage workingImageRight = Transforms.calculateIntensityNTSC(imageRight);
final LocalFeatureList<Keypoint> rightKP = engine.findFeatures(workingImageRight);
matcher.findMatches(rightKP);
ptp.setMatrix(model.getTransform());
imageRight.accumulateWith(ptp);
final MBFImage imageLeft = ImageUtilities.readMBF(new File("data/trento-view-2.jpg"));
imageLeft.processInplace(rp);
final FImage workingImageLeft = Transforms.calculateIntensityNTSC(imageLeft);
final LocalFeatureList<Keypoint> leftKP = engine.findFeatures(workingImageLeft);
matcher.findMatches(leftKP);
ptp.setMatrix(model.getTransform());
imageLeft.accumulateWith(ptp);
final MBFImage projected = ptp.performBlendedProjection(
(-imageMiddle.getWidth()),
imageMiddle.getWidth() + imageMiddle.getWidth(),
-imageMiddle.getHeight() / 2, 3 * imageMiddle.getHeight() / 2, (Float[]) null);
DisplayUtilities.display(projected);
ImageUtilities.write(projected, "png", new File("/Users/jsh2/Desktop/mosaic.png"));
}