|
PiImageStreamer
|
#include <AbstractImageCapturer.h>


Public Member Functions | |
| virtual void | taskMethod ()=0 |
| void | printVideoStreamMetrics () |
| void | addOverlay (std::shared_ptr< AbstractImageOverlay > overlay) |
| void | removeOverlay (std::shared_ptr< AbstractImageOverlay > overlay) |
Public Member Functions inherited from SWE4211RPi::PeriodicTask | |
| PeriodicTask (std::string threadName, uint32_t period, int priority=1) | |
| virtual | ~PeriodicTask () |
| virtual void | setTaskPeriod (uint32_t period) final |
| virtual uint32_t | getTaskPeriod () final |
| void | run () final |
| virtual void | printInformation () |
| virtual double | getCPUUsageInfo () |
| virtual void | resetThreadDiagnostics () |
Public Member Functions inherited from SWE4211RPi::RunnableClass | |
| RunnableClass (std::string threadName, int priority=0) | |
| virtual | ~RunnableClass () |
| virtual pid_t | getThreadID () |
| virtual void | start () final |
| virtual void | setPriority (int priority) final |
| virtual int | getPriority () final |
| virtual bool | isShutdown () final |
| virtual bool | isStarted () final |
| virtual void | stopThreadExecution () |
| virtual void | waitForShutdown () |
Protected Member Functions | |
| AbstractImageCapturer (SWE4211RPi::NewCamera &referencedCamera, AbstractImageTransmitter &trans, int width, int height, std::string threadName, uint32_t period) | |
| virtual | ~AbstractImageCapturer () |
| void | printFrameTiming () |
| void | resetMetricsOnNewConnection () |
| void | applyOverlays (cv::Mat *image) |
Protected Member Functions inherited from SWE4211RPi::PeriodicTask | |
| virtual void | startChildRunnables () final |
| virtual void | stopChildRunnables () final |
| virtual void | startChildTasks () |
| virtual void | stopChildTasks () |
Static Protected Member Functions | |
| static std::chrono::microseconds | getThreadCpuTime () |
Protected Attributes | |
| SWE4211RPi::NewCamera & | myCamera |
| AbstractImageTransmitter & | myTrans |
| int | imageWidth |
| int | imageHeight |
| cv::Size * | size |
| cv::Mat | resizedImage |
| int | count = 0 |
| int | xmitTimeDeadlineMissCount =0 |
| std::chrono::microseconds | totalGrab {0} |
| std::chrono::microseconds | totalResize {0} |
| std::chrono::microseconds | totalTransmit {0} |
| long | framesTransmitted = 0 |
| std::chrono::microseconds | grabTime {0} |
| std::chrono::microseconds | resizeTime {0} |
| std::chrono::microseconds | transmitTime {0} |
| std::chrono::microseconds | delayTime {0} |
| int | lastConnectionNumber = 0 |
| std::list< std::shared_ptr< AbstractImageOverlay > > | overlays |
Protected Attributes inherited from SWE4211RPi::PeriodicTask | |
| uint32_t | taskPeriod = 100000 |
Protected Attributes inherited from SWE4211RPi::RunnableClass | |
| std::thread * | myThread = NULL |
| pthread_t | executingThread = 0 |
| pid_t | myOSThreadID = 0 |
| std::string | myName |
| std::atomic< bool > | keepGoing {true} |
| std::atomic< bool > | runCompleted {false} |
| std::atomic< bool > | runStarted {false} |
| int | priority = -1 |
Additional Inherited Members | |
Static Public Member Functions inherited from SWE4211RPi::RunnableClass | |
| static void | printThreads () |
| static void | resetAllThreadInformation () |
Static Protected Attributes inherited from SWE4211RPi::RunnableClass | |
| static std::list< RunnableClass * > | runningThreads |
This is the abstract base class for all image capturers.
|
protected |
Construct a new instance of the image capturer. It will instantiate an instance of the Size class and allocate the resize buffer.
| referencedCamera | This is the camera that is referenced. |
| trans | This is the image transmitter that is to send the given image across the network. |
| width | This is the width of the image that is to be sent in pixels. |
| height | This is the height of the image that is to be sent in pixels. |
| threadName | This is the name of the thread that is to execute. |
| period | This is the period for the task, given in microseconds. |
Store the width and height of the image to be transmitted, and create a Size object with them.
|
protectedvirtual |
This is the destructor for the class.
This is the destructor. It frees the Size object and restores the terminal's normal scrolling.
| void AbstractImageCapturer::addOverlay | ( | std::shared_ptr< AbstractImageOverlay > | overlay | ) |
This method will add an overlay to the list of overlays that are to be applied to the image that has been captured.
| overlay | This is the overlay to apply. |
|
protected |
This method will apply the active overlays to a given image.
| image | This is the image that the overlays are to be applied to. |

|
staticprotected |
This method will return the amount of CPU time that the calling thread has used so far. Unlike a wall clock, this only advances while the thread is actually running on a CPU, so time spent preempted by other threads or blocked waiting is not counted. Both user and kernel (system call) time are included.

|
protected |
This method will print the timing for the most recently transmitted frame, as well as the running averages, to the console. Before printing, the metrics are reset if a new connection has started.


| void AbstractImageCapturer::printVideoStreamMetrics | ( | ) |
This method will print metrics out to the console about the image stream.
| void AbstractImageCapturer::removeOverlay | ( | std::shared_ptr< AbstractImageOverlay > | overlay | ) |
This method will remove an overlay from the list of overlays that are to be applied to the image that has been captured.
| overlay | This is the overlay to remove. |
This method will remove an overlay to the list of overlays that are to be applied to the image that has been captured.
| overlay | This is the overlay to remove. |
|
protected |
This method will reset the metrics if a new connection has started since the last frame, so that the counts and averages only cover the current connection. The current frame's measurements are kept as the first frame of the new connection.
If the transmitter's connection number has changed, a new connection has started.


|
pure virtual |
This is the taskMethod that will run once each period. It must be implemented by the derived class to capture, process, and transmit one image.
Implements SWE4211RPi::PeriodicTask.
Implemented in SWE4211RPi::CompressedImageCapturer.
|
protected |
This is the frame count shown in the console table. It increments each time a frame's timing is printed, and is reset to 0 when a new connection starts, which causes the table to be redrawn.
|
protected |
This is the number of frames that have been transmitted on the current connection. It is used to calculate the averages.
|
protected |
These are the timing measurements, in us, for the most recently transmitted frame. The grab, resize, and transmit times are CPU times for this thread. The delay time is a wall clock time.
|
protected |
This is the height of the image that is to be transmitted in pixels. It may or may not be the same as the height captured by the camera.
|
protected |
This is the width of the image that is to be transmitted in pixels. It may or may not be the same as the width captured by the camera.
|
protected |
This is the transmitter's connection number as of the last frame. When the transmitter's connection number no longer matches, a new connection has started and the metrics are reset.
|
protected |
This is a reference to the camera that is going to be used to capture the images.
|
protected |
This is a reference to the image transmitter that will transmit the image to the other device.
|
protected |
This variable keeps track of the list of overlays that are to be applied to the image before streaming.
|
protected |
This is the fixed buffer that the resized image is written into. It is allocated once, at the transmitted size, in the constructor and reused for every frame, so that resizing does not allocate a new image each time.
|
protected |
This is the size of the image that is to be transmitted. It is an openCV Size type.
|
protected |
These are the running totals, in us of CPU time, for each step. They are divided by framesTransmitted to give the averages.
|
protected |
This variable will keep track of how many times the image has failed to transmit in an appropriate amount of time (i.e. we have not transmitted fast enough.)