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
parser.add_argument('--file', help='if you only want one file processed, add this argment followed by the file')
12
+
parser.add_argument('--color', help='If you want to specify the color of the scalebar, use this', default=None)
13
+
parser.add_argument('--xybin', help='Default is to bin the image on xy by 2, if you want to change this, use this flag + integer', default=2, type=int)
14
+
parser.add_argument('--textoff', help='if you dont want the text, use this followed by any integer', default=0)
15
+
parser.add_argument('--quality', help='Default jpg quality is 80%, use this flag follwed by an integer to change this',default=80, type=int)
#choose color - this can be given as black, white or grey in the function
68
79
ifcolor=='black':
69
80
pixvalue=0
70
-
textcolor=(0,0,0)
81
+
textcolor='black'
71
82
elifcolor=='white':
72
83
pixvalue=255
73
-
textcolor=(255,255,255)
84
+
textcolor='white'
74
85
elifcolor=='grey':
75
86
pixvalue=150
76
-
textcolor=(150,150,150)
87
+
textcolor='grey'
77
88
else: #default is black, unless it is a particularly dark area - if the mean pixvalue of the scale bar region is significantly less than the overall image mean, the scalebar will be white
font=cv.FONT_HERSHEY_DUPLEX#can change to any opencv fonts, they're all quite rubbish
92
-
fontsize=image.shape[0]/1200#this fontsize looks good to me
106
+
107
+
ifpixelUnit!='nm':
108
+
#print('yes')
109
+
Utext=str(n)+u'\u00b5'+'m'
110
+
text=str(n)+'microns'
111
+
else:
112
+
#print('no')
93
113
text='{}{}'.format(n,dm3_input['pixelUnit'][0])
94
-
cv.putText(new_arr, text, (scalebar_x+3,scalebar_y-int(height*3/5)),font,fontsize, color=textcolor, thickness=int(fontsize*2.5))#can change thickness, color and position here
0 commit comments