|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objects373.flob.Flob
public class Flob
Fast multi-blob detector and simple skeleton tracker using flood-fill algorithms. http://s373.net/code/flob Flob is a continuous frame differencing algorithm using flood fill procedures to calculate blobs. Basic process is comparing incoming image to a background image. There are two main operating modes @om (flob.setOm()): -STATIC_DIFFERENCE (0) incoming image is compared to background. background is unchanged. -CONTINUOUS_DIFFERENCE (1) incoming image is compared to background. background is set to previous frame. -CONTINUOUS_EASE_DIFFERENCE (2) incoming image is compared to background. previous frame eased onto background pixels. Flob receives an ARGB Processing PImage as input and converts rgb->luma (luminance, greyscale image) using one of several methods specified through @colormode. The greyscale luminance image is then binarized (flob.binarize(Image)) using the @videothresh or @videothreshf value as reference. First the image is mirrored if specified through @mirrorX @mirrorY then the image is converted from argb->luma using @colormode possible @colormode values: @RED @GREEN @BLUE @LUMA601 @LUMA609 @LUMAUSER In openFrameworks, it's a similar procedure, you pass an image pixels array, and call the binarize method. To calculate the binary image, now Flob takes @thresholdmode to specify the operation to calculate the binary image. possible values include: - @ABS : absolute diference of incoming pixel versus background - @LESSER : if incoming pixel less than threshold, mark as white pixel in binary image - @GREATER : white if above @videothresh value You can also clamp the internal image (@clampGray) to focus on @nearGray and @farGray interval values. Usefull for kinect like clamping. Once you have the binary image essential for blob tracking, you can call the methods @flob.calc(PImage binImage), which returns a usable list of @ABlob's, or @flob.track(PImage binImage), @flob.tracksimple, @flob.calcsimple, which return a usable list of @TBlob's.
Constructor Summary | |
---|---|
Flob(PApplet applet)
Flob constructor usage summary: public Flob(PApplet applet): output dimensions of blob coords (PApplet.width, PApplet.height) & assumes incoming image 128px public Flob(PApplet applet, PImage video): output dimensions of blob coords (PApplet.width, PApplet.height) & assumes incoming image dimensions of @video public Flob(PApplet applet, PImage video, float w, float h): output dimensions of blob coords (@w, @h) & assumes incoming image dimensions of @video public Flob(PApplet applet, int srcW, int srcH, float dstW, float dstH): output dimensions of blob coords (@dstW, @dstH) & assumes incoming image dimensions of @srcW, @srcH |
|
Flob(PApplet applet,
int srcW,
int srcH,
float dstW,
float dstH)
|
|
Flob(PApplet applet,
PImage video)
|
|
Flob(PApplet applet,
PImage video,
float w,
float h)
|
Method Summary | |
---|---|
PImage |
binarize(int[] pix)
|
PImage |
binarize(PImage video)
Flob.binarize() main image preprocessing stage. |
ArrayList<ABlob> |
calc(PImage img)
calcs with current PImage. |
ArrayList<quadBlob> |
calcQuad(PImage img)
calcs with current PImage. |
ArrayList<TBlob> |
calcsimple(PImage img)
calcsimple is naive tracking. |
Flob |
easeBackground(PImage video)
ease the background to compare to to this PImage. |
PImage |
fastblur(PImage img,
int radius)
PImage img = fastblur(PImage img, int radius); Super Fast Blur v1.1 by Mario Klingemann http://incubator.quasimondo.com |
ABlob |
getABlob(int i)
getABlob returns the nth calc'ed blob of the tracker returns one ABlob element |
float[] |
getABlobExtreme(int i)
|
boolean |
getAnyFeatureActive()
getAnyFeatureActive true if any feature points on |
int[] |
getBackground()
gets the background image // todo: incorporate float here too, but not necessary, can access @backgroundPixelsF directly if needed |
int |
getBlur()
get the blur amount on the image. |
String |
getColorMode()
get selected colormode |
float |
getFade()
get the fade value in flob.om > 0 |
int |
getFarGray()
|
float |
getFloatsmooth()
|
PImage |
getImage()
getImage gets the current video image worked inside flob |
float[] |
getLumaUserCoefs()
get lumausercoefs |
int |
getMaxNumPixels()
get max numpixels to be considered a blob |
int |
getMinNumPixels()
get min numpixels to be considered a blob |
boolean[] |
getMirror()
get mirror in XY axis |
int |
getNearGray()
|
int |
getNumBlobs()
getNumBlobs. |
int |
getNumQuadBlobs()
|
int |
getNumTBlobs()
getNumTBlobs. |
int |
getOm()
get the current om, either CONTINUOUS_DIFFERENCE (1) or STATIC_DIFFERENCE (0) |
int |
getPresence()
getPresence. |
float |
getPresencef()
getPresencef. |
ABlob |
getPreviousABlob(int i)
getPreviousABlob returns the nth calc'ed previous blob of the tracker returns one ABlob element |
TBlob |
getPreviousTBlob(int i)
|
TBlob |
getPreviousTrackedBlob(int i)
getPreviousTrackedBlob returns the nth tracked previous blob of the tracker. |
quadBlob |
getQuadBlob(int i)
|
float |
getSmooth()
get smooth of blob speeds |
PImage |
getSrcImage()
returns the updated videotex (in case it needs updating) |
TBlob |
getTBlob(int i)
|
int |
getTBlobLifeTime()
get the max lifetime for a TBlob |
static float |
getTBlobMaxDistSquared()
|
float |
getThresh()
get the threshold value to the image binarization |
int |
getThresholdmode()
get @thresholdmode |
TBlob |
getTrackedBlob(int i)
getTrackedBlob returns the nth tracked blob of the tracker returns the arraylist of trackedBlob elements a tracked blob holds: // pos & vel & dim results are local world coords // int tb.id; // float tb.cx; // float tb.cy; // float tb.velx; // float tb.vely; // float tb.prevelx; // float tb.prevely; // int tb.presencetime; // float tb.dimx; // float tb.dimy; // int tb.birthtime; |
boolean[] |
getTrackFeatures()
getTrackFeatures gets the boolean array with on/off's for searching feature points: armleft, armright, head, bottom for each blob |
float |
getTrackingMinDist()
get tracking min dist to be the same blob |
boolean |
isClampGray()
|
boolean |
isFloatmode()
are you using floatmode? |
boolean |
isTBlobDoSorting()
|
Flob |
mirrorX(boolean m)
mirror video data along X axis? |
Flob |
mirrorY(boolean m)
mirror video data along Y axis? |
Flob |
setBackground(PImage video)
sets the background to compare to to this PImage. |
Flob |
setBlur(int blur)
set the blur amount on the image. |
Flob |
setClampGray(boolean clampGray)
new kinect specific code can clamp kinect image (or other rgbimages) between values of nearGray and farGray (works on 8bit 0-255 limits) |
Flob |
setColorMode(int t)
set the colormode for the binarization stage. |
Flob |
setFade(float t)
set the fade value in flob.om > 0 |
Flob |
setFarGray(int farGray)
|
void |
setFloatmode(boolean floatmode)
activate floating point calculations in binarize image |
void |
setFloatsmooth(float floatsmooth)
|
Flob |
setImage(int t)
setImage sets the videotex returned by flob.videotex or flob.getSrcImage case 0: videotex = src videoimg as flob sees it (incoming image) case 1: videotex = binary image result from om==0, incoming img vs static bg case 2: videotex = binary image result from om>0, incoming img vs dynamic bg case 3: videotex = image result from incoming img + binary image |
Flob |
setLumaUserCoefs(float[] data)
set lumausercoefs |
Flob |
setMaxNumPixels(int t)
set max numpixels to be considered a blob |
Flob |
setMinNumPixels(int t)
set min numpixels to be considered a blob |
Flob |
setMirror(boolean m0,
boolean m1)
set mirror in XY axis with two booleans |
Flob |
setNearGray(int nearGray)
|
Flob |
setOm(int t)
set the om either CONTINUOUS_DIFFERENCE (1) or STATIC_DIFFERENCE (0) or CONTINUOUS_EASE_DIFFERENCE (2) |
Flob |
setSmooth(float s)
set smooth factor for blob speeds changes |
Flob |
setSrcImage(int t)
setSrcImage sets the videotex returned by flob.videotex or flob.getSrcImage |
Flob |
setTBlobDoSorting(boolean trackedBlobDoSorting)
|
Flob |
setTBlobLifeTime(int t)
set the max lifetime for a trackedblob |
static void |
setTBlobMaxDistSquared(float trackedBlobMaxDistSquared)
setTBlobMaxDistSquared |
Flob |
setThresh(float t)
set the threshold value to the image binarization |
Flob |
setThresholdmode(int thresholdmode)
set @thresholdmode - @flob.ABS (0): absolute diference of incoming pixel versus background - @flob.LESSER (1): if incoming pixel less than threshold, mark as white pixel in binary image - @flob.GREATER (2): white if above @videothresh value |
Flob |
setTrackFeatures(boolean[] tf)
setTrackFeatures turns on/off searching for feature points: armleft, armright, head, bottom for each blob if (tflob.trackfeatures[0]) b = calc_feature_head(b); if (tflob.trackfeatures[1]) b = calc_feature_arms(b); if (tflob.trackfeatures[2])b = calc_feature_feet(b); if (tflob.trackfeatures[3])b = calc_feature_bottom(b); |
Flob |
setTrackingMinDist(float s)
set tracking min dist to be the same blob |
Flob |
setTresh(float t)
set the threshold value to the image binarization. |
Flob |
setVideoTex(int t)
set the videotex returned by flob.videotex case 0: videotex = src videoimg as flob sees it (incoming image) case 1: videotex = binary image result from om==0, incoming img vs static bg case 2: videotex = binary image result from om>0, incoming img vs dynamic bg case 3: videotex = image result from incoming img + binary image |
boolean |
testPos(float x,
float y)
testPos float x, float y. |
boolean |
testPos(int x,
int y)
testPos int x, int y. |
ArrayList<TBlob> |
track(PImage img)
calcs with current PImage. |
ArrayList<TBlob> |
tracksimple(PImage img)
tracksimple is good tracking code, maintains id's, speed's, presencetime for each trackedBlob returns the arraylist of trackedBlob elements |
PImage |
updateVideoTex()
|
String |
version()
return the version of the library. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public PApplet app
public ImageBlobs imageblobs
public PImage videoimg
public PImage videotex
public PImage videotexmotion
public PImage videotexbin
public PImage videoteximgmotion
public int[] backgroundPixels
public int numPixels
public int videoresw
public int videoresh
public int presence
public float presencef
public int videotexmode
public int pvideotexmode
public int videothresh
public float videothreshf
public int videofade
public float videofadef
public boolean mirrorX
public boolean mirrorY
public float worldwidth
public float worldheight
public int blur
public boolean[] trackfeatures
public boolean floatmode
public float floatsmooth
public float[] backgroundLuma
public float[] currentLuma
public int om
public static final int STATIC_DIFFERENCE
public static final int CONTINUOUS_DIFFERENCE
public static final int CONTINUOUS_EASE_DIFFERENCE
public float continuous_ease
public int colormode
public static final int RED
public static final int GREEN
public static final int BLUE
public static final int LUMA601
public static final int LUMA709
public static final int LUMAUSER
public static String redstr
public static String greenstr
public static String bluestr
public static String luma601str
public static String luma709str
public static String lumausrstr
public float[] lumausercoefs
public int thresholdmode
public static final int ABSDIF
public static final int LESSER
public static final int GREATER
public int blobpixmin
public int blobpixmax
public static int TBlobLifeTime
public static float TBlobMaxDistSquared
public boolean TBlobDoSorting
public boolean clampGray
public int nearGray
public int farGray
public static String VERSION
Constructor Detail |
---|
public Flob(PApplet applet)
public Flob(PApplet applet, PImage video)
public Flob(PApplet applet, PImage video, float w, float h)
public Flob(PApplet applet, int srcW, int srcH, float dstW, float dstH)
Method Detail |
---|
public PImage binarize(int[] pix)
public PImage binarize(PImage video)
PImage
-
public PImage getSrcImage()
public PImage updateVideoTex()
public Flob setVideoTex(int t)
public Flob setImage(int t)
t
-
public PImage getImage()
public Flob setSrcImage(int t)
public Flob setTrackFeatures(boolean[] tf)
public boolean[] getTrackFeatures()
public boolean getAnyFeatureActive()
public Flob setOm(int t)
public int getOm()
public boolean isFloatmode()
public void setFloatmode(boolean floatmode)
floatmode
- public float getFloatsmooth()
public void setFloatsmooth(float floatsmooth)
floatsmooth
- the floatsmooth to setpublic int getThresholdmode()
public Flob setThresholdmode(int thresholdmode)
thresholdmode
- public Flob setTBlobLifeTime(int t)
public int getTBlobLifeTime()
public static float getTBlobMaxDistSquared()
public static void setTBlobMaxDistSquared(float trackedBlobMaxDistSquared)
the
- trackedBlobMaxDistSquared to setpublic Flob setColorMode(int t)
public String getColorMode()
public Flob setLumaUserCoefs(float[] data)
public float[] getLumaUserCoefs()
public Flob setBackground(PImage video)
public Flob easeBackground(PImage video)
public int[] getBackground()
public Flob setTresh(float t)
public Flob setThresh(float t)
public float getThresh()
public Flob setFade(float t)
public float getFade()
public Flob mirrorX(boolean m)
public Flob mirrorY(boolean m)
public Flob setMirror(boolean m0, boolean m1)
public boolean[] getMirror()
public Flob setMinNumPixels(int t)
public Flob setMaxNumPixels(int t)
public int getMinNumPixels()
public int getMaxNumPixels()
public Flob setTrackingMinDist(float s)
public float getTrackingMinDist()
public Flob setSmooth(float s)
public float getSmooth()
public Flob setBlur(int blur)
public int getBlur()
public boolean isTBlobDoSorting()
public Flob setTBlobDoSorting(boolean trackedBlobDoSorting)
trackedBlobDoSorting
- the trackedBlobDoSorting to setpublic boolean isClampGray()
public Flob setClampGray(boolean clampGray)
clampGray
- the clampGray to setpublic int getNearGray()
public Flob setNearGray(int nearGray)
nearGray
- the nearGray to setpublic int getFarGray()
public Flob setFarGray(int farGray)
farGray
- the farGray to setpublic ArrayList<ABlob> calc(PImage img)
public ArrayList<TBlob> track(PImage img)
public ArrayList<TBlob> tracksimple(PImage img)
public ArrayList<TBlob> calcsimple(PImage img)
public ArrayList<quadBlob> calcQuad(PImage img)
public TBlob getTrackedBlob(int i)
public TBlob getTBlob(int i)
public TBlob getPreviousTrackedBlob(int i)
public TBlob getPreviousTBlob(int i)
public float[] getABlobExtreme(int i)
public ABlob getABlob(int i)
public quadBlob getQuadBlob(int i)
public ABlob getPreviousABlob(int i)
public int getNumBlobs()
public int getNumTBlobs()
public int getNumQuadBlobs()
public int getPresence()
public float getPresencef()
public boolean testPos(int x, int y)
public boolean testPos(float x, float y)
public PImage fastblur(PImage img, int radius)
public String version()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |