/****************************************************************************** Copyright(C):2015~2018 hzleaper FileName:AlgorithmZK.cpp Author:zhikun wu Email:zk.wu@hzleaper.com Tools:vs2010 pc on company Created:2015/05/22 History:22:5:2015 9:18 *******************************************************************************/ #include "AlgorithmZK.h" #include "zfunctions.h" #define _WF_SAMPLING_OBJECT "sampling_object" #define _WF_SAMPLING_VALUE_X "sampling_center_x" #define _WF_SAMPLING_VALUE_Y "sampling_center_y" #define _WF_SAMPLING_WIDGET_W "sampling_widget_w" #define _WF_SEPARATOR_CAM_AND_MODLE "_-_" #define _WF_DB_TYPE_FOR_MODEL_SAMPLE 0x01//key is model CAlgorithmZK::CAlgorithmZK(void) { } CAlgorithmZK::~CAlgorithmZK(void) { } double pData[4] = { 0.0, 15, 45, 45 }; int CAlgorithmZK::IImageAnalysis(class IImageObject* pImgObj, TP_ALGORITHM_OPTION* pOpt) { return 0; // pImgObj->IMoveToFolder("e://"); // ZKF::qtCopyFile(pImgObj->IGetImageUtf8String(), "e:/"); // QString szObject = pOpt->pImagProcCb->GetStringValue(ALG_OPTION_GLOBAL_KEY_SAMPLING_OBJECT); IAlgorithmShared *pShared = pImgObj->IGetShared(); if (pShared->IGetInt(ALG_SHARED_GLOBAL_KEY_APP_STATUS, IAlgorithmShared::APP_STATUS_DEFAULT))//sampling { QString szModel = pOpt->pImagProcCb->GetStringValue(_WF_SAMPLING_OBJECT); if (szModel.size() > 2) { int nX = pOpt->pImagProcCb->GetIntValue(_WF_SAMPLING_VALUE_X, -1); int nY = pOpt->pImagProcCb->GetIntValue(_WF_SAMPLING_VALUE_Y, -1); int nW = pOpt->pImagProcCb->GetIntValue(_WF_SAMPLING_WIDGET_W, -1); QString sKey = pImgObj->ICameraSerial() + _WF_SEPARATOR_CAM_AND_MODLE + szModel; pOpt->pImagProcCb->DbSetValue(sKey, _WF_DB_TYPE_FOR_MODEL_SAMPLE, QString("it's text!").toUtf8()); pImgObj->ISafeDataToUI(szModel.toUtf8().data(), szModel.toUtf8().size()); } return 0; } QStringList strs = pShared->IGetStringList("models"); emTpColorFormat colorFormat = pImgObj->IColorFormat(); pData[0] += 1.0; int nImageW; int nImageH; int nBitsPerPixel; int nBytesPerLine; BYTE* pImageData = pImgObj->IImageData(nImageW, nImageH, nBitsPerPixel, nBytesPerLine); pImgObj->ISendDataToUI(pOpt); // pImgObj->IDrawDefect("tp_scene_1", IImageObject::TP_DEF_RECT_F, (BYTE*)pData, sizeof(pData)); pImgObj->ISafeDataToUI(pData, sizeof(pData)); pImgObj->IDrawDefectOrg(IImageObject::TP_DEF_RECT_F, (BYTE*)pData, sizeof(pData)); const char* pszName = pImgObj->IGetImageUtf8String(); /**/ UINT colors[256]; for (int i = 0; i < 256; ++i) { QColor clr1(255 - i, 255 - i, 255 - i); colors[i] = clr1.rgb(); } simple_draw_image_8(pImgObj, colors, 256); pImgObj->IAccumulateResult("image_count", QVariant(1)); return 2; }