Package com.alibaba.simpleimage.analyze.sift

Examples of com.alibaba.simpleimage.analyze.sift.ImagePixelArray


    public void testRenderImage() throws Exception {

        BufferedImage bi = ImageIO.read(this.getClass().getResource("/test.png"));
        RenderImage ri = new RenderImage(bi);
        ImagePixelArray arr = ri.toPixelFloatArray(null);
        DumpImage.dump(arr, "/Users/axman/Downloads/arr.jpg");
        //arr = arr.doubled();
        Pyramid pyr = new Pyramid();
        pyr.buildOctaves(arr, 0.5f, 3, 1.6f, 32);
       
View Full Code Here


            VERTICAL, HORIZONTAL
        }

        public static ImagePixelArray convolve(ImagePixelArray img, float[] mask) {

            ImagePixelArray im1 = new ImagePixelArray(img.width, img.height);
            ImagePixelArray im2 = new ImagePixelArray(img.width, img.height);
            convolve1D(im1, mask, img, Direction.VERTICAL);
            convolve1D(im2, mask, im1, Direction.HORIZONTAL);
            return im2;
        }
View Full Code Here

        // 对于DOG(差分图像集)我们需要一张以上的图片才能生成差分图,但是查找极值点更多要差分图。见buildDiffMaps
        smoothedImgs = new ImagePixelArray[scales + 3];
        // 每一个极值点是在三维空间中比较获得,即要和它周围8个点和上一幅对应的9个点以及下一幅对应的9个点,因此为了获得scales层点,
        // 那么在差分高斯金字塔中需要有scales+2幅图像,而如果差分图幅数是scales+2,那么8度空间中至少需要scales+2+1幅高斯模糊图像。
        this.baseScale = baseScale;
        ImagePixelArray prev = base;
        smoothedImgs[0] = base;

        float w = sigma;
        float kTerm = (float) Math.sqrt(Math.pow(Math.pow(2.0, 1.0 / scales), 2.0) - 1.0);
        for (int i = 1; i < smoothedImgs.length; i++) {
View Full Code Here

    public ArrayList<ScalePeak> findPeaks(float dogThresh) {

        ArrayList<ScalePeak> peaks = new ArrayList<ScalePeak>();

        ImagePixelArray current, above, below;

        // Search the D(k * sigma) to D(2 * sigma) spaces
        for (int level = 1; level < (this.diffImags.length - 1); level++) {
            current = this.diffImags[level];
            below = this.diffImags[level - 1];
View Full Code Here

    public void pretreatMagnitudeAndDirectionImgs() {

        magnitudes = new ImagePixelArray[this.smoothedImgs.length - 1];// 梯度的数组
        directions = new ImagePixelArray[this.smoothedImgs.length - 1];// 方向的数组
        for (int s = 1; s < (this.smoothedImgs.length - 1); s++) {
            magnitudes[s] = new ImagePixelArray(this.smoothedImgs[s].width, this.smoothedImgs[s].height);
            directions[s] = new ImagePixelArray(this.smoothedImgs[s].width, this.smoothedImgs[s].height);
            int w = smoothedImgs[s].width;
            int h = smoothedImgs[s].height;
            for (int y = 1; y < (h - 1); ++y) {
                for (int x = 1; x < (w - 1); ++x) {
                    magnitudes[s].data[y * w + x] = (float) Math.sqrt(Math.pow(smoothedImgs[s].data[y * w + x + 1]
View Full Code Here

        float sigma = 3.0f * fpScale;
        int radius = (int) (3.0 * sigma / 2.0 + 0.5);
        int radiusSq = radius * radius;

        ImagePixelArray magnitude = magnitudes[point.level];
        ImagePixelArray direction = directions[point.level];
        // 确定邻点范围
        int xMin = Math.max(point.x - radius, 1);
        int xMax = Math.min(point.x + radius, magnitude.width - 1);
        int yMin = Math.max(point.y - radius, 1);
        int yMax = Math.min(point.y + radius, magnitude.height - 1);
View Full Code Here

        while (needToAdjust) {
            int x = peak.x;
            int y = peak.y;
            if (peak.level <= 0 || peak.level >= (this.diffImags.length - 1)) return (true);

            ImagePixelArray space = diffImags[peak.level];
            if (x <= 0 || x >= (space.width - 1)) return (true);
            if (y <= 0 || y >= (space.height - 1)) return (true);

            RefFloat dp = new RefFloat();
            AdjustedArray adj = getAdjustment(peak, peak.level, x, y, dp);
View Full Code Here

        ref.val = 0.0f;
        if (peak.level <= 0 || peak.level >= (this.diffImags.length - 1)) {
            throw (new IllegalArgumentException("point.Level is not within [bottom-1;top-1] range"));
        }
        ImagePixelArray b = this.diffImags[level - 1]; // below
        ImagePixelArray c = this.diffImags[level]; // current
        ImagePixelArray a = this.diffImags[level + 1]; // above

        AdjustedArray h = new AdjustedArray(3, 3);
        /*
         * 下面是该幅图像尺度空间的三元偏导数,尺度空间上的二阶自变量为3的偏导数2006.3.1
         */
 
View Full Code Here

    public ArrayList<OctaveSpace> octaves; // 该塔中一共有几个8度空间

    public int buildOctaves(ImagePixelArray source, float scale, int levelsPerOctave, float octaveSigm, int minSize) {
        this.octaves = new ArrayList<OctaveSpace>();
        OctaveSpace downSpace = null;
        ImagePixelArray prev = source;

        while (prev != null && prev.width >= minSize && prev.height >= minSize) {
            OctaveSpace osp = new OctaveSpace();

            // Create both the gaussian filtered images and the DOG maps
View Full Code Here

    }

    public ImagePixelArray toPixelFloatArray(IPixelConverter converter) {
        int h = this.srcImage.getHeight();
        int w = this.srcImage.getWidth();
        ImagePixelArray res = new ImagePixelArray(w, h);
        int[] pix = srcImage.getRGB(0, 0, w, h, null, 0, w);

        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                int c = pix[x + y * w];
 
View Full Code Here

TOP

Related Classes of com.alibaba.simpleimage.analyze.sift.ImagePixelArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.