resizing an image not working.
Show older comments
Hello, I am trying to resize a color image by using alternate pixel values. What I am getting is a blue image with a few black dots.I changed it to gray but now I am getting a white image with black image with a few black dots. Can someone tell me how to do the color resize, what is wrong with my script please
Thank you
%read image
a =imread('beach.jpg');
a= rgb2gray(a);
[rows,columns] = size(a);
i = 1, j =1;
c=zeros(rows/2,columns/2);
for x = 1:2:rows
for y = 1:2:columns
c(i,j) = a(x,y);
j = j + 1;
end
i = i +1;
j = 1;
end
imshow(c);2 Comments
madhan ravi
on 21 Oct 2018
Edited: madhan ravi
on 21 Oct 2018
upload your .jpg file to test , you didn't attach the file
Image Analyst
on 21 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Read, Write, and Modify Image 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!