예제 #1
0
void CLocalBrowseWindowState::SetCurrentPath(const CStdString& path)
{
  // Return current path under assumption that Local browse screen has only one source
  SourcesMap mapSources = m_sourceController.GetSources();

  if (CUtil::IsBlurayFolder(path))
    UpdateHistory();

  if (!mapSources.empty())
  {
    CBrowseWindowSource* firstSource = mapSources.begin()->second;
    if (firstSource)
    {
      firstSource->SetBasePath(path);
    }
    else
    {
      CLog::Log(LOGWARNING, "CLocalBrowseWindowState::SetCurrentPath - first source is null (browse)");
    }
  }
  else
  {
    CLog::Log(LOGWARNING, "CLocalBrowseWindowState::SetCurrentPath - no sources found (browse)");
  }
}
예제 #2
0
void flipSources(SourcesMap & sources)
{
    for (auto i = sources.begin(); i != sources.end(); ++i)
    {
        if (i->first.first != "image")
        {
            cout << "warning. nonimage source: \""
                 << i->first.first << "\" : " << i->first.second
                 << ". flipping operation may lead to an error."
                 << endl;
        }
        Mat & image = i->second;
        flip(image, image, 1);
    }
}
예제 #3
0
CStdString CLocalBrowseWindowState::GetCurrentPath()
{
  // Return current path under assumption that Local browse screen has only one source
  SourcesMap mapSources = m_sourceController.GetSources();

  if (!mapSources.empty())
  {
    CBrowseWindowSource* firstSource = mapSources.begin()->second;
    if (firstSource)
    {
      return firstSource->GetBasePath();
    }
    else
    {
      CLog::Log(LOGWARNING, "CLocalBrowseWindowState::GetCurrentPath - first source is null (browse)");
    }
  }
  else
  {
    CLog::Log(LOGWARNING, "CLocalBrowseWindowState::GetCurrentPath - no sources found (browse)");
  }

  return "";
}
예제 #4
0
ImageAnnotation getFlipedAnnotation(const ImageAnnotation & ann,
                                    const SourcesMap & sources)
{
    ImageAnnotation flipedAnn;
    for (size_t i = 0; i < ann.bboxes.size(); ++i)
    {
        if (ann.labels[i] == 0)
        {
            continue;
        }
        flipedAnn.labels.push_back(ann.labels[i]);
        flipedAnn.scores.push_back(ann.scores[i]);
        Rect bbox = ann.bboxes[i];
        Size imageSize = sources.at(DataTypeTime("image", 0)).size();
        bbox.x = imageSize.width - bbox.x - bbox.width;
        flipedAnn.bboxes.push_back(bbox);
    }
    return flipedAnn;
}
예제 #5
0
void HOF::getROIDescription(Mat & featureDescription,
                            const SourcesMap & sources,
                            const vector<Rect> & roi)
{
    bool hasOpticalFlowAsSource = (0 < sources.count(SOURCE_OPTICAL_FLOW));
    bool hasImagesPairAsSource = (0 < sources.count(SOURCE_FIRST_IMAGE) &&
                                  0 < sources.count(SOURCE_SECOND_IMAGE));
    CV_Assert(hasImagesPairAsSource || hasOpticalFlowAsSource);
    
    Mat opticalFlow;
    if (hasOpticalFlowAsSource)
    {
        opticalFlow = sources.at(SOURCE_OPTICAL_FLOW);
    }
    else // if (hasImagesPairAsSource)
    {
        Mat image1, image2;
        cvtColor(sources.at(SOURCE_FIRST_IMAGE), image1, CV_BGR2GRAY);
        cvtColor(sources.at(SOURCE_SECOND_IMAGE), image2, CV_BGR2GRAY);
        opticalFlowComputer->calc(image1, image2, opticalFlow);
    }

    featureDescription.create(roi.size(), featureVectorLength, CV_32F);

    for (size_t t = 0; t < roi.size(); ++t)
    {
        const Rect & r = roi[t];
        CV_Assert(0 < r.width);
        CV_Assert(0 < r.height);
        Mat opticalFlowROI;
        getROI(opticalFlow, opticalFlowROI, r);
        resize(opticalFlowROI, opticalFlowROI,
               Size(params.winSizeW, params.winSizeH));

        SourcesMap imageSource;
        imageSource[SOURCE_OPTICAL_FLOW] = opticalFlowROI;
        computeOnNewImage(imageSource);
        computeOnNewScale(1.0f);
        Mat featureDescriptionRow = featureDescription.row(t);
        getFeatureVector(0, 0, featureDescriptionRow);
    }
}
예제 #6
0
void HOF::computeOnNewImage(const SourcesMap & sources)
{
    bool hasOpticalFlowAsSource = (0 < sources.count(SOURCE_OPTICAL_FLOW));
    bool hasImagesPairAsSource = (0 < sources.count(SOURCE_FIRST_IMAGE) &&
                                  0 < sources.count(SOURCE_SECOND_IMAGE));

    CV_Assert(hasOpticalFlowAsSource || hasImagesPairAsSource);
    if (hasOpticalFlowAsSource)
    {
        sources.at(SOURCE_OPTICAL_FLOW).copyTo(flow);
    }
    else if (hasImagesPairAsSource)
    {
        Mat firstImage;
        cvtColor(sources.at(SOURCE_FIRST_IMAGE), firstImage, CV_BGR2GRAY);
        cvtColor(sources.at(SOURCE_SECOND_IMAGE), secondImage, CV_BGR2GRAY);
        CV_Assert(firstImage.size == secondImage.size);
        opticalFlowComputer->calc(firstImage, secondImage, flow);
    }
}