Ask Your Question
0

Runtime Error in imshow using the DFT example in Opencv 4.0

asked 2018-12-06 12:31:25 -0600

ikarus23 gravatar image

updated 2018-12-06 12:46:20 -0600

berak gravatar image

Hello,

I am trying to get the following example for a Fourier transformation running:

https://docs.opencv.org/4.0.0/d8/d01/...

I am using the attached input Image: C:\fakepath\lenna.jpg

To read the image directly, i adapted the codeline:

Mat I = imread(filename, IMREAD_GRAYSCALE);

to:

Mat I = imread("lenna.jpg", IMREAD_GRAYSCALE);

Compiling the example works fine. But when i run the Code i get a runtime error when displaying the DFT.

Any ideas whats causing the error?

Setup: Windows 10 with Visual Studio 2017 and OpenCV 4.0.0

Thank you in advance!

edit retag flag offensive close merge delete

Comments

when displaying the DFT.

please show the code for that (the code you show so far is unrelated)

berak gravatar imageberak ( 2018-12-06 12:33:34 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-06 12:38:46 -0600

berak gravatar image

it's probably the bug from here

you want to update your opencv repo to latest master, so you have the proper fix (& rebuild)

in the meantime: convert your image locally to CV_8U:

img.convertTo(img, CV_8U, 255);
imshow("XXX", img);
edit flag offensive delete link more

Comments

1

thank you very much! its working now :)

ikarus23 gravatar imageikarus23 ( 2018-12-06 12:45:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-12-06 12:31:25 -0600

Seen: 215 times

Last updated: Dec 06 '18