ehsanhon commited on
Commit
f20e34e
·
verified ·
1 Parent(s): c8b3940

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -202,13 +202,6 @@ def calculate_and_display_angles(image1, return_angles=False):
202
  image = image1#cv2.imread(image_path)
203
  image_rgb = image1 #cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
204
 
205
- # Decode image from memory
206
- data = np.frombuffer(image1.getvalue(), dtype=np.uint8)
207
- image = cv2.imdecode(data, cv2.IMREAD_COLOR)
208
-
209
- # Get image dimensions
210
- height, width, channels = 200 , 300 , 50#image.shape
211
-
212
  # Get pose landmarks
213
  results = pose.process(image_rgb)
214
 
@@ -228,8 +221,9 @@ def calculate_and_display_angles(image1, return_angles=False):
228
  # Display the angle values at corresponding locations
229
  def overlay_angle(angle, location, color=(0, 255, 0)):
230
  # Coordinates are normalized, scale them to the image size
231
- x = int(location[0] * width)#image.shape[1])
232
- y = int(location[1] * height)#image.shape[0])
 
233
  cv2.putText(image, f'{angle:.2f}', (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.3, color, 1)
234
 
235
  # Overlay angles on the image
 
202
  image = image1#cv2.imread(image_path)
203
  image_rgb = image1 #cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
204
 
 
 
 
 
 
 
 
205
  # Get pose landmarks
206
  results = pose.process(image_rgb)
207
 
 
221
  # Display the angle values at corresponding locations
222
  def overlay_angle(angle, location, color=(0, 255, 0)):
223
  # Coordinates are normalized, scale them to the image size
224
+ x = int(location[0] )#* image.shape[1])
225
+ y = int(location[1] )#* image.shape[0])
226
+
227
  cv2.putText(image, f'{angle:.2f}', (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.3, color, 1)
228
 
229
  # Overlay angles on the image