# Native camera android in processing android

**URL:** <https://discourse.processing.org/t/native-camera-android-in-processing-android/26858>\
**Category:** Processing for Android\
**Created:** [January 7, 2021, 2:59pm UTC](https://discourse.processing.org/t/native-camera-android-in-processing-android/26858 "2021-01-07T14:59:31Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![dimpapadop](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Post date:** [January 14, 2021, 8:18pm UTC](https://discourse.processing.org/t/native-camera-android-in-processing-android/26858/34 "2021-01-14T20:18:13Z")

</div>

i am using a plain sketch not even showing preview image.

```auto
import ketai.camera.*;

KetaiCamera cam;
int time;
void setup() {
  orientation(LANDSCAPE);
  imageMode(CENTER);
  cam = new KetaiCamera(this, 176, 144, 30);
  time = millis();
}

void draw() {
  //image(cam, width/2, height/2);
}

void onCameraPreviewEvent()
{
  println(millis()-time);
  time=millis();
  cam.read();
}

// start/stop camera preview by tapping the screen
void mousePressed()
{
  if (cam.isStarted())
  {
    cam.stop();
  }
  else
    cam.start();
}
void keyPressed() {
  if (key == CODED) {
    if (keyCode == MENU) {
      if (cam.isFlashEnabled())
        cam.disableFlash();
      else
        cam.enableFlash();
    }
  }
}

```

the time for every frame capture is  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1905a5f9b9657c387997b208afb0d7795662e53c.png)  
so 7 fps approximately (this is on another phone.)

It doesn;t matter how efficient and elegant the tracking / drawing code is. If you preview 7fps you cannot work as you should. You would be processing the same frame many times.

---

_[View the full topic](https://discourse.processing.org/t/native-camera-android-in-processing-android/26858)._
