|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BLOBable
the interface Blobable can be seen as a "function pointer".
the method "isBLOBable()" is called for each pixel of an image, to check if it belongs to
a blob or not.
so this should be a convenient way, to make your own conditions for blobs.
final class BLOBable_DEFAULT implements BLOBable{ int width_, height_; String name; //@Override public final boolean isBLOBable(int index, int x, int y) { return false; } //@Override public final void updateOnFrame( int width, int height) { width_ = width; height_ = height; System.out.println("default"); } //@Override public final void init() { name = this.getClass().getSimpleName(); System.out.println("default = "+name); } }
public final class BLOBable_A implements BLOBable{ int width_, height_; private float mousex_val_; private String name_; private PApplet papplet_; private PImage img_; public BLOBable_A(PApplet papplet, PImage img){ papplet_ = papplet; img_ = img; } //@Override public final void init() { name_ = this.getClass().getSimpleName(); } //@Override public final void updateOnFrame(int width, int height) { width_ = width; height_ = height; mousex_val_ = PApplet.map(papplet_.mouseX, 0, papplet_.width, 0, 100); } //@Override public final boolean isBLOBable(int pixel_index, int x, int y) { return (PixelColor.brighntess(img_.pixels[pixel_index]) < mousex_val_); } }
Method Summary | |
---|---|
void |
init()
init() is called when assigning a BLOBable-instance to a blobdetection. |
boolean |
isBLOBable(int pixel_index,
int x,
int y)
checks the current pixel-index for beeing part of the blob or not. |
void |
updateOnFrame(int width,
int height)
updateOnFrame() is called every time, before the blobdetection starts to analyse. |
Method Detail |
---|
boolean isBLOBable(int pixel_index, int x, int y)
pixel_index
- the current pixelindex which is checked.x
- current x-position of the detection (column).y
- current x-position of the detection (row).
void updateOnFrame(int width, int height)
width
- width of the whole frame (video, image, etc.)height
- height of the whole frame (video, image, etc.)void init()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |