<commit_before>#include "testApp.h"

using namespace ofxCv;
using namespace cv;
using namespace std;

void testApp::setup() {
	cam.initGrabber(ofGetWidth()/3,ofGetHeight());

	ofSetVerticalSync(true); 
	ofEnableSmoothing(); 

	marking = NULL;
	brush = NULL;
	paint = NULL;

}

void testApp::update() {

	cam.update();
	if(cam.isFrameNew()) {
		convertColor(cam, gray, CV_RGB2GRAY);
		Canny(gray, edge,mouseX,mouseY, 3);
		edge.update();
	}

	if(marking != NULL)
    {
        marking->update();
    }

    for(auto i = 0u; i < markings.size(); i++)
    {
        markings[i]->update();
    }

	if(cam.isFrameNew()) {
		contourFinder.setThreshold(ofMap(mouseX, 0, ofGetWidth(), 0, 255));
		contourFinder.findContours(cam);
	}

	vector<vector<cv::Point> > contours = contourFinder.getContours();


	for(auto &m : markings)
		delete m;

	markings.clear();

	for(auto &c : contours){

		ofColor color = ofColor::black;
	
		path = new ofxSuperPath();
		path->setPathPressureType(OFX_PATH_PRESSURE_FIXED,10);
		paint = new ofxPaint(path, color,100);
		brush = new ofxRibbonBrush(path, paint);
		brush->setDynamic(false);

		marking = new ofxMarking(path, paint, brush);
		path->reset();
		path->lineStart(c[0].x,c[0].y,0,color, ofGetFrameNum(), 0);

		for(auto &p : c){
			path->lineTo(p.x,p.y,0,color, ofGetFrameNum(), 0);
		}

		marking->pathFinished();
		markings.push_back(marking);
		marking = NULL;
	}
}

void testApp::draw() {

	//cam.draw(0, 0);
	edge.draw(ofGetWidth()/3, 0);
//	contourFinder.draw();


	if(marking != NULL)
    {
        marking->draw();
    }
    
    for(auto i = 0u; i < markings.size(); i++)
    {
        markings[i]->draw();
    }

	

}

void testApp::exit()
{
    for(auto i = 0u; i < markings.size(); i++)
    {
        delete markings[i];
    }
    markings.clear();
    
    if(marking != NULL)
    {
        delete marking;
    }
}

//--------------------------------------------------------------
void testApp::keyPressed(int key)
{

}

//--------------------------------------------------------------
void testApp::keyReleased(int key)
{

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y)
{

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h)
{

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg)
{

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo)
{

}
<commit_msg>nettoyage des for et suppression des appels inutiles à update()<commit_after>#include "testApp.h"

using namespace ofxCv;
using namespace cv;
using namespace std;

void testApp::setup() {
	cam.initGrabber(ofGetWidth()/3,ofGetHeight());

	ofSetVerticalSync(true); 
	ofEnableSmoothing(); 

	marking = NULL;
	brush = NULL;
	paint = NULL;

}

void testApp::update() {

    cam.update();
    if(cam.isFrameNew()) {
	    convertColor(cam, gray, CV_RGB2GRAY);
	    Canny(gray, edge,mouseX,mouseY, 3);
	    edge.update();
    }

    if(cam.isFrameNew()) {
	    contourFinder.setThreshold(ofMap(mouseX, 0, ofGetWidth(), 0, 255));
	    contourFinder.findContours(cam);
    }
    
    for(auto &m : markings)
	    delete m;

    markings.clear();

    for(auto &c : contourFinder.getContours()){

	    ofColor color = ofColor::black;
    
	    path = new ofxSuperPath();
	    path->setPathPressureType(OFX_PATH_PRESSURE_FIXED,10);
	    paint = new ofxPaint(path, color,100);
	    brush = new ofxRibbonBrush(path, paint);
	    brush->setDynamic(false);

	    marking = new ofxMarking(path, paint, brush);
	    path->reset();
	    path->lineStart(c[0].x,c[0].y,0,color, ofGetFrameNum(), 0);

	    for(auto &p : c){
		    path->lineTo(p.x,p.y,0,color, ofGetFrameNum(), 0);
	    }

	    marking->pathFinished();
	    markings.push_back(marking);
	    marking = NULL;
    }
}

void testApp::draw() {

    //cam.draw(0, 0);
    edge.draw(ofGetWidth()/3, 0);
    //contourFinder.draw();


    if(marking != NULL)
    {
        marking->draw();
    }
    
    for(auto &i : markings)
    {
        i->draw();
    }

	

}

void testApp::exit()
{
    for(auto &i : markings)
    {
        delete i;
    }
    markings.clear();
    
    if(marking != NULL)
    {
        delete marking;
    }
}

//--------------------------------------------------------------
void testApp::keyPressed(int key)
{

}

//--------------------------------------------------------------
void testApp::keyReleased(int key)
{

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y)
{

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button)
{

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h)
{

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg)
{

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo)
{

}

{'fraction_non_alphanumeric': 0.32977606717984603, 'fraction_numerical': 0.008572428271518544, 'mean_word_length': 1.5454140694568121, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3549553', 'n_tokens_mistral': 1929, 'n_tokens_neox': 1802, 'n_words': 334}