Pixel decomposition

1 view (last 30 days)
Dinesh Ranganathan
Dinesh Ranganathan on 9 Oct 2011
Sir, I`m new to matlab and doing a basic work on decomposition of pixels with the criteria as follows:
Denote the numbers of rows and columns in an original image as n1 and n2, the total number of pixels as n=n1*n2, and the gray pixel-values as Pn belongs (0.255), n=1,2,3etc . assume both n1 and n2 are multiples of 8. Each pn can be represented by 8 bits, , where B(n,t)={Pn/2^t} (1)In other words Pn=(B(n,t). 2t)
We call B(n,7),B(n,6)...B(n,3)the MSB, and B(n,2),B(n,1)the LSB. Then, collect the MSB of each pixel to form an MSB set that includes 5N bits.
Kindly formulate me the code for this computation

Accepted Answer

Walter Roberson
Walter Roberson on 9 Oct 2011
What output representation do you want?
You have
B(n,t)={Pn/2^t}
but that is not going to be a single bit except in the special case where Pn == 2^t exactly. Suppose for example that Pn is 3 and t is 1, then B(n,t) would be 3/2^1 which would be 1 1/2 .
Notice too that when defining MSB and LSB you go down to B(n,1) but not to B(n,0) . Thus you are always dividing by at least 2^1 and therefor have no mechanism to get at the bit with the least value (the one that contributes 0 or 2^0 to Pn)
Your notation
Pn=(B(n,t). 2t)
does not make any sense to me. Pn = Sum(B(n,t) * 2^t, t=1..8) would make more sense to me.
If my guess is correct about your desired output representation, then my suspicion is that the desired output can be produced in one expression. On the other hand, I suspect that your talk about B(n,t) is an indication of how you are being directed to code this.
  1 Comment
Dinesh Ranganathan
Dinesh Ranganathan on 11 Oct 2011
Hi sir,
I'm in need to fulfil the following critera , so pls help me in coding this
Bit Decomposition:
Denote the numbers of rows and columns in an original image as N1 and N2 ,
the total number of pixels as N which is (N=N1*N2) , and
the gray pixel-values as Pn ϵ [0,255], n=1,2…,N.
Here, we assume both and N1 and N2are multiples of 8.
Each Pn can be represented by 8 bits, bn,7 , bn,6 ,…., b n,0, where
(1) bn,t= [Pn/2t] mod 2, t=0,1,…,7.
In other words
(2) Pn= ∑_(t=0)^7▒〖(bn,t.2t)
We call bn,7 , bn,6 ,…., b n,3, the MSB, and bn,2, bn,1 ,…., b n,0, the LSB. Then, collect the MSB of each pixel to form an MSB set that includes 5 bits.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 9 Oct 2011
I also had trouble figuring out what was wanted. I didn't know if the instructor simply wanted the lower 5 bits and/or upper 5 bits of the image, like this:
lower5bits = bitand(grayImage, uint8(32));
upper5bits = bitand(grayImage, uint8(256-32));
or something like that.
  2 Comments
Walter Roberson
Walter Roberson on 9 Oct 2011
I think it is the upper 5 bits being asked for, but extracted I think, or at least shifted down.
One thing to watch out for is that the description of the values does not preclude floating point storage of the Pn values.
Dinesh Ranganathan
Dinesh Ranganathan on 12 Oct 2011
Sir,
this link will give u the clear view of the paper that i hv chosen... please look after that and send me the desired program for that..
http://www.ci.shu.edu.cn/files/Reference%20Sharing%20Mechanism%20for%20Watermark%20Self-Embedding.pdf

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!