AURobotServers
4
|
#include <uimgpush.h>
Public Member Functions | |
int | addPoolPushCommand (UServerInMsg *msg) |
void | createLocalVariables (UVarPool *parent) |
void | fillBuffer (GstElement *fakesrc, GstBuffer *buffer, GstPad *pad) |
void | fillShowBuffer (GstElement *fakesrc, GstBuffer *buffer, GstPad *pad) |
int | getTcpPort () |
virtual void | imgUpdated () |
void | run () |
void | runShow () |
void | setImgLog (UImageLog *imageLog) |
void | setLogInterval (int interval) |
bool | setTcpPort (int port) |
void | startShowing (bool doStart) |
void | startStreaming (bool doStart) |
UImgPush (const unsigned int height=480, const unsigned int width=640, int channels=3, int depth=8) | |
virtual | ~UImgPush () |
Public Member Functions inherited from UImage | |
void | clear (UPixel rgb) |
void | clear (void) |
void | clear (int v) |
bool | colorSaturate (double gain) |
bool | colourSaturate (double gain) |
bool | copy (UImage *source) |
bool | copyAndScale (UImage *source, double factor) |
bool | copyJustImage (UImage *source) |
bool | copyMeta (UImage *source, bool andSize) |
bool | copyScaleDown (UImage *source, int factor) |
bool | copyToMaxRes (UImage *source) |
CvArr * | cvArr () |
void | edgeSobel (UImage *destination, bool absoluteValue=true, int reducFactor=1) |
bool | fromMat (char *colorFormatString=NULL) |
bool | fromMat (cv::Mat src, char *colorFormatString=NULL) |
unsigned int | getBufferSize () |
Get number of bytes in image buffer. This is the total size of the allocated image buffer. This may be larger than the the number of bytes actually used by the image, and allows thus change in image size or format without allocating new buffer space. More... | |
int | getChannels () |
char * | getCharRef (unsigned int line, unsigned int column) |
int | getColorType () |
const char * | getColorTypeString () |
UImage ** | getConvertBuffer () |
UPixel * | getData () |
unsigned int | getDataSize () |
int | getDepth () |
unsigned int | getHeight () |
UTime | getImageTime () |
int * | getIntRef (unsigned int line, unsigned int column) |
IplImage * | getIplImage () |
UPixel * | getLine (unsigned int line) |
bool | GetNewNonCameraImage () |
UPixel | getPix (unsigned int line, unsigned int column) |
UPixel | getPix (unsigned int line, unsigned int column, int inColFormat) |
int | getPixInt (unsigned int line, unsigned int column) |
UPixel * | getPixRef (unsigned int line, unsigned int column) |
bool | getQuadPix (unsigned int line, unsigned int column, unsigned char *I11, unsigned char *I12, unsigned char *I21, unsigned char *I22, unsigned char *U, unsigned char *V) |
unsigned char * | getUCharRef (unsigned int line, unsigned int column) |
unsigned char * | getUline (unsigned int line) |
UTime | getUpdatedTime () |
unsigned char * | getVline (unsigned int line) |
unsigned int | getWidth () |
unsigned char * | getYline (unsigned int line) |
void | gridLine (float Pos, char axis, float minH, float maxH, float minW, float maxW, char sw= 'y', int Color=1) |
void | gridLines (float major, float minor, char axis, float minH, float maxH, float minW, float maxW, char sw) |
unsigned int | height () |
void | hLine (unsigned int line, unsigned int c1, unsigned int c2, int p1, int p2, int p3) |
unsigned int | imgBytes () |
bool | initImage (const unsigned int iHeight, const unsigned int iWidth, char *data, const unsigned int bufferSize, const int channels=3, const int depth=8) |
bool | inRange (int line, int column) |
bool | invertY () |
bool | isBayer () |
bool | isBGR () |
bool | isBW () |
bool | isBW16s () |
bool | isBW16u () |
bool | isRGB () |
bool | isRGBA () |
bool | isTooBig (const unsigned int w, const unsigned int h) |
bool | isValid () |
bool | isYUV () |
bool | isYUV420 () |
bool | isYUV422 () |
void | lineInGrid (UPosition pos1, UPosition pos2, float minH, float maxH, float minW, float maxW, char sw, UPixel *rgb, UMatrix4 *mA=NULL, int lineWidth=1) |
bool | loadBMP (const char filename[]) |
bool | loadBMP (const char path[], const char basename[], const int num, const char nameAdd[]) |
bool | loadPNG (const char *filename) |
unsigned int | maxBytes () |
unsigned int | maxPixels () |
bool | median (UImage *dimg, unsigned int row1, unsigned int col1, unsigned int row2, unsigned int col2, unsigned int fW, unsigned int fH) |
void | moveBW16ToRGB (UImage *dest) |
int | packZLIB (char *buffer, int bufferSize) |
void | paintGridAligned (const int r0, const int c0, const double pixPerM, const int strongTicEvery) |
int | pixCmp (UPixel *p1, UPixel *p2) |
UPixel | pixRGB (unsigned char r, unsigned char g, unsigned char b) |
UPixel * | pixSort (UPixel ***ps, int pixCnt) |
UPixel | pixYUV (unsigned char y, unsigned char u, unsigned char v) |
bool | resize (const unsigned int iHeight, const unsigned int iWidth, const int channels=3, const int depth=8) |
bool | resizeBuffer (const unsigned int iHeight, const unsigned int iWidth, const int channels, const int depth) |
bool | saveBMP (const char filename[]) |
bool | saveBMP (const char path[], const char basename[], const int num, const char nameAdd[]) |
bool | saveMeta (const char *name, const char *type, const char *path) |
bool | savePNG (const char *filename) |
bool | saveTxt (const char *filename) |
int | setColorType (const char *) |
bool | setColorType (int colorFormat) |
bool | setMaxSize43 () |
void | setName (const char *imageName) |
void | setNameAndExt (const char *basename, const char *ext=NULL) |
void | setPix (unsigned int line, unsigned int column, UPixel pix) |
void | setPixChar (unsigned int line, unsigned int column, char pix) |
void | setPixel (int x1, int y1, UPixel rgb, UImage *image=NULL, int procent=0) |
void | setPixInt (unsigned int line, unsigned int column, int pix) |
void | setPixUChar (unsigned int line, unsigned int column, unsigned char pix) |
bool | setQuadPix (unsigned int line, unsigned int column, unsigned char I11, unsigned char I12, unsigned char I21, unsigned char I22, unsigned char U, unsigned char V) |
void | setROI (int x, int y, int w, int h) |
bool | setSize (const unsigned int iHeight, const unsigned int iWidth, const int channels, const int depth, const char *colorType=NULL) |
bool | setSizeOnly (const unsigned int iHeight, const unsigned int iWidth) |
void | shiftCols (int cols, int byteFill=-1) |
void | shiftRows (int rows, int byteFill=-1) |
UPixel | sobel (UPixel *p1, UPixel *p2, UPixel *p3) |
UPixel | sobel (UPixel *p1, UPixel *p2, UPixel *p3, UPixel *pixRef, int reducFactor) |
bool | toBGR (UImage *dest=NULL) |
bool | toBW (UImage *dest=NULL) |
bool | toCromaBGR (UImage *dest=NULL) |
bool | toHalf () |
bool | toMat () |
void | tone (UPixel *rgb, int procent) |
void | tone (UPixel rgb, int procent) |
bool | toRaibow (UImage *gray) |
bool | toRaibowInv (UImage *gray) |
bool | toRGB (UImage *dest=NULL) |
bool | toRGBA (UImage *dest=NULL) |
bool | toYUV (UImage *dest=NULL) |
UImage () | |
bool | unpackZLIB (int rows, int cols, const char *colFormat, char *buffer, int bufferCnt) |
void | updated () |
void | vLine (unsigned int col, unsigned int r1, unsigned int r2, int p1, int p2, int p3) |
unsigned int | width () |
bool | yuv422toBGR (uint8_t *source, int h, int w) |
bool | yuv422toBGRhalf (uint8_t *source, int h, int w) |
bool | yuv422toBW (uint8_t *source, int h, int w) |
bool | yuv422toRGB (uint8_t *source, int h, int w) |
bool | yuv422toRGBhalf (uint8_t *source, int h, int w) |
bool | yuv422toYUV (uint8_t *source, int h, int w) |
bool | yuv422toYUVhalf (uint8_t *source, int h, int w) |
virtual | ~UImage () |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Public Member Functions inherited from UServerPush | |
int | addPushCommand (UServerInMsg *msg) |
bool | doPushCall (UServerPushElement *pe, const char *value) |
void | flushClientCmds (int clientIdx) |
UServerPushImplement * | getImplementor () |
int | getPushCmdCnt (int *cmdCnt, int *callCnt) |
UServerPushQueue * | getPushQueue () |
bool | gotCmdExe () |
void | gotNewData (void *pData) |
bool | isUpdated (int lastCnt, int *newCnt) |
bool | needNewData () |
void | print (const char *preString) |
void | print (const char *preString, char *buff, int buffCnt) |
void | servicePendingPushCmds () |
void | setCmdExe (UServerPushImplement *executor) |
void | setImplementor (UServerPushImplement *executor) |
bool | setResource (UResBase *resource, bool remove) |
bool | setUpdated (const char *value) |
Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More... | |
UServerPush () | |
virtual | ~UServerPush () |
Public Attributes | |
int | imgPoolNumber |
image pool slot More... | |
Public Attributes inherited from UImage | |
void * | cam |
int | camDevice |
unsigned int | hdrSet |
unsigned long | imageNumber |
UTime | imgTime |
cv::Mat | mat |
char | name [MAX_IMG_NAME_SIZE] |
UPosition | pos |
bool | radialErrorRemoved |
float | readDelay |
URotation | rot |
char | saveType [MAX_EXT_SIZE] |
int | source |
unsigned int | used |
bool | valid |
Protected Member Functions | |
virtual void | callGotNewDataWithObject () |
bool | start () |
bool | startShow () |
void | stop (bool andWait) |
void | stopShow (bool andWait) |
Protected Member Functions inherited from UImage | |
bool | moveBGGRTo (int toColFormat, UImage *dest) |
bool | moveBGGRtoBGR (UImage *dest) |
bool | moveBGGRtoBW (UImage *dest) |
void | moveBGGRToHalfBGR () |
bool | moveBGGRtoRGB (UImage *dest) |
void | moveBWToHalf () |
void | movePixToHalf () |
bool | moveYUV420To (int toColFormat, UImage *dest) |
void | moveYUV420ToHalf () |
void | moveYUV420ToHalf (UImage *dst) |
Private Attributes | |
GMainLoop * | gloop |
streamer loop - to be able to stop: More... | |
GMainLoop * | gloop_show |
streamer loop - to be able to stop: More... | |
UImageLog * | imgLog |
logfile structure More... | |
int | imgSizeH |
size of source image in pixels More... | |
int | imgSizeW |
size of source image in pixels More... | |
UTime | lastShowTime |
last image number More... | |
UTime | lastUpdateTime |
actual framerate ?? used? More... | |
pthread_t | threadHandle |
bool | threadRunning |
for image stream More... | |
pthread_t | threadShowHandle |
bool | threadShowRunning |
is thread running - set by thread More... | |
bool | threadShowStop |
is thread to stop - set by main function More... | |
bool | threadStop |
is thread to stop - set by main function More... | |
UVariable * | varDesiredUpdateRate |
(r/w) stream at this update interval More... | |
UVariable * | varLogInterval |
update interval for logging More... | |
UVarPool * | varPoolParent |
link to global variable tree More... | |
UVariable * | varSerial |
image serial number More... | |
UVariable * | varShow |
(r/w) is streaming active More... | |
UVariable * | varSize |
size of image More... | |
UVariable * | varStreaming |
(r/w) is streaming active More... | |
UVariable * | varTcpPort |
streaming port More... | |
UVariable * | varTime |
image serial number More... | |
UVariable * | varUdpClients |
UDP streaming clients. More... | |
UVariable * | varUpdateCnt |
update count More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from UImage | |
static int | toColFormatInt (const char *col) |
Protected Attributes inherited from UImage | |
unsigned int | bufferBytes |
int | colFormat |
IplImage | img |
UTime | imgUpdateTime |
unsigned char * | pu |
unsigned char * | pv |
unsigned char * | py |
Image with push capabilities
UImgPush::UImgPush | ( | const unsigned int | height = 480 , |
const unsigned int | width = 640 , |
||
int | channels = 3 , |
||
int | depth = 8 |
||
) |
Constructor
References gloop, gloop_show, imgLog, UImage::resize(), threadHandle, threadRunning, threadShowHandle, threadShowRunning, threadShowStop, threadStop, varDesiredUpdateRate, varPoolParent, varSerial, varShow, varSize, varStreaming, varTcpPort, and varTime.
|
virtual |
Destructor
References stop().
|
inline |
Add a camera push command. A camera push command is triggered when a new image is available.
References UServerPush::addPushCommand(), createLocalVariables(), imgUpdated(), and setTcpPort().
Referenced by UFunctionImgPool::handlePoolPushCommand().
|
inlineprotectedvirtual |
Called from push structure to get push object followed by a call to 'gotNewData(object)'. Returns false if no push commands are valid.
Reimplemented from UServerPush.
References fillBuffer(), fillShowBuffer(), UServerPush::gotNewData(), run(), runShow(), start(), startShow(), stop(), and stopShow().
void UImgPush::createLocalVariables | ( | UVarPool * | parent | ) |
create local variables Should be called no more than once, and not if not to create global variables with status
parent | parent structure in global variable tree. |
References UVarPool::addVar(), UVarPool::addVarA(), varDesiredUpdateRate, varLogInterval, varPoolParent, varSerial, varShow, varSize, varStreaming, varTcpPort, varTime, varUdpClients, and varUpdateCnt.
Referenced by addPoolPushCommand(), and UImagePool::getImage().
void UImgPush::fillBuffer | ( | GstElement * | fakesrc, |
GstBuffer * | buffer, | ||
GstPad * | pad | ||
) |
Fill fake source buffer with new data from pool image for streaming
References UVariable::add(), UVariable::getBool(), UImage::getData(), UImage::getDataSize(), UVariable::getDouble(), UTime::getTimePassed(), UImage::imgUpdateTime, lastUpdateTime, mini(), UTime::now(), threadStop, ULock::tryLock(), ULock::unlock(), varDesiredUpdateRate, varStreaming, and Wait().
Referenced by callGotNewDataWithObject(), and cb_handoff().
void UImgPush::fillShowBuffer | ( | GstElement * | fakesrc, |
GstBuffer * | buffer, | ||
GstPad * | pad | ||
) |
Fill fake source buffer with new data from pool image - for direct show
References UVariable::add(), UVariable::getBool(), UImage::getConvertBuffer(), UImage::getData(), UImage::getDataSize(), UImage::getDepth(), UVariable::getDouble(), UTime::getTimePassed(), UImage::imgUpdateTime, UImage::isBayer(), UImage::isYUV(), UImage::isYUV420(), UImage::isYUV422(), lastShowTime, lastUpdateTime, mini(), UTime::now(), threadShowStop, UImage::toBGR(), ULock::tryLock(), UImage::UImage(), ULock::unlock(), varDesiredUpdateRate, varShow, and Wait().
Referenced by callGotNewDataWithObject(), and cb_handoff_show().
|
inline |
Get TCP port number for streaming
References UVariable::getInt(), and varTcpPort.
Referenced by UFunctionImgPool::handleImageSetCommand().
|
virtual |
Image is updated now, note this in client handler
Reimplemented from UImage.
References UVariable::add(), UVariable::getBool(), UImage::getChannels(), UImage::getColorType(), UImage::getDepth(), UVariable::getInt(), UImage::height(), UImage::imageNumber, imgLog, imgPoolNumber, UImage::imgTime, UImage::imgUpdated(), UQevent::imgUpdatedEvent(), ULogFile::isOpen(), UImageLog::logImgPoolImage(), qevent, UVariable::setInt(), UVariable::setTime(), UServerPush::setUpdated(), start(), startShow(), stop(), stopShow(), threadRunning, threadShowRunning, varLogInterval, varPoolParent, varSerial, varShow, varSize, varStreaming, varTime, varUpdateCnt, Wait(), and UImage::width().
Referenced by addPoolPushCommand(), startShowing(), and startStreaming().
void UImgPush::run | ( | ) |
stream thread using fake source - image-pool to stream assembles processing and starts gstreamer main thread,
References cb_handoff(), FALSE, UImage::getChannels(), UImage::getDataSize(), UImage::getDepth(), UVariable::getInt(), UVariable::getString(), gloop, UImage::height(), UImage::isBayer(), UImage::isBW(), UImage::isRGB(), UVariable::setBool(), threadRunning, threadStop, TRUE, varStreaming, varTcpPort, varUdpClients, and UImage::width().
Referenced by callGotNewDataWithObject(), and startThread().
void UImgPush::runShow | ( | ) |
image show thread using fake source - image-pool to x-window assembles processing and starts gstreamer main thread,
References cb_handoff_show(), FALSE, UImage::getChannels(), UImage::getDataSize(), UImage::getDepth(), UImage::getHeight(), UImage::getWidth(), gloop_show, UImage::height(), UImage::isBW(), UImage::isRGB(), UVariable::setBool(), threadShowRunning, threadShowStop, TRUE, varShow, and UImage::width().
Referenced by callGotNewDataWithObject(), and startShowThread().
|
inline |
Status change in stream Set reference to image log for image pool
References imgLog, and setLogInterval().
Referenced by UImagePool::setLogImg().
void UImgPush::setLogInterval | ( | int | interval | ) |
Set log attributes for this image
interval | is logging interval 0 is off, 1 is all updates 2 is every other ... |
References UVariable::setInt(), and varLogInterval.
Referenced by setImgLog(), and UImagePool::setLogImg().
bool UImgPush::setTcpPort | ( | int | port | ) |
Set TCP port number for streaming - disconnecting ant clients
References cb_handoff(), UVariable::getBool(), UVariable::setInt(), start(), startThread(), stop(), varStreaming, and varTcpPort.
Referenced by addPoolPushCommand(), and UImagePool::getImage().
|
protected |
stop read thread
andWait | waits until thread is terminated, when false, then the call returns when the stop flag is set (i.e. immidiately). Start stream processing thread |
Start stream processing thread
References startThread(), threadHandle, threadRunning, and threadStop.
Referenced by callGotNewDataWithObject(), imgUpdated(), and setTcpPort().
|
protected |
Start gstream show thread
Start stream processing thread
References startShowThread(), threadShowHandle, threadShowRunning, and threadShowStop.
Referenced by callGotNewDataWithObject(), and imgUpdated().
|
inline |
start streaming, that is set the flag for stream start, but actual start requires that image is updated.
References imgUpdated(), UVariable::setBool(), and varShow.
Referenced by UImagePool::getImage(), and UFunctionImgPool::handleImageSetCommand().
|
inline |
start streaming, that is set the flag for stream start, but actual start requires that image is updated.
References imgUpdated(), UVariable::setBool(), and varStreaming.
Referenced by UFunctionImgPool::handleImageSetCommand().
|
protected |
stop read thread
andWait | waits until thread is terminated, when false, then the call returns when the stop flag is set (i.e. immidiately). |
References gloop, threadHandle, threadRunning, threadStop, and Wait().
Referenced by callGotNewDataWithObject(), imgUpdated(), setTcpPort(), and ~UImgPush().
|
protected |
stop read thread
andWait | waits until thread is terminated, when false, then the call returns when the stop flag is set (i.e. immidiately). |
References gloop_show, threadShowHandle, threadShowRunning, threadShowStop, and Wait().
Referenced by callGotNewDataWithObject(), and imgUpdated().
|
private |
streamer loop - to be able to stop:
Referenced by run(), stop(), and UImgPush().
|
private |
streamer loop - to be able to stop:
Referenced by runShow(), stopShow(), and UImgPush().
|
private |
logfile structure
Referenced by imgUpdated(), setImgLog(), and UImgPush().
int UImgPush::imgPoolNumber |
image pool slot
Referenced by UImagePool::getImage(), imgUpdated(), and UImageLog::logImgPoolImage().
|
private |
size of source image in pixels
|
private |
size of source image in pixels
|
private |
last image number
Referenced by fillShowBuffer().
|
private |
|
private |
Thread handle for processing thread.
Referenced by start(), stop(), and UImgPush().
|
private |
for image stream
is thread running - set by thread
Referenced by imgUpdated(), run(), start(), stop(), and UImgPush().
|
private |
Thread handle for processing thread.
Referenced by startShow(), stopShow(), and UImgPush().
|
private |
is thread running - set by thread
Referenced by imgUpdated(), runShow(), startShow(), stopShow(), and UImgPush().
|
private |
is thread to stop - set by main function
Referenced by fillShowBuffer(), runShow(), startShow(), stopShow(), and UImgPush().
|
private |
is thread to stop - set by main function
Referenced by fillBuffer(), run(), start(), stop(), and UImgPush().
|
private |
(r/w) stream at this update interval
Referenced by createLocalVariables(), fillBuffer(), fillShowBuffer(), and UImgPush().
|
private |
update interval for logging
Referenced by createLocalVariables(), imgUpdated(), and setLogInterval().
|
private |
link to global variable tree
Referenced by createLocalVariables(), imgUpdated(), and UImgPush().
|
private |
image serial number
Referenced by createLocalVariables(), imgUpdated(), and UImgPush().
|
private |
(r/w) is streaming active
Referenced by createLocalVariables(), fillShowBuffer(), imgUpdated(), runShow(), startShowing(), and UImgPush().
|
private |
size of image
Referenced by createLocalVariables(), imgUpdated(), and UImgPush().
|
private |
(r/w) is streaming active
Referenced by createLocalVariables(), fillBuffer(), imgUpdated(), run(), setTcpPort(), startStreaming(), and UImgPush().
|
private |
streaming port
Referenced by createLocalVariables(), getTcpPort(), run(), setTcpPort(), and UImgPush().
|
private |
image serial number
Referenced by createLocalVariables(), imgUpdated(), and UImgPush().
|
private |
UDP streaming clients.
Referenced by createLocalVariables(), and run().
|
private |
update count
Referenced by createLocalVariables(), and imgUpdated().