VelocityDetector::~VelocityDetector()
{
    delete m_currentFrame;
    delete m_lastFrame;

    deleteImages();
}
Beispiel #2
0
void MidiPad::setImages (const Drawable* normal)
{
    deleteImages();
	if (normal != 0) {
		normalImage = normal->createCopy();
	}
    repaint();
}
void VelocityDetector::processImage(Image* input, Image* output)
{
    // Resize images and data structures if needed
    if ((m_lastFrame->getWidth() != input->getWidth()) &&
        (m_lastFrame->getHeight() != input->getHeight()))
    { 
        // Release all the old images
        deleteImages();
        // Allocate the images
        allocateImages(input->getWidth(), input->getHeight());
    }

    // Copy the current frame locally
    m_currentFrame->copyFrom(input);
    if (m_first)
    {
        // Initialize to the same as the current
        m_lastFrame->copyFrom(input);      
	cvCvtColor(m_lastFrame->asIplImage(), m_lastGreyScale, CV_BGR2GRAY);
        m_first = false;
    }


    if (0 != output)
    {
        // Copy the input image
        output->copyFrom(input);
    }

    // Now run all different optical flow algorithms
    if (m_usePhaseCorrelation)
        phaseCorrelation(output);
    else if (m_useLKFlow)
        LKFlow(output);
    
    // Draw velocity vector
    if (output)
    {
        CvPoint start;
        start.x = output->getWidth() / 2;
        start.y = output->getHeight() / 2;
        CvPoint end;
        end.x = start.x + ((int)(m_velocity.x*m_phaseLineScale));
        end.y = start.y - ((int)(m_velocity.y*m_phaseLineScale));
        cvLine(output->asIplImage(), start, end, CV_RGB(255,0,0), 1, CV_AA, 0);
    }

    // We are done with our work now last save the input for later use
    m_lastFrame->copyFrom(input);

    // Now lets publish our result
    math::Vector2EventPtr event(new math::Vector2Event());
    event->vector2 = getVelocity();
    publish(EventType::VELOCITY_UPDATE, event);
}
void DictionaryTextEdit::copy()
{
    QTextCursor cur;

    if (!m_copyImage)
    {
        textEditState.saveState(this);
        deleteImages();
    }
    QTextEdit::copy();
    if (!m_copyImage)
        textEditState.restoreState(this);
}
Beispiel #5
0
bool MidiPad::setImageFromFile(File file)
{
	if (file.exists())
	{
		deleteImages();
		
		normalImage = Drawable::createFromImageFile(file);
		if (normalImage!=0) {
			repaint();
		}
		else return false;
		return true;
	}
	return false;
}
Beispiel #6
0
void VectorRenderer::beginFrame()
{
    LOOM_PROFILE_SCOPE(vectorBegin);

    nvgTessLevelMax(nvg, tessellationQuality);
    nvgBeginFrame(nvg, frameWidth, frameHeight, 1);

    deleteImages();

    /*
    nvgBeginPath(nvg);
    nvgRect(nvg, 100, 100, 120, 30);
    nvgFillColor(nvg, nvgRGBA(255, 192, 0, 255));
    nvgFill(nvg);

    drawLabel(nvg, "hello fonts", 10.f, 50.f, 200.f, 200.f);
    //*/
}
void DrawableButton::setImages (const Drawable* normal,
                                const Drawable* over,
                                const Drawable* down,
                                const Drawable* disabled,
                                const Drawable* normalOn,
                                const Drawable* overOn,
                                const Drawable* downOn,
                                const Drawable* disabledOn)
{
    deleteImages();

    jassert (normal != 0); // you really need to give it at least a normal image..

    if (normal != 0)
        normalImage = normal->createCopy();

    if (over != 0)
        overImage = over->createCopy();

    if (down != 0)
        downImage = down->createCopy();

    if (disabled != 0)
        disabledImage = disabled->createCopy();


    if (normalOn != 0)
        normalImageOn = normalOn->createCopy();

    if (overOn != 0)
        overImageOn = overOn->createCopy();

    if (downOn != 0)
        downImageOn = downOn->createCopy();

    if (disabledOn != 0)
        disabledImageOn = disabledOn->createCopy();

    repaint();
}
Beispiel #8
0
 void destroy() {
     deleteImages();
 }
void DictionaryTextEdit::cut()
{
    if (!m_copyImage)
        deleteImages();
    QTextEdit::cut();
}
DrawableButton::~DrawableButton()
{
    deleteImages();
}
Beispiel #11
0
MidiPad::~MidiPad() 
{
	if (text) delete text;
    deleteImages();
}
DrawablePad::~DrawablePad()
{
    deleteImages();
}