当前位置: 首页 > news >正文

西樵网站制作公司高端的响应式网站建设公司

西樵网站制作公司,高端的响应式网站建设公司,黑马程序员就业情况,上海做网站的公司名称自定义设备函数 核函数#xff1a;__global__修饰#xff1b;在设备中执行#xff1b;设备函数#xff1a;__device__修饰#xff1b;在设备中执行#xff1b;只能被核函数或其他设备函数调用#xff1b;主机函数#xff1a;__host__修饰#xff08;可省略#xff0…自定义设备函数 核函数__global__修饰在设备中执行设备函数__device__修饰在设备中执行只能被核函数或其他设备函数调用主机函数__host__修饰可省略在主机中执行 #include stdio.h #include cuda_runtime.h #include device_launch_parameters.h #includemath.h #include malloc.h #include opencv2/opencv.hpp#include stdlib.h#define BLOCK_SIZE 1void __device__ thread_gpu(unsigned char in, unsigned char* out, int thread) {in thread ? *out 255 : *out 0; }//图像卷积 GPU __global__ void sobel_gpu(unsigned char* in, unsigned char* out, const int Height, const int Width) {int x blockDim.x * blockIdx.x threadIdx.x;int y blockDim.y blockIdx.y threadIdx.y;int index y * Width x;int Gx 0;int Gy 0;unsigned char x0, x1, x2, x3, x4, x5, x6, x7, x8;if (x0 x(Width-1) y0 y(Height-1)){x0 in[(y - 1)*Width (x - 1)];x1 in[(y - 1)*Width (x)];x2 in[(y - 1)*Width (x 1)];x3 in[(y)*Width (x - 1)];x5 in[(y)*Width (x 1)];x6 in[(y 1)*Width (x - 1)];x7 in[(y 1)*Width (x)];x8 in[(y 1)*Width (x 1)];Gx (x0 2 * x3 x6) - (x2 2 * x5 x8);Gy (x0 2 * x1 x2) - (x6 2 * x7 x8);out[index] (abs(Gx) abs(Gy)) / 2;thread_gpu(out[index], out[index], 80);} }int main() {cv::Mat src;src cv::imread(photo16.jpg);cv::Mat grayImg,gaussImg;cv::cvtColor(src, grayImg, cv::COLOR_BGR2GRAY);cv::GaussianBlur(grayImg, gaussImg, cv::Size(3,3), 0, 0, cv::BORDER_DEFAULT);int height src.rows;int width src.cols;//输出图像cv::Mat dst_gpu(height, width, CV_8UC1, cv::Scalar(0));//GPU存储空间int memsize height * width * sizeof(unsigned char);//输入 输出unsigned char* in_gpu;unsigned char* out_gpu;cudaMalloc((void**)in_gpu, memsize);cudaMalloc((void**)out_gpu, memsize);dim3 threadsPreBlock(BLOCK_SIZE, BLOCK_SIZE);dim3 blocksPreGrid((width threadsPreBlock.x - 1)/threadsPreBlock.x, (height threadsPreBlock.y - 1)/threadsPreBlock.y);cudaMemcpy(in_gpu, gaussImg.data, memsize, cudaMemcpyHostToDevice);sobel_gpu blocksPreGrid, threadsPreBlock (in_gpu, out_gpu, height, width);cudaMemcpy(dst_gpu.data, out_gpu, memsize, cudaMemcpyDeviceToHost);cv::imwrite(dst_gpu_save.png, dst_gpu);//cv::namedWindow(src, cv::WINDOW_NORMAL);cv::imshow(src, src);cv::imshow(dst_gpu, dst_gpu);cv::waitKey();cudaFree(in_gpu);cudaFree(out_gpu);return 0; }
http://www.zqtcl.cn/news/621687/

相关文章:

  • 做网站月薪10万微信网页开发教程
  • 网站开发组岗位上海著名企业
  • 阿里云网站建设方案网站源码分享
  • 设计感很强的中文网站公司专业网页制作
  • 自己制作网站做外贸赚钱吗什么是网站html静态化
  • 网站中的搜索功能怎么做的网站空间价格
  • 网站内容收费WordPress之类的
  • 好网站推荐一下网站建设客户评价
  • 重庆交通网站建设wordpress08模板
  • 网站搭建响应式wordpress访客切换主题
  • 标准网站建设推荐帮别人做网站开票开什么税目
  • 温州网站优化衡阳县专业做淘宝网站
  • 门户网站建设存在的问题和差距无锡做智能网站
  • 受欢迎的常州做网站网站制作ppt
  • 物流网站建设实例 天堂资源帝
  • 太原建设厅官方网站wordpress 导入工具
  • 做网站树立品牌形象建设了网站后怎么用谷歌引流
  • 专业公司网站建设建设人才库网站
  • 怎么自己做直播网站吗手机免费建站app
  • 惠州规划建设局网站seo网站关键词排名优化公司
  • 关键词检测百度seo一本通
  • 做效果图的外包网站徐州低价seo
  • xp系统中做网站服务器吗网站设计版权
  • 化妆品网站建设经济可行性分析怎么做好网站
  • 软件企业网站建设栏目结构图服务公司有哪些
  • 郑州专业做淘宝网站推广哪些公司需要网站开发工程师
  • 如何为企业做网站单页网站推广
  • 做公众号封面图的网站凡客精选app
  • 张家界做旅游网站网业小说畅读服务
  • 短租网站那家做的好网络设计工作好找吗