Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any android camera support #103

Open
dattasaurabh82 opened this issue Oct 2, 2017 · 3 comments
Open

Any android camera support #103

dattasaurabh82 opened this issue Oct 2, 2017 · 3 comments

Comments

@dattasaurabh82
Copy link

So Ketai library does the heavy lifting for camera class, while processing's native video lib does't support android camera yet. Under those circumstances, How can I use, not face but object detection with specific object cascade files from android , using opencv-lib? can I?

@elcraydo
Copy link

Hi, I'd like to bump this issue.
This library is great on windows/mac, but nearly two years later and it seems the same problems still exist with core Processing libraries in Android mode. Ketai works with the camera and wraps android's face detection, but openCV marker detection is what I'm looking for.

@wisehackermonkey
Copy link

wisehackermonkey commented Feb 22, 2020

im in the same boat right now, im trying to use Ketai camera and combine it with opencv's face detection but its currently giving me bugs.

if you just want face detection i ended up using Ketai's face tracking:
NOTE: you have to have Ketai and android mode install within processing3 for this to work

import ketai.camera.*;

import ketai.cv.facedetector.*;



KetaiCamera cam;

PImage video;
int low = 30;
int high = 100;
int camWidth = 640;
int camHeight = 480;
int MAX_FACES = 20;
KetaiSimpleFace[] faces = new KetaiSimpleFace[MAX_FACES];


void setup() {
  orientation(LANDSCAPE);
  imageMode(CENTER);

  stroke(0, 255, 0);
  strokeWeight(2);
  noFill();
  rectMode(CENTER);

  cam = new KetaiCamera(this, camWidth, camHeight, 30);
  // 0: back camera; 1: front camera

  video = createImage(camWidth, camHeight, RGB);
}

void draw() {
  if (cam != null && cam.isStarted()) {
    cam.loadPixels();
    for (int y = 0; y < cam.height; y++) {
      for (int x = 0; x < cam.width; x++) {
        color pixelColor = cam.get(x, y);
        video.set(x, y, pixelColor);
      }
    }
    video.loadPixels(); 
    image(video, width/2, height/2, width, height);
    //scale(2);

    faces = KetaiFaceDetector.findFaces(video, MAX_FACES); 

    for (int i=0; i < faces.length; i++)
    {
      //We only get the distance between the eyes so we base our bounding box off of that 
      rect(faces[i].location.x, faces[i].location.y, 2.5*faces[i].distance, 3*faces[i].distance);
    }
  }
}


void mousePressed()
{
  if (cam.isStarted()) {
    cam.stop();
  } else {
    cam.setCameraID(1);
    cam.start();
  }
}

void onCameraPreviewEvent()
{
  cam.read();
}

@elcraydo
Copy link

Hey, I managed to get marker detection working great for AR on Android using Ketai and nyARToolkit. Here's a link to an older post:
https://discourse.processing.org/t/augmented-reality-made-easy/12692/2
It's not the final working code, but it might give you some ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants