@@ -665,11 +665,13 @@ def plot_lines(image, centerlines, measure_points, file_name, path_out):
665
665
plt .figure (figsize = (imgwidth / plot_dpi , 2 * (imgheight / plot_dpi )), dpi = plot_dpi )
666
666
#fig, (ax1, ax2) = plt.subplots(2)
667
667
plt .imshow (image )
668
+ linewidth = (imgheight / 1000 )* 5 # looks very variable depending on the image resolution whne set as a constant defaoult is 1.5
668
669
else : # adjust image size if it`s exceeding 30000 pixels to 30000
669
670
resized_height = imgheight * (30000 / imgwidth )
670
671
plt .figure (figsize = (30000 / plot_dpi , 2 * (resized_height / plot_dpi )), dpi = plot_dpi )
671
672
#fig, (ax1, ax2) = plt.subplots(2)
672
673
plt .imshow (image )
674
+ linewidth = (resized_height / 1000 )* 5 # looks very variable depending on the image resolution whne set as a constant defaoult is 1.5
673
675
674
676
675
677
# Plot the lines to the image
@@ -682,14 +684,14 @@ def plot_lines(image, centerlines, measure_points, file_name, path_out):
682
684
points = measure_points [i ]
683
685
684
686
xc ,yc = centerlines [i ].coords .xy
685
- plt .plot (xc ,yc ,'g' )
687
+ plt .plot (xc ,yc ,'g' , linewidth = linewidth )
686
688
687
689
xp , yp = points [0 ].coords .xy
688
690
xp1 , yp1 = points [1 ].coords .xy
689
- plt .plot ([xp , xp1 ], [yp , yp1 ], 'r' )
691
+ plt .plot ([xp , xp1 ], [yp , yp1 ], 'r' , linewidth = linewidth )
690
692
691
693
xc ,yc = centerlines [- 1 ].coords .xy
692
- plt .plot (xc ,yc ,'g' )
694
+ plt .plot (xc ,yc ,'g' , linewidth = linewidth )
693
695
#plt.show()
694
696
695
697
@@ -705,15 +707,15 @@ def plot_lines(image, centerlines, measure_points, file_name, path_out):
705
707
#print('loop', i)
706
708
707
709
xc ,yc = centerlines1 [i ].coords .xy
708
- plt .plot (xc ,yc ,color [l ])
710
+ plt .plot (xc ,yc ,color [l ], linewidth = linewidth )
709
711
710
712
points = measure_points1 [i ]
711
713
xp , yp = points [0 ].coords .xy
712
714
xp1 , yp1 = points [1 ].coords .xy
713
- plt .plot ([xp , xp1 ], [yp , yp1 ], 'r' )
715
+ plt .plot ([xp , xp1 ], [yp , yp1 ], 'r' , linewidth = linewidth )
714
716
715
717
xc ,yc = centerlines1 [- 1 ].coords .xy # To print the last point
716
- plt .plot (xc ,yc , color [l ])
718
+ plt .plot (xc ,yc , color [l ], linewidth = linewidth )
717
719
#plt.show()
718
720
719
721
plt .savefig (os .path .join (export_path , f ), bbox_inches = 'tight' , pad_inches = 0 )
@@ -778,7 +780,7 @@ def write_to_pos(centerlines, measure_points, file_name, image_name, DPI, path_o
778
780
print ("Writing .pos file" )
779
781
write_run_info ("Writing .pos file" )
780
782
# Check if it is one or two parts in measure points
781
- # If two adjust naming. Nothink for the normal one and add "x" at the end for the second part
783
+ # If two adjust naming. Nothing for the normal one and add "x" at the end for the second part
782
784
#print('measure_point len', len(measure_points))
783
785
#print('measure_point', measure_points)
784
786
# Prepare date, time
@@ -943,7 +945,7 @@ class InferenceConfig(configCrack.__class__):
943
945
# DETECTION
944
946
else :
945
947
print ("Starting inference mode" )
946
- # Check compulsary argument and print which are missing
948
+ # Check compulsory argument and print which are missing
947
949
print ('Checking compulsory arguments' )
948
950
if args .input == None :
949
951
print ("Compulsory argument --input is missing. Specify the path to image file of folder" )
@@ -985,7 +987,7 @@ class InferenceConfig(configCrack.__class__):
985
987
json_list = []
986
988
for f in os .listdir (path_out ):
987
989
if f .endswith ('.json' ):
988
- json_name = os .path .splitext (f )[0 ]
990
+ # json_name = os.path.splitext(f)[0]
989
991
json_name = f .replace ('.json' , '' )
990
992
json_list .append (json_name )
991
993
@@ -1000,7 +1002,7 @@ class InferenceConfig(configCrack.__class__):
1000
1002
input_list = os .listdir (input )
1001
1003
input_path = input
1002
1004
else :
1003
- print ("Image argument is neither valid file nor directory" )
1005
+ print ("Image argument is neither valid file nor directory" ) # input or image?
1004
1006
write_run_info ("Image argument is neither valid file nor directory" )
1005
1007
#print("got until here", input_list, input_path)
1006
1008
@@ -1094,7 +1096,7 @@ class InferenceConfig(configCrack.__class__):
1094
1096
write_run_info ("clean_up_mask cracks done" )
1095
1097
print ("clean_up_mask cracks done" )
1096
1098
1097
- write_to_json (image_name = f ,cutting_point = cutting_point , run_ID = run_ID ,
1099
+ write_to_json (image_name = f , cutting_point = cutting_point , run_ID = run_ID ,
1098
1100
path_out = path_out , centerlines_rings = centerlines_rings ,
1099
1101
clean_contours_rings = clean_contours_rings ,
1100
1102
clean_contours_cracks = clean_contours_cracks )
0 commit comments