Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Image Processing Help

Subject: Image Processing Help

From: Abed

Date: 1 Dec, 2010 12:17:05

Message: 1 of 4

Hello guys, I am new to Matlab and I am working on a primary project for school about Data Compression, so the first thing we learned about is Huffman Encoding, so now I have to do it on Matlab, I know the functions but I need the probability distribution, what I want to do is to read an image and convert to black and white ( which I successfully did it :) ) and now I want to see the repeated values in the matrix for example, let's say that I have now 100 times repeated "135" and a 100 "0" and so on, and finally i can find the probability of the pixels values.

regards,
Abed

Subject: Image Processing Help

From: Star lite

Date: 1 Dec, 2010 12:41:06

Message: 2 of 4

Suppose you have an array
a =

     1 1 2 3 4 4 4 5 6 6

a1=unique(a)

a1 =

     1 2 3 4 5 6

Now do the follwing
for i = 1:length(a1)
length(find(a==a1(i)))
end

hope it helps

"Abed " <abedzaben@gmail.com> wrote in message <id5ec0$e8e$1@fred.mathworks.com>...
> Hello guys, I am new to Matlab and I am working on a primary project for school about Data Compression, so the first thing we learned about is Huffman Encoding, so now I have to do it on Matlab, I know the functions but I need the probability distribution, what I want to do is to read an image and convert to black and white ( which I successfully did it :) ) and now I want to see the repeated values in the matrix for example, let's say that I have now 100 times repeated "135" and a 100 "0" and so on, and finally i can find the probability of the pixels values.
>
> regards,
> Abed

Subject: Image Processing Help

From: Abed

Date: 1 Dec, 2010 13:27:05

Message: 3 of 4

Thank you, that's what I really wanted, now I just want to save the result for each pixel value and its corresponding occurrence.

Thank you :)

Subject: Image Processing Help

From: Sean de

Date: 1 Dec, 2010 14:31:20

Message: 4 of 4

"Abed " <abedzaben@gmail.com> wrote in message <id5if9$b3h$1@fred.mathworks.com>...
> Thank you, that's what I really wanted, now I just want to save the result for each pixel value and its corresponding occurrence.
>
> Thank you :)

What you really want is histc
doc histc

Tags for this Thread

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.

Contact us