Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change resolution #7

Open
jly0810 opened this issue Mar 15, 2022 · 4 comments
Open

Change resolution #7

jly0810 opened this issue Mar 15, 2022 · 4 comments

Comments

@jly0810
Copy link

jly0810 commented Mar 15, 2022

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:
image

640*480:
image

I hope you can answer, thank you!

@pntt3011
Copy link
Owner

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.

@jly0810
Copy link
Author

jly0810 commented Mar 15, 2022

你试过了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?
以下是我更改后的测试结果
image
image
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:

image

Debugging results:

image

@pntt3011
Copy link
Owner

pntt3011 commented Mar 15, 2022

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.

@pntt3011
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants