Image Processing, Pixel decomposition
1 次查看(过去 30 天)
显示 更早的评论
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.
3 个评论
Jan
2011-10-12
@Dinesh: "Post what you have done so far" does *not* mean, that you send me the code by email. I thought the message on my personal profile could stop users from sending their question by email.
采纳的回答
Walter Roberson
2011-10-11
The above algorithm is incorrect. Consider bn,0 = [Pn/(2*0] mod 2, which can either be undefined (if Pn was 0) or infinity (otherwise). undefined mod 2 is undefined, and infinity mod 2 is undefined.
0 个评论
更多回答(1 个)
Walter Roberson
2011-10-11
Dinesh sent me a copy of the original question. I have edited it to use a more standard MATLAB notation. The question used subscripts to indicate distinguished variables rather than indexing; I will use _n to indicate a subscript of n, but will use standard MATLAB () notation for indexing. The original question confuses indexing and subscripting, so we end up with a bit of a mix. :(
Bit Decomposition:
Denote the numbers of rows and columns in an original image as N_1 and N_2 ,
the total number of pixels as N which is (N=N_1*N_2) , and
the gray pixel-values as P(n) which are elements of [0,255], n=1,2…,N.
Here, we assume both and N_1 and N_2 are multiples of 8.
Each P(n) can be represented by 8 bits, b(n,7) , b(n,6) , ..., b(n,0), where
(1) b(n,t)= fix(P(n)/2^t) mod 2, t=0,1,...,7.
In other words
(2) P(n)= sum( b(n,0:7).*2^(0:7) )
We call b(n,7) , b(n,6) ,..., b(n,3), the MSB, and b(n,2_, b(n,1) ,..., b(n,0), the LSB. Then, collect the MSB of each pixel to form an MSB set that includes 5 bits.
Notes:
The use of fix() is my interpretation. The original paper used [] which is not the notation for floor (that would have bars at the bottom but not at the top) and which is not the notation for ceiling (that would have bars at the top but not at the bottom.) None-the less it is clear that the integer part must be taken, but the paper does not in itself define or mention which integer part, round to -infinity or round to infinity. I thus interpret that round towards zero, fix() is intended.
The instructions say to collect the MSB of each pixel to form an MSB bit set that includes 5 bits, but does not say anything about output format. It also specifically says "set", and by definition a set is unordered and without duplicates. There being only two distinct pixel values, the bit set cannot exceed size 2. The collection must be done over each pixel, but the set is not given as being per-pixel.
This suggests that the proper answer to the question as stated is simply the empty set if N is 0, the set {0} if all of the 5 MSB of the pixels are value 0, the set {1} if all of the 5 MSB pixels are value 1, and the set {0,1} otherwise. Not per-pixel, just 1 set total.
There is nothing in the question that mandates using the bit decomposition strategy described, as long as the output set is produced.
Must have been an engineer who wrote the question ;-) A mathematician would know the difference between a set and a sequence!
3 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!