deskew icon indicating copy to clipboard operation
deskew copied to clipboard

deskew confidence?

Open DiTo97 opened this issue 2 years ago • 7 comments

Hi @sbrunner,

Is there a way to retrieve the deskew confidence?

It would make it much easier to avoid rotating the image when the confidence in the skew angle is low.

DiTo97 avatar Jun 05 '23 13:06 DiTo97

Good question,

Currently, there is nothing like it, but it will be a great improvement :-)

sbrunner avatar Jun 05 '23 13:06 sbrunner

Do you have any pointers on how such a confidence should be implemented?

I may imagine something like the rate of adherence of the maximum peak's frequency against that of all other peaks...

DiTo97 avatar Jun 05 '23 13:06 DiTo97

I guess a softmax on the freqs dictionary will do it for now, turning the number of occurrences into probabilities

DiTo97 avatar Jun 05 '23 14:06 DiTo97

Or an addition of the dist on the same angle? https://github.com/sbrunner/deskew/blob/master/deskew/init.py#L48

sbrunner avatar Jun 05 '23 14:06 sbrunner

Or an addition of the dist on the same angle? https://github.com/sbrunner/deskew/blob/master/deskew/init.py#L48

Do you mean summing the distances for each angle instead of summing ones as you do in the freqs array? Then, softmax?

What is the rationale behind summing distances and confidence, tho?

DiTo97 avatar Jun 05 '23 14:06 DiTo97

Yes, if the line concerned is long, it's more confident than if it's short, not?

sbrunner avatar Jun 05 '23 15:06 sbrunner

I just don't see how the $\rho$ parameters (the dists array) of the lines parameterized as $(\rho, \theta)$ in Hough space, or their magnitude (short or long), would relate to the detection confidence of the skew angle

DiTo97 avatar Jun 05 '23 15:06 DiTo97