Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

virtual void Impala::Core::VideoSet::ExportStills::HandleNewFile ( VideoSet vs,
int  fileId,
Stream::RgbDataSrc src 
) [inline, virtual]

Arrived at given DB_FILE in a "normal" walk.

Reimplemented from Impala::Core::VideoSet::Listener.

Definition at line 114 of file ExportStills.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Database::RawDataSet::AddFile(), Impala::Core::Array::ArrayListDelete(), Impala::Core::Stream::RgbDataSrc::DataPtr(), Impala::FileNameBase(), Impala::FileNameCtor(), Impala::Core::Stream::RgbDataSrc::FrameHeight(), Impala::Core::Stream::RgbDataSrc::FrameWidth(), Impala::Core::Database::RawDataSet::GetContainerDir(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::Database::RawDataSet::GetFilePathImageArchive(), Impala::Core::Database::RawDataSet::GetFirstFileId(), Impala::Core::VideoSet::Segmentation::GetFirstShotVideo(), Impala::Core::VideoSet::Segmentation::GetNrShotsVideo(), Impala::Core::VideoSet::Segmentation::GetStart(), Impala::Core::Stream::RgbDataSrc::GotoFrame(), ILOG_DEBUG, ILOG_ERROR, ILOG_INFO, mBuf, mBufSize, mDoData, mDoDef, mDoFullSize, mImSet, mNr, mNrIm, mSegmentation, mSkipFr, mStills, mTimer, Impala::Core::Geometry::NEAREST, Impala::Core::Array::Scale(), Impala::Core::Array::Set(), Impala::Core::Stream::RgbDataSrc::SetInterval(), Impala::Timer::SplitTime(), Impala::Core::Array::WriteJpgToMemory(), and Impala::Core::Array::WriteRawListVar().

00115     {
00116         std::vector<Array2dScalarUInt8*> imList;
00117         String dbSec(FileNameBase(vs->GetSetName()) + "_stills");
00118         String dbDir = vs->GetFile(fileId);
00119         String dirOfFile = vs->GetDirOfFile(fileId);
00120 
00121         if (Link::DiskImage::DiskImageUsed())
00122         {
00123             dbSec = vs->GetAsPath(fileId);
00124             int posSep = dbSec.find_last_of('/');
00125             dbSec = "stills/" + dbSec.substr(0, posSep);
00126         }
00127         else
00128         {
00129             dbSec = "stills/" + vs->GetSectionOfFile(fileId) + "/" + dirOfFile;
00130         }
00131 
00132         int firstS = mSegmentation->GetFirstShotVideo(fileId);
00133         int lastS = firstS + mSegmentation->GetNrShotsVideo(fileId);
00134         for (int shot=firstS ; shot<lastS ; shot++)
00135         {
00136             int startF = mSegmentation->GetStart(shot);
00137             int endF = mSegmentation->GetEnd(shot);
00138             int interval = (endF - startF) / (mNrIm - 1);
00139             if (interval < mSkipFr)
00140                 interval = mSkipFr;
00141             ILOG_DEBUG("Doing shot " << shot << " from " << startF << " to "
00142                        << endF << " interval " << interval);
00143             if (mDoData && (interval < 100))
00144                 src->SetInterval(interval);
00145 
00146             int i=0;
00147             while (startF <= endF)
00148             {
00149                 if (mDoData)
00150                 {
00151                     ILOG_DEBUG("Doing frame " << startF);
00152                     src->GotoFrame(startF);
00153                     Array2dVec3UInt8* im = Array::ArrayCreate<Array2dVec3UInt8>
00154                         (src->FrameWidth(), src->FrameHeight(), 0, 0,
00155                          src->DataPtr(), true);
00156                     Array2dVec3UInt8* sc = 0;
00157                     if (mDoFullSize)
00158                         Array::Set(sc, im);
00159                     else
00160                         Array::Scale(sc, im, 0.5, 0.5, Geometry::NEAREST, true);
00161 
00162                     size_t nrBytes = 0;
00163                     Array::WriteJpgToMemory(sc, mBuf, mBufSize, &nrBytes);
00164                     delete sc;
00165                     delete im;
00166 
00167                     Array2dScalarUInt8* jpgData =
00168                         Array::MakeFromData<Array2dScalarUInt8>((UInt8*) mBuf,
00169                                                                 nrBytes, 1);
00170                     imList.push_back(jpgData);
00171                 }
00172                 if (mDoDef)
00173                 {
00174                     String name(FileNameCtor("shot", fileId, shot, i++, ".jpg"));
00175                     mImSet->AddFile(name, dbSec, dbDir);
00176                     mStills->Add(fileId, shot, startF, name);
00177                 }
00178                 startF += interval;
00179             }
00180 
00181             if (mDoData && (mNr % 100 == 0))
00182                 ILOG_INFO("Did " << mNr + 1 << " shots in "
00183                           << mTimer.SplitTime() << " sec");
00184             mNr++;
00185         }
00186 
00187         if (!mDoData)
00188             return;
00189 
00190 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00191         int id = mImSet->GetFirstFileId(fileId); // use video as dir
00192         String fName = mImSet->GetFilePathImageArchive(id, "images.raw",
00193                                                        true, false);
00194         if (! fName.empty())
00195         {
00196             Array::WriteRawListVar(imList, fName, mImSet->GetDatabase(), true,
00197                                    true);
00198         }
00199         else
00200         {
00201             ILOG_ERROR("unable to write to " << fName);
00202         }
00203 #else // REPOSITORY_USED
00204         String container = mImSet->GetContainerDir(fileId); // use video as dir
00205         Persistency::ImageArchiveLocator loc(vs->GetLocator(), false,
00206                                              container, "images.raw", 0);
00207         Array::ImageArchiveMemory wrapper(&imList);
00208         Persistency::ImageArchiveRepository().Add(loc, &wrapper);
00209 #endif // REPOSITORY_USED
00210         Array::ArrayListDelete(&imList);
00211     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:29:12 2010 for ImpalaSrc by  doxygen 1.5.1