im2col error in size
이전 댓글 표시
Hi this is my code:
R=rand(162,72);
r=im2col(R,[2 2],'sliding');
R1=col2im(r,[2 2],size®,'sliding');
the size of R is [162 72];
when I use line 1 it is OK. It gives me a a matrix r with size of r=[4 11431]
but at line 2 to obtain R, when I want to convert them to the original matrix via col2im, it give me this error:
"To RESHAPE the number of elements must not change."
Can anybody help me please and tell me what is the problem?
채택된 답변
추가 답변 (1개)
Sean de Wolski
2012년 7월 16일
Because you are using a 'sliding' block with im2col the number of elements in r is much bigger than the number in R. Compare:
numel(R)
numel(r)
What you have works with 'distinct' blocks as you would expect:
R=rand(162,72);
r=im2col(R,[2 2],'distinct');
R1=col2im(r,[2 2],size(R),'distinct');
댓글 수: 5
Andrea
2012년 7월 16일
Ryan
2012년 7월 16일
Why do you need to re-compress down to the original image size and have it return differently than the original image?
Andrea
2012년 7월 17일
Image Analyst
2012년 7월 17일
That won't happen if you don't do that im2col/col2im stuff and use nlfilter instead.
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!