/** * Images are resized so as not to exceed the {@link DocumentBuilder#MAX_IMAGE_DIMENSION}, after that * features are extracted using the given localFeatureExtractor. * @param image is the image * @param localFeatureExtractor selected local feature extractor * @return the input localFeatureExtractor */ public LocalFeatureExtractor extractLocalFeatures(BufferedImage image, LocalFeatureExtractor localFeatureExtractor) { assert (image != null); // Scaling image is especially with the correlogram features very important! // All images are scaled to guarantee a certain upper limit for indexing. if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { image = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } localFeatureExtractor.extract(image); return localFeatureExtractor; }
/** * Images are resized so as not to exceed the {@link DocumentBuilder#MAX_IMAGE_DIMENSION}, after that * features are extracted using the given localFeatureExtractor. * @param image is the image * @param localFeatureExtractor selected local feature extractor * @return the input localFeatureExtractor */ public LocalFeatureExtractor extractLocalFeatures(BufferedImage image, LocalFeatureExtractor localFeatureExtractor) { assert (image != null); // Scaling image is especially with the correlogram features very important! // All images are scaled to guarantee a certain upper limit for indexing. if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { image = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } localFeatureExtractor.extract(image); return localFeatureExtractor; }
/** * Images are resized so as not to exceed the {@link DocumentBuilder#MAX_IMAGE_DIMENSION}, after that * the feature is extracted using the given globalFeature. * * @param image is the image * @param globalFeature selected global feature * @return the input globalFeature */ public GlobalFeature extractGlobalFeature(BufferedImage image, GlobalFeature globalFeature) { assert (image != null); // Scaling image is especially with the correlogram features very important! // All images are scaled to guarantee a certain upper limit for indexing. if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { image = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(image); return globalFeature; }
/** * Images are resized so as not to exceed the {@link DocumentBuilder#MAX_IMAGE_DIMENSION}, after that * the feature is extracted using the given globalFeature. * * @param image is the image * @param globalFeature selected global feature * @return the input globalFeature */ public GlobalFeature extractGlobalFeature(BufferedImage image, GlobalFeature globalFeature) { assert (image != null); // Scaling image is especially with the correlogram features very important! // All images are scaled to guarantee a certain upper limit for indexing. if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { image = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(image); return globalFeature; }
if (tmp.getHeight() > 200) { double factor = 200d / ((double) tmp.getHeight()); tmp = ImageUtils.scaleImage(tmp, (int) (tmp.getWidth() * factor), 200);
if (tmp.getHeight() > 200) { double factor = 200d / ((double) tmp.getHeight()); tmp = ImageUtils.scaleImage(tmp, (int) (tmp.getWidth() * factor), 200);
public ImageSearchHits search(BufferedImage image, IndexReader reader, TopDocs results) throws IOException { logger.finer("Starting extraction."); GlobalFeature globalFeature = null; SimpleImageSearchHits searchHits = null; try { globalFeature = (GlobalFeature) descriptorClass.newInstance(); // Scaling image is especially with the correlogram features very important! BufferedImage bimg = image; if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { bimg = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(bimg); logger.fine("Extraction from image finished"); double maxDistance = findSimilar(results, reader, globalFeature); searchHits = new SimpleImageSearchHits(this.docs, maxDistance); } catch (InstantiationException e) { logger.log(Level.SEVERE, "Error instantiating class for generic image searcher: " + e.getMessage()); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, "Error instantiating class for generic image searcher: " + e.getMessage()); } return searchHits; }
public ImageSearchHits search(BufferedImage image, IndexReader reader, TopDocs results) throws IOException { logger.finer("Starting extraction."); GlobalFeature globalFeature = null; SimpleImageSearchHits searchHits = null; try { globalFeature = (GlobalFeature) descriptorClass.newInstance(); // Scaling image is especially with the correlogram features very important! BufferedImage bimg = image; if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { bimg = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(bimg); logger.fine("Extraction from image finished"); double maxDistance = findSimilar(results, reader, globalFeature); searchHits = new SimpleImageSearchHits(this.docs, maxDistance); } catch (InstantiationException e) { logger.log(Level.SEVERE, "Error instantiating class for generic image searcher: " + e.getMessage()); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, "Error instantiating class for generic image searcher: " + e.getMessage()); } return searchHits; }
public double[] getFeature(BufferedImage image) { image = ImageUtils.scaleImage(image, MAX_IMG_HEIGHT); Raster imageRaster = image.getRaster(); int[][] grayLevel = new int[imageRaster.getWidth()][imageRaster.getHeight()];
public ImageSearchHits search(BufferedImage image, IndexReader reader) throws IOException { logger.finer("Starting extraction."); OpponentHistogram globalFeature = null; SimpleImageSearchHits searchHits = null; globalFeature = new OpponentHistogram(); // Scaling image is especially with the correlogram features very important! BufferedImage bimg = image; if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { bimg = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(bimg); logger.fine("Extraction from image finished"); double maxDistance = findSimilar(reader, globalFeature); searchHits = new SimpleImageSearchHits(this.docs, (float) maxDistance); return searchHits; }
public ImageSearchHits search(BufferedImage image, IndexReader reader) throws IOException { logger.finer("Starting extraction."); OpponentHistogram globalFeature = null; SimpleImageSearchHits searchHits = null; globalFeature = new OpponentHistogram(); // Scaling image is especially with the correlogram features very important! BufferedImage bimg = image; if (Math.max(image.getHeight(), image.getWidth()) > DocumentBuilder.MAX_IMAGE_DIMENSION) { bimg = ImageUtils.scaleImage(image, DocumentBuilder.MAX_IMAGE_DIMENSION); } globalFeature.extract(bimg); logger.fine("Extraction from image finished"); double maxDistance = findSimilar(reader, globalFeature); searchHits = new SimpleImageSearchHits(this.docs, (float) maxDistance); return searchHits; }
tmp = ImageUtils.scaleImage(tmp, (int) (tmp.getWidth() * factor), 200);
public double[] getFeature(BufferedImage image) { image = ImageUtils.scaleImage(image, MAX_IMG_HEIGHT); Raster imageRaster = image.getRaster(); int[][] grayLevel = new int[imageRaster.getWidth()][imageRaster.getHeight()];
tmp = ImageUtils.scaleImage(tmp, (int) (tmp.getWidth() * factor), 200);
@Override public void extract(BufferedImage image) { histogram = new double[18]; double[] directionality; ColorConvertOp op = new ColorConvertOp(image.getColorModel().getColorSpace(), ColorSpace.getInstance(ColorSpace.CS_GRAY), new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY)); BufferedImage bimg = op.filter(image, null); bimg = ImageUtils.scaleImage(bimg, MAX_IMG_HEIGHT); Raster raster = bimg.getRaster(); int[] tmp = new int[3]; this.grayScales = new int[raster.getWidth()][raster.getHeight()]; for (int i = 0; i < raster.getWidth(); i++) { for (int j = 0; j < raster.getHeight(); j++) { raster.getPixel(i, j, tmp); this.grayScales[i][j] = tmp[0]; } } imgWidth = bimg.getWidth(); imgHeight = bimg.getHeight(); histogram[0] = this.coarseness(bimg.getWidth(), bimg.getHeight()); histogram[1] = this.contrast(); directionality = this.directionality(); for (int i = 2; i < histogram.length; i++) { histogram[i] = directionality[i - 2]; } }
@Override public void extract(BufferedImage image) { histogram = new double[18]; double[] directionality; ColorConvertOp op = new ColorConvertOp(image.getColorModel().getColorSpace(), ColorSpace.getInstance(ColorSpace.CS_GRAY), new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY)); BufferedImage bimg = op.filter(image, null); bimg = ImageUtils.scaleImage(bimg, MAX_IMG_HEIGHT); Raster raster = bimg.getRaster(); int[] tmp = new int[3]; this.grayScales = new int[raster.getWidth()][raster.getHeight()]; for (int i = 0; i < raster.getWidth(); i++) { for (int j = 0; j < raster.getHeight(); j++) { raster.getPixel(i, j, tmp); this.grayScales[i][j] = tmp[0]; } } imgWidth = bimg.getWidth(); imgHeight = bimg.getHeight(); histogram[0] = this.coarseness(bimg.getWidth(), bimg.getHeight()); histogram[1] = this.contrast(); directionality = this.directionality(); for (int i = 2; i < histogram.length; i++) { histogram[i] = directionality[i - 2]; } }
BufferedImage img = ImageIO.read(b); if (maxSideLength > 50) img = ImageUtils.scaleImage(img, maxSideLength); byte[] tmpBytes = tmp.getFileName().getBytes();
BufferedImage img = ImageIO.read(b); if (maxSideLength > 50) img = ImageUtils.scaleImage(img, maxSideLength); byte[] tmpBytes = tmp.getFileName().getBytes();
int height = 600; image = ImageUtils.scaleImage(image, width, height); image = ImageUtils.get8BitRGBImage(image); BufferedImage bimg = ImageUtils.scaleImage(image, (int) (0.5 * image.getWidth()), (int) (0.5 * image.getHeight())); double[][] smapM = createSmap(bimg, myPMasks.getPmasks(), myPMasks.getMaskWhite()); double[] ThresBigm = filterM(smapM); BufferedImage bimg2 = ImageUtils.scaleImage(bimg, (int) (0.5 * bimg.getWidth()), (int) (0.5 * bimg.getHeight())); double[][] smapS = createSmap(bimg2, myPMasks.getPmasks(), myPMasks.getMaskWhite());
int height = 600; image = ImageUtils.scaleImage(image, width, height); image = ImageUtils.get8BitRGBImage(image); BufferedImage bimg = ImageUtils.scaleImage(image, (int) (0.5 * image.getWidth()), (int) (0.5 * image.getHeight())); double[][] smapM = createSmap(bimg, myPMasks.getPmasks(), myPMasks.getMaskWhite()); double[] ThresBigm = filterM(smapM); BufferedImage bimg2 = ImageUtils.scaleImage(bimg, (int) (0.5 * bimg.getWidth()), (int) (0.5 * bimg.getHeight())); double[][] smapS = createSmap(bimg2, myPMasks.getPmasks(), myPMasks.getMaskWhite());