SOMHunter Core
sh::DatasetFrames Class Reference

#include <dataset-frames.h>

Collaboration diagram for sh::DatasetFrames:

Public Member Functions

 DatasetFrames (const Settings &config)
 
std::string operator[] (FrameId i) const
 
std::vector< VideoFrame >::iterator end ()
 
std::vector< VideoFrame >::iterator begin ()
 
std::vector< VideoFrame >::const_iterator end () const
 
std::vector< VideoFrame >::const_iterator begin () const
 
size_t get_num_videos () const
 
VideoFrameget_frame (FrameId i)
 
const VideoFrameget_frame (FrameId i) const
 
VideoFrameget_frame_ptr (FrameId i)
 
const VideoFrameget_frame_ptr (FrameId i) const
 
std::vector< VideoFrame >::const_iterator get_frame_it (FrameId i) const
 
size_t size () const
 
VideoId get_video_id (FrameId img_ID) const
 
FrameRange get_all_video_frames (VideoId video_ID) const
 Return copy of FrameRange representing all selected frames from the given video. More...
 
FrameRange get_shot_frames (VideoId video_ID, size_t frame_num_from, size_t frame_num_to) const
 Returns new instance of FrameRange representing all frames from prvided video ID in interval [frame_num_from, frame_num_to]. More...
 
std::vector< VideoFramePointerids_to_video_frame (const std::vector< FrameId > &ids) const
 Translation to VideoFrameRefs from vector ids or FrameRange. More...
 

Static Public Member Functions

static std::vector< VideoFramePointerrange_to_video_frame (const FrameRange &ids)
 

Private Member Functions

VideoFrame parse_video_filename (std::string &&filename)
 From filename string it parses useful info as video/shot/frame ID etc. More...
 
FiltersData parse_metadata_line (const std::string &line)
 Parses the desired metadata from the metadata line. More...
 

Static Private Member Functions

static std::vector< std::vector< KeywordId > > parse_top_kws_for_imgs_text_file (const std::string &filepath)
 Parses a text file with lists of top keywords for given image ID. More...
 

Private Attributes

std::vector< FrameRange_video_ID_to_frame_range
 Map from video ID to range of image IDs. More...
 
std::vector< VideoFrame_frames
 
std::string frames_dir
 
std::string thumbs_dir
 
DatasetsSettings::VideoFilenameOffsets offs {}
 

Constructor & Destructor Documentation

◆ DatasetFrames()

DatasetFrames::DatasetFrames ( const Settings config)
Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

std::vector<VideoFrame>::iterator sh::DatasetFrames::begin ( )
inline

◆ begin() [2/2]

std::vector<VideoFrame>::const_iterator sh::DatasetFrames::begin ( ) const
inline

◆ end() [1/2]

std::vector<VideoFrame>::iterator sh::DatasetFrames::end ( )
inline

◆ end() [2/2]

std::vector<VideoFrame>::const_iterator sh::DatasetFrames::end ( ) const
inline

◆ get_all_video_frames()

FrameRange sh::DatasetFrames::get_all_video_frames ( VideoId  video_ID) const
inline

Return copy of FrameRange representing all selected frames from the given video.

◆ get_frame() [1/2]

VideoFrame& sh::DatasetFrames::get_frame ( FrameId  i)
inline

◆ get_frame() [2/2]

const VideoFrame& sh::DatasetFrames::get_frame ( FrameId  i) const
inline

◆ get_frame_it()

std::vector<VideoFrame>::const_iterator sh::DatasetFrames::get_frame_it ( FrameId  i) const
inline

◆ get_frame_ptr() [1/2]

VideoFrame* sh::DatasetFrames::get_frame_ptr ( FrameId  i)
inline

◆ get_frame_ptr() [2/2]

const VideoFrame* sh::DatasetFrames::get_frame_ptr ( FrameId  i) const
inline

◆ get_num_videos()

size_t sh::DatasetFrames::get_num_videos ( ) const
inline

◆ get_shot_frames()

FrameRange sh::DatasetFrames::get_shot_frames ( VideoId  video_ID,
size_t  frame_num_from,
size_t  frame_num_to 
) const
inline

Returns new instance of FrameRange representing all frames from prvided video ID in interval [frame_num_from, frame_num_to].

◆ get_video_id()

VideoId sh::DatasetFrames::get_video_id ( FrameId  img_ID) const
inline
Here is the call graph for this function:

◆ ids_to_video_frame()

std::vector< VideoFramePointer > DatasetFrames::ids_to_video_frame ( const std::vector< FrameId > &  ids) const

Translation to VideoFrameRefs from vector ids or FrameRange.

Here is the call graph for this function:

◆ operator[]()

std::string sh::DatasetFrames::operator[] ( FrameId  i) const
inline

◆ parse_metadata_line()

FiltersData DatasetFrames::parse_metadata_line ( const std::string &  line)
private

Parses the desired metadata from the metadata line.

Here is the call graph for this function:

◆ parse_top_kws_for_imgs_text_file()

std::vector< std::vector< KeywordId > > DatasetFrames::parse_top_kws_for_imgs_text_file ( const std::string &  filepath)
staticprivate

Parses a text file with lists of top keywords for given image ID.

e.g: with_top.images_top_keywords.txt

Line determines image ID therefore input file must have them sorted.

◆ parse_video_filename()

VideoFrame DatasetFrames::parse_video_filename ( std::string &&  filename)
private

From filename string it parses useful info as video/shot/frame ID etc.

Here is the call graph for this function:

◆ range_to_video_frame()

std::vector< VideoFramePointer > DatasetFrames::range_to_video_frame ( const FrameRange ids)
static
Here is the call graph for this function:

◆ size()

size_t sh::DatasetFrames::size ( ) const
inline

Member Data Documentation

◆ _frames

std::vector<VideoFrame> sh::DatasetFrames::_frames
private

◆ _video_ID_to_frame_range

std::vector<FrameRange> sh::DatasetFrames::_video_ID_to_frame_range
private

Map from video ID to range of image IDs.

◆ frames_dir

std::string sh::DatasetFrames::frames_dir
private

◆ offs

DatasetsSettings::VideoFilenameOffsets sh::DatasetFrames::offs {}
private

◆ thumbs_dir

std::string sh::DatasetFrames::thumbs_dir
private

The documentation for this class was generated from the following files: