FrameOstream subclass that writes image hashes to an output file. More...
#include <Transport/HashOutputSeries.H>
Classes | |
struct | Impl |
Public Member Functions | |
HashOutputSeries (OptionManager &mgr) | |
Constructor. | |
virtual | ~HashOutputSeries () |
Destructor. | |
virtual void | setConfigInfo (const std::string &filename) |
Override from FrameOstream; just calls setFileName(). | |
virtual bool | setFrameNumber (int n) |
Set the current frame number and remember it. | |
virtual void | writeFrame (const GenericFrame &frame, const std::string &shortname, const FrameInfo &auxinfo) |
Write a image hash to the output file. | |
virtual void | closeStream (const std::string &shortname) |
No-op. | |
void | setFileName (const std::string &s) |
Specify the output filename. |
FrameOstream subclass that writes image hashes to an output file.
To try out HashOutputSeries, you can for example do the following using bin/stream to generate a listing on stderr of 100 32-bit hashes of 300x300 random images like this:
./bin/stream --in=random:300x300 --in-echo=hash:stderr \ --input-frames=0-99
which will generate output like the following:
000000 5b380a30 0 % input-echo 000001 1d108dc8 0 % input-echo 000002 5c0e58aa 0 % input-echo 000003 cb34047b 0 % input-echo 000004 f800c826 0 % input-echo 000005 6386062a 0 % input-echo 000006 30ed69d6 0 % input-echo
where the first column is the frame number, the second column is the hash, and the third column is a 0 or 1 indicating whether we've seen that hash value previously in this run -- note that a value of 1 doesn't necessarily imply a hash-function collision; it could be that the input frames were exactly the same! The last column, after a matlab-comment character (%), is the image name as it was passed to writeRGB() or writeGray() or writeFloat().
If the filename given to HashOutputSeries is "", "-", "stdout", or "STDOUT" then the output goes to stdout, likewise "stderr" or "STDERR" sends output to stderr, and anything else will be interpreted as a literal filename to which output should be written.
Definition at line 75 of file HashOutputSeries.H.
HashOutputSeries::HashOutputSeries | ( | OptionManager & | mgr | ) |
Constructor.
Definition at line 134 of file HashOutputSeries.C.
HashOutputSeries::~HashOutputSeries | ( | ) | [virtual] |
Destructor.
Definition at line 141 of file HashOutputSeries.C.
void HashOutputSeries::closeStream | ( | const std::string & | shortname | ) | [virtual] |
void HashOutputSeries::setConfigInfo | ( | const std::string & | filename | ) | [virtual] |
Override from FrameOstream; just calls setFileName().
Reimplemented from FrameOstream.
Definition at line 147 of file HashOutputSeries.C.
References setFileName().
void HashOutputSeries::setFileName | ( | const std::string & | s | ) |
Specify the output filename.
Definition at line 193 of file HashOutputSeries.C.
Referenced by setConfigInfo().
bool HashOutputSeries::setFrameNumber | ( | int | n | ) | [virtual] |
Set the current frame number and remember it.
Reimplemented from FrameOstream.
Definition at line 157 of file HashOutputSeries.C.
void HashOutputSeries::writeFrame | ( | const GenericFrame & | frame, | |
const std::string & | shortname, | |||
const FrameInfo & | auxinfo | |||
) | [virtual] |
Write a image hash to the output file.
Implements FrameOstream.
Definition at line 165 of file HashOutputSeries.C.
References GenericFrame::asGrayF32(), GenericFrame::asGrayU8(), GenericFrame::asRgbF32(), GenericFrame::asRgbU8(), GenericFrame::asVideo(), GenericFrame::GRAY_F32, GenericFrame::GRAY_U16, GenericFrame::GRAY_U8, GenericFrame::nativeType(), GenericFrame::nativeTypeName(), GenericFrame::NONE, GenericFrame::RGB_F32, GenericFrame::RGB_U16, GenericFrame::RGB_U8, and GenericFrame::RGBD.