-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsparks_data.py
36 lines (30 loc) · 1.39 KB
/
sparks_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import prueba_image_spark
import cv2
import sparks_analysis
path = '/media/leandro/Volumen1TB/Lean/Analizador_imagenes_calcio/Sp/Imagenes_confocal/sp_para entrenar/'
# path = 'C:/Users/Leand/OneDrive/Documentos/Lean/Analizador_imagenes_calcio/Imagenes_confocal/Rata/C071112/'
photo_name = '2arf001'
image = prueba_image_spark.Read_image(path, photo_name)
imcrop = prueba_image_spark.Image_cropping(image)
contours, img_processed, original = prueba_image_spark.Image_processing(imcrop)
list_img_col, list_img_row, x_position, y_position, width, high = prueba_image_spark.Image_analysis(contours, img_processed, original)
# Detect each event and give it a category
def write_points(event, x_position, y_position, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
img_points.append(flags)
if event == cv2.EVENT_RBUTTONDOWN:
img_points.append(flags)
winname="TAG :: Press ESC to exit; left Click to TAG 1; right Click to TAG 2"
cv2.namedWindow(winname)
img_points = []
cv2.setMouseCallback(winname,write_points)
while True:
cv2.imshow(winname,img_processed)
cv2.imshow('original',image)
if cv2.waitKey(20) & 0xFF ==27:
break
cv2.destroyAllWindows()
# Take the processing data to analyze each spark and extract parameters
parameters = sparks_analysis.analysis_process (list_img_col, list_img_row,x_position,y_position,width,high)
print(parameters)
#parameters.to_csv()