hi, I'm trying to solve an enlarge image problem. I need to enlarge image 1.7*x and 1.3*y But I'm getting error as
Show older comments
Attempted to access (0.7,0.3); index must be a positive
integer or logical.
Error in Untitled (line 5)
B((1.7*i-1),(1.3*j-1))=A(i,j);
Here is my code
A=double(imread('image'));
for i=1:256
for j=1:256
B((1.7*i-1),(1.3*j-1))=A(i,j);
B((1.7*i),(1.3*j-1))=A(i,j);
B((1.7*i-1),(1.3*j))=A(i,j);
B((1.7*i),(1.3*j))=A(i,j);
end
end
imshow(uint8(B));
Accepted Answer
More Answers (1)
Image Analyst
on 14 Oct 2015
[rows, columns, numberOfColorChannel] = size(A);
newRows = 1.3 * rows;
newColumns = 1.7 * columns;
outputImage = imresize(A, [newRows, newColumns]);
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!