Pixel location
in each mask
Image
\label{image-1}
Figure 4.7: Implementation of Prewitt operators using a 3 × 3
2–D mask
First, the gradient value at each pixel is conventionally given as
s5 = 1 . 1 1
1 1 1 1 1 1 1
. . .
2 . 2 . 2 (z7 + z8) + z9. − 2 . 2 (z1
+ z2) + z3.. + 2 2 2 (z3 + z6) + z9
− 2 2 (z1 + z4) + z7
= 1
8 (|z7 + z8 + 2z9 − z1 − z2
− 2z3| + |z3 + z6 +
2z9 − z1 − z4 − 2z7|)
,
(4.6)
where s5 is the pixel value at center location of the processed
image. We consider the cofficients 1/2 so as to ensure the pixel
values being into the range of the grayscale pixel value [0,
255].
0.5
0.5
Figure 4.8: Design of Prewitt operators using SC
Now, we implement this operator by using SC. It can be shown in
Fig.4.8 that the architecture of the
Prewitt operator in Stochastic domain. In this configuration,
Pini = zi/256 represents SN in unipolar form which encodes
the pixel value at location i, and Pout5 perform the
output value in the
same format of center pixel. We assume that Bini = 2Pini −
1, Bout5 = 2Pout5 − 1 being the bipolar
representation of pixel values at the input and the output,
respectively. Therefore, according to this
design, the output is given as
1
Bout5 = 8 (|Bin7 + Bin8 + 2Bin9
− Bin1 − Bin2 − Bin3 | +
|Bin3 + Bin6 + 2Bin9 − Bin1 −
Bin4 − 2Bin7 |)
(4.7)
(a) (b) (c) (d)
Figure 4.9: Simulation results of edge detection based on Prewitt
operator on (a) original image using: (b) conventional approach and
stochastic computing of lengths (c) 2048 bits and (d) 4096 bits
By combining (4.6),
(4.7) and the above assumptions, it
can be easily deduced as
s5 1
Pout5 = 512 − 2 (4.8)
Hence, it is similar to the result obtained in case of Roberts operator,
the gradient value at center pixel can be received by counting the
number of bit beging logic 1 at the output bit sequence.
It can be shown in Fig.4.9 and
Fig.4.6 that the Prewitt operator
provides an better result of edge detection compared that of the
Roberts operator in conventional approach. Meanwhile, it seems to
be converse in stochastic processing. This fact can be explained by the
inaccuracy in multi–stage SC circuit. Because it is evident to be seen
that the Prewitt operator require more stages than the
Robert operator, and when the signals pass more stages, their
PDFs becomes different from the expected ones (the uniformly distributed
form at the output is required). This issue will be studied as an
important problem of SC in the future.