Class libdt

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class libdt
    extends AlgorithmBase
    libdt - OpenCV library for Dynamic Textures - version 1.0 Copyright (c) 2011-2014 Antoni B. Chan, Adeel Mumtaz, City University of Hong Kong All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither name of copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Modeling, clustering, and segmenting video with mixtures of dynamic textures. Antoni B. Chan and Nuno Vasconcelos, IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI), 30(5):909-926, May 2008. Clustering Dynamic Textures with the Hierarchical EM Algorithm for Modeling Video. Adeel Mumtaz, Emanuele Coviello, Gert R.G. Lanckriet, and Antoni B. Chan, IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI), 35(7):1606-1621, Jul 2013. [appendix] A Scalable and Accurate Descriptor for Dynamic Textures using Bag of System Trees. Adeel Mumtaz, Emanuele Coviello, Gert R.G. Lanckriet, and Antoni B. Chan, IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI), 37(4):697-712, Apr 2015. [appendix]
    • Constructor Detail

      • libdt

        public libdt()
    • Method Detail

      • runAlgorithm

        public void runAlgorithm()
        #include #include #include #include #include #include #include #include "opencv/cv.h" #include "opencv/cxcore.h" #include "opencv/highgui.h" #include "options.h" #include "utils/libutils.h" #include "stats/libstats.h" #include "video/libvideo.h" #include "dytex/libdytex.h" #include "platInd/platInd.hpp" #include "bufferer/Bufferer.hpp" using namespace cv; using namespace std;
        Specified by:
        runAlgorithm in class AlgorithmBase
      • getTime

        private java.lang.String getTime()
      • test_HEM

        public void test_HEM()
      • computeEll

        private void computeEll​(libdt.Estats Estat)
      • subvid

        libdt.Mat[] subvid​(libdt.Mat[] vid,
                           int zstart,
                           int zend,
                           int ystart,
                           int yend,
                           int xstart,
                           int xend)
      • subvid

        libdt.Mat[] subvid​(libdt.Mat[] vid,
                           int frange_start_inclusive,
                           int frange_end_exclusive)
      • logdetiid

        double logdetiid​(libdt.Mat Q,
                         double r,
                         int C)
      • create

        private libdt.Mat[] create​(int frames,
                                   int rows,
                                   int cols,
                                   int type)
      • regularize

        private void regularize​(libdt.Dytex dy,
                                boolean regA)
      • zabs

        private double zabs​(double zr,
                            double zi)
        zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.
        Parameters:
        zr - double
        zi - double
        Returns:
        double
      • inp_minbnd

        private boolean inp_minbnd​(double[] arr,
                                   double min_bnd)
      • inp_minbnd

        private boolean inp_minbnd​(double[][] arr,
                                   double min_bnd)
      • copyToDstColRange

        private void copyToDstColRange​(libdt.Mat A,
                                       libdt.Mat B,
                                       int inclusiveStart,
                                       int exclusiveEnd)
      • copyFromSrcColRange

        private void copyFromSrcColRange​(libdt.Mat A,
                                         libdt.Mat B,
                                         int inclusiveStart,
                                         int exclusiveEnd)
      • countNonZero

        public int countNonZero​(libdt.Mat A)
      • trace

        public double trace​(libdt.Mat A)
      • read

        public void read​(java.lang.String name,
                         java.util.Vector<java.lang.Integer> vec)
      • readVecDouble

        void readVecDouble​(java.lang.String name,
                           java.util.Vector<java.lang.Double> vec)
      • writeVecDouble

        public void writeVecDouble​(java.lang.String name,
                                   java.util.Vector<java.lang.Double> vec)
      • readVecVecDouble

        void readVecVecDouble​(java.lang.String name,
                              java.util.Vector<java.util.Vector<java.lang.Double>> vec)
      • writeVecVecDouble

        public void writeVecVecDouble​(java.lang.String name,
                                      java.util.Vector<java.util.Vector<java.lang.Double>> vec)
      • readVectorString

        public void readVectorString​(java.lang.String name,
                                     java.util.Vector<java.lang.String> vec)
      • write

        public void write​(java.lang.String name,
                          java.util.Vector<java.lang.Integer> vec)
      • read

        public void read​(java.lang.String name,
                         double[] val)
      • write

        public void write​(java.lang.String name,
                          double val)
      • writeDouble

        public final void writeDouble​(double data,
                                      boolean bigEndian)
                               throws java.io.IOException
        Writes a double as eight bytes to a file.
        Parameters:
        data - Data to be written to file.
        bigEndian - true indicates big endian byte order, false indicates little endian.
        Throws:
        java.io.IOException - if there is an error writing the file
      • writeLong

        public final void writeLong​(long data,
                                    boolean bigEndian)
                             throws java.io.IOException
        Writes a long as eight bytes to a file.
        Parameters:
        data - Data to be written to file.
        bigEndian - true indicates big endian byte order, false indicates little endian.
        Throws:
        java.io.IOException - if there is an error writing the file
      • read

        public void read​(java.lang.String name,
                         libdt.Mat mtx)
      • write

        public void write​(java.lang.String name,
                          libdt.Mat mtx)
      • read

        public void read​(javax.vecmath.Point3i p)
      • write

        public void write​(javax.vecmath.Point3i p)
      • read

        public void read​(java.lang.String name,
                         boolean[] val)
      • write

        public void write​(java.lang.String name,
                          boolean val)
      • read

        public void read​(java.lang.String name,
                         int[] val)
      • write

        public void write​(java.lang.String name,
                          int val)
      • writeSize

        public void writeSize​(long spos)
      • read

        public void read​(java.lang.String name,
                         byte[] val)
      • write

        public void write​(java.lang.String name,
                          byte val)
      • readHeader

        public void readHeader​(java.lang.String str)
      • writeHeader

        public long writeHeader​(java.lang.String str)
      • writeInt

        public final void writeInt​(int data,
                                   boolean bigEndian)
                            throws java.io.IOException
        Writes an int as four bytes to a file.
        Parameters:
        data - Data to be written to file.
        bigEndian - true indicates big endian byte order, false indicates little endian.
        Throws:
        java.io.IOException - if there is an error writing the file
      • resize

        private void resize​(java.util.Vector<libdt.Mat> matVec,
                            int n)
      • resizeDouble

        private void resizeDouble​(java.util.Vector<java.lang.Double> doubleVec,
                                  int n)
      • getInt

        public final int getInt​(boolean bigEndian)
                         throws java.io.IOException
        Reads four signed bytes from file.
        Parameters:
        bigEndian - true indicates big endian byte order, false indicates little endian.
        Returns:
        The value of the integer read from the file.
        Throws:
        java.io.IOException - if there is an error reading the file
      • getDouble

        public final double getDouble​(boolean bigEndian)
                               throws java.io.IOException
        Reads eight unsigned bytes from file.
        Parameters:
        bigEndian - true indicates big endian byte order, false indicates little endian.
        Returns:
        The value of the double read from the file.
        Throws:
        java.io.IOException - if there is an error reading the file
      • test_videoSegm

        public int test_videoSegm​(java.lang.String paramFile)
      • learnDTM

        void learnDTM​(libdt.VidSegm tvs,
                      java.lang.String vpath,
                      boolean dosegm)
      • loaddat

        libdt.Mat[] loaddat​(java.lang.String filename,
                            java.lang.String opt)
      • checkOptionInStr

        int checkOptionInStr​(java.lang.String str,
                             java.lang.String opt)
      • strtok2

        java.lang.String[] strtok2​(java.lang.String str,
                                   java.lang.String del)
      • computeVariance3dDouble

        double computeVariance3dDouble​(libdt.Mat[] input)
      • dumpMatSize

        void dumpMatSize​(libdt.Mat[] m)
      • meanOfStdVector

        double meanOfStdVector​(java.util.Vector<java.lang.Double> v)
      • minOfStdVector

        double minOfStdVector​(java.util.Vector<java.lang.Double> v)
      • convertmovie

        libdt.Mat convertmovie​(libdt.Mat[] Y,
                               int[] sx,
                               int[] sy,
                               int[] sc,
                               int[] cnorm)
      • extractY

        java.util.Vector<libdt.Mat> extractY​(libdt.Mat[] Yin,
                                             java.util.Vector<java.lang.Integer> inds)
      • learnLeastSquares

        void learnLeastSquares​(libdt.Dytex mydt,
                               java.util.Vector<libdt.Mat> videos)
      • mulTransposed

        void mulTransposed​(libdt.Mat src,
                           libdt.Mat dst,
                           boolean transposeFirst)
      • maxvotefilt

        libdt.Mat[] maxvotefilt​(libdt.Mat[] I,
                                int sx,
                                int sy,
                                int sz,
                                int numclass)
      • segmentVideoSequence

        public void segmentVideoSequence​(libdt.VidSegm vs,
                                         java.util.Vector<java.lang.String> paths,
                                         int stepxy,
                                         int stepz,
                                         int filtxy,
                                         int filtz,
                                         java.lang.String vidPath2)
      • getClasses

        public void getClasses​(libdt.DytexMix dtm,
                               java.util.Vector<libdt.Mat> Y,
                               java.util.Vector<java.lang.Integer> classes)
      • test_HEMDTM

        public void test_HEMDTM()
      • learnBaseDTM

        void learnBaseDTM()
      • learnTagDTM

        void learnTagDTM()
      • readGtruthFile

        void readGtruthFile​(java.lang.String fpath,
                            java.util.Vector<java.lang.String> vlist,
                            java.util.Vector<java.util.Vector<java.lang.String>> annlist,
                            java.util.Vector<java.lang.String> taglist)
      • readTrialInfo

        void readTrialInfo​(java.lang.String fpath,
                           java.util.Vector<java.util.Vector<java.lang.Integer>> trainVidIds,
                           java.util.Vector<java.util.Vector<java.lang.Integer>> testVidIds)
      • getTagVids

        java.util.Vector<java.lang.Integer> getTagVids​(java.util.Vector<java.lang.Integer> trainVidIds,
                                                       java.lang.String tag,
                                                       java.util.Vector<java.util.Vector<java.lang.String>> annlist)
      • annotateVideos

        void annotateVideos()
      • computePrecisionRecall

        void computePrecisionRecall()
      • printResults

        void printResults()
      • plus

        java.util.Vector<java.lang.Double> plus​(java.util.Vector<java.lang.Double> a,
                                                java.util.Vector<java.lang.Double> b)
      • test_BoSClassification

        public void test_BoSClassification()
      • learnBaseDTMBoS

        void learnBaseDTMBoS()