フィルターのクリア

I am trying enlarge an image using interpolation without using MATLAB commands, but my image isn't resizing properly.

1 回表示 (過去 30 日間)
This function interpolates the rows first and then the columns from the interpolated rows.
function [enl] = enlarge(image)
img = imread(image);
img = double(img);
[m,n] = size(img);
% enl = zeros(m,n);
for i = 1:1:m
for j = 1:2:n-1
enl(i,j+1) = (img(i,j)+img(i,j+1))/2;
end
end
for i = 1:2:m-1
for j = 1:1:n
enl(i+1,j) = (img(i,j)+img(i+1,j))/2;
end
end
imshow(enl)
imwrite(enl, 'enl.gif')
end
  2 件のコメント
Walter Roberson
Walter Roberson 2013 年 10 月 24 日
Please describe the difference between what you see and what you want.
Brady
Brady 2013 年 10 月 24 日
Thank you, I see what you mean. How can I make sure they include each other?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2013 年 10 月 24 日
You are interpolating in one direction, but then you are ignoring the results of that when you interpolate in the other direction. Both times you overwrite the matrix en1 with values computed solely from img.
  1 件のコメント
Brady
Brady 2013 年 10 月 24 日
Thank you, I see what you mean. How can I make sure they include each other?

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2013 年 10 月 24 日
Why not just imresize?

Dingbang Liang
Dingbang Liang 2018 年 4 月 30 日
i tried this one, but it doesnt work. error is saying unusage of the first column "image", how to solve it?
  1 件のコメント
Image Analyst
Image Analyst 2018 年 4 月 30 日
It doesn't say that. "unusage" is not even a word. Paste the actual error message, including the line of code and the line numbers and the actual error message, as well as your script. In other words, attach your script, and any image or data that needs to be read in by it, and paste back here the complete error message ( ALL the red text).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by