Videoverarbeitung eines Beerpongspiels. Entstehung im Rahmen einer Praktikumsaufgabe im Fach "Interaktion".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bpRecognizer.cpp 714B

123456789101112131415161718192021222324252627282930
  1. #include "bpRecognizer.h"
  2. void bpRecognizer::update(ofxCvGrayscaleImage image, int video_width, int video_height) {
  3. //subtracted.absDiff(image, background);
  4. subtracted.allocate(video_width, video_height);
  5. for (int i = 0; i < video_width * video_height; i++)
  6. {
  7. subtracted.getPixels()[i] = image.getPixels()[i] > background.getPixels()[i] + threshhold ? 255 : 0;
  8. }
  9. binarized = subtracted;
  10. //binarized.threshold(threshhold);
  11. contourFinder.findContours(
  12. binarized,
  13. 10,
  14. video_height * video_width / 10,
  15. 10,
  16. true);
  17. }
  18. void bpRecognizer::setThreshhold(int threshhold) {
  19. this->threshhold = threshhold;
  20. }
  21. void bpRecognizer::setBackground(ofxCvGrayscaleImage image) {
  22. this->background = image;
  23. }