Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems while rotating/flipping an image on CPU and GPU #206

Open
vguptai opened this issue Jul 11, 2018 · 1 comment
Open

Problems while rotating/flipping an image on CPU and GPU #206

vguptai opened this issue Jul 11, 2018 · 1 comment

Comments

@vguptai
Copy link

vguptai commented Jul 11, 2018

Hi,

Can anyone share an example for rotation of an image on CPU and GPU?

When I try the CPU version, it seems to indicate that rotate function is not available.

local cv_im = cv.imread{'demo/data/lena.jpg',  cv.IMREAD_COLOR}
local im_rotated = cv.rotate{src=cv_im, dsize={512,512}, angle=1.5708}

attempt to call field 'rotate' (a nil value)

And when I rotate on GPU, I do not seem to get the correct result.

local cv_im = cv.imread{'demo/data/lena.jpg',  cv.IMREAD_COLOR}

local im_cuda = cv_im:cuda()

local im_rotated_gpu = cv.cuda.rotate{src=im_cuda, dsize={512,512}, angle=1.5708}

cv.imwrite{'demo/data/lena_rotated_gpu.jpg', im_rotated_gpu:byte()}

The image written is all black !!

Similar error while flipping an image on GPU:

cv.cuda.flip{src=im_cuda, flipCode = 0}

attempt to call field 'flip' (a nil value)

@vguptai vguptai changed the title Example for rotation - CPU and GPU Problems while rotating an image on- CPU and GPU Jul 11, 2018
@vguptai vguptai changed the title Problems while rotating an image on- CPU and GPU Problems while rotating an image on CPU and GPU Jul 11, 2018
@vguptai vguptai changed the title Problems while rotating an image on CPU and GPU Problems while rotating/flipping an image on CPU and GPU Jul 11, 2018
@shrubb
Copy link
Contributor

shrubb commented Jul 13, 2018

Hi,

on CPU refer to OpenCV documentation and use cv.warpAffine. cv.cuda.flip isn't implemented unfortunately. And there are still many bugs in CUDA wrappers that I didn't have time to fix.

Overall, I strongly recommend using Python because Torch is basically dead and this library is very weakly maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants