Reducing size of image

Well I want to write a function reducesize(imagematrix, amount) that returns a new image that is reduced in size by the given amount. In particular, it reduces the size of an image by taking only pixels every ‘amount’ pixels apart. For example, if amount=3 then the image will be one third as high and one third as wide. Can you help me?

2 commentaires

Rik
Rik le 20 Nov 2020
Why did you remove all you questions? That is extremely rude.
Rena Berman
Rena Berman le 15 Jan 2021
(Answers Dev) Restored edit

Connectez-vous pour commenter.

Réponses (1)

KALYAN ACHARJYA
KALYAN ACHARJYA le 15 Oct 2018
Modifié(e) : KALYAN ACHARJYA le 15 Oct 2018

0 votes

function reduced_image=reducesize(imagematrix,amount)
[rows colm]=size(imagematrix);
x=randi(rows);
y=round(amount/x);
reduced_image=imresize(imagematrix,[x y])
end

Catégories

Question posée :

le 15 Oct 2018

Modifié(e) :

le 15 Jan 2021

Community Treasure Hunt

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

Start Hunting!

Translated by