Răsfoiți Sursa

update holder

Torsten Simon 2 ani în urmă
părinte
comite
8dbdf2dad1
1 a modificat fișierele cu 11 adăugiri și 11 ștergeri
  1. 11 11
      src/data-writer.py

+ 11 - 11
src/data-writer.py

@@ -104,19 +104,19 @@ class SolarMonitor:
         #height= 60
         #width=230
         #return image[top : (top + height) , left: (left + width)]
-        pt_A = [225, 390]
-        pt_B = [223, 432]
-        pt_C = [420, 426]
-        pt_D = [422, 384]
-        width_AD = np.sqrt(((pt_A[0] - pt_D[0]) ** 2) + ((pt_A[1] - pt_D[1]) ** 2))
-        width_BC = np.sqrt(((pt_B[0] - pt_C[0]) ** 2) + ((pt_B[1] - pt_C[1]) ** 2))
+        pt_TL = [280, 205]
+        pt_TR = [486, 205]
+        pt_BL = [280, 250]
+        pt_BR = [486, 250]
+        width_AD = np.sqrt(((pt_TL[0] - pt_TR[0]) ** 2) + ((pt_TL[1] - pt_TR[1]) ** 2))
+        width_BC = np.sqrt(((pt_BL[0] - pt_BR[0]) ** 2) + ((pt_BL[1] - pt_BR[1]) ** 2))
         maxWidth = max(int(width_AD), int(width_BC))
 
 
-        height_AB = np.sqrt(((pt_A[0] - pt_B[0]) ** 2) + ((pt_A[1] - pt_B[1]) ** 2))
-        height_CD = np.sqrt(((pt_C[0] - pt_D[0]) ** 2) + ((pt_C[1] - pt_D[1]) ** 2))
+        height_AB = np.sqrt(((pt_TL[0] - pt_BL[0]) ** 2) + ((pt_TL[1] - pt_BL[1]) ** 2))
+        height_CD = np.sqrt(((pt_BR[0] - pt_TR[0]) ** 2) + ((pt_BR[1] - pt_TR[1]) ** 2))
         maxHeight = max(int(height_AB), int(height_CD))
-        input_pts = np.float32([pt_A, pt_B, pt_C, pt_D])
+        input_pts = np.float32([pt_TL, pt_BL, pt_BR, pt_TR])
         output_pts = np.float32([[0, 0],
                         [0, maxHeight - 1],
                         [maxWidth - 1, maxHeight - 1],
@@ -134,7 +134,7 @@ class SolarMonitor:
         self.camera.awb_gains = (1.5, 2.0)
         self.camera.shutter_speed = 10000
         self.camera.iso = 800
-        self.camera.rotation = 180
+        self.camera.rotation = 0
 
     def capture(self): 
         from picamera.array import PiRGBArray
@@ -186,7 +186,7 @@ class SolarMonitor:
             print(results)
             if results:
                 self.writeData(results)
-                img = cv2.putText(img, str(results), (75, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.25, (255), 1, cv2.LINE_AA)
+                img = cv2.putText(img, str(results), (75, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.25, (255, 255, 255), 1, cv2.LINE_AA)
             cv2.imwrite(file + '_r.jpg', img, [cv2.IMWRITE_JPEG_QUALITY, 35])
             time.sleep(5)