How to check a pixel is within a range?
Show older comments
I have a image matrix DM (which pixel values are in range 0 to 12, i attached the values),
i want to create a matrix Aux from DM as follows
Aux pixels are set to the gray-level 255 before performing the process for any given direction. The value 255,white, is chosen since it identifies the gray-level of pixels certainly belonging to the background. During the ith inspection, only and all the pixels of DM with value in the range [i -2, i + 2] are copied onto Aux, where are assigned value 0. In fact, the pixels currently copied onto Aux were (tentatively) interpreted as vessel pixels during the construction of DM, and it is then reasonable to assign to themthe gray-level 0, black,which is definitely a value for foreground pixels.
Condition checking is we remark that for any i (i = 1,2, … , 12), i + 1and i + 2 are computed modulo 12; as for i -1and i - 2, if these values result to be ≤0 they are increased by 12, so as to avoid copying in Aux pixels with i = 0, which does not correspond to a valid direction for foreground pixels.
Can anyone help me to understand it ?
2 Comments
Walter Roberson
on 27 Jan 2016
When i = 10, then (i+2) mod 12 = 0, so do we need to avoid coying the 0, and we would copy 9, 10, 11? Or we would copy 9, 10, 11, 12?
When i = 11, then (i+2) mod 12 = 1, so the [i-2, i+2] mod 12 would be [9, 1] so does that mean that we should be copying 1, 2, 3, 4, 5, 6, 7, 8, 9, or does it mean we should be copying 9, 10, 11, 12, and 1, or 9, 10, 11, and 1 ?
Kalai S
on 27 Jan 2016
Accepted Answer
More Answers (0)
Categories
Find more on Image Quality in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!