I am implementing A No-Reference Perceptual Blur Metric paper.

Somewhere in the prep steps they mention the use of vertical Sobel filter for finding vertical edges.

The algorithm is summarized in Fig. 1. First we apply an edge detector (e.g. vertical Sobel filter) in order to find vertical edges in the image. We then scan each row of the image1.

I am using scipy.ndimage.sobel(y, axis=1) on Y component of the image as suggested in the paper. But to be honest I don't know how should I interpret this output to decide if there is an edge in this area or not.

Basic idea of the solution from the paper is summarised in this graph:

enter image description here

So I think I understand how to calculate the edge width using the algorithm but to be able to do that I need to know the location for the green dashed line. I think this is what Sobel filter gave them or interpreting the results of scipy.ndimage.sobel(y, axis=1) will give me.

How will I be able to identify the locations of green dashed lines from the output of scipy.ndimage.sobel(y, axis=1).

  • $\begingroup$ Welcome to SE.SP! I can't really see how they're getting the green "edge locations". But do you really need them? The algorithm just seems to need the start and end of the edges (the P2 and P2' locations), which seem straightforward to find. $\endgroup$
    – Peter K.
    Jun 20, 2022 at 2:02
  • $\begingroup$ Hello! I guess that would work. It would just increase the number of computations - for the section from the screenshot it would go from 4 to 10 since we would always have to consider edge is between minima and maxima. That would include calculating a lot of noise - like pixels 175 - 180 from a screenshot. Maybe we can introduce some thresholding? I did a lot of research on Sobel filter this weekend. Usually you calculate both dx and dy and take magnitude, threshold that and based on it you decide if it is an edge or not. Maybe I can do this. But anyway it will no longer be the paper solution. $\endgroup$ Jun 20, 2022 at 8:02
  • $\begingroup$ Or maybe it will be since paper aim at assessing blueness via width of the edge so how I arrive at the edge location is not relevant. $\endgroup$ Jun 20, 2022 at 8:04

1 Answer 1


You should follow their algorithm logic:

enter image description here

When they say if there's an edge in the pixel they mean, as they write:

enter image description here

That you apply any edge detector (Sobel, but you may use others) and apply the logic to mark edges.
Usually, in the case of Sobel, the magnitude of the derivative is used.
If it is higher than a threshold, the pixel is considered to be an edge.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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