# How to import the Blob class?

**URL:** <https://discourse.processing.org/t/how-to-import-the-blob-class/35452>\
**Category:** Libraries\
**Created:** [February 26, 2022, 1:18am UTC](https://discourse.processing.org/t/how-to-import-the-blob-class/35452 "2022-02-26T01:18:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamshark70](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jamshark70](https://discourse.processing.org/u/jamshark70)\
**Post date:** [February 26, 2022, 1:18am UTC](https://discourse.processing.org/t/how-to-import-the-blob-class/35452/1 "2022-02-26T01:18:02Z")

</div>

Apologies for what is probably a painfully basic question. I’m new to Processing, but I’m not new to media programming (19+ year user of SuperCollider, 2-3 years teaching with Pure Data). Processing 3.5.4.

I am seeing a number of code examples online using the Blob class. (The goal is to supplement some image processing in Pure Data with blobby goodness – Pd’s Gem external claims to have a blob tracker but it’s slow enough to be unusable. That’s fine because Pd focuses on audio rather than video processing – so the lesson for the students will be how to integrate with other tools that are better suited to the task.)

Trying it for myself, I got as far as opening and displaying the camera 👍 and instantiating an OpenCV object 👍 but it chokes on ‘Cannot find a class or type named “Blob”’.

I tried several Google searches about “processing language Blob class” and I find many, many pages about how to use Blob, but nothing about where it’s defined. I can’t even find a reference for the class.

Then I noticed that these code examples all(?) `import hypermedia.video.*;`.

Processing IDE → Import Library → Add Library → search “hyper” oh, well, there’s nothing. Search “video” and several packages do show up, but there is no indication in the window which one of those might be hypermedia.

I also see that there is a BlobDetection library, but I’m not sure this is the right one because I didn’t see `import blobDetection.*;` in any of the examples (and `blobs` comes from the OpenCV object anyway).

So… this incoming user is experiencing a disconnect between examples and documentation.

Where do I get `Blob`?

hjh

Working example, displaying camera:

```auto
import processing.video.*;

Capture video;

void setup() {
  size(640, 480);
  video = new Capture(this, 640, 480);
  video.start();
}

void draw() {
  if (video.available() == true) {
    video.read();
  };
  image(video, 0, 0);
}

```

This sketch can’t find Blob:

```auto
import gab.opencv.*;
import processing.video.*;

OpenCV opencv;
Capture video;

float s=10;
float sc;

void setup() {
  size(640, 480);
  video = new Capture(this, 640, 480);
  opencv=new OpenCV(this, 640, 480);
  video.start();
}

void draw() {
  if (video.available() == true) {
    video.read();
  };
  image(video, 0, 0);
  // background(255);
  opencv.threshold(80);
  Blob[] blobs=opencv.blobs(10, width*height,100,true,OpenCV.MAX_VERTICES*4);
  for(int i=0; i<blobs.length;i++) {
    for(int j=0; j<blobs[i].points.length; j++) {
      fill(255);
      stroke(sc);
      rect(blobs[i].points[j].x,blobs[i].points[j].y,s,s);
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![jamshark70](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jamshark70](https://discourse.processing.org/u/jamshark70)\
**Post date:** [February 27, 2022, 12:59am UTC](https://discourse.processing.org/t/how-to-import-the-blob-class/35452/2 "2022-02-27T00:59:57Z")

</div>

So this morning I thought, why not import blobDetection and see what happens?

I expected some incompatibility with the Blob interface, but instead found that OpenCV was the problem:

“The function blobs(int, int, int, boolean) does not exist.”

Or

“The function blobs(int, int, int, boolean, int) does not exist.”

… which… have I installed the wrong version of OpenCV or something?

```auto
name=OpenCV for Processing
category=Video & Vision
... snip...
version=17
prettyVersion=0.5.4

```

Because, for instance, in a page which looks like [OpenCV reference documentation](https://ubaa.net/shared/processing/opencv/opencv_blobs.html), the example calls `opencv.blobs` so clearly this is expected to be provided somewhere.

_Anyway_ blobDetection’s example sketch works out of the box, so it looks like this might be my best option for now.

hjh
