OpenCV Input Resolution for processing - Increase performance - Reduce processing time

Hi, my developer and I are making an Android application which is using edge detection and pixel detection on a webcam feed, however are finding the performance to be very slow. Our Video webcam resolution is 1280x720 at 60fps & 1920x1080 at 30fps.

We are relatively new to OpenCV, but can not seem to find any resources that could help us with performance.

Can we reduce the input process resolution and framerate but maintain a full video output and framerate with effects overlaid at the lower resolution and framerate.

Is there a way that we can show a 1920x1080p 30fps video feed on screen, but the processing is being done on a 640x360p input at 15fps?
or
1280x720p 60fps video feed but the processing is being done at 432x243 30fps?

Any other performance enhancements for android would be very helpful!

Thank so much everyone!

Hi, you can resize your image with:

Imgproc.resize

Then you can run your algorithms and display the new results in the original image at full resolution. Of course, by doing this you will have to manually scale up the data to the new resolution, and there will be a loss of precision/need to interpolate data, but for visualization purposes only, this is usually more than enough.

About the frame rate, a quick solution could be to process one frame each two/three, then visualize the data (for example, a bounding box, or the edge map, etc.) for the other frame(s). Note that the final frame rate will depends on how much processing you are performing, and that again you are showing a result of the processing at one frame more times, where the real data would differ a bit but again, if it is for visualization purposes, it can be a rough approximation, and particularly quick to implement.