Package com.alibaba.simpleimage.analyze.harris.io

Examples of com.alibaba.simpleimage.analyze.harris.io.InterestPointListInfo


        int count = 0;
        BufferedImage image;
        for (int i = 0; i < imageCount; i++) {
            String tmp = String.format("ukbench%05d", i);
            String featfile = path + tmp + ".surf";
            InterestPointListInfo info = InterestPointInfoReader.readComplete(featfile);
            List<SURFInterestPoint> surfPoints = null;
            if (info != null) surfPoints = info.getList();
            if (surfPoints == null) {
                try {
                    String imgfile = path + tmp + ".jpg";
                    image = ImageIO.read(new File(imgfile));
                } catch (IOException e) {
                    e.printStackTrace();
                    continue;
                }

                HarrisSurf hs = new HarrisSurf(image);
                hs.getDescriptions(hs.detectInterestPoints(), false);
                surfPoints = hs.getInterestPoints();
                info = new InterestPointListInfo();
                info.setHeight(image.getHeight());
                info.setWidth(image.getWidth());
                info.setList(surfPoints);
                info.setImageFile(tmp + ".jpg");
                InterestPointInfoWriter.writeComplete(featfile, info);
            }

            Iterator<SURFInterestPoint> itr = surfPoints.iterator();
            while (itr.hasNext()) {
View Full Code Here


            System.out.println("Begin to Build Index");
            ie.init(treePath);
            for (int i = 0; i < imageCount; i++) {
                String tmp = String.format("ukbench%05d", i);
                String featfile = path + tmp + ".surf";
                InterestPointListInfo info = InterestPointInfoReader.readComplete(featfile);
                List<SURFInterestPoint> surfPoints = null;
                if (info != null) surfPoints = info.getList();
                ie.buildIndex(surfPoints, i);
            }
            ie.buildWeight();
            ie.saveIndex(indexPath);
            ie.saveHistogram(histogramPath);
View Full Code Here

                    HarrisSurf tempalte_hs = new HarrisSurf(bi);
                    tempalte_hs.getDescriptions(tempalte_hs.detectInterestPoints(), false);
                    al = tempalte_hs.getInterestPoints();
                }
                if (al == null) al = new ArrayList<SURFInterestPoint>();
                InterestPointListInfo ipl = new InterestPointListInfo();
                ipl.setList(al);
                ipl.setWidth(bi == null ? 0 : bi.getWidth());
                ipl.setHeight(bi == null ? 0 : bi.getHeight());
                InterestPointInfoWriter.writeComplete(target, ipl);

                // check
                InterestPointListInfo ipl1 = InterestPointInfoReader.readComplete(target);
                if (ipl.getList().size() != ipl1.getList().size()) {
                    System.out.println("Write failed:" + f.getName());
                }
            }
        }
    }
View Full Code Here

                    HarrisSurf tempalte_hs = new HarrisSurf(bi);
                    tempalte_hs.getDescriptions(tempalte_hs.detectInterestPoints(), true);
                    al = tempalte_hs.getInterestPoints();
                }
                if (al == null) al = new ArrayList<SURFInterestPoint>();
                InterestPointListInfo ipl = new InterestPointListInfo();
                ipl.setList(al);
                ipl.setWidth(bi == null ? 0 : bi.getWidth());
                ipl.setHeight(bi == null ? 0 : bi.getHeight());
                InterestPointInfoWriter.writeComplete(target, ipl);

                // check
                InterestPointListInfo ipl1 = InterestPointInfoReader.readComplete(target);
                if (ipl.getList().size() != ipl1.getList().size()) {
                    System.out.println("Write failed:" + f.getName());
                }
            }
        }
    }
View Full Code Here

        Map<String, BufferedImage> logoImgs = new HashMap<String, BufferedImage>();

        for (File f : fs) {
            String logo_surf_name = f.getName();
            if (!logo_surf_name.endsWith("rsurf")) continue;
            InterestPointListInfo ipl = InterestPointInfoReader.readComplete(f.getAbsolutePath());
            if (f.getName().startsWith("taobao_annual_des_1.png")) // read from a configuration file
            ipl.setMaxSize(30);
            logoPonits.put(logo_surf_name, ipl);

        }
        int q = tfs.length / 10;
        int end = (offset == 9) ? tfs.length : (offset + 1) * q;
        System.out.println("work task from " + (offset * q) + ",end of " + end);
        Color[] cs = { Color.RED, Color.GREEN, Color.BLUE };
        for (int i = offset * q; i < end; i++) {
            File tf = tfs[i];
            if (!tf.getName().endsWith("rsurf")) continue;
            InterestPointListInfo ipl = InterestPointInfoReader.readComplete(tf.getAbsolutePath());

            List<SURFInterestPoint> targetPoint = ipl.getList();
            if (targetPoint.size() < ModifiableConst.getMinPointCount()) continue;
            for (Entry<String, InterestPointListInfo> e : logoPonits.entrySet()) {
                InterestPointListInfo logoipl = e.getValue();
                String logo_surf_name = e.getKey();
                Map<SURFInterestPoint, SURFInterestPoint> matchMap = HarrisSurf.match(logoipl.getList(), targetPoint);
                HarrisSurf.geometricFilter(matchMap, logoipl.getWidth(), logoipl.getHeight());
                HarrisSurf.joinsFilter(matchMap);

                if (matchMap.size() < logoipl.getMaxSize()) continue;
                FileOutputStream fos;
                BufferedImage logo = logoImgs.get(logo_surf_name);
                if (logo == null) {
                    logo = ImageIO.read(new File(logo_img_path + logo_surf_name.replaceFirst(".rsurf", "")));
                    logoImgs.put(logo_surf_name, logo);
View Full Code Here

TOP

Related Classes of com.alibaba.simpleimage.analyze.harris.io.InterestPointListInfo

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.