Map<String, BufferedImage> logoImgs = new HashMap<String, BufferedImage>();
for (File f : fs) {
String logo_surf_name = f.getName();
if (!logo_surf_name.endsWith("rsurfn")) continue;
InterestPointNListInfo ipl = InterestPointNInfoReader.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("rsurfn")) continue;
InterestPointNListInfo ipl = InterestPointNInfoReader.readComplete(tf.getAbsolutePath());
List<SURFInterestPointN> targetPoint = ipl.getList();
if (targetPoint.size() < ModifiableConst.getMinPointCount()) continue;
for (Entry<String, InterestPointNListInfo> e : logoPonits.entrySet()) {
InterestPointNListInfo logoipl = e.getValue();
String logo_surf_name = e.getKey();
List<SurfMatch> ms = null;
try {
ms = SurfMatchPoints.findMatchesBBF(logoipl.getList(), targetPoint);
} catch (Exception ex) {
ex.printStackTrace();
}
if (ms == null) continue;
ms = SurfMatchPoints.filterFarMatchL(ms, logoipl.getWidth(), logoipl.getHeight());
ms = SurfMatchPoints.filterJoins(ms);
if (ms.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(".rsurfn", "")));
logoImgs.put(logo_surf_name, logo);