You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
2.5 KiB
112 lines
2.5 KiB
/***************************************************************************************
|
|
*
|
|
* detect.h is part of SimpleSkyCam.
|
|
*
|
|
*****************************************************************************************/
|
|
|
|
|
|
#ifndef _DETECT_H_
|
|
#define _DETECT_H_
|
|
|
|
#include "gui.h"
|
|
#include "config.h"
|
|
#include "video.h"
|
|
#include "videoframe.h"
|
|
|
|
#define DET_MAXSHIFT 20
|
|
|
|
enum {
|
|
AUTODETECT_OFF = 0,
|
|
AUTODETECT_BRIGHT
|
|
};
|
|
|
|
enum {
|
|
AUTOFOLLOW_OFF = 0,
|
|
AUTOFOLLOW_BRIGHT,
|
|
AUTOFOLLOW_CROSSC
|
|
};
|
|
|
|
|
|
struct {
|
|
VideoFrame *image; // detected image
|
|
uint16_t *detmatrix;
|
|
int posx; // position of the detected object
|
|
int posy; // position of the detected object
|
|
} typedef DetectOutput;
|
|
|
|
|
|
|
|
class Detect {
|
|
private:
|
|
int running;
|
|
VideoFrame inFrame; // input frame
|
|
VideoFrame oldFrame; // oldinput frame
|
|
int inFrameNew; // new input frame;
|
|
VideoFrame image; // output image
|
|
VideoFrame imagegtk; // output image -- send to gtk
|
|
GMutex muteximage;
|
|
GMutex mutexin;
|
|
GMutex mutex; // general mutex for changing settings
|
|
GThread *thread;
|
|
|
|
float *maxx;
|
|
float *maxy;
|
|
int posmaxx;
|
|
int posmaxy;
|
|
uint32_t *detmatrix;
|
|
|
|
int objectX; // current object position
|
|
int objectY; // current object position
|
|
int objectW; // object Image Size Width
|
|
int objectH; // object Image Size Height
|
|
int minBright; // min brightness
|
|
|
|
int autodetecttype; // input detection type to use
|
|
int autofollowtype; // input detection type to use
|
|
|
|
void InputDetect (int *posx, int *posy);
|
|
void InputDetectCrossC (int *posx, int *posy);
|
|
void SetInputSize (int nw, int nh);
|
|
void CopyObjectImage(int objx, int objy);
|
|
|
|
public:
|
|
Detect();
|
|
~Detect();
|
|
|
|
int NewFrame(VideoFrame *newframe);
|
|
|
|
//
|
|
// Thread Releated Functions (maybe soon private?)
|
|
int TryLockInMutex() { return g_mutex_trylock(&mutexin); };
|
|
void LockInMutex() { g_mutex_lock(&mutexin);};
|
|
void UnLockInMutex() { g_mutex_unlock(&mutexin);};
|
|
|
|
int TryLockImageMutex() { return g_mutex_trylock(&muteximage); };
|
|
void LockImageMutex() { g_mutex_lock(&muteximage);};
|
|
void UnLockImageMutex() { g_mutex_unlock(&muteximage);};
|
|
|
|
void LockMutex() { g_mutex_lock(&mutex);};
|
|
void UnLockMutex() { g_mutex_unlock(&mutex);};
|
|
|
|
//
|
|
// Object functions
|
|
void SetObjectSize (int neww, int newh);
|
|
void GetObjectSize (int *ow, int *oh);
|
|
|
|
void SetMinBrightness (int value);
|
|
int GetMinBrightness();
|
|
|
|
void SetFollowType(int intype);
|
|
int GetFollowType();
|
|
|
|
void SetDetectType(int intype);
|
|
int GetDetectType();
|
|
|
|
void SetObjectPos (int x, int y);
|
|
void GetObjectPos (int *x, int *y);
|
|
|
|
void Thread();
|
|
};
|
|
|
|
#endif
|