I'm working on image processing, and I have an image that has been DCT'd and quantized for 8 x 8 blocks of the 512 x 512 matrix, now I have to find how many quantizing levels that the image has. Do I need to take the top left pixel and place it in to an array and then place this on a graph calling hist
?
Asked
Active
Viewed 1,155 times
3

Matthew Simoneau
- 6,199
- 6
- 35
- 46

Stina
- 509
- 1
- 7
- 19
1 Answers
4
length(unique(x(:)))
, where x
is your image array. This is appropriate for grayscale images.

Oliver Charlesworth
- 267,707
- 33
- 569
- 680
-
Is x the 512 x 512 full image or an 8 x 8 block contained in it? Thank you – Stina Feb 23 '11 at 15:50
-
@Stina: It's whatever you want it to be! Your original question isn't very clear; are you trying to get the *overall* number of levels for the *overall* image, or something else? – Oliver Charlesworth Feb 23 '11 at 15:57
-
I appreciate I'm asking about an assignment but it is a subpart and the question is: "Estimate the required number of quantization levels for DCT coecients for different values of the quality factor". I think my vagueness in my question stems from the fact that I am unsure of what I am being asked – Stina Feb 23 '11 at 16:04