0
$\begingroup$

This is my first question on this site, complete noob. But here goes.

I have a positive Laplacian operator

[[0,1,0],
 [1,-4,1],
 [0,1,0]] 

Now this Laplacian operator is used to find the outward edges of an image , IIRC. The image which I have in binary format is this

[[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  1.  1.  0.  0.]
 [ 0.  0.  0.  0.  0.  1.  1.  1.  0.  0.]
 [ 0.  0.  0.  0.  1.  1.  1.  1.  0.  0.]
 [ 0.  0.  0.  1.  1.  1.  1.  1.  0.  0.]
 [ 0.  0.  1.  1.  1.  1.  1.  1.  0.  0.]
 [ 0.  1.  1.  1.  1.  1.  1.  1.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]]

Its hard to make out here, but the image represents some staircase type of image. I have a PY script which does the convolve and gives me back the following result of convolution :

[[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  1.  0.  1.  0.]
 [ 0.  0.  0.  0.  0.  1.  0.  0.  1.  0.]
 [ 0.  0.  0.  0.  1.  0.  0.  0.  1.  0.]
 [ 0.  0.  0.  1.  0.  0.  0.  0.  1.  0.]
 [ 0.  0.  1.  0.  0.  0.  0.  0.  1.  0.]
 [ 0.  1.  0.  0.  0.  0.  0.  0.  1.  0.]
 [ 1.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
 [ 0.  1.  1.  1.  1.  1.  1.  1.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]]

Drawing straight line through all 1s actually does give me the outward edge of the binary image.

However, the zero crossing algorithm has confused me . According to this link , the algorithm to detect zero crossing is:

Do the following for each pixel $I(u, v)$:

  1. Look at your four neighbors, left, right, up and down
  2. If they all have the same sign as you, then you are not a zero crossing
  3. Else, if you have the smallest absolute value compared to your neighbors with opposite sign, then you are a zero crossing

But here, the 0 and 1 have the same signs , right ? Both are positive. I am confused in this. If someone can take a small sample out of the result image, and mark some zero crossing for me, it will be clear to me.

Thank you in advance, it's a long post. I hope its clear though.

$\endgroup$
1
$\begingroup$

It was my mistake. My PY script was thresholded to output 1 if pixel value was above 0.5, and 0 if otherwise. Removing the threshold, I got the following result

`

[[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.],
 [ 0.  0.  0.  0.  0.  0.  2. -3.  1.  0.],
 [ 0.  0.  0.  0.  0.  2. -2. -1.  1.  0.],
 [ 0.  0.  0.  0.  2. -2.  0. -1.  1.  0.],
 [ 0.  0.  0.  2. -2.  0.  0. -1.  1.  0.],
 [ 0.  0.  2. -2.  0.  0.  0. -1.  1.  0.],
 [ 0.  2. -2.  0.  0.  0.  0. -1.  1.  0.],
 [ 1. -3. -1. -1. -1. -1. -1. -2.  1.  0.],
 [ 0.  1.  1.  1.  1.  1.  1.  1.  0.  0.],
 [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]]

`

Here I can find the transition between negative and positive pixels easily.

Damn you coding...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.