You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.9 KiB
C++
99 lines
2.9 KiB
C++
#ifndef __TP_ALGORITHM_H
|
|
#define __TP_ALGORITHM_H
|
|
|
|
#include "baseDefine.h"
|
|
#include <QtCore\qstring.h>
|
|
#include <QtGui\qimage.h>
|
|
#include <QtCore\qvariant.h>
|
|
#include <QtCore\qbuffer.h>
|
|
#include <QtCore\qstringlist.h>
|
|
|
|
#define ALG_SHARED_GLOBAL_KEY_APP_STATUS "app_status"
|
|
#define ALG_SHARED_GLOBAL_KEY_APP_CHECKED "app_checked_status"
|
|
#define ALG_OPTION_GLOBAL_KEY_SAMPLING_OBJECT "sampling_object"
|
|
|
|
typedef struct tagTP_ALGORITHM_OPTION {
|
|
int algorithm;
|
|
class IAlgorithmOption* pImagProcCb;
|
|
} TP_ALGORITHM_OPTION;
|
|
////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum emTpCameraProperty{
|
|
TP_CAM_PROPERTY_NONE = 0,
|
|
TP_CAM_PROPERTY_EXPOSURE = 1,
|
|
TP_CAM_PROPERTY_BALANCE_RATIO_RED = 2,
|
|
TP_CAM_PROPERTY_BALANCE_RATIO_GREEN = 3,
|
|
TP_CAM_PROPERTY_BALANCE_RATIO_BLUE = 4,
|
|
TP_CAM_PROPERTY_FOLDER_NAME = 50,
|
|
TP_CAM_BITFLOW_BASE = 110,
|
|
TP_CAM_BITFLOE_SAVE_CFG = TP_CAM_BITFLOW_BASE,
|
|
TP_CAM_BITFLOW_ROW_RATE = TP_CAM_BITFLOW_BASE + 1,
|
|
TP_CAM_BITFLOW_COMMAND = TP_CAM_BITFLOW_BASE + 9,
|
|
TP_CAM_PROPERTY_FINISH = 0xFFFF,
|
|
TP_CAM_PROPERTY_GAIN,
|
|
TP_CAM_PROPERTY_IMAGE_OFFSET_X,
|
|
TP_CAM_PROPERTY_IMAGE_OFFSET_Y,
|
|
TP_CAM_PROPERTY_IMAGE_WIDTH,
|
|
TP_CAM_PROPERTY_IMAGE_HEIGHT,
|
|
TP_CAM_PROPERTY_FRAME_RATE,
|
|
|
|
};
|
|
#define TP_MAX_STRING_SIZE 260
|
|
typedef struct tagTP_CAMERA_PROPERTY {
|
|
emTpCameraProperty property;
|
|
long value;
|
|
char szProperty[TP_MAX_STRING_SIZE];
|
|
int nErrorCode;//return by camera
|
|
} TP_CAMERA_PROPERTY;
|
|
|
|
class IImageObject
|
|
{
|
|
public:
|
|
IImageObject() { }
|
|
virtual ~IImageObject() { }
|
|
|
|
virtual emTpColorFormat IColorFormat() = 0;
|
|
virtual BYTE* IImageData(int& nOutW, int& nOutH, int& nOutBitsPerPixel, int& nOutBytesPerLine) = 0;
|
|
virtual QImage IImage() = 0;
|
|
virtual void IVariantMapToUI(const QVariantMap& vMap) = 0;
|
|
virtual const QString ICameraSerial() = 0;
|
|
virtual const QVariant& IVarFromUI() = 0;
|
|
virtual quint64 ITimeStamp() = 0;
|
|
};
|
|
|
|
inline void simple_draw_image_8(IImageObject* pImgObj, uint *pColor, int nNum) {
|
|
//pImgObj->IDrawImage(QImage(pBuffer, w, h, QImage::Format_ARGB32).copy());
|
|
QImage image = pImgObj->IImage();
|
|
if (QImage::Format_Indexed8 == image.format() && NULL != pColor) {
|
|
QVector<QRgb> corFmt;
|
|
for (int i = 0; i < nNum; ++i) {
|
|
corFmt.append(pColor[i]);
|
|
}
|
|
image.setColorTable(corFmt);
|
|
}
|
|
}
|
|
|
|
class IAlgorithm
|
|
{
|
|
public:
|
|
IAlgorithm() {}
|
|
virtual ~IAlgorithm() {}
|
|
virtual int IImageAnalysis(class IImageObject* pImgObj) = 0;
|
|
};
|
|
|
|
//#define _LOAD_ALGORITHM_DLL_STATIC
|
|
|
|
#ifdef ALGORITHM_EXPORTS
|
|
#define ALGORITHM_API extern "C" __declspec(dllexport)
|
|
#else
|
|
#ifndef _LOAD_ALGORITHM_DLL_STATIC
|
|
#define ALGORITHM_API extern "C"
|
|
#else
|
|
#define ALGORITHM_API extern "C" __declspec(dllimport)
|
|
#endif
|
|
#endif
|
|
|
|
ALGORITHM_API IAlgorithm* Algorithm_Create();
|
|
ALGORITHM_API void Algorithm_Delete(IAlgorithm* pAlg);
|
|
|
|
#endif |