1 Star 0 Fork 0

luoyuming/AscendGaussianBlur

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
main.cpp 1.37 KB
Copy Edit Raw Blame History
luoyuming authored 2021-06-01 15:10 . v0.9
#define _GNU_SOURCE
#include <sched.h>
#include <iostream>
#include "AscendGaussianBlur.h"
#include <sys/time.h>
int main(int argc, char** argv) {
//set opencv cpu limit
cpu_set_t mask;
CPU_ZERO(&mask);
for(int i=0; i < atoi(argv[1]); i++){
CPU_SET(i,&mask);
}
sched_setaffinity(0, sizeof(cpu_set_t), &mask);
struct timeval start;
struct timeval end;
Mat img = imread(argv[4]);
resize(img, img, Size(atoi(argv[2]),atoi(argv[3])));
std::cout << img.cols <<" "<< img.rows << std::endl;
imwrite("src.jpg", img);
aclInit(nullptr);
AscendGaussianBlur blur(img.cols, img.rows, 3, 13, 2.5);
Mat dst;
Mat dst_1;
switch(atoi(argv[1])){
case 0:
gettimeofday(&start,NULL);
dst = blur.run(img);
gettimeofday(&end,NULL);
cout<<"ascend blur time : "<<(end.tv_sec-start.tv_sec)*1000+(end.tv_usec-start.tv_usec) / 1000.0 <<"ms"<<endl;
imwrite("ascend_blur.jpg", dst);
break;
default:
gettimeofday(&start,NULL);
GaussianBlur(img, dst_1, Size(13,13), 2.5,2.5);
gettimeofday(&end,NULL);
cout<<"opencv blur time : "<<(end.tv_sec-start.tv_sec)*1000+(end.tv_usec-start.tv_usec) / 1000.0 <<"ms"<<endl;
imwrite("opencv_blur.jpg", dst_1);
break;
}
aclFinalize();
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yukming_law/AscendGaussianBlur.git
git@gitee.com:yukming_law/AscendGaussianBlur.git
yukming_law
AscendGaussianBlur
AscendGaussianBlur
master

Search

0d507c66 1850385 C8b1a773 1850385