⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchsemanticdescriptionthread.java

📁 图像检索的代码b
💻 JAVA
字号:
/* * This file is part of Caliph & Emir. * * Caliph & Emir is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Caliph & Emir is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Caliph & Emir; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * Copyright statement: * -------------------- * (c) 2002-2004 by Mathias Lux (mathias@juggle.at) * http://www.juggle.at *//* * Created by Mathias Lux, mathias@juggle.at * User: Mathias Lux, mathias@juggle.at * Date: 09.09.2002 * Time: 20:51:41 */package at.lux.fotoretrieval;import at.lux.components.ProgressWindow;import at.lux.fotoretrieval.panels.ResultsPanel;import at.lux.fotoretrieval.retrievalengines.FileSystemRetrieval;import at.lux.fotoretrieval.retrievalengines.RetrievalEngine;import javax.swing.*;import java.awt.*;import java.text.DecimalFormat;import java.text.NumberFormat;import java.util.Vector;/** * SearchThroughXPathThread * * @author Mathias Lux, mathias@juggle.at */public class SearchSemanticDescriptionThread extends Thread {    String dir, xPath;    boolean recursive;    RetrievalFrame parent;    JProgressBar progress;    DecimalFormat df;    Vector objects;    public SearchSemanticDescriptionThread(String xPath, Vector objects, String directory, boolean descend,                                    RetrievalFrame frame, JProgressBar progress) {        this.xPath = xPath;        this.dir = directory;        this.recursive = descend;        this.parent = frame;        this.progress = progress;        df = (DecimalFormat) NumberFormat.getInstance();        df.setMaximumFractionDigits(2);        this.objects = objects;    }    public void run() {        parent.setEnabled(false);        ProgressWindow pw = new ProgressWindow(parent, progress);        pw.pack();        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();        pw.setLocation((d.width - pw.getWidth()) / 2, (d.height - pw.getHeight()) / 2);        pw.setVisible(true);        long stime,ftime;        stime = System.currentTimeMillis();        parent.setStatus("searching for similar images ...");        debug("XPath statement: " + xPath);        RetrievalEngine engine = new FileSystemRetrieval();        Vector results = new Vector(engine.getImagesBySemantics(xPath, objects, dir, recursive, progress));        stime = System.currentTimeMillis() - stime;        ftime = System.currentTimeMillis();        parent.setStatus("Formatting results ...");        ResultsPanel rp = new ResultsPanel(results, progress, parent.getQualityConstraints());        ftime = System.currentTimeMillis() - ftime;        parent.addResult(rp);        parent.setStatus("Searched for " + df.format(stime / 1000.0) + " s, formatting lasted " + df.format(ftime / 1000.0) + " s");        pw.setVisible(false);        parent.setEnabled(true);    }    private void debug(String message) {        if (RetrievalFrame.DEBUG) {            System.out.println("[at.lux.fotoretrieval.SearchThroughXPathThread] " + message);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -