From d838d22ea537c64c958c5c0524f2c0efa8de91d8 Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sun, 31 Mar 2013 19:17:02 +0100 Subject: [PATCH] Some more line filtering bid'nizz. --- DisplayMachine.pde | 11 +++++++++++ controlsSetup.pde | 4 ++-- drawing.pde | 2 +- gamepad.pde | 16 ++++++++++++++++ polargraphcontroller_webcam.pde | 4 +++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/DisplayMachine.pde b/DisplayMachine.pde index 344ba28..698e437 100644 --- a/DisplayMachine.pde +++ b/DisplayMachine.pde @@ -425,6 +425,17 @@ class DisplayMachine extends Machine float scaler = h / vec.getHeight(); PVector position = new PVector(getPanel(PANEL_NAME_WEBCAM).getOutline().getRight()+7, height -10); +// int noOfChildren = vec.countChildren(); +// List children = new ArrayList(noOfChildren); +// for (int i=0; i < noOfChildren; i++) +// { +// if (vec.children[i].getArea() > pathLengthHighPassCutoff) +// children.add(vec.children[i]); +// } +// +// RShape[] newArray = children.toArray(new RShape[children.size()]); +// vec.children = newArray; + RPoint[][] pointPaths = vec.getPointsInPaths(); if (pointPaths != null) { diff --git a/controlsSetup.pde b/controlsSetup.pde index 159801f..6df809f 100644 --- a/controlsSetup.pde +++ b/controlsSetup.pde @@ -497,8 +497,8 @@ Map initialiseNumberboxValues(Map map) { n.setDecimalPrecision(1); n.setValue(pathLengthHighPassCutoff); - n.setMin(0); - n.setMax(10000); + n.setMin(PATH_LENGTH_HIGHPASS_CUTOFF_MIN); + n.setMax(PATH_LENGTH_HIGHPASS_CUTOFF_MAX); n.setMultiplier(0.5); } } diff --git a/drawing.pde b/drawing.pde index 645a555..07c56c7 100644 --- a/drawing.pde +++ b/drawing.pde @@ -746,7 +746,7 @@ List removeShortPaths(List list, int cutoff) { if (cutoff > 0) { - int numberOfPaths = list.size(); + int numberOfPaths = list.size()-1; for (int i=0; i= list.get(i).length) diff --git a/gamepad.pde b/gamepad.pde index 8aed7df..e58ba34 100644 --- a/gamepad.pde +++ b/gamepad.pde @@ -86,11 +86,27 @@ void dpadPress(float x, float y) if (liveSimplification > LIVE_SIMPLIFICATION_MAX) liveSimplification = LIVE_SIMPLIFICATION_MAX; } + if (val == 8.0) // left + { + pathLengthHighPassCutoff--; + if (pathLengthHighPassCutoff < PATH_LENGTH_HIGHPASS_CUTOFF_MIN) + pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MIN; + } + else if (val == 4.0) // right + { + pathLengthHighPassCutoff++; + if (pathLengthHighPassCutoff > PATH_LENGTH_HIGHPASS_CUTOFF_MAX) + pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MAX; + } Numberbox n = (Numberbox) getAllControls().get(MODE_LIVE_SIMPLIFICATION_VALUE); n.setValue(liveSimplification); n.update(); + n = (Numberbox) getAllControls().get(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF); + n.setValue(pathLengthHighPassCutoff); + n.update(); + } void processGamepadInput() diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index 46498a1..0cea90f 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -470,7 +470,9 @@ static PImage processedCapturedImage = null; static final Integer LIVE_SIMPLIFICATION_MIN = 1; static final Integer LIVE_SIMPLIFICATION_MAX = 32; -static int pathLengthHighPassCutoff = 100; +static int pathLengthHighPassCutoff = 0; +static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MAX = 10000; +static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MIN = 0; JMyron liveCamera; BlobDetector blob_detector;