# Judge the angle when the number of rows and columns is fixed

**URL:** <https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504>\
**Category:** Python\
**Created:** [October 10, 2022, 8:34am UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504 "2022-10-10T08:34:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![soso\_zys](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@soso\_zys](https://forum.opencv.org/u/soso_zys)\
**Post date:** [October 10, 2022, 8:34am UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504/1 "2022-10-10T08:34:00Z")

</div>

Hi, I am trying to judge the angle when the number of rows and columns is fixed. The angle is within the range of 0,90,180,270.  
This is the test picture:  
 ![test](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/9/9d6ea668d6e00b67403a846a0af3cf111afbb117.jpeg)  
thanks!

---

<div class="post-metadata">

**Author:** ![matti.vuori](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@matti.vuori](https://forum.opencv.org/u/matti.vuori)\
**Post date:** [October 10, 2022, 9:58am UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504/2 "2022-10-10T09:58:08Z")

</div>

Text recognition done horizontally is an old thing. You could rotate the image into those angles and try to recognize the numbers. The angle is where you get most hits.

---

<div class="post-metadata">

**Author:** ![soso\_zys](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@soso\_zys](https://forum.opencv.org/u/soso_zys)\
**Post date:** [October 11, 2022, 1:09am UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504/3 "2022-10-11T01:09:26Z")

</div>

Thanks for your suggestion.It could get the angle.But I still try to find some methods that can only use image processing instead of text recognition.Are there other approaches that could be used?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 11, 2022, 12:03pm UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504/4 "2022-10-11T12:03:33Z")

</div>

logically impossible.

text has no inherent low level features that allow you to tell which way is up. you have to recognize individual glyphs to know, and when you do that, that is already rudimentary OCR.

_at best_, you could tell if text is sideways, assuming that glyphs in their proper orientation are _tall_ rather than _wide_. you could _not_ tell if text was upside down from that.

---

<div class="post-metadata">

**Author:** ![soso\_zys](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@soso\_zys](https://forum.opencv.org/u/soso_zys)\
**Post date:** [October 12, 2022, 1:24am UTC](https://forum.opencv.org/t/judge-the-angle-when-the-number-of-rows-and-columns-is-fixed/10504/5 "2022-10-12T01:24:01Z")

</div>

You’re right. I’m sorry that I didn’t express this clearly.

Some information that I have not described clearly include:

1. The image has 3 rows and 6 columns
2. The last row has 1 column

I’m trying to use projection method to judge the angle based on these information.  
this is what I get:  
 ![hProjection2](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/f/f0d7242c96894d2bcf0160ead243d762508714c8.jpeg)  
 ![vProjection](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/d/d83498ae7c88e724e6cb421b10defea113b28054.jpeg)

I’m trying to do the next analysis. Is there some idea?
