You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
font_file
'/home/rohit/.local/share/fonts/Shobhika-Regular.otf'
font = pygame.freetype.Font(font_file,30)
font
Font('/home/rohit/.local/share/fonts/Shobhika-Regular.otf')
Got a surface of size 134X159 accordingly for word_text = "hello":-
mid_idx = wl//2
BS = self.baselinestate.get_sample()
curve = [BS'curve' for i in range(wl)]
curve[mid_idx] = -np.sum(curve) / (wl-1)
rots = [-int(math.degrees(math.atan(BS'diff'/(font.size/2)))) for i in range(wl)]
curve
[-1.75256073377731, -0.4381401834443275, 1.0953504586108187, -0.4381401834443275, -1.75256073377731]
rots
[-6, -3, 0, 3, 6]
The following code of updating rect.centerx is clear:-
bbs = []
rect = font.get_rect(word_text)
rect
<rect(0, 23, 67, 23)>
surf.get_rect().centerx
67
rect.centerx = surf.get_rect().centerx
rect
<rect(34, 23, 67, 23)>
It seems like (0,23) was the left bottom point WITH CO-ORDINATE SYSTM OF IMAGE X GOING RIGHT Y GOING DOWN, which got shifted to (34,23) i.e. centre(67) - rendered_word_text_width//2(i.e. 67//2 = 33) = 34
Now, the problem is in understanding the update of rect.centery:-
centery of rect is moved to 79 + 23 i.e 102, so the bottom point should be 102 + 23//2 = 113 but what we get is 91. Can you explain?
Also in function place_text: why is loc, which is the random choice of x and y coordinates from the collision-free location in the mask, reversed as loc[::-1] while updating bounding boxes bbs[i] = move_bb(bbs[i],loc[::-1]) ?
The text was updated successfully, but these errors were encountered:
@rohitsaluja22:
(1) the bottom point should be (center - h/2) = 102 - 23/2 = 91 -- which is what you get.
(2) Pygame surface is transposed wrt opencv / normal image conventions, hence, we need to reverse the coordinates.
Hey I am trying to understand function "def render_curved(self,font,word_text):" defined in text_utils.
I took a font "Shobhika" https://github.com/Sandhi-IITBombay/Shobhika
loaded it with the size of 30
Got a surface of size 134X159 accordingly for word_text = "hello":-
Got the following curve and rots as samples:-
The following code of updating rect.centerx is clear:-
It seems like (0,23) was the left bottom point WITH CO-ORDINATE SYSTM OF IMAGE X GOING RIGHT Y GOING DOWN, which got shifted to (34,23) i.e. centre(67) - rendered_word_text_width//2(i.e. 67//2 = 33) = 34
Now, the problem is in understanding the update of rect.centery:-
centery of rect is moved to 79 + 23 i.e 102, so the bottom point should be 102 + 23//2 = 113 but what we get is 91. Can you explain?
Also in function place_text: why is loc, which is the random choice of x and y coordinates from the collision-free location in the mask, reversed as loc[::-1] while updating bounding boxes bbs[i] = move_bb(bbs[i],loc[::-1]) ?
The text was updated successfully, but these errors were encountered: