|
PiImageStreamer
|
#include <CompressedImageCapturer.h>


Public Member Functions | |
| CompressedImageCapturer (SWE4211RPi::NewCamera &referencedCamera, AbstractImageTransmitter &trans, int width, int height, std::string threadName, uint32_t period) | |
| virtual | ~CompressedImageCapturer () |
| virtual void | taskMethod () |
Public Member Functions inherited from SWE4211RPi::AbstractImageCapturer | |
| 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 () |
Additional Inherited Members | |
Static Public Member Functions inherited from SWE4211RPi::RunnableClass | |
| static void | printThreads () |
| static void | resetAllThreadInformation () |
Protected Member Functions inherited from SWE4211RPi::AbstractImageCapturer | |
| 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 inherited from SWE4211RPi::AbstractImageCapturer | |
| static std::chrono::microseconds | getThreadCpuTime () |
Protected Attributes inherited from SWE4211RPi::AbstractImageCapturer | |
| 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 |
Static Protected Attributes inherited from SWE4211RPi::RunnableClass | |
| static std::list< RunnableClass * > | runningThreads |
This class is the image capturer used with the compressed image transmitter.
| CompressedImageCapturer::CompressedImageCapturer | ( | SWE4211RPi::NewCamera & | referencedCamera, |
| AbstractImageTransmitter & | trans, | ||
| int | width, | ||
| int | height, | ||
| std::string | threadName, | ||
| uint32_t | period | ||
| ) |
Construct a new instance of the image capturer.
| 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. |
|
virtual |
This is the destructor for the class.
This is the destructor.
|
virtual |
This is the taskMethod that will run once each period. It will capture, process, and transmit one image.
This is the virtual task method. It will capture, process, and transmit one image. It will execute once each task period. The algorithm is as follows:
Obtain the CPU time used so far by this thread. This is used to measure how much CPU time each step takes, excluding any time this thread spends preempted or blocked.
Take the picture from the camera. This returns a newly allocated copy of the camera's most recent frame.
If the image is not empty,
Apply the overlays to the image.
Obtain the CPU time used so far by this thread.
Resize the image according to the desired size, if a resize needs to occur. The resized image is written into the fixed resizedImage buffer rather than back into the original image, which would force a new image to be allocated every frame. The image to send is then the resized image. If no resize is needed, the original image is sent.
Obtain the CPU time used so far by this thread.
Stream the image to the remote device.
Obtain the CPU time used so far by this thread, and the current time from the steady clock.
Add the specific values to the running totals as is applicable.
If the time is negative
Increment the count of frames transmitted.
Print the timing for this frame and the running averages to the console.
Implements SWE4211RPi::AbstractImageCapturer.
