Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ANDROID: Using CameraBridgeViewBase to capture camera frames. Only getting ~3 frames per second when detecting objects with classifier...

hello there again.

http://answers.opencv.org/question/19283/java-android-trying-to-detect-buttons-in-a-car/

what i did so far:

in the link above you can see that i am trying to write an android app to detect and recognize buttons in a car. so far i have successfully trained two CascadeClassifiers and they work smooth on the desktop-programm i wrote to try them. i am using videocapture in the desktop-program to grab frames from my webcam and then detect the objects on these frames. i am getting a smooth and fast videostream, so everything is fine.

the problem:

now i've been trying to write that android app, and therefore i have looked at the source of the facedetection-example that comes with opencv for android. i basically copied most of the stuff from the FdActivity class to my own project, made it load my cascade files and let it run. everything works, and it detects my buttons somewhat good, but the problem is, that i only get around 3 frames per second. im using the CameraBridgeViewBase just like in the example, and im doing all of the detection-realted code in the onCameraFrame()-method. if i comment that code within that method out, im getting between 20 and 30 frames per second. i did not copy any code from the DetectionBasedTracker class, since that is native code and i would prefer not to use any of that. also i did not copy any code from the FdActivity class that is related to the DetectionBasedTracker class.

facts:

  • the frames recieved have a size of 800x480 pixels.
  • i tried to downsize them, but the lowest my camera supports is 640x382 pixels, so i can't go any lower without the app saying "it seems that your device does not support camera or it is locked" on startup.
  • i set the minimumSize within the detection method to 60*60 pixels to prevent it from detecting too many small objects.

so my question:

how is it possible, that the facedetection-app runs that smooth on my device, while my own app only gets around 3 frames per second? @StevenPuttemans since you helped me so great with my last question, maybe you have any idea?

ANDROID: Using CameraBridgeViewBase to capture camera frames. Only getting ~3 frames per second when detecting objects with classifier...

hello there again.

http://answers.opencv.org/question/19283/java-android-trying-to-detect-buttons-in-a-car/

what i did so far:

in the link above you can see that i am trying to write an android app to detect and recognize buttons in a car. so far i have successfully trained two CascadeClassifiers and they work smooth on the desktop-programm i wrote to try them. i am using videocapture in the desktop-program to grab frames from my webcam and then detect the objects on these frames. i am getting a smooth and fast videostream, so everything is fine.

the problem:

now i've been trying to write that android app, and therefore i have looked at the source of the facedetection-example that comes with opencv for android. i basically copied most of the stuff from the FdActivity class to my own project, made it load my cascade files and let it run. everything works, and it detects my buttons somewhat good, but the problem is, that i only get around 3 frames per second. im using the CameraBridgeViewBase just like in the example, and im doing all of the detection-realted code in the onCameraFrame()-method. if i comment that code within that method out, im getting between 20 and 30 frames per second. i did not copy any code from the DetectionBasedTracker class, since that is native code and i would prefer not to use any of that. also i did not copy any code from the FdActivity class that is related to the DetectionBasedTracker class.

facts:

  • the frames recieved have a size of 800x480 pixels.
  • i tried to downsize them, but the lowest my camera supports is 640x382 pixels, so i can't go any lower without the app saying "it seems that your device does not support camera or it is locked" on startup.
  • i set the minimumSize within the detection method to 60*60 pixels to prevent it from detecting too many small objects.

so my question:

how is it possible, that the facedetection-app runs that smooth on my device, while my own app only gets around 3 frames per second? @StevenPuttemans since you helped me so great with my last question, maybe you have any idea?

btw, i add my code here when i can access it again, which will be in about 12 hours.

ANDROID: Using CameraBridgeViewBase to capture camera frames. Only getting ~3 frames per second when detecting objects with classifier...

hello there again.

http://answers.opencv.org/question/19283/java-android-trying-to-detect-buttons-in-a-car/

what i did so far:

in the link above you can see that i am trying to write an android app to detect and recognize buttons in a car. so far i have successfully trained two CascadeClassifiers and they work smooth on the desktop-programm i wrote to try them. i am using videocapture in the desktop-program to grab frames from my webcam and then detect the objects on these frames. i am getting a smooth and fast videostream, so everything is fine.

