pogucam 0.1.7__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pogucam/buffers.py +24 -1
- pogucam/explore_u24_uni.py +40 -35
- {pogucam-0.1.7.dist-info → pogucam-0.1.8.dist-info}/METADATA +1 -1
- pogucam-0.1.8.dist-info/RECORD +9 -0
- pogucam-0.1.7.dist-info/RECORD +0 -9
- {pogucam-0.1.7.dist-info → pogucam-0.1.8.dist-info}/WHEEL +0 -0
- {pogucam-0.1.7.dist-info → pogucam-0.1.8.dist-info}/entry_points.txt +0 -0
pogucam/buffers.py
CHANGED
@@ -10,6 +10,9 @@ class FastAccumBuffer:
|
|
10
10
|
self.shape = shape
|
11
11
|
self._init_buffer()
|
12
12
|
self._last_retrieved_idx = -1 #???
|
13
|
+
self.previous_sum_frames = None
|
14
|
+
#self._saturated_pixel_count = 0
|
15
|
+
self._saturated_pixel_count = np.zeros(3, dtype=int)
|
13
16
|
|
14
17
|
def _init_buffer(self):
|
15
18
|
self.cube = np.empty((self.max_frames, *self.shape), dtype=np.uint8)
|
@@ -17,6 +20,9 @@ class FastAccumBuffer:
|
|
17
20
|
self.idx = 0
|
18
21
|
self.count = 0
|
19
22
|
self._last_retrieved_idx = -1 #???
|
23
|
+
self.previous_sum_frames = None
|
24
|
+
#self._saturated_pixel_count = 0
|
25
|
+
self._saturated_pixel_count = np.zeros(3, dtype=int)
|
20
26
|
|
21
27
|
def add(self, img: np.ndarray, info: dict):
|
22
28
|
"""
|
@@ -45,14 +51,31 @@ class FastAccumBuffer:
|
|
45
51
|
return False
|
46
52
|
return self.idx != self._last_retrieved_idx # ???
|
47
53
|
|
54
|
+
def get_previous_sum_frames(self):
|
55
|
+
#print("i... prev buffers")
|
56
|
+
return self.previous_sum_frames
|
57
|
+
|
48
58
|
def get_sum_frames(self):
|
49
59
|
if self.count == 0:
|
60
|
+
self._saturated_pixel_count = 0
|
50
61
|
return None
|
51
62
|
#print("!... SUM")
|
52
63
|
summed = np.sum(self.cube[:self.count].astype(np.uint16), axis=0)
|
64
|
+
saturated_mask = summed > 255#
|
65
|
+
#Count saturation per channel
|
66
|
+
self._saturated_pixel_count = np.array([
|
67
|
+
np.count_nonzero(saturated_mask[:, :, c]) for c in range(3)
|
68
|
+
])
|
69
|
+
#self._saturated_pixel_count = np.count_nonzero(saturated_mask)
|
53
70
|
np.clip(summed, 0, 255, out=summed)
|
54
71
|
self._last_retrieved_idx = self.idx # ???
|
55
|
-
|
72
|
+
#prev = self.previous_sum_frames
|
73
|
+
curr = summed.astype(np.uint8)
|
74
|
+
self.previous_sum_frames = curr
|
75
|
+
return curr# summed.astype(np.uint8)
|
76
|
+
|
77
|
+
def get_saturated_pixel_count(self):
|
78
|
+
return self._saturated_pixel_count
|
56
79
|
|
57
80
|
def get_max_frames(self):
|
58
81
|
return self.max_frames
|
pogucam/explore_u24_uni.py
CHANGED
@@ -467,8 +467,8 @@ class StreamWidget(QLabel):
|
|
467
467
|
self.SAVED_NOW = False # for overtext info
|
468
468
|
#
|
469
469
|
self.xtended = False # 2x local
|
470
|
-
self.flag_print = False # terminal \n
|
471
|
-
self.flag_print_over = True # overtext
|
470
|
+
self.flag_print = False # terminal \n OR \r "P"
|
471
|
+
self.flag_print_over = True # overtext "S-P"
|
472
472
|
self.flag_redcross = False
|
473
473
|
self.error = False
|
474
474
|
self.zoomme = 1
|
@@ -508,8 +508,8 @@ class StreamWidget(QLabel):
|
|
508
508
|
#self.accum_buffer_size = 0 #
|
509
509
|
#self.accum_count = 0 # actual number of img in buff
|
510
510
|
# -------------------------------------------------
|
511
|
-
self.level2_buffer = None
|
512
|
-
self.level2_buffer_max_size = 10
|
511
|
+
#self.level2_buffer = None
|
512
|
+
#self.level2_buffer_max_size = 10
|
513
513
|
|
514
514
|
# --------------------------------- I put it at the end so that it knows all attributes
|
515
515
|
self.update_image()
|
@@ -542,7 +542,7 @@ class StreamWidget(QLabel):
|
|
542
542
|
post_response = requests.post(url=self.post_addr, data=data )
|
543
543
|
else:
|
544
544
|
# --------------------------------------------------------- JUST LOCAL DEVICE ----------------
|
545
|
-
print("X... no remote IP defined - nothing sent", data)
|
545
|
+
#print("X... no remote IP defined - nothing sent", data)
|
546
546
|
#--------------------------- ------------------------------------ACUUMULATE LOCALY
|
547
547
|
if ('accumtxt' in data):
|
548
548
|
val = int(data['accumtxt']) # SIZE OF THE BUFFER
|
@@ -693,7 +693,7 @@ class StreamWidget(QLabel):
|
|
693
693
|
if action == "q": # quit
|
694
694
|
self.zoomme = 1
|
695
695
|
self.redcross = [0, 0]
|
696
|
-
self.l_gamma = 1
|
696
|
+
self.l_gamma = 1 # local is 1
|
697
697
|
self.l_rotate = 0
|
698
698
|
|
699
699
|
self.r_integrate = 0
|
@@ -859,14 +859,14 @@ class StreamWidget(QLabel):
|
|
859
859
|
# OVERTEXT
|
860
860
|
# --------------------------------------------------------------------------------
|
861
861
|
|
862
|
-
def
|
862
|
+
def overtext(self, blackbar=False):
|
863
863
|
"""
|
864
864
|
great font for small numbers
|
865
865
|
"""
|
866
866
|
#
|
867
867
|
#
|
868
868
|
#
|
869
|
-
if self.
|
869
|
+
if self.img is None:
|
870
870
|
return
|
871
871
|
RXT = f"XT:{self.r_xtend}" # CC LU ... for remote ok
|
872
872
|
ZOO = f"ZOO:{self.zoomme:3.1f}"
|
@@ -895,27 +895,28 @@ class StreamWidget(QLabel):
|
|
895
895
|
#
|
896
896
|
overtext = f"{self.frame_time} # {self.frame_num} # {self.l_frame_num:6d} # {RXT} . {ZOO} . {ROO} . {LGA} . {SAV} {FIT} . {BUF}. {LAPS}"
|
897
897
|
#
|
898
|
-
position = ( 0, self.
|
898
|
+
position = ( 0, self.img.shape[0]-1 ) # 480 on x-axis
|
899
899
|
#
|
900
900
|
|
901
901
|
if blackbar:
|
902
|
-
overlay = self.
|
902
|
+
overlay = self.img.copy()
|
903
903
|
if self.resolution == "1920x1080":
|
904
904
|
shade_height = 20
|
905
905
|
else:
|
906
906
|
shade_height = 10
|
907
|
-
height, width = self.
|
907
|
+
height, width = self.img.shape[:2]
|
908
908
|
cv2.rectangle(overlay, (0, height - shade_height), (width, height), (0, 0, 0), -1)
|
909
909
|
alpha = 0.5
|
910
910
|
#alpha = 0.
|
911
|
-
cv2.addWeighted(overlay, alpha, self.frame, 1 - alpha, 0, self.frame)
|
911
|
+
#cv2.addWeighted(overlay, alpha, self.frame, 1 - alpha, 0, self.frame)
|
912
|
+
cv2.addWeighted(overlay, alpha, self.img, 1 - alpha, 0, self.img)
|
912
913
|
#
|
913
914
|
font = "di"
|
914
915
|
if self.resolution == "1920x1080":
|
915
916
|
font = "di2"
|
916
917
|
self.img = iprint(self.img, str(overtext), font=font, position=position,color_rgb=(0,255,0) )
|
917
918
|
if self.SAVED_NOW:
|
918
|
-
position = ( self.
|
919
|
+
position = ( self.img.shape[1] - 20, self.img.shape[0]-1 ) # 480 on x-axis
|
919
920
|
self.img = iprint(self.img, f"SAVE", font=font, position=position,color_rgb=(0,0,255) ) # bgr
|
920
921
|
|
921
922
|
#self.img = iprint(self.img, str(overtext), font="p7", position=position,color_rgb=(0,255,0) )
|
@@ -1327,7 +1328,7 @@ class StreamWidget(QLabel):
|
|
1327
1328
|
print("X.... Timeouted on URLOPEN", end="\n")
|
1328
1329
|
if nopass:
|
1329
1330
|
self.which_error = f"{self.which_error} / NOPASS" # no password file
|
1330
|
-
print( f"{str(dt.datetime.now() )[:-4]}
|
1331
|
+
print( f"{str(dt.datetime.now() )[:-4]}....", end="\r")
|
1331
1332
|
|
1332
1333
|
return stream
|
1333
1334
|
|
@@ -1480,7 +1481,7 @@ class StreamWidget(QLabel):
|
|
1480
1481
|
self.frame_time = self.l_frame_time.strftime("%H:%M:%S.%f")[:-4]
|
1481
1482
|
if not ret:
|
1482
1483
|
return False
|
1483
|
-
print(f"
|
1484
|
+
print(f" ... {self.frame_time} ; resolution /{self.frame.shape}/ .... ", end="")
|
1484
1485
|
|
1485
1486
|
avg = self.frame # once per Nx it is AVG
|
1486
1487
|
self.img = avg # normally frame. but sometimes avg == really averaged img!
|
@@ -1641,11 +1642,10 @@ class StreamWidget(QLabel):
|
|
1641
1642
|
|
1642
1643
|
|
1643
1644
|
# Final transformations before SAVE, you save zoomed------------------TRANNS OR NOT TRANS
|
1645
|
+
# TRANS Before save
|
1644
1646
|
if self.saving_transformed_image:
|
1645
1647
|
self.img = self.final_transformations( self.img )
|
1646
|
-
|
1647
|
-
self.overttext() #
|
1648
|
-
self.SAVED_NOW = False # this is for overtext RED save
|
1648
|
+
#self.SAVED_NOW = False # this is for overtext RED save # maybe I dont need it
|
1649
1649
|
|
1650
1650
|
# SAVING organization HERE
|
1651
1651
|
# SAVING organization HERE
|
@@ -1654,9 +1654,9 @@ class StreamWidget(QLabel):
|
|
1654
1654
|
# SAVING organization HERE
|
1655
1655
|
# SAVING organization HERE
|
1656
1656
|
|
1657
|
-
if self.level2_buffer is None:
|
1658
|
-
|
1659
|
-
|
1657
|
+
#if self.level2_buffer is None:
|
1658
|
+
# self.level2_buffer = buffers.AccumBuffer(self.img)
|
1659
|
+
# self.level2_buffer.define_accum_buffer( self.level2_buffer_max_size ) # ???
|
1660
1660
|
|
1661
1661
|
|
1662
1662
|
# DEFINE BUFFER, if not yet / if overtext is before, i have blurred timemarks
|
@@ -1667,11 +1667,20 @@ class StreamWidget(QLabel):
|
|
1667
1667
|
|
1668
1668
|
# showing or NOT the average image
|
1669
1669
|
if self.l_show_accum and (len(self.FABuffer) > 1):# and (len(self.accum_buffer) > 1):
|
1670
|
-
rimg =
|
1670
|
+
rimg = None
|
1671
|
+
if self.FABuffer.new_sum_available():
|
1672
|
+
rimg = self.FABuffer.get_sum_frames()#_mean_accum_buffer()
|
1673
|
+
#print("\n new", type(rimg))
|
1674
|
+
print(f"SATURATED: {self.FABuffer.get_saturated_pixel_count()}", end="")
|
1675
|
+
else:
|
1676
|
+
rimg = self.FABuffer.get_previous_sum_frames()#_mean_accum_buffer()
|
1677
|
+
#print("\n----pre", type(rimg))
|
1671
1678
|
if rimg is not None:
|
1672
1679
|
self.img = rimg
|
1673
|
-
self.
|
1680
|
+
#### self.overtext(blackbar=True) # applies on img
|
1674
1681
|
|
1682
|
+
if self.flag_print_over:
|
1683
|
+
self.overtext(blackbar=True) #
|
1675
1684
|
|
1676
1685
|
|
1677
1686
|
# # -- LAPS 1s 10s 60s but also accumulated local frames
|
@@ -1701,7 +1710,7 @@ class StreamWidget(QLabel):
|
|
1701
1710
|
# self.saving_laps_last_save = now
|
1702
1711
|
# self.save_img( time_tag=self.frame_time , savingjpg=False) #
|
1703
1712
|
|
1704
|
-
# ---- just save once
|
1713
|
+
# ---- just save once -------------------- ************ "s" ***********
|
1705
1714
|
if self.saving_once:
|
1706
1715
|
# jpg and NO AVG
|
1707
1716
|
if (len(self.FABuffer) < 2) and (not self.l_show_accum) and (not self.saving_fits_only):
|
@@ -1838,21 +1847,12 @@ class StreamWidget(QLabel):
|
|
1838
1847
|
|
1839
1848
|
|
1840
1849
|
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
1850
|
# ------------------------------------- -------------------- TRANNS OR NOT TRANS
|
1851
1851
|
if not self.saving_transformed_image:
|
1852
1852
|
self.img = self.final_transformations( self.img )
|
1853
1853
|
if self.flag_print_over:
|
1854
|
-
self.
|
1855
|
-
self.SAVED_NOW = False # this is for overtext RED save
|
1854
|
+
self.overtext(blackbar=True)
|
1855
|
+
#self.SAVED_NOW = False # this is for overtext RED save
|
1856
1856
|
|
1857
1857
|
#
|
1858
1858
|
else:# --- NO IMAGE CREATED ------------------------------- ... make the image gray ...
|
@@ -1861,6 +1861,11 @@ class StreamWidget(QLabel):
|
|
1861
1861
|
self.img = cv2.cvtColor(self.img, cv2.COLOR_BGR2GRAY)
|
1862
1862
|
self.img = cv2.cvtColor(self.img, cv2.COLOR_GRAY2BGR) #I want to keep 3 channels
|
1863
1863
|
self.use_frame(stripes=True)# img = self.frame
|
1864
|
+
|
1865
|
+
if self.flag_print_over:
|
1866
|
+
#self.overtext(blackbar=True)
|
1867
|
+
self.SAVED_NOW = False # this is for overtext RED save
|
1868
|
+
|
1864
1869
|
#=============================== --------------------- =================== UPDATE/SHOW
|
1865
1870
|
#=============================== --------------------- =================== UPDATE/SHOW
|
1866
1871
|
#=============================== --------------------- =================== UPDATE/SHOW
|
@@ -0,0 +1,9 @@
|
|
1
|
+
pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
|
2
|
+
pogucam/buffers.py,sha256=9nW9W8z3wjaLcfFrZqmsnsowxQOWXTweOuHVjwWWIn8,6368
|
3
|
+
pogucam/explore_u24_uni.py,sha256=1_P7_5IYgxIKcTAh5l8FtXXndN162KS59Qlb9m7TQmM,110637
|
4
|
+
pogucam/installation.md,sha256=8qspiLlYjEBx5CedRfBU7Mm0A2pz0lfAnaupZyBm5Eo,128
|
5
|
+
pogucam/text_write.py,sha256=hyRyA1M5z-pda963T-k0i8fvvAlv1p3YBTZtYNdOeoE,19304
|
6
|
+
pogucam-0.1.8.dist-info/METADATA,sha256=Rdr2jXmn_yWxnwj0YagSp4UFtZanb4JMXu_w0SNVnUM,466
|
7
|
+
pogucam-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
+
pogucam-0.1.8.dist-info/entry_points.txt,sha256=-97N0LsXIR8h0rJMzIMuNeNwuY8LvPYPTqnXsuAnVsM,63
|
9
|
+
pogucam-0.1.8.dist-info/RECORD,,
|
pogucam-0.1.7.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
|
2
|
-
pogucam/buffers.py,sha256=DwEmQYej6CJ7KwXLhR_ulIC_tziQAKM2yFQoEXZ-ocA,5432
|
3
|
-
pogucam/explore_u24_uni.py,sha256=BHsS7pAtJKMr7EqlcERF2_MaP6ZZ1Lyy1xs1EMGF8-c,109954
|
4
|
-
pogucam/installation.md,sha256=8qspiLlYjEBx5CedRfBU7Mm0A2pz0lfAnaupZyBm5Eo,128
|
5
|
-
pogucam/text_write.py,sha256=hyRyA1M5z-pda963T-k0i8fvvAlv1p3YBTZtYNdOeoE,19304
|
6
|
-
pogucam-0.1.7.dist-info/METADATA,sha256=zTstNsYYV4-ctxOPP0aRm1RYxBbTkpuqvBAlN7c07ug,466
|
7
|
-
pogucam-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
-
pogucam-0.1.7.dist-info/entry_points.txt,sha256=-97N0LsXIR8h0rJMzIMuNeNwuY8LvPYPTqnXsuAnVsM,63
|
9
|
-
pogucam-0.1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|