diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4d9195 --- /dev/null +++ b/README.md @@ -0,0 +1,131 @@ +MOT - Moving Object Segmentation and Tracking System +___ +####Terms of Use + +Copyright (c) 2003 by DVMM Laboratory + +Department of Electrical Engineering
+Columbia University
+Rm 1312 S.W. Mudd, 500 West 120th Street
+New York, NY 10027
+USA + + +Di Zhong and Shih-Fu Chang, Columbia University +{dzhong,sfchang}@ee.columbia.edu + +####1. SYSTEM OVERVIEW + + +MOT is a moving object segmentation and tracking system for salient objects +over long period in general video sources. The system utilizes innovative +methods of combining color and edge information in improving the object motion +estimation results. It then uses the long-term spatio-temporal constraints to +achieve reliable object tracking over long sequences. + +The system contains two stages. In the first stage, we apply an iterative +motion layer detection process based on the estimation and merging of affine +motion models. Each iteration generates one motion layer. The difference from +existing methods is that motion models are estimated from spatially segmented +color regions instead of just pixels or blocks. In the second stage, temporal +constraints are applied to detect moving objects in spatial and temporal space. +Layers in individual frames are linked together based on characteristics of +their underlying regions. One or more layers will be declared as motion objects +according to specific spatio-temporal consistency rules. + +The input are decoded frames in either PPM, GIF or JPEG format. The system does +not include an interface to decode MPEG video into image files. One can use the +AMOS system to decode MPEG streams and build database of video shots. + +In this binary distribution, we provide the classes for local segmentation and +global detection. We also provide sample Java codes to extract region information +described in OIF files. Before using the system, the video clip should have +been segmented into individual shots and store individual frames in PPM format. + +####2.SYSTEM REQUIREMENT/ INSTALLATION + + +The system is developed in Java language on Sun Solaris 2.5, Windows NT 4.0, +Windows 2000, or Windows XP. It requires following software packages. + +a) JDK 1.1.6+ or 1.2 (with JIT compiler) + + +The final installation will include following directory structure: +00README.txt --- this file +test.db --- an example database file (generate by AMOS) +runmot.bat --- run object tracking for the example database file +image --- general image I/O and processing functions +feature --- segmentation and feature computation +db --- management of video shots and objects +VisualNumerics --- numeric functions from the third party +odet --- main program for object segmentation and tracking +test --- this is the root directory of "test.db" and repository + of frames of a sample shot "1009" +sample --- sample code for extracting region information +makesample.bat --- how to compile the region information sample code +runsample.bat --- execute region information extraction +README_for_db_file --- interpretation of "db" file + + + +####3. USING THE SYSTEM + + +As previously discussed, it include two steps to track moving objects, which +are both provided with binary Java codes. The last step is to extract the +region information, kept in *.OIF files, and is demonstrated in a sample code. + +#####3.1 Local Segmentation + + +Usage: Java odet.ObjectDetection {v.db} {th} {min_size} +where: v.db --- the database file for video shots + th --- the color merging threshold + min_size --- minimum size of tracked regions (in number of pixels) + +This program generates intermedia segmentation results in OIF files, including: +- salient regions +- foreground or background classification at individual frames + +The source video sequences, in PPM formats, are located in ".\test\1009\frames\" and +OIF files are further generated in ".\test\1009\odet\". + +#####3.2 Global Detection + +Usage: java odet.GlobalDetection {v.db} {min_mv} {min_lifespan} +where: v.db --- the database file for video shots + min_mv --- the minimum number of frames with motion + min_lifespan --- the minimum number of total frames + +This program generates final moving object. Outputs are stored to PPM files +under the directory ".\test\1009\odet\" for each image sequence. + +#####3.3 db File + + +The interpretation of the "db" file is exemplified in "README_for_db_file.txt". + +#####3.4 Example + + +[path to Java run time program] java odet.ObjectDetection test.db 20 100 +[path to Java run time program] java odet.GlobalDetection test.db 8 15 + +Please reference "runmot.bat" for these scripts and parameters. Before +executing the program, pease make sure Java environment and corresponding +PATH are well configured. + +####4. Region information extraction + + +Each image will be segmented into regions defined by boundary boxes +and masks and described in *.OIF file. To know how to extract region +information, please reference "RegionInfoDoc.tex" in directory "sample". + + +####5. Misc. + + +Before executing the binary distribution and compiling the sample code, please +MAKE SURE that Java runtime and development enviroment are well configured. \ No newline at end of file diff --git a/README_for_db_file.txt b/README_for_db_file.txt new file mode 100644 index 0000000..c9484e2 --- /dev/null +++ b/README_for_db_file.txt @@ -0,0 +1,21 @@ +// The interpretation of the "test.db" file is as the following +// For simplicity, we suggest using a "db" file for a single shot. +// If there are multiple shots to process, generate *.db files in +// batch. + + +.\test // storing corresponding frames within shots, here shot "1009" only +100000 // next_shotid +1 // number of shots + // one blank row is necessary here. This cannot be omitted. +1009 // shot id (same as folder name under the path designated on the first line) +-UNKNOWN- // video file name (for mpeg2dec. This is not used in MOT) +234300 // start time (not used in MOT) +50 // duration (not used in MOT) +40 // start frame number +30 // number of frames +352 // width of the frame +240 // height of the frame +2 // (not used in MOT) +6002138 // (not used in MOT) + diff --git a/VisualNumerics/math/BLAS.class b/VisualNumerics/math/BLAS.class new file mode 100644 index 0000000..90b2dda Binary files /dev/null and b/VisualNumerics/math/BLAS.class differ diff --git a/VisualNumerics/math/BLASA.class b/VisualNumerics/math/BLASA.class new file mode 100644 index 0000000..af442c2 Binary files /dev/null and b/VisualNumerics/math/BLASA.class differ diff --git a/VisualNumerics/math/Complex.class b/VisualNumerics/math/Complex.class new file mode 100644 index 0000000..78c4aa8 Binary files /dev/null and b/VisualNumerics/math/Complex.class differ diff --git a/VisualNumerics/math/ComplexA.class b/VisualNumerics/math/ComplexA.class new file mode 100644 index 0000000..295347a Binary files /dev/null and b/VisualNumerics/math/ComplexA.class differ diff --git a/VisualNumerics/math/ComplexCholesky.class b/VisualNumerics/math/ComplexCholesky.class new file mode 100644 index 0000000..fb7c92c Binary files /dev/null and b/VisualNumerics/math/ComplexCholesky.class differ diff --git a/VisualNumerics/math/ComplexLU.class b/VisualNumerics/math/ComplexLU.class new file mode 100644 index 0000000..c6ecd0e Binary files /dev/null and b/VisualNumerics/math/ComplexLU.class differ diff --git a/VisualNumerics/math/ComplexMatrix.class b/VisualNumerics/math/ComplexMatrix.class new file mode 100644 index 0000000..bc131c7 Binary files /dev/null and b/VisualNumerics/math/ComplexMatrix.class differ diff --git a/VisualNumerics/math/ComplexQR.class b/VisualNumerics/math/ComplexQR.class new file mode 100644 index 0000000..4d65969 Binary files /dev/null and b/VisualNumerics/math/ComplexQR.class differ diff --git a/VisualNumerics/math/ComplexSVD.class b/VisualNumerics/math/ComplexSVD.class new file mode 100644 index 0000000..695ba10 Binary files /dev/null and b/VisualNumerics/math/ComplexSVD.class differ diff --git a/VisualNumerics/math/ComplexVector.class b/VisualNumerics/math/ComplexVector.class new file mode 100644 index 0000000..e99e764 Binary files /dev/null and b/VisualNumerics/math/ComplexVector.class differ diff --git a/VisualNumerics/math/DoubleCholesky.class b/VisualNumerics/math/DoubleCholesky.class new file mode 100644 index 0000000..18b14d7 Binary files /dev/null and b/VisualNumerics/math/DoubleCholesky.class differ diff --git a/VisualNumerics/math/DoubleLU.class b/VisualNumerics/math/DoubleLU.class new file mode 100644 index 0000000..ff6bc89 Binary files /dev/null and b/VisualNumerics/math/DoubleLU.class differ diff --git a/VisualNumerics/math/DoubleMatrix.class b/VisualNumerics/math/DoubleMatrix.class new file mode 100644 index 0000000..91fc35f Binary files /dev/null and b/VisualNumerics/math/DoubleMatrix.class differ diff --git a/VisualNumerics/math/DoubleQR.class b/VisualNumerics/math/DoubleQR.class new file mode 100644 index 0000000..bfd7778 Binary files /dev/null and b/VisualNumerics/math/DoubleQR.class differ diff --git a/VisualNumerics/math/DoubleSVD.class b/VisualNumerics/math/DoubleSVD.class new file mode 100644 index 0000000..3f94f1b Binary files /dev/null and b/VisualNumerics/math/DoubleSVD.class differ diff --git a/VisualNumerics/math/DoubleVector.class b/VisualNumerics/math/DoubleVector.class new file mode 100644 index 0000000..98b8b6c Binary files /dev/null and b/VisualNumerics/math/DoubleVector.class differ diff --git a/VisualNumerics/math/MathException.class b/VisualNumerics/math/MathException.class new file mode 100644 index 0000000..8fff7b7 Binary files /dev/null and b/VisualNumerics/math/MathException.class differ diff --git a/VisualNumerics/math/Sfun.class b/VisualNumerics/math/Sfun.class new file mode 100644 index 0000000..ccbfd2d Binary files /dev/null and b/VisualNumerics/math/Sfun.class differ diff --git a/VisualNumerics/math/Statistics.class b/VisualNumerics/math/Statistics.class new file mode 100644 index 0000000..ceab350 Binary files /dev/null and b/VisualNumerics/math/Statistics.class differ diff --git a/db/ObjectFeature.class b/db/ObjectFeature.class new file mode 100644 index 0000000..924ded8 Binary files /dev/null and b/db/ObjectFeature.class differ diff --git a/db/RegionFeature.class b/db/RegionFeature.class new file mode 100644 index 0000000..f2ad3ae Binary files /dev/null and b/db/RegionFeature.class differ diff --git a/db/StructureFeature.class b/db/StructureFeature.class new file mode 100644 index 0000000..09e5034 Binary files /dev/null and b/db/StructureFeature.class differ diff --git a/db/VideoDB.class b/db/VideoDB.class new file mode 100644 index 0000000..fb7b28f Binary files /dev/null and b/db/VideoDB.class differ diff --git a/db/VideoObject.class b/db/VideoObject.class new file mode 100644 index 0000000..222b1ee Binary files /dev/null and b/db/VideoObject.class differ diff --git a/db/VideoRegion.class b/db/VideoRegion.class new file mode 100644 index 0000000..73ee400 Binary files /dev/null and b/db/VideoRegion.class differ diff --git a/db/VideoShot.class b/db/VideoShot.class new file mode 100644 index 0000000..5f1fbdc Binary files /dev/null and b/db/VideoShot.class differ diff --git a/feature/AffineModel.class b/feature/AffineModel.class new file mode 100644 index 0000000..1fcfa15 Binary files /dev/null and b/feature/AffineModel.class differ diff --git a/feature/EdgeMap.class b/feature/EdgeMap.class new file mode 100644 index 0000000..af93cee Binary files /dev/null and b/feature/EdgeMap.class differ diff --git a/feature/OpticalFlow.class b/feature/OpticalFlow.class new file mode 100644 index 0000000..f834c3b Binary files /dev/null and b/feature/OpticalFlow.class differ diff --git a/feature/RegionInfo.class b/feature/RegionInfo.class new file mode 100644 index 0000000..0cb1d25 Binary files /dev/null and b/feature/RegionInfo.class differ diff --git a/feature/Segment.class b/feature/Segment.class new file mode 100644 index 0000000..75d9dfc Binary files /dev/null and b/feature/Segment.class differ diff --git a/feature/Snake.class b/feature/Snake.class new file mode 100644 index 0000000..a63f332 Binary files /dev/null and b/feature/Snake.class differ diff --git a/image/ImageData.class b/image/ImageData.class new file mode 100644 index 0000000..7c5e964 Binary files /dev/null and b/image/ImageData.class differ diff --git a/image/ImageIO.class b/image/ImageIO.class new file mode 100644 index 0000000..73bcc41 Binary files /dev/null and b/image/ImageIO.class differ diff --git a/image/ImageProc.class b/image/ImageProc.class new file mode 100644 index 0000000..8da1f12 Binary files /dev/null and b/image/ImageProc.class differ diff --git a/image/IndexSortable.class b/image/IndexSortable.class new file mode 100644 index 0000000..db0deaa Binary files /dev/null and b/image/IndexSortable.class differ diff --git a/image/IntVector.class b/image/IntVector.class new file mode 100644 index 0000000..1ee02de Binary files /dev/null and b/image/IntVector.class differ diff --git a/image/Mask.class b/image/Mask.class new file mode 100644 index 0000000..affb44d Binary files /dev/null and b/image/Mask.class differ diff --git a/image/PubFunc.class b/image/PubFunc.class new file mode 100644 index 0000000..95a46cb Binary files /dev/null and b/image/PubFunc.class differ diff --git a/image/Sortable.class b/image/Sortable.class new file mode 100644 index 0000000..047c8b9 Binary files /dev/null and b/image/Sortable.class differ diff --git a/image/XPolygon.class b/image/XPolygon.class new file mode 100644 index 0000000..baf5894 Binary files /dev/null and b/image/XPolygon.class differ diff --git a/image/luv4096.dat b/image/luv4096.dat new file mode 100644 index 0000000..f916fb2 Binary files /dev/null and b/image/luv4096.dat differ diff --git a/mksample.bat b/mksample.bat new file mode 100755 index 0000000..1d8e3ca --- /dev/null +++ b/mksample.bat @@ -0,0 +1,2 @@ +javac -O -d . sample\SampleRegionInfo.java + diff --git a/odet/GlobalDetection.class b/odet/GlobalDetection.class new file mode 100644 index 0000000..93ec370 Binary files /dev/null and b/odet/GlobalDetection.class differ diff --git a/odet/ObjectDetection.class b/odet/ObjectDetection.class new file mode 100644 index 0000000..cc10a22 Binary files /dev/null and b/odet/ObjectDetection.class differ diff --git a/runmot.bat b/runmot.bat new file mode 100755 index 0000000..c5950d8 --- /dev/null +++ b/runmot.bat @@ -0,0 +1,2 @@ +java odet.ObjectDetection test.db 20 100 +java odet.GlobalDetection test.db 8 15 diff --git a/runsample.bat b/runsample.bat new file mode 100755 index 0000000..43e09ce --- /dev/null +++ b/runsample.bat @@ -0,0 +1 @@ +java sample.SampleRegionInfo .\test 1009 diff --git a/sample/RegionInfoDoc.txt b/sample/RegionInfoDoc.txt new file mode 100644 index 0000000..747262e --- /dev/null +++ b/sample/RegionInfoDoc.txt @@ -0,0 +1,222 @@ +[Usage of region information] + +Each image will be segmented into regions defined by boundary boxes +and masks and described in *.OIF file. To know how to extract region +information please reference the sample code "SampleRegionInfo.java" and +"RegionInfoDoc.txt". + +* Sample code + sample.SampleRegionInfo + Each image will be segmented into regions defined by boundary boxes + and masks and are described in *.oif files. This program shows how + to extract region information from *.oif files. + + This program is complied with ..\mksample.bat, and it is run with ..\runsample.bat. + ** Please make sure the Java environment is well configured. + +* Explanation about RegionInfo class + Region information can be handled using RegionInfo class. The following + is the explanation about the class. + +1. Members + + public int id -- region id + public int pixelnum -- number of pixels within the region + public float[] feat1 -- mean color of the region (feat1[0]:L, feat1[1]:u, feat1[2]:v ) + public float[] feat2 -- motion parameters of the region. motion is compensated by the following equation: + x= feat2[0] + feat2[1] * x0 + feat2[2] * y0 + feat2[6] * x0 * x0 + feat2[7] * x0 * y0 + x0, + y= feat2[3] + feat2[4] * x0 + feat2[5] * y0 + feat2[6] * x0 * y0 + feat2[7] * y0 * y0 + y0 + where (x0,y0) is a point in the current region and (x,y) is its corresponding point in the next frame. + public Point ul -- the coordinate of the upper-left corner of the bounding box + public Point lr -- the coordinate of the lower-right corner of the bounding box + public Hashtable con_regs -- List of the adjoining regions. + public boolean[][] mask -- Mask information indicating the region shape. The mask size is the same as the bounding box of the region. Hence mask[0][0] indicates the mask information at the upper-left point of bounding box. + public int tag -- This can be used for several way. In the Object/GlobalDetection, tag is used for distinguishing + foreground and background regions. If tag = 1, the region indicates foreground, otherwise, background. + + +2. Methods + +public RegionInfo(int id, float[] clr, int x, int y) + Arguments: + int id -- region ID. + float[] clr -- the Luv value for the pixel at (x,y). + int x -- x coordinate of the pixel included in the region + int y -- y coordinate of the pixel included in the region + Explanation: + Constructor of RegionInfo object. This makes RegionInfo object for the region including a single pixel (x,y). +------------------------------------------------------------------------------------------- +public RegionInfo(RegionInfo r) + Arguments: + RegionInfo r -- region information to be copied + Explanation: + Copy constructor of RegionInfo object. +------------------------------------------------------------------------------------------- +public static final RegionInfo[] read(String fname) + Arguments: + String fileName -- The OIF file name from which the region information is read. + Returned values: + Array of RegionInfo objects, each of which indicates a region in the image. + Explanation: + This method reads region information from the file designated by fname, and return the array of RegionInfo objects. +------------------------------------------------------------------------------------------- +public static final void write(String fname, RegionInfo[] rlist, int nextid, int fw, int fh, float[] gm_param ) + Arguments: + String fname -- The OIF file name to which the region information is written. + RegionInfo[] rlist -- The array of region information + int nextid -- next region id (Currently this is not used, so any positive integer is all right) + int fw -- frame width (Currently this is not used, so any positive integer is all right) + int fh -- frame height (Currently this is not used, so any positive integer is all right) + float[] gm_param -- global motion parameters (Currently this is not used, but memory for these parameters should be allocated before calling. See the sample code.) + Returned values: + None + Explanation: + This method writes the array of region information rlist to the file designated by fname. +------------------------------------------------------------------------------------------- +public final int perimeter() + Arguments: + None + Returned values: + The perimeter of this region + Explanation: + This method finds the perimeter of this region and return the value. +------------------------------------------------------------------------------------------- +public final boolean imgxy( int x, int y ) + Arguments: + int x -- x coordinate of the point + int y -- y coordinate of the point + Returned values: + True if the point is inside the region, and false otherwise. + Explanation: + This method is used for checking whether the point is inside the region or not. +------------------------------------------------------------------------------------------- +public final boolean isBorder(int x,int y) + Arguments: + int x -- x coordinate of the point + int y -- y coordinate of the point + Returned values: + True if it is a point on the border, and false otherwise. + Explanation: + This method is used for checking whether the point is on the border or not. +------------------------------------------------------------------------------------------- +public final boolean isNeighbor(int x, int y) + Arguments: + int x -- x coordinate of the point + int y -- y coordinate of the point + Returned values: + True if it is an adjoining point, and false otherwise. + Explanation: + This method is used for checking whether the point adjoins this region or not. +------------------------------------------------------------------------------------------- +public static void merge(RegionInfo r0,RegionInfo r1) + Arguments: + RegionInfo r0 -- the first region information, which carries the merge result. + RegionInfo r1 -- the second region information. + Returned values: + None. + Explanation: + Regions r0 and r1 are merged. The merge result is included in r0. +------------------------------------------------------------------------------------------ +public RegionInfo nearestNeighbor(float sqthresh, float[] w) + Arguments: + float sqthresh -- threshold to determine the upper-limit of mean color distance. + float[] w -- weight for calculating the mean color distance of the regions. + Returned values: + RegionInfo object with the closest mean color to this region. + Explanation: + This method finds the region with the closest mean color to this region among the adjoining regions, + and the found region information is returned. If the difference in the mean colors are more than + sqthresh for all the adjoining regions, the function returns null instead. The distance is calculated + by + d = w[0]*w[0]*DL*DL + w[1]*w[1]*Du*Du + w[2]*w[2]*Dv*Dv, + where DL, Du and Dv denote the difference of mean L, u and v values between two regions. +------------------------------------------------------------------------------------------ +public final void connect(RegionInfo nb) + Arguments: + RegionInfo nb -- region information to be connected to this region + Returned values: + None. + Explanation: + Connect the region nb to this region. +------------------------------------------------------------------------------------------ +public final void disconnect() + Arguments: + None. + Returned values: + None. + Explanation: + Disconnect this region from all the adjoining regions. +------------------------------------------------------------------------------------------ +public final int[] getConnectList() + Arguments: + None. + Returned values: + List of the IDs of the adjoining region. + Explanation: + This method returns the list of the IDs of the adjoining region. +------------------------------------------------------------------------------------------ +public static boolean[][] getMask(RegionInfo[] rlist, Rectangle rect) + Arguments: + RegionInfo[] rlist -- region information array. + Rectangle rect -- bouding box of combined mask. + Returned values: + 2D boolean array indicating the combined mask information. + Explanation: + This method is used for geting combined mask of a list of regions. The mask size equals + the given bounding box. +------------------------------------------------------------------------------------------ +public static Rectangle getBoundingBox(RegionInfo[] rlist) + Arguments: + RegionInfo[] rlist -- A list of the regions. + Returned values: + Rectangle object indicating the bouding box of the regions included in rlist. + Explanation: + This method returns the bounding box for the region included in the list rlist. +------------------------------------------------------------------------------------------ +public void printRandomColor() + Arguments: + None. + Returned values: + None. + Explanation: + This method displays the color of the region in a region image to the stdout. +------------------------------------------------------------------------------------------ +public final int intersectPixels(boolean[][] mask0, Point mask_ul) + Arguments: + boolean[][] mask0 -- the gievn mask information + Point mask_ul -- coordinate of the upper-left corner of the mask + Returned values: + The number of pixels included in intersection. + Explanation: + This methold counts the number of pixels in intersection region with mask0. +------------------------------------------------------------------------------------------ +public final boolean[][] intersect(boolean[][] mask0, Point mask_ul) + Arguments: + boolean[][] mask0 -- the given mask information. + Point mask_ul -- coordinate of upper-left corner of the given mask. + Returned values: + Mask for intersection + Explnaation: + This method computes the intersection of the region with a given mask. +------------------------------------------------------------------------------------------ +public static boolean[][] getCloseOpenMask(RegionInfo[] rlist, Rectangle rect, float close_r, float open_r) + Arguments: + RegionInfo rlist -- Region information array + Rectangle rect -- Bounding box of combined mask + float close_r -- The radius of closing operator + float open_r -- The radius of opening operator + Returned values: + Resultant mask. + Explanation: + This method is used for getting morphologocal-closed mask of a list of regions. The mask size equals the given bounding box. +------------------------------------------------------------------------------------------ +public static boolean[][] getOpenCloseMask(RegionInfo[] rlist, Rectangle rect, float open_r, float close_r) + Arguments: + RegionInfo rlist -- Region information array + Rectangle rect -- Bounding box of combined mask + float open_r -- The radius of opening operator + float close_r -- The radius of closing operator + Returned values: + Resultant mask. + Explanation: + This method is used for getting morphological-opened then closed mask of a list of regions. The mask size equals the given bounding box. diff --git a/sample/SampleRegionInfo.class b/sample/SampleRegionInfo.class new file mode 100644 index 0000000..b537352 Binary files /dev/null and b/sample/SampleRegionInfo.class differ diff --git a/sample/SampleRegionInfo.java b/sample/SampleRegionInfo.java new file mode 100644 index 0000000..ecd2156 --- /dev/null +++ b/sample/SampleRegionInfo.java @@ -0,0 +1,98 @@ +// In this example, we demonstrate how to extract region information from +// *.oif files. Each region is defined by a bounding box and a mask. Eeach +// frame might contain multiple regions. +// +// We try to extract the region information from the oif file of the first video +// frame, "000", from the shot "0019" +// +// Digital Video and Multimedia Group, Columbia University +// http://www.ee.columbia.edu/dvmm/ +// Date: 07/31/2003 + +package sample; + +import java.lang.* ; +import java.util.* ; +import java.io.* ; +import java.awt.* ; + +import feature.RegionInfo ; +import image.*; + +public class SampleRegionInfo { + public static void main(String[] args) throws IOException { + String fnum = "000"; // frame number (three digits), in this example, we process the first frame only + + if( args.length != 2 ){ + System.err.println( "Usage: java sample.SampleRegionInfo {directory name} {shot id}" ); + System.exit( 1 ); + } + + //region info file (OIF file) + int sid = Integer.valueOf( args[ 1 ] ).intValue(); //shot id + + String dirName = args[ 0 ] + File.separator + sid; //directory name for this shot + String regInfoName = dirName + File.separator + "odet" + File.separator + sid + "_" + fnum + "_obj.oif"; + + //read region information from the file designated by regInfoName + RegionInfo[] cur_rlist=RegionInfo.read( regInfoName ); + + //extract region information + // cur_rlist.lenth: the number of regions in the OIF + for( int k = 0; k < cur_rlist.length; k++ ) + extractRegInfo( cur_rlist[ k ] ); + + String regInfoName2 = "test.oif"; + + //write region information to the file designated by regInfoName2 + RegionInfo.write( regInfoName2, cur_rlist, 10, 10, 10, new float[ 10 ] ); + + System.exit( 0 ); + } + + private static void extractRegInfo( RegionInfo cr ) + { + int id = cr.id; // region id + int x0 = cr.ul.x, y0 = cr.ul.y; // Coordinate of the upper-left corner of boundary box + int x1 = cr.lr.x, y1 = cr.lr.y; // Coordinate of the lower-right corner of boundary box + int numPels = cr.pixelnum; // The number of the pixels within the region + boolean[][] mask = cr.mask; // mask information of the region + float[] meanColor = cr.feat1; // mean Luv color + float[] mp = cr.feat2; // motion parameters; + /* + Motion is compensated by the following equation: + x = mp[0] + mp[1] * x0 + mp[2] * y0 + mp[6] * x0 * x0 + mp[7] * x0 * y0 + x0, + y = mp[3] + mp[4] * x0 + mp[5] * y0 + mp[6] * x0 * y0 + mp[7] * y0 * y0 + y0 + where (x0,y0) is a point in the current region and (x,y) is its corresponding point in the next frame. + */ + int[] regIDs = cr.getConnectList(); //adjoining region IDs + int perimeter = cr.perimeter(); // perimeter of this region + + // display region information + System.out.println( "Region ID: " + id ); + System.out.println( "Number of pixels: " + numPels ); + System.out.println( "Perimeter: " + perimeter ); + System.out.println( "Upper-left corner of boundary box: (" + x0 + "," + y0 + ")" ); + System.out.println( "Lower-right corner of boundary box: ("+ x1 + "," + y1 + ")" ); + System.out.print( "Adjoint region IDs: " ); + for( int i = 0; i < regIDs.length; i++ ){ + if( 0 != i ) + System.out.print( "," ); + System.out.print( regIDs[ i ] ); + } + System.out.println( "" ); + System.out.println( "Mean color (L,u,v): (" + meanColor[ 0 ] + "," + meanColor[ 1 ] + "," + meanColor[ 2 ] + ")" ); + + System.out.print( "Motion parameters: (" ); + for( int i = 0; i < 8; i++ ){ + if( 0 != i ) + System.out.print( "," ); + System.out.print( mp[ i ] ); + } + System.out.println( ")" ); + System.out.print( "Color of this region " ); + cr.printRandomColor(); + + System.out.println( "" ); + } +} diff --git a/test.db b/test.db new file mode 100644 index 0000000..78b5828 --- /dev/null +++ b/test.db @@ -0,0 +1,14 @@ +.\test +100000 +1 + +1009 +-UNKNOWN- +234300 +50 +40 +30 +352 +240 +2 +6002138 \ No newline at end of file diff --git a/test/1009/frames/f00014.ppm b/test/1009/frames/f00014.ppm new file mode 100644 index 0000000..44dbe8f Binary files /dev/null and b/test/1009/frames/f00014.ppm differ diff --git a/test/1009/frames/f00015.ppm b/test/1009/frames/f00015.ppm new file mode 100644 index 0000000..b7cd400 Binary files /dev/null and b/test/1009/frames/f00015.ppm differ diff --git a/test/1009/frames/f00016.ppm b/test/1009/frames/f00016.ppm new file mode 100644 index 0000000..b8eb8a6 Binary files /dev/null and b/test/1009/frames/f00016.ppm differ diff --git a/test/1009/frames/f00017.ppm b/test/1009/frames/f00017.ppm new file mode 100644 index 0000000..c994016 Binary files /dev/null and b/test/1009/frames/f00017.ppm differ diff --git a/test/1009/frames/f00018.ppm b/test/1009/frames/f00018.ppm new file mode 100644 index 0000000..232d041 Binary files /dev/null and b/test/1009/frames/f00018.ppm differ diff --git a/test/1009/frames/f00030.ppm b/test/1009/frames/f00030.ppm new file mode 100644 index 0000000..6248c6c Binary files /dev/null and b/test/1009/frames/f00030.ppm differ diff --git a/test/1009/frames/f00031.ppm b/test/1009/frames/f00031.ppm new file mode 100644 index 0000000..7d10cd4 Binary files /dev/null and b/test/1009/frames/f00031.ppm differ diff --git a/test/1009/frames/f00032.ppm b/test/1009/frames/f00032.ppm new file mode 100644 index 0000000..304849d Binary files /dev/null and b/test/1009/frames/f00032.ppm differ diff --git a/test/1009/frames/f00033.ppm b/test/1009/frames/f00033.ppm new file mode 100644 index 0000000..5c541bf Binary files /dev/null and b/test/1009/frames/f00033.ppm differ diff --git a/test/1009/frames/f00034.ppm b/test/1009/frames/f00034.ppm new file mode 100644 index 0000000..05d7696 Binary files /dev/null and b/test/1009/frames/f00034.ppm differ diff --git a/test/1009/frames/f00035.ppm b/test/1009/frames/f00035.ppm new file mode 100644 index 0000000..2b2dc23 Binary files /dev/null and b/test/1009/frames/f00035.ppm differ diff --git a/test/1009/frames/f00036.ppm b/test/1009/frames/f00036.ppm new file mode 100644 index 0000000..52e18e5 Binary files /dev/null and b/test/1009/frames/f00036.ppm differ diff --git a/test/1009/frames/f00037.ppm b/test/1009/frames/f00037.ppm new file mode 100644 index 0000000..547005a Binary files /dev/null and b/test/1009/frames/f00037.ppm differ diff --git a/test/1009/frames/f00038.ppm b/test/1009/frames/f00038.ppm new file mode 100644 index 0000000..498cb45 Binary files /dev/null and b/test/1009/frames/f00038.ppm differ diff --git a/test/1009/frames/f00039.ppm b/test/1009/frames/f00039.ppm new file mode 100644 index 0000000..d800d85 Binary files /dev/null and b/test/1009/frames/f00039.ppm differ diff --git a/test/1009/frames/f00040.ppm b/test/1009/frames/f00040.ppm new file mode 100644 index 0000000..e5b1073 Binary files /dev/null and b/test/1009/frames/f00040.ppm differ diff --git a/test/1009/frames/f00041.ppm b/test/1009/frames/f00041.ppm new file mode 100644 index 0000000..10a400b Binary files /dev/null and b/test/1009/frames/f00041.ppm differ diff --git a/test/1009/frames/f00042.ppm b/test/1009/frames/f00042.ppm new file mode 100644 index 0000000..8c01414 Binary files /dev/null and b/test/1009/frames/f00042.ppm differ diff --git a/test/1009/frames/f00043.ppm b/test/1009/frames/f00043.ppm new file mode 100644 index 0000000..f6aed04 Binary files /dev/null and b/test/1009/frames/f00043.ppm differ diff --git a/test/1009/frames/f00044.ppm b/test/1009/frames/f00044.ppm new file mode 100644 index 0000000..e490a67 Binary files /dev/null and b/test/1009/frames/f00044.ppm differ diff --git a/test/1009/frames/f00045.ppm b/test/1009/frames/f00045.ppm new file mode 100644 index 0000000..4e76239 Binary files /dev/null and b/test/1009/frames/f00045.ppm differ diff --git a/test/1009/frames/f00046.ppm b/test/1009/frames/f00046.ppm new file mode 100644 index 0000000..3329517 Binary files /dev/null and b/test/1009/frames/f00046.ppm differ diff --git a/test/1009/frames/f00047.ppm b/test/1009/frames/f00047.ppm new file mode 100644 index 0000000..9446c98 Binary files /dev/null and b/test/1009/frames/f00047.ppm differ diff --git a/test/1009/frames/f00048.ppm b/test/1009/frames/f00048.ppm new file mode 100644 index 0000000..4632fc1 Binary files /dev/null and b/test/1009/frames/f00048.ppm differ diff --git a/test/1009/frames/f00049.ppm b/test/1009/frames/f00049.ppm new file mode 100644 index 0000000..91ed987 Binary files /dev/null and b/test/1009/frames/f00049.ppm differ diff --git a/test/1009/frames/f00050.ppm b/test/1009/frames/f00050.ppm new file mode 100644 index 0000000..2e60b9b Binary files /dev/null and b/test/1009/frames/f00050.ppm differ diff --git a/test/1009/frames/f00051.ppm b/test/1009/frames/f00051.ppm new file mode 100644 index 0000000..aaaceba Binary files /dev/null and b/test/1009/frames/f00051.ppm differ diff --git a/test/1009/frames/f00052.ppm b/test/1009/frames/f00052.ppm new file mode 100644 index 0000000..922eeef Binary files /dev/null and b/test/1009/frames/f00052.ppm differ diff --git a/test/1009/frames/f00053.ppm b/test/1009/frames/f00053.ppm new file mode 100644 index 0000000..de04b37 Binary files /dev/null and b/test/1009/frames/f00053.ppm differ diff --git a/test/1009/frames/f00054.ppm b/test/1009/frames/f00054.ppm new file mode 100644 index 0000000..90e2350 Binary files /dev/null and b/test/1009/frames/f00054.ppm differ diff --git a/test/1009/frames/f00055.ppm b/test/1009/frames/f00055.ppm new file mode 100644 index 0000000..d767894 Binary files /dev/null and b/test/1009/frames/f00055.ppm differ diff --git a/test/1009/frames/f00056.ppm b/test/1009/frames/f00056.ppm new file mode 100644 index 0000000..282841b Binary files /dev/null and b/test/1009/frames/f00056.ppm differ diff --git a/test/1009/frames/f00057.ppm b/test/1009/frames/f00057.ppm new file mode 100644 index 0000000..21dd910 Binary files /dev/null and b/test/1009/frames/f00057.ppm differ diff --git a/test/1009/frames/f00058.ppm b/test/1009/frames/f00058.ppm new file mode 100644 index 0000000..22b7856 Binary files /dev/null and b/test/1009/frames/f00058.ppm differ diff --git a/test/1009/frames/f00059.ppm b/test/1009/frames/f00059.ppm new file mode 100644 index 0000000..deafc4b Binary files /dev/null and b/test/1009/frames/f00059.ppm differ diff --git a/test/1009/frames/f00060.ppm b/test/1009/frames/f00060.ppm new file mode 100644 index 0000000..746f429 Binary files /dev/null and b/test/1009/frames/f00060.ppm differ diff --git a/test/1009/frames/f00061.ppm b/test/1009/frames/f00061.ppm new file mode 100644 index 0000000..02f1050 Binary files /dev/null and b/test/1009/frames/f00061.ppm differ diff --git a/test/1009/frames/f00062.ppm b/test/1009/frames/f00062.ppm new file mode 100644 index 0000000..d558345 Binary files /dev/null and b/test/1009/frames/f00062.ppm differ diff --git a/test/1009/frames/f00063.ppm b/test/1009/frames/f00063.ppm new file mode 100644 index 0000000..0389bf3 Binary files /dev/null and b/test/1009/frames/f00063.ppm differ diff --git a/test/1009/frames/f00064.ppm b/test/1009/frames/f00064.ppm new file mode 100644 index 0000000..06fff11 Binary files /dev/null and b/test/1009/frames/f00064.ppm differ diff --git a/test/1009/frames/f00065.ppm b/test/1009/frames/f00065.ppm new file mode 100644 index 0000000..fcc2522 Binary files /dev/null and b/test/1009/frames/f00065.ppm differ diff --git a/test/1009/frames/f00066.ppm b/test/1009/frames/f00066.ppm new file mode 100644 index 0000000..a0bec7e Binary files /dev/null and b/test/1009/frames/f00066.ppm differ diff --git a/test/1009/frames/f00067.ppm b/test/1009/frames/f00067.ppm new file mode 100644 index 0000000..1f137cf Binary files /dev/null and b/test/1009/frames/f00067.ppm differ diff --git a/test/1009/frames/f00068.ppm b/test/1009/frames/f00068.ppm new file mode 100644 index 0000000..7476238 Binary files /dev/null and b/test/1009/frames/f00068.ppm differ diff --git a/test/1009/frames/f00069.ppm b/test/1009/frames/f00069.ppm new file mode 100644 index 0000000..3e42e04 Binary files /dev/null and b/test/1009/frames/f00069.ppm differ diff --git a/test/1009/frames/f00070.ppm b/test/1009/frames/f00070.ppm new file mode 100644 index 0000000..4d76722 Binary files /dev/null and b/test/1009/frames/f00070.ppm differ diff --git a/test/1009/frames/f00071.ppm b/test/1009/frames/f00071.ppm new file mode 100644 index 0000000..a9efb7e Binary files /dev/null and b/test/1009/frames/f00071.ppm differ diff --git a/test/1009/frames/f00072.ppm b/test/1009/frames/f00072.ppm new file mode 100644 index 0000000..a2e791b Binary files /dev/null and b/test/1009/frames/f00072.ppm differ diff --git a/test/1009/frames/f00073.ppm b/test/1009/frames/f00073.ppm new file mode 100644 index 0000000..6713340 Binary files /dev/null and b/test/1009/frames/f00073.ppm differ diff --git a/test/1009/frames/f00074.ppm b/test/1009/frames/f00074.ppm new file mode 100644 index 0000000..6090852 Binary files /dev/null and b/test/1009/frames/f00074.ppm differ diff --git a/test/1009/frames/f00075.ppm b/test/1009/frames/f00075.ppm new file mode 100644 index 0000000..efc5a1a Binary files /dev/null and b/test/1009/frames/f00075.ppm differ diff --git a/test/1009/frames/f00076.ppm b/test/1009/frames/f00076.ppm new file mode 100644 index 0000000..f92bd1a Binary files /dev/null and b/test/1009/frames/f00076.ppm differ diff --git a/test/1009/frames/f00077.ppm b/test/1009/frames/f00077.ppm new file mode 100644 index 0000000..48de762 Binary files /dev/null and b/test/1009/frames/f00077.ppm differ diff --git a/test/1009/frames/f00078.ppm b/test/1009/frames/f00078.ppm new file mode 100644 index 0000000..5256e3e Binary files /dev/null and b/test/1009/frames/f00078.ppm differ