From 5fb4665df87d877c5463d0a0e474f434d8844234 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sat, 3 Feb 2018 16:47:39 +0000 Subject: reallocate openCv for change in res --- gui/src/ofApp.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gui/src') diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 05314d1..48f9fc0 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -422,7 +422,10 @@ void ofApp::drawOutput(ofEventArgs & args){ if (movie.isLoaded()){ ofPoint scale=ofPoint(outputWindowSize.x/movie.getWidth(),outputWindowSize.y/movie.getHeight()); colorImg.setFromPixels(movie.getPixels()); - grayImage = colorImg; + if (grayImage.getWidth()!=colorImg.getWidth()||grayImage.getHeight()!=colorImg.getHeight()){ + grayImage.clear(); + } + grayImage=colorImg; grayImage.threshold(contour_threshold); contourFinder.findContours(grayImage, 20, (340*240)/3, 10, true); for (int i = 0; i < contourFinder.nBlobs; i++){ -- cgit v1.2.3