Ketai camera problem (Sequal to "Merging two pictures")


#1

I’m displaying the camera on the screen but the screen appears white.

Code

Code:

import ketai.camera.*;
import ketai.cv.facedetector.*;
import ketai.data.*;
import ketai.net.*;
import ketai.net.bluetooth.*;
import ketai.net.nfc.*;
import ketai.net.nfc.record.*;
import ketai.net.wifidirect.*;
import ketai.sensors.*;
import ketai.ui.*;

private KetaiCamera cam;
private KetaiSensor snsr;

float rx, ry;
PGraphics FP;

void setup() {
  fullScreen();
  orientation(PORTRAIT);
  FP = createGraphics(1080,1920);
  FP.beginDraw();
  FP.background(0);
  FP.endDraw();
  cam = new KetaiCamera(this, 1080, 1920, 60);
  snsr = new KetaiSensor(this);
  cam.start();
  cam.setCameraID(0);
  snsr.start();
}

void draw() {
  //FP.beginDraw();
  //image(FP, 0, 0, 1080, 1920);
  //if (cam.isStarted()) {
  //  FP.image(cam, rx, ry, 108, 192);
  //}
  //FP.endDraw();
  image(cam,0,0);
}

void onOrientationEvent(float x, float y, float z) {
  rx = x;
  ry = y;
}

void onCameraPreviewEvent() {
  cam.read();
}
MCVE
import ketai.camera.*;
private KetaiCamera cam;

void setup() {
  cam = new KetaiCamera(this, 1080, 1920, 60);
  cam.start();
}

void draw() {
  image(cam,0,0);
}

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

Error:
Failed to open camera for camera ID: 0:Fail to connect to camera service


#2

@Odermonicon===

Are you using the last version from Ketai???
I had this error 2 or 3 years ago


#3

I’m using v14 and I realized in “Sketch Permissions” “CAMERA” Was ticked off, I will try to tick that.

PS: that did nothing.


#4

@Odermonicon===

add permission on runtime by code, not in the Manifest.


#5

A

So how?


#6

@Odermonicon====

this question was already answered in this forum or in the previous one. Have a look!


#7

Oops should have closed the fourum by now…