feat: add fps show in console
This commit is contained in:
parent
4be2d6ae49
commit
7e588d5e24
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
#include <opencv2/imgproc/imgproc.hpp>
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
|
@ -28,6 +29,10 @@ int main(int argc, char *argv[]) {
|
||||||
if (!ok) return 1;
|
if (!ok) return 1;
|
||||||
api->ConfigStreamRequest(request);
|
api->ConfigStreamRequest(request);
|
||||||
|
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
|
|
||||||
api->EnableStreamData(Stream::DEPTH);
|
api->EnableStreamData(Stream::DEPTH);
|
||||||
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
|
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
|
||||||
|
|
||||||
|
@ -43,6 +48,10 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||||
|
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include "mynteye/api/api.h"
|
#include "mynteye/api/api.h"
|
||||||
|
@ -51,6 +52,10 @@ int main(int argc, char *argv[]) {
|
||||||
// cv::namedWindow("disparity");
|
// cv::namedWindow("disparity");
|
||||||
cv::namedWindow("disparity_normalized");
|
cv::namedWindow("disparity_normalized");
|
||||||
|
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
api->WaitForStreams();
|
api->WaitForStreams();
|
||||||
|
|
||||||
|
@ -58,6 +63,10 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||||
|
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include "mynteye/api/api.h"
|
#include "mynteye/api/api.h"
|
||||||
|
@ -32,6 +33,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
api->Start(Source::VIDEO_STREAMING);
|
api->Start(Source::VIDEO_STREAMING);
|
||||||
|
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
|
|
||||||
cv::namedWindow("frame");
|
cv::namedWindow("frame");
|
||||||
PCViewer pcviewer;
|
PCViewer pcviewer;
|
||||||
|
|
||||||
|
@ -41,6 +46,11 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
|
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include "mynteye/api/api.h"
|
#include "mynteye/api/api.h"
|
||||||
|
@ -27,6 +28,10 @@ int main(int argc, char *argv[]) {
|
||||||
api->ConfigStreamRequest(request);
|
api->ConfigStreamRequest(request);
|
||||||
api->Start(Source::VIDEO_STREAMING);
|
api->Start(Source::VIDEO_STREAMING);
|
||||||
|
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
|
|
||||||
cv::namedWindow("frame");
|
cv::namedWindow("frame");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -37,6 +42,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include "mynteye/api/api.h"
|
#include "mynteye/api/api.h"
|
||||||
|
@ -31,6 +32,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
api->Start(Source::VIDEO_STREAMING);
|
api->Start(Source::VIDEO_STREAMING);
|
||||||
|
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
|
|
||||||
cv::namedWindow("frame");
|
cv::namedWindow("frame");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -40,6 +45,11 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT_RECTIFIED);
|
auto &&right_data = api->GetStreamData(Stream::RIGHT_RECTIFIED);
|
||||||
|
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
|
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
#include <stdio.h>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include "mynteye/api/api.h"
|
#include "mynteye/api/api.h"
|
||||||
|
@ -28,7 +29,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
api->setDuplicate(true);
|
api->setDuplicate(true);
|
||||||
|
|
||||||
api->EnablePlugin("plugins/linux-x86_64/libplugin_g_cuda9.1_opencv3.4.0.so");
|
api->EnablePlugin("plugins/libplugin_g_cuda9.2_opencv3.3.1.so");
|
||||||
|
|
||||||
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
|
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
|
||||||
|
|
||||||
|
@ -36,7 +37,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
cv::namedWindow("frame");
|
cv::namedWindow("frame");
|
||||||
cv::namedWindow("disparity");
|
cv::namedWindow("disparity");
|
||||||
|
double fps;
|
||||||
|
double t = 0.01;
|
||||||
|
std::cout << "fps:" << std::endl;
|
||||||
while (true) {
|
while (true) {
|
||||||
api->WaitForStreams();
|
api->WaitForStreams();
|
||||||
|
|
||||||
|
@ -44,6 +47,10 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||||
|
|
||||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||||
|
double t_c = cv::getTickCount() / cv::getTickFrequency();
|
||||||
|
fps = 1.0/(t_c - t);
|
||||||
|
printf("\b\b\b\b\b\b\b\b\b%.2f", fps);
|
||||||
|
t = t_c;
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user