From 781d94004aa20cb7911a991e43bcfed23194e8b2 Mon Sep 17 00:00:00 2001 From: grafju78439 Date: Thu, 9 Jun 2022 14:34:49 +0200 Subject: [PATCH] Tracking mit RGB --- src/ofApp.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index 6472481..d0c2321 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -20,12 +20,13 @@ void ofApp::update(){ rgb_immage.setFromPixels(webcam.getPixels()); rgb_immage.blurGaussian(5); - hsv_immage = rgb_immage; - hsv_immage.convertRgbToHsv(); + //hsv_immage = rgb_immage; + //hsv_immage.convertRgbToHsv(); + //hsv_immage.blur(); - contour.setTargetColor(color); - contour.setThreshold(30); - contour.findContours(hsv_immage); + contour.setTargetColor(color); /*, ofxCv::TRACK_COLOR_HSV*/ + contour.setThreshold(20); + contour.findContours(rgb_immage); selection = 0; if (contour.size() != 0) { for (i = 1; i < contour.size(); i++) { @@ -75,7 +76,7 @@ void ofApp::keyPressed(int key){ else if (key == 57356) { mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); } - else if (key == 57357) { + else if (key == ' ') { select_colour = select_colour ^ 0x0001; } } @@ -104,7 +105,7 @@ void ofApp::mouseDragged(int x, int y, int button){ //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button) { if (calibrated == 4 && select_colour == 0x0001) { - color = hsv_immage.getPixels().getColor(x, y); + color = rgb_immage.getPixels().getColor(x, y); printf("%i, %i, %i\n", color.r, color.g, color.b); printf("%f, %f, %f, %f \n", y_offset, y_scale, x_offset, x_scale); color_picked = 1;