Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /src/hugin1/hugin/AssistantPanel.cpp [1b4a52] .. [07df41] Maximize Restore

  Switch to unified view

a/src/hugin1/hugin/AssistantPanel.cpp b/src/hugin1/hugin/AssistantPanel.cpp
...
...
52
#include "hugin/TextKillFocusHandler.h"
52
#include "hugin/TextKillFocusHandler.h"
53
#include "hugin/PanoDruid.h"
53
#include "hugin/PanoDruid.h"
54
#include "base_wx/MyProgressDialog.h"
54
#include "base_wx/MyProgressDialog.h"
55
#include "hugin/config_defaults.h"
55
#include "hugin/config_defaults.h"
56
56
57
#include "algorithms/control_points/FeatureExtractorZoran.h" // 
57
#include "algorithms/control_points/FeatureExtractorZoran.h" // algorithms/control_points/
58
58
59
using namespace PT;
59
using namespace PT;
60
using namespace PTools;
60
using namespace PTools;
61
using namespace utils;
61
using namespace utils;
62
using namespace vigra;
62
using namespace vigra;
...
...
381
381
382
    fill_set(imgs, 0, m_pano->getNrOfImages()-1);
382
    fill_set(imgs, 0, m_pano->getNrOfImages()-1);
383
383
384
    long nFeatures = wxConfigBase::Get()->Read(wxT("/Assistant/nControlPoints"), HUGIN_ASS_NCONTROLPOINTS); 
384
    long nFeatures = wxConfigBase::Get()->Read(wxT("/Assistant/nControlPoints"), HUGIN_ASS_NCONTROLPOINTS); 
385
385
386
    /*
386
    // Onur: uncommented
387
    bool createCtrlP = true;
387
    bool createCtrlP = true;
388
    // TODO: handle existing control points properly instead of adding them twice.
388
    // TODO: handle existing control points properly instead of adding them twice.
389
    if (m_pano->getNrOfCtrlPoints() > 0) {
389
    if (m_pano->getNrOfCtrlPoints() > 0) {
390
        int a = wxMessageBox(wxString::Format(_("The panorama already has %d control points.\n\nSkip control points creation?"), m_pano->getNrOfCtrlPoints()),
390
        int a = wxMessageBox(wxString::Format(_("The panorama already has %d control points.\n\nSkip control points creation?"), m_pano->getNrOfCtrlPoints()),
391
                     _("Skip control point creation?"), wxICON_QUESTION | wxYES_NO);
391
                     _("Skip control point creation?"), wxICON_QUESTION | wxYES_NO);
392
        createCtrlP = a != wxYES;
392
        createCtrlP = a != wxYES;
393
    }
393
    }
394
    */
394
    
395
395
396
  // Onur: problematic when user adds new images after aligning once
396
    bool createCtrlP = m_pano->getNrOfCtrlPoints() == 0;
397
    // bool createCtrlP = m_pano->getNrOfCtrlPoints() == 0;
397
    
398
    
398
    // Onur
399
    // Onur
399
    // generate keypoints
400
    // generate keypoints
400
    ProgressReporterDialog progress(6, _("Aligning images"), _("Extracting keypoints"));
401
    ProgressReporterDialog progress(6, _("Aligning images"), _("Extracting keypoints"));
401
    wxString alignMsg;
402
    wxString alignMsg;
402
    FeatureExtractorZoran fez;
403
    FeatureExtractorZoran fez;
403
    cout << "generate keypoints" << endl;
404
    cout << "generate keypoints" << endl;
405
  double progressIncrement = 1.0/m_pano->getNrOfImages();
406
  // for each image in panorama
404
    for (int imageNr=0; imageNr < m_pano->getNrOfImages(); imageNr++) {
407
    for (int imageNr=0; imageNr < m_pano->getNrOfImages(); imageNr++) {
408
      // check if we have extracted Zoran keypoints before
409
      if (m_pano->getImage(imageNr).getKeypoints().size() == 0)
410
      {
405
        std::string fn = m_pano->getSrcImage(imageNr).getFilename();
411
         std::string fn = m_pano->getSrcImage(imageNr).getFilename();
406
        std::vector<HuginBase::Keypoint> points = fez.extractFeatures(fn);
412
         std::vector<HuginBase::Keypoint> points = fez.extractFeatures(fn);
407
        cout << points.size() << " keypoints generated for " << fn << endl;
413
         cout << points.size() << " keypoints generated for " << fn << endl;
408
        HuginBase::PanoImage img = m_pano->getImage(imageNr);
414
         HuginBase::PanoImage img = m_pano->getImage(imageNr);
409
        img.setKeypoints(points);
415
         img.setKeypoints(points);
410
        m_pano->setImage(imageNr,img);
416
         m_pano->setImage(imageNr,img);
417
      }
418
      progress.increaseProgress(progressIncrement, std::string(wxString(_("Extracting keypoints")).mb_str(wxConvLocal)));
411
    }
419
    }
412
    
420
    
413
    // find matching keypoints to create control points
421
    // find matching keypoints to create control points
414
    progress.increaseProgress(1.0, std::string(wxString(_("Finding corresponding points")).mb_str(wxConvLocal)));
422
    progress.increaseProgress(0.0, std::string(wxString(_("Finding corresponding points")).mb_str(wxConvLocal)));
415
    
423
    
416
    if (createCtrlP) {
424
    if (createCtrlP) {
417
        AutoCtrlPointCreator matcher;
425
        AutoCtrlPointCreator matcher;
418
        CPVector cps = matcher.automatch(*m_pano, imgs, nFeatures);
426
        CPVector cps = matcher.automatch(*m_pano, imgs, nFeatures);
419
        GlobalCmdHist::getInstance().addCommand(
427
        GlobalCmdHist::getInstance().addCommand(
...
...
441
        return;
449
        return;
442
    }
450
    }
443
451
444
    // optimize panorama
452
    // optimize panorama
445
    Panorama optPano = m_pano->getSubset(imgs);
453
    Panorama optPano = m_pano->getSubset(imgs);
446
  
447
  // clear out the CPs with large distances after optimization
448
  //for (int cpnum=0; cpnum<m_pano->getNrOfCtrlPoints(); cpnum++)  {
449
//        ControlPoint cp = m_pano->getCtrlPoint(cpnum);
450
//        if (cp.error > 10) {
451
//            cout << "CP with " << cp.error << " found and removed!" << endl;
452
//            m_pano->removeCtrlPoint(cpnum--);
453
//        }
454
//    }
455
454
456
    // set TIFF_m with enblend
455
    // set TIFF_m with enblend
457
    PanoramaOptions opts = m_pano->getOptions();
456
    PanoramaOptions opts = m_pano->getOptions();
458
    opts.outputFormat = PanoramaOptions::TIFF;
457
    opts.outputFormat = PanoramaOptions::TIFF;
459
    opts.blendMode = PanoramaOptions::ENBLEND_BLEND;
458
    opts.blendMode = PanoramaOptions::ENBLEND_BLEND;