Hi!
I’m color-blind and I made a small android app to exchange colors in a realtime image in order to distinguish red from black.
But the app runs slowly and gets just one frame from the camera.
After many attempts (I initially blamed on my filters, but they took less than 40 microseconds to run), I discovered that this code shows a camera preview image:
We would need to see a complete code demonstrating your problem so we can see your approach. Related to your slow image observation, I have experience that before a while ago when I was using Ketai in Android. Two things I did to speed up the display process were:
To use the P3D renderer as it would be more efficient displaying your images
When creating a camera, I would choose a smaller image dimensions when instantiating the camera and then I would scale the image when I displayed it. This might not be good in your case if you need the resolution. It is worth to give it a shot if you can get a better responsive video.
Another option would be to use native Android libraries in your Processing code which would require some effort from your side to get it going unless you find some samples and demos on the net.
I reviewed other sketches made by me and I saw I ketaiCamera.get() worked after displaying the preview frame. It seems the camera preview frame is only refreshed when displayed on the app surface, regardless of onCameraPreviewEvent and ketaiCamera.read();
So, even when you don’t want to show the preview frame in your sketch, you must do something like this:
ketaiCamera cam;
PImage mypimage;
void setup(){
cam.start();
}
void draw(){
// Assuming you have a cam.read() on the appropriate
// onCameraPreviewEvent()
//We don't want to display cam, but mypimage.
//... BUT ...
// if you comment this out, mypimage will be a blank image:
//
image(cam,somex,somey);
//
//luckily, the user won't see that image.
mypimage=cam.get()
//some filter function that is applied over mypimage.pixels[];
myfilterfunction();
image(mypimage(width/2,height/2, width,height));
}
Thank you for sharing your solution. This is worth to report as a tix in ketai github. I would say this is a workaround but not a desirable final solution. May I suggest you try using the P3D renderer by calling fullScreen(P3D); in setup?
I don’t want to use P3D since my app does not use 3D at all. I don’t know if adding P3D to my project would add an implicit uses-feature.
Since I’m already having trouble for the stores detecting implicit features and not being able to remove them via <uses-feature … android:required=“false”>, since APDE removes the AndroidManifest file and desktop processing gives strange errors.