Ejemplo n.º 1
0
		void Update ()
			{
			ForegroundFLD->Int (OrigREC,Foreground ());
			BackgroundFLD->Int (OrigREC,Background ());
			StyleFLD->Int (OrigREC,Style ());
			OrigREC->Name (Name ());
			}
Ejemplo n.º 2
0
 DBInt IsChanged() {
     if (Foreground() != ForegroundFLD->Int(OrigREC)) return (true);
     if (Background() != BackgroundFLD->Int(OrigREC)) return (true);
     if (Style() != StyleFLD->Int(OrigREC)) return (true);
     if (strcmp(Name(), OrigREC->Name()) != 0) return (true);
     return (false);
 }
Ejemplo n.º 3
0
void
Console::ResetAttributes()
{
	SetBold(false);
	SetBlink(false);
	SetReverseVideo(false);
	Background(BLACK);
	Foreground(WHITE);
}
Ejemplo n.º 4
0
void SAGMMBuilder::Update(InputArray frame, OutputArray mask) 
{
    Mat Image = frame.getMat();
    Mat Foreground(Image.size(),CV_8U,Scalar::all(0));
    Mat FilteredImage;
    
    
    // Initialize temporal-spatial filter.
    if (frame_counter < filter->getTemporalWindow()) {
        
        if (frame_counter == 0) {
            // Initialize in zero three channels of img kernel.
            filter->initializeFirstImage(Image);
            
        }

        //Apply filter and puts result in FilteredImage.
        //Note this filter also keeps internal copy of filter result.
        filter->SpatioTemporalPreprocessing(Image, FilteredImage);
        
        Foreground.copyTo(mask);

        frame_counter += 1;
        
        if ( frame_counter == filter->getTemporalWindow() ) {
            
            // Initialize model
            model->initializeModel(FilteredImage);
            model->getBackground(Background);
            
        }

        return;
    }
    
    
    
    //Applies spatial and temporal filter
    //note this filter return a Mat CV_32FC3 type.
    filter->SpatioTemporalPreprocessing(Image, FilteredImage);
    
    //Global illumination changing factor 'g' between reference image ir and current image ic.
    double globalIlluminationFactor = factor->getIlluminationFactor(FilteredImage,Background);
    
    //Calling background subtraction algorithm.
    model->operator()(FilteredImage, Foreground, update_bg_model ? -1 : 0, globalIlluminationFactor);

    // background to calculate illumination next iteration.
    model->getBackground(Background);


    // Applying morphological filter, Erode the image
    Mat Eroded; 
    if (ApplyMorphologicalFilter) {
        Mat Element(2,2,CV_8U,Scalar(1));
        //erode(Mask,Eroded,Mat());
        erode(Foreground,Eroded,Element);
        Eroded.copyTo(mask);
    }
    else {
        // return mask
        Foreground.copyTo(mask);
    }

    
    
    Foreground.copyTo(mask);
    
    frame_counter += 1;
    

}
Ejemplo n.º 5
0
/// @todo Check boundaries
bool
Console::AnsiEscFilter(const char c)
{
	if (_ansiBufferPos == 0 && c == (char)0x9B) {
		_ansiBufferPos = 2;
		return true;
	}else if (_ansiBufferPos == 0 && c == (char)0x1B) {
		_ansiBufferPos = 1;
		return true;
	}else if (_ansiBufferPos == 1) {
		if (c == '[') {
			_ansiBufferPos = 2;
			return true;
		} else {
			_ansiBufferPos = 0;
			return false;
		}
	}else if (_ansiBufferPos > 1) {
		if (isdigit(c) || c == ';') {
			_ansiBuffer[_ansiBufferPos++] = c;
		} else {
			_ansiBuffer[_ansiBufferPos] = '\0';
			_ansiBufferPos = 0;

			long params[10] = {0};
			const int parQty = AnsiEscParseParams(&_ansiBuffer[2], params);
			switch(c) {
				case 'c':	// Reset Device
					ResetAttributes();
					Erase(BOTH, false);
					break;
				case 'h':
					if (parQty == 1 && params[0] == 7)
						SetLineWrap(true);
					break;
				case 'l':
					if (parQty == 1 && params[0] == 7)
						SetLineWrap(false);
					break;
				case 'A':	// [nA Cursor Up
					if (!parQty)
						params[0] = 1;
					//
					_cursor -= _canvas.Size().x*params[0];
					UpdateCursor();
					break;
				case 'B':	// [nB Cursor Down
					if (!parQty)
						params[0] = 1;
					//
					_cursor += _canvas.Size().x*params[0];
					UpdateCursor();
					break;
				case 'C':	// [nC Cursor Forward
					if (!parQty)
						params[0] = 1;
					//
					_cursor += params[0];
					UpdateCursor();
					break;
				case 'D':	// [nD Cursor Backward
					if (!parQty)
						params[0] = 1;
					//
					_cursor -= params[0];
					UpdateCursor();
					break;
				case 'H':	// [y;xH Cursor Home
				case 'f':	// [y;xf Force Cursor Position
					if (parQty < 2) {
						params[0] = 0;	// Y
						params[1] = 0;	// X
					}
					//
					_cursor = _canvas.Buffer() + _canvas.Size().x*params[0] + params[1];
					UpdateCursor();
					break;
				case 's':	// [s Save Cursor
					_ansiCursorStack.Push(_cursor);
					break;
				case 'u':	// [u Unsave Cursor
					_cursor = _ansiCursorStack.Pop();
					UpdateCursor();
					break;
				case 'J':	// [nJ
					if (parQty == 0)
						params[0] = 0;
					Erase(static_cast<EraseDirection>(params[0]), false);
					break;
				case 'K':	// [nK
					if (parQty == 0)
						params[0] = 0;
					Erase(static_cast<EraseDirection>(params[0]), true);
					break;
				case 'm':	// [p1;..;pNm
					if (!parQty) {
						ResetAttributes();
					} else {
						for(int i=0; i<parQty; ++i) {
							switch(params[i]) {
								case  0:	ResetAttributes();		break;
								case  1:	SetBold(true);			break;
								//case  2:	SetFaint(true);			break;
								//case  3:	SetItalic(true);		break;
								//case  4:	SetUnderline(true);		break;
								case  5:	SetBlink(true);			break;
								//case  6:	SetRapidBlink(true);	break;
								case  7:	SetReverseVideo(true);	break;
								//case  8:	SetInvisible(true);		break;
								//case 48:	SetSubscript(true);		break;
								//case 49:	SetSuperscript(true);	break;

								case 30:	Foreground(BLACK);	break;
								case 31:	Foreground(RED);	break;
								case 32:	Foreground(GREEN);	break;
								case 33:	Foreground(BROWN);	break;
								case 34:	Foreground(BLUE);	break;
								case 35:	Foreground(MAGENTA);break;
								case 36:	Foreground(CYAN);	break;
								case 37:	Foreground(WHITE);	break;
								case 90:	Foreground(GRAY);	break;
								case 91:	Foreground(RED_B);	break;
								case 92:	Foreground(LIME);	break;
								case 93:	Foreground(YELLOW);	break;
								case 94:	Foreground(BLUE_B);	break;
								case 95:	Foreground(MAGENTA_B);break;
								case 96:	Foreground(CYAN_B);	break;
								case 97:	Foreground(WHITE_B);break;

								case 40:	Background(BLACK);	break;
								case 41:	Background(RED);	break;
								case 42:	Background(GREEN);	break;
								case 43:	Background(BROWN);	break;
								case 44:	Background(BLUE);	break;
								case 45:	Background(MAGENTA);break;
								case 46:	Background(CYAN);	break;
								case 47:	Background(WHITE);	break;
								case 100:	Background(GRAY);	break;
								case 101:	Background(RED_B);	break;
								case 102:	Background(LIME);	break;
								case 103:	Background(YELLOW);	break;
								case 104:	Background(BLUE_B);	break;
								case 105:	Background(MAGENTA_B);break;
								case 106:	Background(CYAN_B);	break;
								case 107:	Background(WHITE_B);break;
							}
						}
					}
					break;
				default:		//the command was not recognized
					char* p = _ansiBuffer;
					while(*p)
						PutChar(*p++);
					break;
			}
		}
		return true;
	}
	return false;
}