Thread Subject: NEED CODING???

Subject: NEED CODING???

From: rain h.

Date: 28 Sep, 2009 21:31:01

Message: 1 of 4

I need a coding to quantize an image uniformly into 8 levels and another one for resizing it with a bilinear interpolation without using imresize.
Thanks a million.

Subject: NEED CODING???

From: Sprinceana

Date: 29 Sep, 2009 12:19:03

Message: 2 of 4

To quantize an image use imhist function and obtain his histogram.


>>help imhist

An example:

>>img=imread('name_photo.jpg'); % img is a rgb image that you read
>>imshow(img) % display rgb image with imshow
>>img2=rgb2gray(img) % img2 is a gray level image
>>imhist(img2)

To resize an image simply:

>>help imresize

Subject: NEED CODING???

From: ImageAnalyst

Date: 29 Sep, 2009 13:03:32

Message: 3 of 4

On Sep 29, 8:19 am, "Sprinceana " <mihai...@yahoo.com> wrote:
> To resize an image simply:
> >>help imresize-

Yes, but reread his message - it says "without using imresize" for
some reason.

Subject: NEED CODING???

From: Sprinceana

Date: 29 Sep, 2009 15:40:19

Message: 4 of 4

If your image is 2D:

img = imread('name_photo.jpg') ; % 2d image(grayscale or binary)
size(img)

[c,r ] = size(img); % R?cup?ration des 2 dimensions de l'image

[ci,ri] = meshgrid(1:2:r,1:2:c); % mesh generation for interpolation

img = interp2(img,ci,ri); % interpolation of the pixels values with interp2

size(img)



If your image is 3D: (if your image is rgb use interp3)

img = imread('name_photo2.jpg'); % read 3d image (which is rgb)
size(img)
 
[c,r,p] = size(img); % get the 3 dimensions of image in variables c,r and p

[ci,ri,pi] = meshgrid(1:2:r,1:2:c,1:p); % mesh generation for interpolation

img = interp3(img,ci,ri,pi); % interpolation of pixel values with interp3

size(img)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
interp3 Sprinceana 29 Sep, 2009 11:44:05
interp2 Sprinceana 29 Sep, 2009 11:44:05
bilinear interp... Sprinceana 29 Sep, 2009 10:51:02
imhist Sprinceana 29 Sep, 2009 08:24:04
imresize Sprinceana 29 Sep, 2009 08:24:04
reference Sprinceana 29 Sep, 2009 08:24:04
doit4me John D'Errico 28 Sep, 2009 19:59:43
rssFeed for this Thread

Contact us at files@mathworks.com