用opencl编写的小波变换:看到图像中的伪像 [英] Wavelet transform written in opencl: seeing artifacts in image

查看:87
本文介绍了用opencl编写的小波变换:看到图像中的伪像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在opencl中编写了正向小波变换.

I have written a forward wavelet transform in opencl.

基本算法是将图像划分为128x8的图块;左两列和右两列被视为边界列.

Basic algorithm is to divide the image into tiles of 128x8; the two left columns and two right columns are treated as boundary columns.

将分块数据移动到本地内存中,进行转换,并且将无边界列存储在目标中.

Tile data is moved into local memory, transformed, and non-boundary columns are stored in destination.

我在图块的水平边界处看到图像伪像,但我不知道是什么原因造成的.它们出现在第四列和第124列,即第一列和最后一个偶数列不在边界上.

I am seeing image artifacts at the horizontal boundary of the tiles, and I can't figure out what is causing them. They occur on the fourth and 124th column, i.e. the first and last even column not on the boundary.

该项目是开源的:

https://github.com/boxerab/roger

依赖项:Visual Studio 2012,Intel OpenCL SDK和OpenCV

Dependencies: Visual Studio 2012, Intel OpenCL SDK and OpenCV

推荐答案

通常,当OpenCL在边界上返回意外的答案时,这就是边界问题.如果大多数代码都可以在边界上工作,请检查内核中的内存访问是否正确.通常,它与以下内容有关:全局偏移量+全局ID,本地偏移量+本地ID或大于分配值的组合.确保C/C ++代码中的全局和本地工作大小以及偏移量与分配的内存匹配,因为这会在内核中转换为全局和本地ID.

Usually when OpenCL returns unexpected answers on boundaries it is an Out-of-Bounds issues. If the majority of the code works except on boundaries, check that the memory access in the kernel is correct. Usually it is going to be something to do with: global offset + global id, local offset + local id, or a combination being larger than what was allocated. Make sure the global and local worksize and offsets in the C/C++ code match the memory allocated, since this gets translated into global and local ids in the kernel.

尝试在CPU设备上运行代码,因为这些代码对OOB的容忍度较低,并且(通常)会导致堆栈溢出或类似的情况. GPU设备非常宽容,通常会使用undefined,0(取决于编译器选项)或一些奇怪的超级巨大值.

Try running the code on a CPU device, as these are less forgiving of OOB and will (usually) cause a stack overflow or something similar. GPU devices are very forgiving and will usually either use undefined, 0 (depending on compiler options), or some bizarre super huge value.

这篇关于用opencl编写的小波变换:看到图像中的伪像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