Change resolution
jly0810 opened this issue · comments
When I use the following statement to change the resolution of the camera (changing the resolution from the default 640 * 480 to 1280 * 720), why does the average frame rate increase instead?
cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720);
1280*720:
I hope you can answer, thank you!
Did you try cv::VideoCapture cap(0, cv::CAP_DSHOW)
? Btw, the inference time in my code does not include the time opencv captures a frame because it is limited by your camera's FPS.
你试过了
cv::VideoCapture cap(0, cv::CAP_DSHOW)
吗?顺便说一句,我的代码中的推理时间不包括 opencv 捕获帧的时间,因为它受到相机 FPS 的限制。
Thank you for your reply! I think the reason for the above problem is that FPS in your code does not include the time of capturing frames. If I want to record the complete time to get FPS, I put the amount of time "start" before the "cap. Read" function. Is this correct?
以下是我更改后的测试结果
These results seem right.
In addition, I have another question that has not been solved. I hope you can answer it. I can run your code in the release mode of VS, but an error will be reported in the debug mode. What is the reason?
Operation results:
Debugging results:
I think your FPS measurement is absolutely correct.
About the error in debug mode, I also faced it before but couldn't fix it (I vaguely remembered it was tflite's problem). That was one of the reasons I decided to use CMake instead because of its "Release with Debug info" mode. I'm sorry I couldn't be of more help.
I tried moving tflite::ops::builtin::BuiltinOpResolver resolver
to the ModelLoader
class instead of using as a local variable and the above error was solved. But then m_interpreter->inputs()
raised another error. All examples I have seen just hardcode the tensor index.