BLOBable (Javadocs: diewald_CV_kit)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## diewald_CV_kit.blobdetection
Interface BLOBable

    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.

- here's an example of the default condition, integrated in the imageprocessing class:

      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);
        }
      }

- Here's another example, that can just be copied into your sketch

      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_);
        }

      }

Author:
  thomas diewald (c) 2011

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

### isBLOBable

    boolean isBLOBable(int pixel_index,
                       int x,
                       int y)

  checks the current pixel-index for beeing part of the blob or not. isBLOBable() is called for every pixel!

  Parameters:
    `pixel_index` - the current pixelindex which is checked.
    `x` - current x-position of the detection (column).
    `y` - current x-position of the detection (row).
  Returns:
    true, if the pixel is part of the blob. false if not.

### updateOnFrame

    void updateOnFrame(int width,
                       int height)

  updateOnFrame() is called every time, before the blobdetection starts to analyse.

  Parameters:
    `width` - width of the whole frame (video, image, etc.)
    `height` - height of the whole frame (video, image, etc.)

### init

    void init()

  init() is called when assigning a BLOBable-instance to a blobdetection.

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Processing library diewald_CV_kit by Thomas Diewald. (C) 2012