We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to build an app that does blog detection using blobscanner and ketai libraries.
import ketai.camera.*;
import blobscanner.*;
KetaiCamera cam;
PImage img;
Detector bd;
int totalblobs=0;
void setup() {
orientation(LANDSCAPE);
imageMode(CENTER);
textSize(45);
bd = new Detector( this, 235 );
}
void draw() {
if(cam != null && cam.isStarted()){
image(cam, width/2, height/2, width, height);
cam.savePhoto();
}
else
{
background(128);
text("Waiting for camera....touch to activate", 100, height/2);
}
cam.filter(THRESHOLD);
bd.imageFindBlobs(cam);
totalblobs=bd.getBlobsNumber();
if(totalblobs >=10 )
{
print("Photo captured");
}
delay(2000);
}
void onCameraPreviewEvent()
{
cam.read();
}
// start/stop camera preview by tapping the screen
void mousePressed()
{
//HACK: Instantiate camera once we are in the sketch itself
if(cam == null)
cam = new KetaiCamera(this, 640, 480, 24);
if (cam.isStarted())
{
cam.stop();
}
else
cam.start();
}
void exit()
{
cam.stop();
}
The savePhoto() command doesn't seem to work and whenever I try to launch it, the app crashes. I want the app to take a photo and save it automatically when a certain amount of blobs are detected. I tried testing it on a Nexus 7 running 5.1.1. Any suggestions?
Answers
@nishok=== version of processing ???
(ketai lib does not work with P3)...and not always with P2...
I am using p 3.0.1. But when I load the ketai camera example it works perfectly.