参考了网上其他人的CUDA + OpenCV实现Julia Set的例子( https://blog.csdn.net/Ricardo232525/article/details/74178963),用到了波纹示例上,代码如下:
#include "device_launch_parameters.h"
#include "cuda_runtime.h"
#include <highgui.hpp>
using namespace cv;
#define DIM 512
struct DataBlock{
unsigned char *dev_bitmap;
};
__global__ void kernel(unsigned char *ptr, int ticks)
{
int x = threadIdx.x + blockIdx.x * blockDim.x;
int y = threadIdx.y + blockIdx.y * blockDim.y;
int offset = x + y * blockDim.x * gridDim.x;