I ran the object detection demo from Tensorflow for android and I noticed that the DESIRED_PREVIEW_SIZE
in the DetectorActivity
is static (640X480) and doesn't depend on the device screen size. When I changed that using these :
public static int getScreenWidth() {
return Resources.getSystem().getDisplayMetrics().widthPixels;
}
public static int getScreenHeight() {
return Resources.getSystem().getDisplayMetrics().heightPixels;
}
i noticed that with a bigger preview the detection got slower and preview is a little bit laggy when you move the phone. The problem is when I keep the 640x480 resolution and take a picture it's going to be too small. That's why I need a bigger preview size.
Any suggestions on how I can improve the speed of the camera preview with a dynamic size that suits phones with big screens? I thought of applying detection only on 1 of 2 frames for example to speed it up but apparently it won't work since the accuracy will drop...