Skip to content
Snippets Groups Projects
Commit 091aa463 authored by simon.fanetti's avatar simon.fanetti
Browse files

add reading perf file app

parent 62abeaa4
No related branches found
No related tags found
No related merge requests found
include ../../../ar_sandbox_lib/dep.mk
include ../../ar_sandbox_lib/dep.mk
API_PATH=../../../ar_sandbox_lib
API_PATH=../../ar_sandbox_lib
CFLAGS=-std=c++11 -Wall -Wextra -g
CCP=g++
DBG_GPROF=-pg
......
......@@ -7,12 +7,7 @@
int main(){
Sandbox sandbox;
// Default
char *sandbox_conf_file = (char*)"../../sandbox_conf.yaml";
// Debug
//char * sandbox_conf_file = (char *)"../../../sandbox_conf.yaml";
char *sandbox_conf_file = (char*)"./sandbox_conf.yaml";
if(sandbox.loadConfig(sandbox_conf_file)){
std::cout << "Failed to load the configuration" << std::endl;
......@@ -43,52 +38,29 @@ void displayLevels(Sandbox &sandbox, float top, float height){
cv::setWindowProperty(windowName, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
sandbox.captureFrame();
cv::Mat depth_cache = sandbox.getDepthFrame();
cv::Mat new_depth = cv::Mat(depth_cache.size(), CV_32F);
cv::Mat colorized = cv::Mat(depth_cache.size(), CV_8UC3);
cv::Mat_<cv::Vec3b> res = cv::Mat(depth_cache.size(), CV_8UC3);
cv::Mat1f depth_cache = sandbox.getDepthFrame();
cv::Mat1f new_depth = cv::Mat(depth_cache.size(), CV_32F);
cv::Mat3b colorized = cv::Mat(depth_cache.size(), CV_8UC3);
cv::Mat3b res = cv::Mat(depth_cache.size(), CV_8UC3);
//cv::Mat_<cv::Vec3b> img = cv::imread("index.png");
//std::chrono::milliseconds start_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//int cpt_frame = 0;
//double average = 0;
do{
//for(int i=0; i<200; i++){
sandbox.captureFrame();
new_depth = sandbox.getDepthFrame();
// don't show what is above the top of sandox
depth_cache.copyTo( new_depth, (new_depth < top) );
// don't update little differences due to the camera depth captors
new_depth.copyTo( depth_cache, (cv::abs(depth_cache-new_depth) > DEPTH_MARGIN_ERROR) );
colorized = colorizeDepth(depth_cache, top, height);
cv::cvtColor(colorized, res, CV_RGB2BGR);
//std::chrono::milliseconds start_adj_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//cv::Mat_<cv::Vec3b> result = sandbox.adjustProjection(res);
//std::chrono::milliseconds now_adj_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//int time = (now_adj_ms - start_adj_ms).count();
//average += time;
//std::cout << time << std::endl;
res = sandbox.adjustProjection(res, depth_cache);
cv::imshow(windowName, res);
/*
cpt_frame++;
std::chrono::milliseconds now_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
if(now_ms-start_ms > std::chrono::milliseconds(1000)){
std::cout << cpt_frame << std::endl;
cpt_frame = 0;
start_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
}
*/
//}
} while (cv::waitKey(10) != ESCAPE_CHAR);
//std::cout << "Average " << average/200 << std::endl;
cv::destroyAllWindows();
}
......
......@@ -11,8 +11,8 @@ CroppingMask:
width: 452
height: 338
BeamerResolution:
width: 1024
height: 768
width: 1400
height: 1050
BeamerPosition:
x: 0.05
y: 0.2
......
#!/usr/bin/env python3
import sys
times = [0,0,0,0]
average = times
average_fps = 0
cnt = 0
if(len(sys.argv) < 2):
print("Use case : ./exec [output_file_name]")
exit()
with open(sys.argv[1]) as file:
lines = file.readlines()
for i in range(1, len(lines)):
line = lines[i]
cnt += 1
str_values = line.split(",")
values = [ int(v.rstrip("\n")) for v in str_values ]
for n in range(0, len(times)):
times[n] += values[n]
if(cnt > 0):
average = [ float(time)/cnt for time in times ]
average_fps = 1000.0 / sum(average)
print("Average times in ms :")
print("Capture : {}".format(average[0]))
print("Get depth frame : {}".format(average[1]))
print("Get color frame : {}".format(average[2]))
print("Adjust frame : {}".format(average[3]))
print("With an average fps of : {}".format(average_fps))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment