Matlab imshow function border tight not working under small size image
이전 댓글 표시
By default, when imshow displays an image in a figure, it surrounds the image with a gray border. You can change this default and suppress the border using the 'border' parameter.
But, I recently found that border tight will stop working when the matrix is smaller than approximately 125-130 thresholding
Please try these two Matlab command and you will see the difference
imshow(rand(130,130),'Border','tight') % works! no grey boundary at all
imshow(rand(120,120),'Border','tight') % not working! grey boundary appears

I carefully read the doc and found the sentence below When set to ‘tight', the figure window does not include any space around the image in the figure. If the image is very small or if the figure contains other objects besides an image and its axes, imshow might use a border regardless of how this parameter is set.
That is very disappointing. What I am trying to do is to capture image after imshow and store it to the matrix using command like
f=getframe(gcf);
resultMatr=f.cdata;
so any border will influence the result.
Any solution for that?
답변 (1개)
Jihang Wang
2015년 3월 4일
편집: Jihang Wang
2015년 3월 4일
댓글 수: 2
Cg Gc
2019년 1월 9일
I know this is a little odd, but can you provide an example of how to use your function? I am trying to group a few images together and I really would like to remove the border, but I keep receiving an error message because I don't have enough input arguments. I am not sure what that means. An example would be lovely.
Thank you.
Walter Roberson
2019년 1월 9일
Example of use:
img = imread('cameraman.tif');
outsize = 100;
outputimg = removeBorder(img, outsize);
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!