Part Number: PROCESSOR-SDK-AM57X
Tool/software: Linux
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: PROCESSOR-SDK-AM57X
Tool/software: Linux
test code:
int main()
{
cv::Mat map_x, map_y,src_img,dst_img;
UMat usrc_img,udst_img,umap_x,umap_y;
CountTime ct;
int m = 10, n = 10;
struct timespec tp0, tp1, tp2, tp3,tp4,tp5;
//ready data
ct.time_start("ready_data");
{
src_img = imread("back.jpg",1);
src_img.copyTo(usrc_img);
dst_img = imread("back.jpg",1);
dst_img.copyTo(udst_img);
FILE* pfile = NULL;
//pfile = fopen("backwide.dat", "rb");
pfile = fopen("leftright4front.dat", "rb");
if (NULL == pfile)
{
return -1;
}
read_mat_from_file(pfile, map_x);
read_mat_from_file(pfile, map_y);
map_x.copyTo(umap_x);
map_y.copyTo(umap_y);
}
ct.time_end("ready_data"):
while(m--)
{
clock_gettime(CLOCK_MONOTONIC, &tp0);
cv::remap(usrc_img, udst_img, umap_x, umap_y, cv::INTER_LINEAR);
clock_gettime(CLOCK_MONOTONIC, &tp1);
cv::imwrite("./result_test_img.jpg",udst_img);
clock_gettime(CLOCK_MONOTONIC, &tp2);
printf ("[Use UMat] remap cost tdiff=%lf save file cost tdiff=%lf\n", tdiff_calc(tp0, tp1),tdiff_calc(tp1, tp2));
}
while(n--)
{
clock_gettime(CLOCK_MONOTONIC, &tp0);
cv::remap(src_img, dst_img, map_x, map_y, cv::INTER_LINEAR);
clock_gettime(CLOCK_MONOTONIC, &tp1);
cv::imwrite("./result_test_img.jpg",dst_img);
clock_gettime(CLOCK_MONOTONIC, &tp2);
printf ("[Use Mat] remap cost tdiff=%lf save file cost tdiff=%lf\n", tdiff_calc(tp0, tp1),tdiff_calc(tp1, tp2));
}
return 0;
}
test result:
[Use UMat] remap cost tdiff=6.562949 save file cost tdiff=1156.278259
[Use UMat] remap cost tdiff=0.214394 save file cost tdiff=1148.338498
[Use UMat] remap cost tdiff=0.214557 save file cost tdiff=1147.207314
[Use UMat] remap cost tdiff=0.214394 save file cost tdiff=1147.243101
[Use UMat] remap cost tdiff=0.257014 save file cost tdiff=1147.025940
[Use UMat] remap cost tdiff=0.213419 save file cost tdiff=1153.175880
[Use UMat] remap cost tdiff=0.214070 save file cost tdiff=1147.167787
[Use UMat] remap cost tdiff=0.196501 save file cost tdiff=1147.019434
[Use UMat] remap cost tdiff=0.207562 save file cost tdiff=1164.622407
[Use UMat] remap cost tdiff=0.208051 save file cost tdiff=1146.908983
[Use Mat] remap cost tdiff=36.088901 save file cost tdiff=43.951883
[Use Mat] remap cost tdiff=28.747755 save file cost tdiff=43.974168
[Use Mat] remap cost tdiff=28.649016 save file cost tdiff=43.874941
[Use Mat] remap cost tdiff=28.727096 save file cost tdiff=51.569075
[Use Mat] remap cost tdiff=29.357917 save file cost tdiff=55.143837
[Use Mat] remap cost tdiff=23.774059 save file cost tdiff=34.686714
[Use Mat] remap cost tdiff=23.295167 save file cost tdiff=34.747389
[Use Mat] remap cost tdiff=23.226523 save file cost tdiff=34.794237
[Use Mat] remap cost tdiff=23.193826 save file cost tdiff=34.747064
[Use Mat] remap cost tdiff=23.192526 save file cost tdiff=34.813432
Part Number: PROCESSOR-SDK-AM57X
Tool/software: Linux
Hi,
Is there any OpenCL expert help me to figure out this problem, I am stacking at this problem for a long time.
Regards!
Adam.
Hi, Adam,
. Per this stackoverflow post, UMat might involve OpenCL processing underneath: https://stackoverflow.com/questions/33602675/what-is-the-difference-between-umat-and-mat-in-opencv?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
While I am checking internally with OpenCV person, could you try turn off OpenCV acceleration if you know how and see what happen?
Rex
When I turn off the openCL , the remap cost same as it runs on the A15, about 22 ms,and save file time is about 58 ms