示例#1
0
void GPUImage::setBitmap(BitmapPtr pBmp, TexCompression comp)
{
    assertValid();
    if (!pBmp) {
        throw Exception(AVG_ERR_UNSUPPORTED, "setBitmap(): bitmap must not be None!");
    }
    if (comp == TEXCOMPRESSION_B5G6R5 && pBmp->hasAlpha()) {
        throw Exception(AVG_ERR_UNSUPPORTED, 
                "B5G6R5-compressed textures with an alpha channel are not supported.");
    }
    unload();
    changeSource(BITMAP);
    m_pBmp = BitmapPtr(new Bitmap(pBmp->getSize(), pBmp->getPixelFormat(), ""));
    m_pBmp->copyPixels(*pBmp);
    if (comp == TEXCOMPRESSION_B5G6R5) {
        BitmapPtr pDestBmp = BitmapPtr(new Bitmap(pBmp->getSize(), B5G6R5, ""));
        if (!BitmapLoader::get()->isBlueFirst()) {
            FilterFlipRGB().applyInPlace(m_pBmp);
        }
        pDestBmp->copyPixels(*m_pBmp);
        m_pBmp = pDestBmp;
    }
    if (m_State == GPU) {
        setupBitmapSurface();
    }
    assertValid();
}
示例#2
0
文件: Image.cpp 项目: dboesel/libavg
BitmapPtr Image::getBitmap()
{
    if (m_Source == NONE || m_Source == SCENE) {
        return BitmapPtr();
    } else {
        return BitmapPtr(new Bitmap(*m_pBmp));
    }
}
示例#3
0
BitmapPtr FilterBandpass::apply(BitmapPtr pBmpSrc)
{
    BitmapPtr pLPBmp = m_LowpassFilter.apply(pBmpSrc);
    BitmapPtr pHPBmp = m_HighpassFilter.apply(pBmpSrc);

    IntPoint Size = pHPBmp->getSize();
    BitmapPtr pDestBmp = BitmapPtr(new Bitmap(Size, I8, pBmpSrc->getName()));

    int lpStride = pLPBmp->getStride();
    int hpStride = pHPBmp->getStride();
    int destStride = pDestBmp->getStride();
    unsigned char * pLPLine = pLPBmp->getPixels()+m_FilterWidthDiff*lpStride;
    unsigned char * pHPLine = pHPBmp->getPixels();
    unsigned char * pDestLine = pDestBmp->getPixels();
    for (int y = 0; y < Size.y; ++y) {
        unsigned char * pLPPixel = pLPLine+m_FilterWidthDiff;
        unsigned char * pHPPixel = pHPLine;
        unsigned char * pDestPixel = pDestLine;
        for (int x = 0; x < Size.x; ++x) {
            *pDestPixel = (int(*pLPPixel)-*pHPPixel)+128;
            ++pLPPixel;
            ++pHPPixel;
            ++pDestPixel;
        }
        pLPLine += lpStride;
        pHPLine += hpStride;
        pDestLine += destStride;
    }
    return pDestBmp;
}
示例#4
0
BitmapPtr FilterDilation::apply(BitmapPtr pSrcBmp) 
{
    AVG_ASSERT(pSrcBmp->getPixelFormat() == I8);
    IntPoint size = pSrcBmp->getSize();
    BitmapPtr pDestBmp = BitmapPtr(new Bitmap(size, I8, pSrcBmp->getName()));
    unsigned char * pSrcLine = pSrcBmp->getPixels();
    unsigned char * pNextSrcLine;
    unsigned char * pDestLine = pDestBmp->getPixels();
    for (int y = 0; y < size.y; y++) {
        pDestLine = pDestBmp->getPixels()+y*pDestBmp->getStride();
        unsigned char * pLastSrcLine = pSrcLine;
        pSrcLine = pSrcBmp->getPixels()+y*pSrcBmp->getStride();
        if (y < size.y-1) {
            pNextSrcLine = pSrcBmp->getPixels()+(y+1)*pSrcBmp->getStride();
        } else {
            pNextSrcLine = pSrcBmp->getPixels()+y*pSrcBmp->getStride();
        }
        pDestLine[0] = max(pSrcLine[0], max(pSrcLine[1], 
                max(pLastSrcLine[0], pNextSrcLine[0])));
        for (int x = 1; x < size.x-1; x++) { 
            pDestLine[x] = max(pSrcLine[x], max(pSrcLine[x-1], max(pSrcLine[x+1], 
                    max(pLastSrcLine[x], pNextSrcLine[x]))));
        }
        pDestLine[size.x-1] = max(pSrcLine[size.x-2], max(pSrcLine[size.x-1], 
                max(pLastSrcLine[size.x-1], pNextSrcLine[size.x-1])));
    }
    return pDestBmp;
}
示例#5
0
文件: Image.cpp 项目: dboesel/libavg
void Image::setFilename(const std::string& sFilename, TextureCompression comp)
{
    assertValid();
    AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Loading " << sFilename);
    BitmapPtr pBmp = loadBitmap(sFilename);
    if (comp == TEXTURECOMPRESSION_B5G6R5 && pBmp->hasAlpha()) {
        throw Exception(AVG_ERR_UNSUPPORTED, 
                "B5G6R5-compressed textures with an alpha channel are not supported.");
    }
    changeSource(FILE);
    m_pBmp = pBmp;

    m_sFilename = sFilename;

    switch (comp) {
        case TEXTURECOMPRESSION_B5G6R5:
            m_pBmp = BitmapPtr(new Bitmap(pBmp->getSize(), B5G6R5, sFilename));
            if (!BitmapLoader::get()->isBlueFirst()) {
                FilterFlipRGB().applyInPlace(pBmp);
            }
            m_pBmp->copyPixels(*pBmp);
            break;
        case TEXTURECOMPRESSION_NONE:
            break;
        default:
            assert(false);
    }

    if (m_State == GPU) {
        m_pSurface->destroy();
        setupSurface();
    }
    assertValid();
}
示例#6
0
BitmapPtr CMUCamera::getImage(bool bWait)
{
    if (bWait) {
        unsigned rc = WaitForSingleObject(m_pCamera->GetFrameEvent(), INFINITE);
        AVG_ASSERT(rc == WAIT_OBJECT_0);
    } else {
        unsigned rc = WaitForSingleObject(m_pCamera->GetFrameEvent(), 0);
        if (rc == WAIT_TIMEOUT) {
            // No frame yet
            return BitmapPtr();
        }
        AVG_ASSERT(rc == WAIT_OBJECT_0);
    }
    int rc2 = m_pCamera->AcquireImageEx(FALSE, NULL);
    if (rc2 != CAM_SUCCESS) {
        throw Exception(AVG_ERR_CAMERA_NONFATAL,
                "CMUCamera: Could not acquire image from camera. " +
                CMUErrorToString(rc2));
    }
    unsigned long captureBufferLength;
    unsigned char* pCaptureBuffer = m_pCamera->GetRawData(&captureBufferLength);

    BitmapPtr pCamBmp(new Bitmap(getImgSize(), getCamPF(), pCaptureBuffer, 
            captureBufferLength / getImgSize().y, false, "TempCameraBmp"));
    return convertCamFrameToDestPF(pCamBmp);
}
示例#7
0
void RasterNode::checkReload()
{
    string sLastMaskFilename = m_sMaskFilename;
    string sMaskFilename = m_sMaskHref;
    initFilename(sMaskFilename);
    if (sLastMaskFilename != sMaskFilename) {
        m_sMaskFilename = sMaskFilename;
        try {
            if (m_sMaskFilename != "") {
                AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO,
                        "Loading " << m_sMaskFilename);
                m_pMaskBmp = loadBitmap(m_sMaskFilename, I8);
                setMaskCoords();
            }
        } catch (Exception & ex) {
            if (ex.getCode() == AVG_ERR_VIDEO_GENERAL) {
                throw;
            }
            m_sMaskFilename = "";
            logFileNotFoundWarning(ex.getStr());
        }
        if (m_sMaskFilename == "") {
            m_pMaskBmp = BitmapPtr();
            getSurface()->setMask(MCTexturePtr());
        }
        if (getState() == Node::NS_CANRENDER && m_pMaskBmp) {
            downloadMask();
        }
    } else {
        setMaskCoords();
    }
}
void CChildView::OnPaint() 
{
   CPaintDC dc(this); // device context for painting

   // If the unbounded_buffer object contains a Bitmap object, 
   // draw the image to the client area.
   BitmapPtr pBitmap;
   if (try_receive(m_MandelbrotImages, pBitmap))
   {
      if (pBitmap != NULL)
      {
         // Draw the bitmap to the client area.
         Graphics g(dc);
         g.DrawImage(pBitmap.get(), 0, 0);
      }
   }
   // Draw the image on a worker thread if the image is not available.
   else
   {
      RECT rc;
      GetClientRect(&rc);
      m_DrawingTasks.run([rc,this]() {
         DrawMandelbrot(BitmapPtr(new Bitmap(rc.right, rc.bottom)));
      });
   }
}
void ApplyFilter(IFilterProcessor& filter)
{
	LARGE_INTEGER start, end;
	QueryPerformanceCounter(&start);

	BitmapPtr inBitmap = bitmap;

	BitmapPtr outBitmap = BitmapPtr(
		inBitmap->Clone(0, 0, inBitmap->GetWidth(), inBitmap->GetHeight(),
		PixelFormat32bppARGB));

	Gdiplus::Rect rect(0, 0, inBitmap->GetWidth(), inBitmap->GetHeight());
	Gdiplus::BitmapData originalImage;
	inBitmap->LockBits(&rect, Gdiplus::ImageLockModeWrite,
		PixelFormat32bppARGB, &originalImage);

	Gdiplus::BitmapData processedImage;
	outBitmap->LockBits(&rect, Gdiplus::ImageLockModeWrite,
		PixelFormat32bppARGB, &processedImage);

	filter.ProcessImage(originalImage, processedImage);

	bitmap = outBitmap;

	inBitmap->UnlockBits(&originalImage);
	outBitmap->UnlockBits(&processedImage);

	QueryPerformanceCounter(&end);
	elapsedTime = ComputeElapsedTime(start, end);
}
示例#10
0
BitmapPtr GPUImage::getBitmap()
{
    if (m_Source == NONE || m_Source == SCENE) {
        return BitmapPtr();
    } else {
        return m_pBmp;
    }
}
示例#11
0
BitmapPtr Window::screenshot(int buffer)
{
    AVG_ASSERT(m_pGLContext);
    m_pGLContext->activate();
    BitmapPtr pBmp;
    glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
    if (m_pGLContext->isGLES()) {
        pBmp = BitmapPtr(new Bitmap(m_Size, R8G8B8X8, "screenshot"));
        glReadPixels(0, 0, m_Size.x, m_Size.y, GL_RGBA, GL_UNSIGNED_BYTE, 
                pBmp->getPixels());
        GLContext::checkError("Window::screenshot:glReadPixels()");
    } else {
#ifndef AVG_ENABLE_EGL
        bool bIsLinuxIntel = false;
#ifdef __linux__
        if (m_pGLContext->isRenderer("Mesa DRI Intel(R) Sandybridge Mobile")) {
            bIsLinuxIntel = true;
        }
#endif
        pBmp = BitmapPtr(new Bitmap(m_Size, B8G8R8X8, "screenshot"));
        string sTmp;
        bool bBroken = getEnv("AVG_BROKEN_READBUFFER", sTmp) || bIsLinuxIntel;
        GLenum buf = buffer;
        if (!buffer) {
            if (bBroken) {
                // Workaround for buggy GL_FRONT on some machines.
                buf = GL_BACK;
            } else {
                buf = GL_FRONT;
            }
        }
        glReadBuffer(buf);
        GLContext::checkError("Window::screenshot:glReadBuffer()");
        glproc::BindBuffer(GL_PIXEL_PACK_BUFFER, 0);
        glReadPixels(0, 0, m_Size.x, m_Size.y, GL_BGRA, GL_UNSIGNED_BYTE, 
                pBmp->getPixels());
        GLContext::checkError("Window::screenshot:glReadPixels()");
#endif
    }
    FilterFlip().applyInPlace(pBmp);
    return pBmp;
}
示例#12
0
BitmapPtr VideoDecoderThread::getBmp(BitmapQueuePtr pBmpQ, const IntPoint& size, 
        PixelFormat pf)
{
    BitmapPtr pBmp = pBmpQ->pop(false);
    if (pBmp) {
        AVG_ASSERT (pBmp->getSize() == size && pBmp->getPixelFormat() == pf);
        return pBmp;
    } else {
        return BitmapPtr(new Bitmap(size, pf)); 
    }
}
示例#13
0
BitmapPtr FakeCamera::getImage(bool bWait)
{
    if (bWait) {
        msleep(100);
    }
    if (!m_bIsOpen || !bWait || m_pBmpQ->empty()) {
        return BitmapPtr();
    } else {
        BitmapPtr pBmp = m_pBmpQ->front();
        m_pBmpQ->pop(); 
        return pBmp; 
    }
}
示例#14
0
BitmapPtr FWCamera::getImage(bool bWait)
{
#ifdef AVG_ENABLE_1394_2
    bool bGotFrame = false;
    unsigned char * pCaptureBuffer = 0;
    dc1394video_frame_t * pFrame;
    dc1394error_t err;
    if (bWait) {
        err = dc1394_capture_dequeue(m_pCamera, DC1394_CAPTURE_POLICY_WAIT, &pFrame);
    } else {
        err = dc1394_capture_dequeue(m_pCamera, DC1394_CAPTURE_POLICY_POLL, &pFrame);
    }
    if (err == DC1394_SUCCESS && pFrame) {
        bGotFrame = true;
        pCaptureBuffer = pFrame->image;
    }
    if (bGotFrame) {
        int lineLen;
        if (getCamPF() == YCbCr411) {
            lineLen = getImgSize().x*1.5;
        } else {
            lineLen = getImgSize().x*getBytesPerPixel(getCamPF());
        }
        BitmapPtr pCamBmp(new Bitmap(getImgSize(), getCamPF(), pCaptureBuffer, lineLen,
                false, "TempCameraBmp"));
        BitmapPtr pDestBmp = convertCamFrameToDestPF(pCamBmp);
//        cerr << "CamBmp: " << pCamBmp->getPixelFormat() << ", DestBmp: " 
//                << pDestBmp->getPixelFormat() << endl;
        dc1394_capture_enqueue(m_pCamera, pFrame);
        return pDestBmp;
    } else {
        return BitmapPtr();
    }
#else
    return BitmapPtr();
#endif
}
示例#15
0
void GPUImage::unload()
{
    if (m_pImage) {
        if (m_State == GPU) {
            m_pImage->decTexRef();
            m_pSurface->destroy();
        }
        m_pImage->decBmpRef();
        m_pImage = CachedImagePtr();
    }
    m_pBmp = BitmapPtr();
    if (m_State == GPU && m_Source != NONE) {
        m_pSurface->destroy();
    }
}
void CChildView::OnSize(UINT nType, int cx, int cy)
{
   // The window size has changed; cancel any existing drawing tasks.
   m_DrawingTasks.cancel();
   // Wait for any existing tasks to finish.
   m_DrawingTasks.wait();

   // If the new size is non-zero, create a task to draw the Mandelbrot 
   // image on a separate thread.
   if (cx != 0 && cy != 0)
   {      
      m_DrawingTasks.run([cx,cy,this]() {
         DrawMandelbrot(BitmapPtr(new Bitmap(cx, cy)));
      });
   }
}
示例#17
0
BitmapPtr GPUFilter::apply(BitmapPtr pBmpSource)
{
    AVG_ASSERT(m_pSrcTex);
    AVG_ASSERT(!(m_pFBOs.empty()));
    m_pSrcPBO->moveBmpToTexture(pBmpSource, *m_pSrcTex);
    apply(m_pSrcTex);
    BitmapPtr pFilteredBmp = m_pFBOs[0]->getImage();
    BitmapPtr pDestBmp;
    if (pFilteredBmp->getPixelFormat() != pBmpSource->getPixelFormat()) {
        pDestBmp = BitmapPtr(new Bitmap(m_DestRect.size(),
                pBmpSource->getPixelFormat()));
        pDestBmp->copyPixels(*pFilteredBmp);
    } else {
        pDestBmp = pFilteredBmp;
    }
    return pDestBmp;
}
示例#18
0
BitmapPtr FilterResizeBilinear::apply(BitmapPtr pBmpSrc)
{
    int bpp = pBmpSrc->getBytesPerPixel();
    AVG_ASSERT(bpp==4 || bpp==3 || bpp==1);

    BitmapPtr pBmpDest = BitmapPtr(new Bitmap(m_NewSize, 
            pBmpSrc->getPixelFormat(), pBmpSrc->getName()+"_resized"));

    BilinearContribDef f(0.64);
    switch (bpp) {
        case 4:
            {
                TwoPassScale<CDataRGBA_UBYTE> sS(f);
                sS.Scale((CDataRGBA_UBYTE::PixelClass *) pBmpSrc->getPixels(), 
                        pBmpSrc->getSize(), pBmpSrc->getStride(), 
                        (CDataRGBA_UBYTE::PixelClass *) pBmpDest->getPixels(),
                        pBmpDest->getSize(), pBmpDest->getStride());
            }
            break;
        case 3:
            {
                TwoPassScale <CDataRGB_UBYTE> sS(f);
                sS.Scale((CDataRGB_UBYTE::PixelClass *) pBmpSrc->getPixels(), 
                        pBmpSrc->getSize(), pBmpSrc->getStride(), 
                        (CDataRGB_UBYTE::PixelClass *) pBmpDest->getPixels(),
                        pBmpDest->getSize(), pBmpDest->getStride());
            }
            break;
        case 1:
            {
                TwoPassScale <CDataA_UBYTE> sS(f);
                sS.Scale((CDataA_UBYTE::PixelClass *) pBmpSrc->getPixels(), 
                        pBmpSrc->getSize(), pBmpSrc->getStride(), 
                        (CDataA_UBYTE::PixelClass *) pBmpDest->getPixels(),
                        pBmpDest->getSize(), pBmpDest->getStride());
            }
            break;
        default:
            AVG_ASSERT(false);
    }
    return pBmpDest;
}
示例#19
0
BitmapPtr FilterDistortion::apply(BitmapPtr pBmpSource)
{
    BitmapPtr pDestBmp = BitmapPtr(new Bitmap(m_SrcSize, I8));
    unsigned char* pDestLine = pDestBmp->getPixels();
    unsigned char* pSrcPixels = pBmpSource->getPixels();
    unsigned char* pDestPixel = pDestLine;
    int destStride = pDestBmp->getStride();
    int srcStride = pBmpSource->getStride();
    IntPoint * pMapPos = m_pMap;
    for (int y = 0; y < m_SrcSize.y; ++y) {
        for(int x = 0; x < m_SrcSize.x; ++x) {
            *pDestPixel = pSrcPixels[pMapPos->x + srcStride*pMapPos->y];
            pDestPixel++;
            pMapPos++;
        }
        pDestLine+=destStride;
        pDestPixel = pDestLine;
    }
    return pDestBmp;
}
示例#20
0
文件: Image.cpp 项目: dboesel/libavg
void Image::setBitmap(BitmapPtr pBmp, TextureCompression comp)
{
    assertValid();
    if (!pBmp) {
        throw Exception(AVG_ERR_UNSUPPORTED, "setBitmap(): bitmap must not be None!");
    }
    if (comp == TEXTURECOMPRESSION_B5G6R5 && pBmp->hasAlpha()) {
        throw Exception(AVG_ERR_UNSUPPORTED, 
                "B5G6R5-compressed textures with an alpha channel are not supported.");
    }
    bool bSourceChanged = changeSource(BITMAP);
    PixelFormat pf;
    switch (comp) {
        case TEXTURECOMPRESSION_NONE:
            pf = pBmp->getPixelFormat();
            break;
        case TEXTURECOMPRESSION_B5G6R5:
            pf = B5G6R5;
            if (!BitmapLoader::get()->isBlueFirst()) {
                FilterFlipRGB().applyInPlace(pBmp);
            }
            break;
        default:
            assert(false);
    }
    m_pBmp = BitmapPtr(new Bitmap(pBmp->getSize(), pf, ""));
    m_pBmp->copyPixels(*pBmp);
    if (m_State == GPU) {
        MCTexturePtr pTex = m_pSurface->getTex();
        if (bSourceChanged || m_pSurface->getSize() != m_pBmp->getSize() ||
                m_pSurface->getPixelFormat() != pf)
        {
            pTex = GLContextManager::get()->createTexture(m_pBmp->getSize(), pf, 
                    m_Material.getUseMipmaps(), m_Material.getWrapSMode(), 
                    m_Material.getWrapTMode());
            m_pSurface->create(pf, pTex);
        }
        GLContextManager::get()->scheduleTexUpload(pTex, m_pBmp);
    }
    assertValid();
}
示例#21
0
文件: Image.cpp 项目: dboesel/libavg
bool Image::changeSource(Source newSource)
{
    if (newSource != m_Source) {
        switch (m_Source) {
            case NONE:
                break;
            case FILE:
            case BITMAP:
                m_pBmp = BitmapPtr();
                m_sFilename = "";
                break;
            case SCENE:
                m_pCanvas = OffscreenCanvasPtr();
                break;
            default:
                AVG_ASSERT(false);
        }
        m_Source = newSource;
        return true;
    } else {
        return false;
    }
}
示例#22
0
BitmapPtr FilterBlur::apply(BitmapPtr pBmpSrc)
{
    AVG_ASSERT(pBmpSrc->getPixelFormat() == I8);
    
    IntPoint Size(pBmpSrc->getSize().x-2, pBmpSrc->getSize().y-2);
    BitmapPtr pDestBmp = BitmapPtr(new Bitmap(Size, I8, pBmpSrc->getName()));
    int srcStride = pBmpSrc->getStride();
    int destStride = pDestBmp->getStride();
    unsigned char * pSrcLine = pBmpSrc->getPixels()+srcStride+1;
    unsigned char * pDestLine = pDestBmp->getPixels();
    for (int y = 0; y < Size.y; ++y) {
        unsigned char * pSrcPixel = pSrcLine;
        unsigned char * pDestPixel = pDestLine;
        for (int x = 0; x < Size.x; ++x) {
            *pDestPixel = (*(pSrcPixel-1) + *(pSrcPixel)*4 + *(pSrcPixel+1)
                    +*(pSrcPixel-srcStride)+*(pSrcPixel+srcStride)+4)/8;
            ++pSrcPixel;
            ++pDestPixel;
        }
        pSrcLine += srcStride;
        pDestLine += destStride;
    }
    return pDestBmp;
}
BmpTextureMover::BmpTextureMover(const IntPoint& size, PixelFormat pf)
    : TextureMover(size, pf)
{
    m_pBmp = BitmapPtr(new Bitmap(size, pf));
}
示例#24
0
void VideoWriter::writeDummyFrame()
{
    BitmapPtr pBmp = BitmapPtr(new Bitmap(m_FrameSize, B8G8R8X8));
    FilterFill<Pixel32>(Pixel32(0,0,0,255)).applyInPlace(pBmp);
    sendFrameToEncoder(pBmp);
}
示例#25
0
void TrackerThread::setConfig(TrackerConfig config, IntRect roi, 
        BitmapPtr ppBitmaps[NUM_TRACKER_IMAGES])
{
    boost::mutex::scoped_lock lock(*m_pMutex);
    try {
        m_TouchThreshold = config.getIntParam("/tracker/touch/threshold/@value");
    } catch (Exception&) {
        m_TouchThreshold = 0;
    }
    m_bTrackBrighter = config.getBoolParam("/tracker/brighterregions/@value");
    try {
        m_TrackThreshold = config.getIntParam("/tracker/track/threshold/@value");
    } catch (Exception&) {
        m_TrackThreshold = 0;
    }
    m_Prescale = config.getIntParam("/tracker/prescale/@value");
    if(m_pHistoryPreProcessor) {
        m_pHistoryPreProcessor->setInterval(config.getIntParam
                ("/tracker/historyupdateinterval/@value"));
    }
    DeDistortPtr pDeDistort = config.getTransform();
    if (!(*m_pTrafo == *pDeDistort)) {
        m_pDistorter = FilterDistortionPtr(new FilterDistortion(
                m_pBitmaps[TRACKER_IMG_CAMERA]->getSize()/m_Prescale, pDeDistort));
        *m_pTrafo = *pDeDistort;
    }
    int brightness = config.getIntParam("/camera/brightness/@value");
    int exposure = config.getIntParam("/camera/exposure/@value");
    int gamma = config.getIntParam("/camera/gamma/@value");
    int gain = config.getIntParam("/camera/gain/@value");
    int shutter = config.getIntParam("/camera/shutter/@value");
    int strobeDuration = config.getIntParam("/camera/strobeduration/@value");
    string sCameraMaskFName = config.getParam("/tracker/mask/@value");
    bool bNewCameraMask = ((m_pCameraMaskBmp == BitmapPtr() && sCameraMaskFName != "") || 
            m_pConfig->getParam("/tracker/mask/@value") != sCameraMaskFName);
    if (int(m_pCamera->getFeature(CAM_FEATURE_BRIGHTNESS)) != brightness ||
             int(m_pCamera->getFeature(CAM_FEATURE_GAMMA)) != gamma ||
             int(m_pCamera->getFeature(CAM_FEATURE_EXPOSURE)) != exposure ||
             int(m_pCamera->getFeature(CAM_FEATURE_GAIN)) != gain ||
             int(m_pCamera->getFeature(CAM_FEATURE_SHUTTER)) != shutter ||
             int(m_pCamera->getFeature(CAM_FEATURE_STROBE_DURATION)) != strobeDuration ||
             bNewCameraMask)
    {
        m_pHistoryPreProcessor->reset();
    }

    m_pCamera->setFeature(CAM_FEATURE_BRIGHTNESS, brightness);
    m_pCamera->setFeature(CAM_FEATURE_GAMMA, gamma);
//    m_pCamera->setFeature(CAM_FEATURE_EXPOSURE, exposure);
    m_pCamera->setFeature(CAM_FEATURE_GAIN, gain);
    m_pCamera->setFeature(CAM_FEATURE_SHUTTER, shutter);
    m_pCamera->setFeature(CAM_FEATURE_STROBE_DURATION, strobeDuration, true);

    if (bNewCameraMask) {
        if (sCameraMaskFName == "") {
            m_pCameraMaskBmp = BitmapPtr();
        } else {
            BitmapPtr pRGBXCameraMaskBmp = loadBitmap(sCameraMaskFName, I8);
        }
    }
    m_pConfig = TrackerConfigPtr(new TrackerConfig(config));
        
    setBitmaps(roi, ppBitmaps);
    createBandpassFilter();
}