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

These results are different from those with cv2.dft #13

Open
lilu1996 opened this issue Dec 4, 2019 · 1 comment
Open

These results are different from those with cv2.dft #13

lilu1996 opened this issue Dec 4, 2019 · 1 comment

Comments

@lilu1996
Copy link

lilu1996 commented Dec 4, 2019

input image "im_gray" of uint8 and size of [256,256], then i made following operations with opencv and torch-dct, respectively:
a = cv2.dct(im_gray.astype("float"))
b = torch_dct.dct_2d(torch.from_numpy(im_gray.astype("float"))).
But a and b are greatly different.

@lilu1996 lilu1996 changed the title This result is different from those with cv2.dft These results are different from those with cv2.dft Dec 4, 2019
@DYin65535
Copy link

Are you sure you used the same norm method as in cv2? Try this:

a = cv2.dct(im_gray.astype("float"))
b = torch_dct.dct_2d(torch.from_numpy(im_gray.astype("float")), norm='ortho')

I suppose both cv2 and MatLab use the orthogonal factor as default.

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