Problem with col2im () function

Hello
I have a problem regarding the col2im function !
I have used the the im2col () with the property 'sliding' and a 5x5 kernel and so I have a 25 x 1000 matrix now !
I need to transform it back to an image but as I read the col2im() does not allows input to be a matrix (strangely) ! Can someone explain me why I have the following error !
"To RESHAPE the number of elements must not change."
My input matrix (im2col) is exactly the same size as the output (col2im). I read about the advice not to use this function but know have implemented it in a large workflow and I would rather not change it !
I just need to reconstruct my image.
Thanks in advance

댓글 수: 1

Dimitris M
Dimitris M 2013년 9월 15일
Hello again
Can someone from Mathworks advice me on the subject ! This function seems to crash for no reason ! Even the documentation is not very helpful in this case !

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2013년 9월 15일

0 개 추천

This function is rarely used - probably because it's so confusing and rarely needed even if someone did understand it. In my mind, they should be deprecated. If you're using a sliding linear filter, why not just use the much simpler imfilter() or conv2()?

댓글 수: 4

Dimitris M
Dimitris M 2013년 9월 15일
Hello
Thank you for the reply ! The thing is that I am using a kernel and the I am applying a non linear filtering process on the its values. So practically I need the values of the sliding window and do the following processes over them
1) sort them in ascending order
2) compute their absolute difference
I have done all the using the im2col function and processing the exported elements in a column wise manner but know I need to reconstruct them image. I am not really sure if it easy to construct an algorithm to do the same thing using imfilter() !
Is there another way to reconstruct my image using the data from im2col (with sliding property) ???
Thanks again
Image Analyst
Image Analyst 2013년 9월 15일
I still don't see why you need that function. I wouldn't use it. In fact MATLAB has a rank filter like you're doing. So if you have a 3x3 window, you'd have 8 absolute differences with the center pixels. You can do this with 8 calls to conv2(). But what do you do then with the 8 absolute values of the 8 differences? What gets assigned to an output image?
Dimitris M
Dimitris M 2013년 9월 15일
After some research in the internet I found this - with a small modification I was able to finally run my code !
Image Analyst
Image Analyst 2013년 9월 15일
I still say it's an unnecessary and obsolete function. If you want to do non-linear filter, as you have said, then the function to use is nlfilter().

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

질문:

2013년 9월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by