fpiernas / FBP

Filtered Back Projection C++
MIT License
39 stars 12 forks source link

I met this error when run callFBP.cpp #1

Closed bemoregt closed 5 years ago

bemoregt commented 5 years ago

Hi, @fpiernas

I met this error when run callFBP.cpp

I'm using Sinogram of Lena.png.

What's wrong to me ?

kerb:FBP mun$ kerb:FBP mun$ ./callFBP libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(4.0.1) /tmp/opencv-20190105-31032-o160to/opencv-4.0.1/modules/core/src/merge.cpp:295: error: (-215:Assertion failed) mv[i].size == mv[0].size && mv[i].depth() == depth in function 'merge'

Abort trap: 6

Thanks .

fpiernas commented 5 years ago

Hi @bemoregt,

Could you please send me that sinogram image so I can test it? Attach it to a message here. Also paste here the exact code you use to reconstruct it.

It seems it's failing when performing the Fourier filter. In the meantime, try compiling in Debug mode instead of Release mode, if you were compiling in Release mode.

bemoregt commented 5 years ago

I use this image:

https://1.bp.blogspot.com/-khNda4jJyac/UNNppPx92oI/AAAAAAAAAmQ/5d2XtX7bDDc/s400/SinogramLenaMask120_zeropad.png

Thanks.

fpiernas commented 5 years ago

Hi @bemoregt,

That sinogram has its axis vertical, so rotate it 90º clockwise before running the program. I could reconstruct it with no errors:

lena_reconstruction

using this code:

Mat sinogram=imread("SinogramLenaMask120_zeropad.png",IMREAD_COLOR); Mat filtered_sinogram=filter_sinogram(sinogram); Mat reconstruction=iradon(filtered_sinogram,false); renormalize255_frame(reconstruction); imwrite("Reconstruction.png",reconstruction);

My Fourier filter function uses the OpenCV "merge" function that is known to have runtime errors when compiling in Release mode, please try to compile in Debug mode to see if that was the problem.

bemoregt commented 5 years ago

Hi, @fpiernas

That's Great ~!

I Think that Radon transform is a Hough Transform for Grayscale Image. Also,

I Think that it is possible to removing periodic texture using radonT-smoothing-iradonT procedure. It is more easy than FFT2-Notch-iFFT2 procedure.

Thanks.

Radon Transform

fpiernas commented 5 years ago

I don't know much about the Hough transform but I know it's very related to Radon and Fourier transforms.

So, is the code now working for you? If so, I can mark the thread as solved.