the problem:

now i've been trying to write that android app, and therefore i have looked at the source of the facedetection-example that comes with opencv for android. i basically copied most of the stuff from the FdActivity class to my own project, made it load my cascade files and let it run. everything works, and it detects my buttons somewhat good, but the problem is, that i only get around 3 frames per second. im using the CameraBridgeViewBase just like in the example, and im doing all of the detection-realted code in the onCameraFrame()-method. if i comment that code within that method out, im getting between 20 and 30 frames per second. i did not copy any code from the DetectionBasedTracker class, since that is native code and i would prefer not to use any of that. also i did not copy any code from the FdActivity class that is related to the DetectionBasedTracker class.

facts:

  • the frames recieved have a size of 800x480 pixels.
  • i tried to downsize them, but the lowest my camera supports is 640x382 pixels, so i can't go any lower without the app saying "it seems that your device does not support camera or it is locked" on startup.
  • i have tried to downsize the Mat in which i store the frame in the onCameraFrame()-method to an even smaller size. that works, but at the end of the method this Mat is returned and is giving me an exception, since this Mat has to be converted back to Bitmap by then (thats what i read from the exception) and it can't do that as the Bitmap has to be the size of the original frame (800*480).
  • therefore i tried to scale the Mat up to 800*480 before returning it, but that of course gave me a blurred and ugly looking picture.
  • i set the minimumSize within the detection method to 60*60 pixels to prevent it from detecting too many small objects.

so my question:

how is it possible, that the facedetection-app runs that smooth on my device, while my own app only gets around 3 frames per second? @StevenPuttemans since you helped me so great with my last question, maybe you have any idea?

btw, i add my code here when i can access it again, which will be in about 12 hours.

ANDROID: Using CameraBridgeViewBase to capture camera frames. Only getting ~3 frames per second when detecting objects with classifier...

hello there again.

http://answers.opencv.org/question/19283/java-android-trying-to-detect-buttons-in-a-car/

what i did so far:

in the link above you can see that i am trying to write an android app to detect and recognize buttons in a car. so far i have successfully trained two CascadeClassifiers and they work smooth on the desktop-programm i wrote to try them. i am using videocapture in the desktop-program to grab frames from my webcam and then detect the objects on these frames. i am getting a smooth and fast videostream, so everything is fine.

the problem:

now i've been trying to write that android app, and therefore i have looked at the source of the facedetection-example that comes with opencv for android. i basically copied most of the stuff from the FdActivity class to my own project, made it load my cascade files and let it run. everything works, and it detects my buttons somewhat good, but the problem is, that i only get around 3 frames per second. im using the CameraBridgeViewBase just like in the example, and im doing all of the detection-realted code in the onCameraFrame()-method. if i comment that code within that method out, im getting between 20 and 30 frames per second. i did not copy any code from the DetectionBasedTracker class, since that is native code and i would prefer not to use any of that. also i did not copy any code from the FdActivity class that is related to the DetectionBasedTracker class.

facts:

  • the frames recieved have a size of 800x480 pixels.
  • i tried to downsize them, but the lowest my camera supports is 640x382 pixels, so i can't go any lower without the app saying "it seems that your device does not support camera or it is locked" on startup.
  • i have tried to downsize the Mat in which i store the frame in the onCameraFrame()-method to an even smaller size. that works, but at the end of the method this Mat is returned and is giving me an exception, since this Mat has to be converted back to Bitmap by then (thats what i read from the exception) and it can't do that as the Bitmap has to be the size of the original frame (800*480).
  • therefore i tried to scale the Mat up to 800*480 again before returning it, but that of course gave me a blurred and ugly looking picture.
  • i set the minimumSize within the detection method to 60*60 pixels to prevent it from detecting too many small objects.

so my question:

how is it possible, that the facedetection-app runs that smooth on my device, while my own app only gets around 3 frames per second? @StevenPuttemans since you helped me so great with my last question, maybe you have any idea?

btw, i add my code here when i can access it again, which will be in about 12 hours.