Coder Social home page Coder Social logo

Comments (3)

elcraydo avatar elcraydo commented on July 18, 2024

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.

from opencv-processing.

wisehackermonkey avatar wisehackermonkey commented on July 18, 2024

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

from opencv-processing.

elcraydo avatar elcraydo commented on July 18, 2024

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.

from opencv-processing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.