Package gov.nih.mipav.model.algorithms
Class libdt
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.libdt
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
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]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classstatic enumregularization method.static enumtype of covariance matrix.class(package private) classStructure to represent Dat file Descriptor parametersclassDynamic Texture class.(package private) classclass for running the Kalman filter for dynamic texture inference.classclassclassClass for specifying the regularization methods for a Dytex.class(package private) class(package private) class(package private) static enumclassprivate classprivate classstatic enumclass(package private) static enumNormalization mode for each patch.(package private) classClass for extracting spatio-temporal patches (cubes) from a video (batch mode).(package private) classClass for extracting spatio-temporal patches (cubes) from a video (online mode).(package private) classClass for specifying spatio-temporal patches (cubes).(package private) classstatic enumstatic enumstatic enumstatic enum(package private) class(package private) classstatic enumOptions for modeling the observation mean, Ymean.Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]byte array for double *private final byte[]byte array for int *private final byte[]byte array for long *private final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate final intprivate booleanprivate booleanprivate libdt.Mat[][]private double[][]private final intprivate RandomAccessFileFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanaddFrames(libdt.PatchExtractor pe, libdt.Mat[] invid) (package private) void(package private) voidcalculate(libdt.CovMatrix cov, libdt.Mat data, boolean use_unbiased) (package private) intcheckOptionInStr(String str, String opt) (package private) voidprivate voidcomputeAggregateStats(libdt.Estats Estat, libdt.Mat W) private voidcomputeEll(libdt.Estats Estat) (package private) void(package private) doublecomputeVariance3dDouble(libdt.Mat[] input) (package private) libdt.Matconvertmovie(libdt.Mat[] Y, int[] sx, int[] sy, int[] sc, int[] cnorm) private voidcopyFromSrcColRange(libdt.Mat A, libdt.Mat B, int inclusiveStart, int exclusiveEnd) private voidprivate voidprivate voidcopyToDstColRange(libdt.Mat A, libdt.Mat B, int inclusiveStart, int exclusiveEnd) intprivate libdt.Mat[]create(int frames, int rows, int cols, int type) (package private) voiddumpMatSize(libdt.Mat[] m) voiddytex_kalman(libdt.Mat[] Y2, libdt.Dytex dt, String opt, Vector<libdt.Mat> xt, libdt.Mat[] Vt, libdt.Mat[] Vt1, libdt.Mat L) private voiddytex_mix_split(libdt.DytexMix dtm, libdt.DytexSplitParams splitopt, int[] ctg, int[] csp) private voiddytex_perturb(libdt.Dytex dtp, double pert, libdt.Split_mode mode, libdt.Split_vars vars) elementTimes(libdt.Mat A, libdt.Mat B) private libdt.MatvoidgetClasses(libdt.DytexMix dtm, Vector<libdt.Mat> Y, libdt.Mat LLm) voidgetClasses(libdt.DytexMix dtm, Vector<libdt.Mat> Y, Vector<Integer> classes) getCov_reg_type(int cov_reg_code) getCov_type(int cov_code) final doublegetDouble(boolean bigEndian) Reads eight unsigned bytes from file.final intgetInt(boolean bigEndian) Reads four signed bytes from file.getNorm_type(int norm_code) private StringgetTime()getYmean_type(int Ymean_code) private libdt.Dytex(package private) libdt.Dytexinitcluster_doretto(Vector<libdt.Mat> Y, libdt.DytexOptions param) private booleaninp_minbnd(double[][] arr, double min_bnd) private booleaninp_minbnd(double[] arr, double min_bnd) (package private) libdt.CovMatrixinv(libdt.CovMatrix cov) (package private) void(package private) void(package private) voidlearnDTM(libdt.VidSegm tvs, String vpath, boolean dosegm) (package private) voidlearnLeastSquares(libdt.Dytex mydt, Vector<libdt.Mat> videos) (package private) void(package private) voidlearnWithSplitting(libdt.DytexMix dtm, Vector<libdt.Mat[]> Yin, libdt.EMOptions emopt) (package private) libdt.Mat[](package private) libdt.DatDescriptorloaddatinfo(String filename, int verbose) (package private) double(package private) libdt.Mat(package private) libdt.Matmask2Border(libdt.Mat mask, int border, byte[] mask_flag) (package private) libdt.Mat[]maxvotefilt(libdt.Mat[] I, int sx, int sy, int sz, int numclass) (package private) double(package private) double(package private) voidmulTransposed(libdt.Mat src, libdt.Mat dst, boolean transposeFirst) (package private) double(package private) voidpostmultiply(libdt.CovMatrix cov, libdt.Mat src, libdt.Mat dst) private void(package private) void(package private) void(package private) voidprocessVideoTesting(libdt.Dytex dt, libdt.Mat vin, libdt.Mat Yout) (package private) voidprocessVideoTraining(libdt.Dytex mydt, libdt.Mat vin, libdt.Mat Yout, libdt.Mat Yout_mean) voidread(libdt.CovMatrix cm) voidread(libdt.Dytex dt) voidread(libdt.DytexMix dtm) voidread(libdt.DytexOptions opt) voidvoidvoidvoidvoidvoidvoidread(javax.vecmath.Point3i p) (package private) voidreadGtruthFile(String fpath, Vector<String> vlist, Vector<Vector<String>> annlist, Vector<String> taglist) voidreadHeader(String str) (package private) voidreadTrialInfo(String fpath, Vector<Vector<Integer>> trainVidIds, Vector<Vector<Integer>> testVidIds) (package private) voidreadVecDouble(String name, Vector<Double> vec) voidreadVectorString(String name, Vector<String> vec) (package private) voidreadVecVecDouble(String name, Vector<Vector<Double>> vec) private voidprivate voidprivate libdt.DytexMixreduceWithSplitting(libdt.DytexMix dtm, libdt.HEMOptions hopt) private voidprivate voidregularize(libdt.Dytex dy, boolean regA) voidprivate voidprivate voidresizeDouble(Vector<Double> doubleVec, int n) void#include#include #include #include #include #includeinvalid input: '<'math.h> #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; (package private) voidrunEM(libdt.DytexMix dtm, Vector<libdt.Mat[]> Yin, libdt.EMOptions emopt) private voidrunHEM(libdt.DytexMix dtm, libdt.DytexMix hembest, libdt.HEMOptions hopt, Vector<Integer> classes) (package private) void(package private) libdt.Mat[]segm_mask(libdt.PatchBatchExtractor pbe, Vector<Integer> oldclasses) (package private) libdt.Mat[](package private) libdt.Mat[]segmentVideo(libdt.VidSegm vs, libdt.Mat[] vid, int stepxy, int stepz, int filtxy, int filtz, libdt.Mat[] osmaskout) voidsegmentVideoSequence(libdt.VidSegm vs, Vector<String> paths, int stepxy, int stepz, int filtxy, int filtz, String vidPath2) private voidsetRegularizer(libdt.CovMatrix cov, libdt.cov_reg_type regopt, double regval) private voidsetRegularizer(libdt.Dytex dy, libdt.DytexRegOptions dtreg) (package private) voidsetupKFB(libdt.DytexMix dtm, int tau) (package private) String[](package private) libdt.Mat[](package private) libdt.Mat[](package private) libdt.Mat[]subvid(libdt.Mat[] vid, libdt.Range box_z, libdt.Range box_y, libdt.Range box_x) doublevoidvoidtest_HEM()voidinttest_videoSegm(String paramFile) (package private) libdt.Mat(package private) long(package private) longdouble(package private) libdt.Matvoidwrite(libdt.CovMatrix cm) voidwrite(libdt.Dytex dt) voidwrite(libdt.DytexMix dtm) voidwrite(libdt.DytexOptions opt) voidvoidvoidvoidvoidvoidvoidwrite(javax.vecmath.Point3i p) final voidwriteDouble(double data, boolean bigEndian) Writes a double as eight bytes to a file.longwriteHeader(String str) final voidwriteInt(int data, boolean bigEndian) Writes an int as four bytes to a file.final voidwriteLong(long data, boolean bigEndian) Writes a long as eight bytes to a file.voidwriteSize(long spos) voidwriteVecDouble(String name, Vector<Double> vec) voidwriteVecVecDouble(String name, Vector<Vector<Double>> vec) private doublezabs(double zr, double zi) zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
raFile
-
endian
private boolean endian -
byteIntBuffer
private final byte[] byteIntBufferbyte array for int * -
byteDoubleBuffer
private final byte[] byteDoubleBufferbyte array for double * -
byteLongBuffer
private final byte[] byteLongBufferbyte array for long * -
CV_8U
private final int CV_8U- See Also:
-
CV_8UC1
private final int CV_8UC1- See Also:
-
CV_8UC
private final int CV_8UC- See Also:
-
CV_64F
private final int CV_64F- See Also:
-
CV_64FC1
private final int CV_64FC1- See Also:
-
CV_64FC
private final int CV_64FC- See Also:
-
CV_64FC3
private final int CV_64FC3- See Also:
-
CV_REDUCE_SUM
private final int CV_REDUCE_SUM- See Also:
-
CV_REDUCE_AVG
private final int CV_REDUCE_AVG- See Also:
-
CV_REDUCE_MAX
private final int CV_REDUCE_MAX- See Also:
-
CV_REDUCE_MIN
private final int CV_REDUCE_MIN- See Also:
-
MAXCOL
private final int MAXCOL- See Also:
-
g_mask_lut
-
g_rgbtable
private double[][] g_rgbtable -
debug
private boolean debug
-
-
Constructor Details
-
libdt
public libdt()
-
-
Method Details
-
runAlgorithm
public void runAlgorithm()#include#include #include #include #include #includeinvalid input: '<'math.h> #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:
runAlgorithmin classAlgorithmBase
-
getTime
-
test_HEM
public void test_HEM() -
reduceWithSplitting
-
runHEM
private void runHEM(libdt.DytexMix dtm, libdt.DytexMix hembest, libdt.HEMOptions hopt, Vector<Integer> classes) -
computeAggregateStats
-
logtrick
-
computeEll
-
subvid
-
subvid
-
subvid
-
reduce
-
reduce
-
logdetiid
-
frame
-
create
-
setRegularizer
-
setRegularizer
-
regularize
-
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- doublezi- double- Returns:
- double
-
regularize
-
inp_minbnd
private boolean inp_minbnd(double[] arr, double min_bnd) -
inp_minbnd
private boolean inp_minbnd(double[][] arr, double min_bnd) -
init_multiple_dt
-
dytex_mix_split
private void dytex_mix_split(libdt.DytexMix dtm, libdt.DytexSplitParams splitopt, int[] ctg, int[] csp) -
dytex_perturb
private void dytex_perturb(libdt.Dytex dtp, double pert, libdt.Split_mode mode, libdt.Split_vars vars) -
ppertC
-
copyTo
-
copyTo
-
copyToDstColRange
-
copyFromSrcColRange
-
getYmean_type
-
getCov_type
-
getCov_reg_type
-
toFullMatrix
-
inv
-
postmultiply
-
plus
-
plus
-
divide
-
minus
-
minus
-
elementTimes
-
times
-
times
-
times
-
divide
-
transpose
-
col
-
sum
-
countNonZero
-
clone
-
trace
-
repeat
-
repeat
-
scaleRows
-
read
-
write
-
read
-
readVecDouble
-
writeVecDouble
-
readVecVecDouble
-
writeVecVecDouble
-
readVectorString
-
write
-
read
-
write
-
read
-
write
-
read
-
write
-
writeDouble
Writes a double as eight bytes to a file.- Parameters:
data- Data to be written to file.bigEndian-trueindicates big endian byte order,falseindicates little endian.- Throws:
IOException- if there is an error writing the file
-
writeLong
Writes a long as eight bytes to a file.- Parameters:
data- Data to be written to file.bigEndian-trueindicates big endian byte order,falseindicates little endian.- Throws:
IOException- if there is an error writing the file
-
read
-
write
-
read
public void read(javax.vecmath.Point3i p) -
write
public void write(javax.vecmath.Point3i p) -
read
-
write
-
read
-
write
-
read
-
write
-
writeSize
public void writeSize(long spos) -
read
-
write
-
readHeader
-
writeHeader
-
writeInt
Writes an int as four bytes to a file.- Parameters:
data- Data to be written to file.bigEndian-trueindicates big endian byte order,falseindicates little endian.- Throws:
IOException- if there is an error writing the file
-
resize
-
resizeDouble
-
getInt
Reads four signed bytes from file.- Parameters:
bigEndian-trueindicates big endian byte order,falseindicates little endian.- Returns:
- The value of the integer read from the file.
- Throws:
IOException- if there is an error reading the file
-
getDouble
Reads eight unsigned bytes from file.- Parameters:
bigEndian-trueindicates big endian byte order,falseindicates little endian.- Returns:
- The value of the double read from the file.
- Throws:
IOException- if there is an error reading the file
-
test_videoSegm
-
getNorm_type
-
learnDTM
-
loaddat
-
checkOptionInStr
-
loaddatinfo
-
strtok2
-
getPatches
-
addFrames
-
processNextPatch
-
norm2
-
total
-
total
-
computeVariance3dDouble
-
dumpMatSize
-
meanOfStdVector
-
minOfStdVector
-
learnWithSplitting
-
runEM
-
convertmovie
-
extractY
-
initcluster_doretto
-
learnLeastSquares
-
processVideoTraining
-
vectorize
-
calculate
-
mulTransposed
-
dytex_kalman
-
setupKFB
-
processVideoTesting
-
segm_mask
-
maxvotefilt
-
colorMask
-
mask2Border
-
segmentVideoSequence
public void segmentVideoSequence(libdt.VidSegm vs, Vector<String> paths, int stepxy, int stepz, int filtxy, int filtz, String vidPath2) -
segmentVideo
libdt.Mat[] segmentVideo(libdt.VidSegm vs, libdt.Mat[] vid, int stepxy, int stepz, int filtxy, int filtz, libdt.Mat[] osmaskout) -
getClasses
-
getClasses
-
segm_mask
-
test_HEMDTM
public void test_HEMDTM() -
learnBaseDTM
void learnBaseDTM() -
learnTagDTM
void learnTagDTM() -
readGtruthFile
-
readTrialInfo
-
getTagVids
-
annotateVideos
void annotateVideos() -
computePrecisionRecall
void computePrecisionRecall() -
printResults
void printResults() -
plus
-
test_BoSClassification
public void test_BoSClassification() -
learnBaseDTMBoS
void learnBaseDTMBoS()
-