Package com.meapsoft

Examples of com.meapsoft.FeatChunk


        progress.setValue(0);
   
    for (int chunkNum = firstChunkToDraw; chunkNum < numChunks && x < getWidth(); chunkNum++)
    {
      //FeatChunk fC = getFeatChunkByNumber(chunkNum);
      FeatChunk fC = (FeatChunk)events.get(chunkNum);
      //if (edlFile == null)
      //{
        x = (int) ((fC.startTime - localFirstEventTime) * xScaler);
        width = (int) (fC.length * xScaler) + 1;
      //}
      //else
      //{
      //  EDLChunk eC = (EDLChunk)events.get(chunkNum);
      //  x = (int) ((eC.dstTime - localFirstEventTime) * xScaler);
      //  width = (int) (eC.length * xScaler) + 1;
      //}

      // adjust to zero
      //double[] dataPoints = featFile.getFeatureByName(featureName, i);
      double[] dataPoints = fC.getFeatureByName(featureName);
      //double dataPoints[] = fC.getFeatures();// featureData[i];

      if (featureSize > 1)
      {
        for (int j = 1; j < featureSize + 1; j++)
View Full Code Here


      //System.out.println("reusing chunks!");
      int numChunks = chunks.size();
     
      for (int chunkNum = 0; chunkNum < numChunks; chunkNum++)
      {
          FeatChunk targetChunk = (FeatChunk) chunks.get(chunkNum);
          chunks.remove(targetChunk);
          dist.setTarget(targetChunk);
          FeatChunk nnChunk = (FeatChunk) Collections.min(chunks, dist);
          //System.out.println(targetChunk);
          //System.out.println(nnChunk);
          //System.out.println(chunks.size()+"\n");
 
          chunks.add(chunkNum, targetChunk);
 
          outFile.chunks.add(new EDLChunk(nnChunk, targetChunk.startTime));
 
          progress.setValue(progress.getValue() + 1);
      }     
    }
    else
    {
      while (chunks.size() > 1)
      {
          FeatChunk targetChunk = (FeatChunk) chunks.get(0);
          chunks.remove(targetChunk);
          dist.setTarget(targetChunk);
          FeatChunk nnChunk = (FeatChunk) Collections.min(chunks, dist);
          chunks.remove(nnChunk);
          //System.out.println(targetChunk);
          //System.out.println(nnChunk);
          //System.out.println(chunks.size()+"\n");
 
View Full Code Here

        .get(firstChunkToDraw)).startTime;
    int x = 0;

    for (int i = firstChunkToDraw; i < numChunks && x < getWidth(); i++)
    {
      FeatChunk fC = (FeatChunk) events.get(i);
      x = (int) ((fC.startTime - localFirstEventTime) * xScaler);
      int width = (int) (fC.length * xScaler) + 1;

      //double[] features = featFile.getFeatureByName(featureName, i);
      double[] features = fC.getFeatureByName(featureName);
     
      //we can just use features[0] because we know that bar graph panel only
      //draws one dimensional features!
      // adjust to zero
      double dataPoint = features[0] - lowestValue;
View Full Code Here

  public EDLFile compose()
  {
    // initial chunk - pick it at random:
    // int randIdx = (int)Math.floor(featFile.chunks.size()*Math.random());
    // start with the first chunk
    FeatChunk currChunk = (FeatChunk) featFile.chunks.get(0);

    dist.setTarget(currChunk);

    Vector chunks = new Vector(featFile.chunks);

    NumberFormat fmt = NumberFormat.getInstance();
    fmt.setMaximumFractionDigits(3);

    double currTime = 0;
    while (chunks.size() > 0)
    {
      dist.setTarget(currChunk);
            currChunk = (FeatChunk) Collections.min(chunks, dist);
            chunks.remove(currChunk);

      // turn currChunk into an EDL chunk
      EDLChunk nc = new EDLChunk(currChunk, currTime);

      if (debug)
      {
        nc.comment = "    # feats = ";
        double[] feat = currChunk.getFeatures(featdim);
        for (int x = 0; x < feat.length - 1; x++)
          nc.comment += fmt.format(feat[x]) + ", ";
        nc.comment += fmt.format(feat[feat.length - 1]);
      }

View Full Code Here

     
      for (int i = 0; i < numChunks; i++)
      {
        double feature = 0.0;
       
        FeatChunk fC = (FeatChunk) events.get(i);
 
        for (int j = 0; j < featureSize; j++)
        {
          if (featureNumber == -1)
            feature = fC.length;
          else
          {
            double[] featureArray = featFile.getFeatureByName(featureName, i);
            feature = featureArray[j];
          }
 
          if (feature < lowestValue)
            lowestValue = feature;
 
          if (feature > highestValue)
            highestValue = feature;
 
          if (fC.startTime < firstEventTime)
            firstEventTime = fC.startTime;
 
          if (fC.startTime > lastEventTime)
            lastEventTime = fC.startTime;
 
          if (fC.startTime + fC.length > endTime)
            endTime = fC.startTime + fC.length;
        }
      }
    }
    else
    {
      System.out.println("got edl file!");
      //events = edlFile.chunks;
      //events = featFile.chunks;
      events = new Vector(100, 0);

      // extract feature data, find highest/lowest feature values
      //numChunks = events.size();
      numChunks = featFile.chunks.size();
     
      for (int i = 0; i < numChunks; i++)
      {
        double feature = 0.0;

        EDLChunk edlC = (EDLChunk)edlFile.chunks.get(i);
        FeatChunk fC = (FeatChunk)featFile.chunks.get(i);
 
        for (int j = 0; j < featureSize; j++)
        {
          if (featureNumber == -1)
            feature = fC.length;
          else
          {
            double[] featureArray = featFile.getFeatureByName(featureName, i);
            feature = featureArray[j];
          }
 
          if (feature < lowestValue)
            lowestValue = feature;
 
          if (feature > highestValue)
            highestValue = feature;
 
          if (edlC.dstTime < firstEventTime)
            firstEventTime = edlC.dstTime;
 
          if (edlC.dstTime > lastEventTime)
            lastEventTime = edlC.dstTime;
 
          if (edlC.dstTime + edlC.length > endTime)
            endTime = edlC.dstTime + edlC.length;
        }
      }
     
      //add chunks to events in new EDL order
      //System.out.println("adding chunks from FeatFile...");
      for (int i = 0; i < numChunks; i++)
      {
        EDLChunk edlC = (EDLChunk)edlFile.chunks.get(i);
       
        double sT = edlC.startTime;
       
        int matchChunkNum = -1;
       
        for (int chunkNum = 0; chunkNum < numChunks; chunkNum++)
        {
          FeatChunk fC = (FeatChunk)featFile.chunks.get(chunkNum);
          double fST = fC.startTime;
         
          if (fST == sT)
          {
            matchChunkNum = chunkNum;
View Full Code Here

  //we need this indirect method so that we can swap in the
  //appropriate FeatChunk if our timeline is determined by an
  //EDLFile. 
  FeatChunk getFeatChunkByNumber(int chunkNum)
  {
    FeatChunk fC = null;
   
    if (edlFile == null)
      return (FeatChunk)events.get(chunkNum);
    else
    {
      EDLChunk eC = (EDLChunk)events.get(chunkNum);
     
      for (int featChunkNum = 0; featChunkNum < numChunks; featChunkNum++)
      {
        fC = (FeatChunk) featFile.chunks.get(featChunkNum);
       
        if (fC.compareTo(eC) == 0)
          return fC;
      }
    }
   
    System.out.println("can't find matching feat chunk!");
View Full Code Here

        int ndat = trainFile.chunks.size();
        int prevState = -1;
        String lastSrcFile = "";
        for(int n = 0; n < ndat; n++)
        {
            FeatChunk ch = (FeatChunk)trainFile.chunks.get(n);
           
            int currState = quantizeChunk(ch);

            // is this the beginning of a srcFile?
            if(!lastSrcFile.equals(ch.srcFile))
View Full Code Here

   
    //iterate through all the chunks that the segmenter found
    while(c.hasNext())
    {
      //your current features chunk
      FeatChunk ch = (FeatChunk)c.next();
      double length = ch.length/numSubChunks;
      double localStartTime = ch.startTime;
     
      for (int i = numSubChunks - 1; i >= 0; i--)
      {
View Full Code Here

    double currentTime = 0.0;

    for (int i = 0; i < selectedChunks.size(); i++)
    {
      // featOutputFile.chunks.add(selectedChunks.elementAt(i));
      FeatChunk oldChunk = (FeatChunk) selectedChunks.elementAt(i);

      FeatChunk newChunk = new FeatChunk(oldChunk.srcFile, currentTime,
          oldChunk.length, oldChunk.featureDescriptions);
      newChunk.addFeature(oldChunk.getFeatures());
      featOutputFile.chunks.add(newChunk);
      currentTime += oldChunk.length;
    }

    int numFeatDescs = featInputFile.featureDescriptions.size();
View Full Code Here

        fmt.setMaximumFractionDigits(3);

        Iterator dstchunks = dstFile.chunks.iterator();
        while(dstchunks.hasNext())
        {
            FeatChunk currChunk = (FeatChunk)dstchunks.next();
            double mindist = Double.MAX_VALUE;
            FeatChunk match = null;
           
            // find closest match to currChunk in DB
            Iterator i = DBFile.chunks.iterator();
            while(i.hasNext())
            {
                FeatChunk c = (FeatChunk)i.next();
                double d = dist.distance(currChunk, c);

                if(d < mindist)
                {
                    mindist = d;
View Full Code Here

TOP

Related Classes of com.meapsoft.FeatChunk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.