Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,10 @@ from db import dropbox_upload_file
|
|
| 20 |
from pathlib import Path
|
| 21 |
from PreprocessingFoundation import rmv_text,rmv_dashedLines
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
#############################################################################################
|
| 25 |
|
| 26 |
'''push output to dropbox'''
|
|
@@ -679,7 +682,7 @@ def FillDictionary(green2,SimilarAreaDictionary,img,number,num1,num2,flag,finalC
|
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
-
def drawAllContours(green2,img,number,finalColorArray,num1,num2,flag):
|
| 683 |
# colors=[color,color1,color2,color3,color4,color5,color6,color7]
|
| 684 |
# img=np.array(img)
|
| 685 |
areasinImage=[]
|
|
@@ -895,11 +898,185 @@ def drawAllContours(green2,img,number,finalColorArray,num1,num2,flag):
|
|
| 895 |
return imgPerimeter1,image_new1,SimilarAreaDictionary , s
|
| 896 |
# drawAllContours(img,0,[],1.11,25579,'area') #,[190,47,250] ,[47,251,255] ,[80,240,15],[253,163,40]
|
| 897 |
# imgPerimeter1,image_new1,Dictionary=drawAllContours(img,220,[47,251,255],[251,163,47],1.105,27233.5,'area')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 898 |
|
| 899 |
|
| 900 |
-
def MainFunc(green2,img,dp,finalColorArray,number,num1,num2,flag):
|
| 901 |
|
| 902 |
-
imgPerimeter1,image_new1,Df2,s=drawAllContours(green2,img,number,finalColorArray,num1,num2,flag)
|
| 903 |
# x = path.split("/")
|
| 904 |
# x=x.pop()
|
| 905 |
Df2=Df2.T
|
|
@@ -920,7 +1097,8 @@ def MainFunc(green2,img,dp,finalColorArray,number,num1,num2,flag):
|
|
| 920 |
# display(Df2)
|
| 921 |
return Df2, imgPerimeter1,image_new1 ,s
|
| 922 |
|
| 923 |
-
def
|
|
|
|
| 924 |
print(type(img))
|
| 925 |
green2=allpreSteps(img)
|
| 926 |
|
|
@@ -936,30 +1114,30 @@ def PickColorContours(dp,img,radioButton,radioButton1, color,color1,color2,color
|
|
| 936 |
if radioButton=="Measure Full Image" :
|
| 937 |
|
| 938 |
if radioButton1=='Area':
|
| 939 |
-
imgPerimeter1,image_new1,df ,s =drawAllContours(green2,img,0,finalColorArray,num1,num2,'area')
|
| 940 |
return image_new1
|
| 941 |
else:
|
| 942 |
-
imgPerimeter1,image_new1,df ,s =drawAllContours(green2,img,0,finalColorArray,num1,num2,'perimeter')
|
| 943 |
return imgPerimeter1
|
| 944 |
else:
|
| 945 |
if radioButton1=='Area':
|
| 946 |
-
imgPerimeter1,image_new1,df ,s =drawAllContours(green2,img,220,finalColorArray,num1,num2,'area') #rgbValue
|
| 947 |
return image_new1
|
| 948 |
else:
|
| 949 |
-
imgPerimeter1,image_new1,df ,s =drawAllContours(green2,img,220,finalColorArray,num1,num2,'perimeter') #rgbValue
|
| 950 |
return imgPerimeter1
|
| 951 |
else:
|
| 952 |
if radioButton=="Measure Full Image":
|
| 953 |
if radioButton1=='Area':
|
| 954 |
-
Dictionary, imgPerimeter1,image_new1 ,s =MainFunc(green2,img,dp,finalColorArray,0,num1,num2,'area')
|
| 955 |
else:
|
| 956 |
-
Dictionary, imgPerimeter1,image_new1 ,s =MainFunc(green2,img,dp,finalColorArray,0,num1,num2,'perimeter')
|
| 957 |
|
| 958 |
else:
|
| 959 |
if radioButton1=='Area':
|
| 960 |
-
Dictionary, imgPerimeter1,image_new1,s =MainFunc(green2,img,dp,finalColorArray,220,num1,num2,'area')
|
| 961 |
else:
|
| 962 |
-
Dictionary, imgPerimeter1,image_new1,s =MainFunc(green2,img,dp,finalColorArray,220,num1,num2,'perimeter')
|
| 963 |
|
| 964 |
Dictionary=Dictionary.T
|
| 965 |
s=s.to_html()
|
|
@@ -989,7 +1167,8 @@ def getMeasurement(plan,SaveOP,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,i
|
|
| 989 |
|
| 990 |
|
| 991 |
if num1!=0 and num2!=0:
|
| 992 |
-
imgPerimeter1,Dictionary , s=
|
|
|
|
| 993 |
imgPerimeter1= cv2.cvtColor(imgPerimeter1, cv2.COLOR_RGB2BGR)
|
| 994 |
if SaveOP:
|
| 995 |
pushToDropbox(plan,imgPerimeter1,Dictionary)
|
|
@@ -997,13 +1176,15 @@ def getMeasurement(plan,SaveOP,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,i
|
|
| 997 |
exportToExcel(plan,Dictionary)
|
| 998 |
return imgPerimeter1,Dictionary , s
|
| 999 |
else:
|
| 1000 |
-
area=
|
|
|
|
| 1001 |
area = cv2.cvtColor(area, cv2.COLOR_BGR2RGB)
|
| 1002 |
# if SaveOP:
|
| 1003 |
# pushToDropbox(plan, area)
|
| 1004 |
return area
|
| 1005 |
# else:
|
| 1006 |
-
# areaPerimeterImg,df=
|
|
|
|
| 1007 |
# if SaveOP:
|
| 1008 |
# pushToDropbox(plan,area,perim,df)
|
| 1009 |
|
|
@@ -1106,9 +1287,11 @@ with gr.Blocks(css="#search {background: orangered}") as mainBlock:
|
|
| 1106 |
show_button.click(fn=getMeasurement, inputs=[ drop, check ,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12],outputs=img1)
|
| 1107 |
buttonSaveDf.click(fn=saveExcel,inputs=[out2,project])
|
| 1108 |
# clr_btn.click(fn=clear,outputs=[project,radio_button,check,drop])
|
| 1109 |
-
# btn1.click(fn=
|
|
|
|
| 1110 |
#secoond part
|
| 1111 |
-
# btn.click(fn=
|
|
|
|
| 1112 |
btn.click(fn=getMeasurement, inputs=[ drop, check,check1 ,dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12,num1,num2],outputs=[out1,out2,out3])
|
| 1113 |
project.change(fn=update_dropdown, inputs=[project], outputs=drop)
|
| 1114 |
|
|
|
|
| 20 |
from pathlib import Path
|
| 21 |
from PreprocessingFoundation import rmv_text,rmv_dashedLines
|
| 22 |
|
| 23 |
+
from __future__ import print_function
|
| 24 |
+
from googleapiclient.discovery import build
|
| 25 |
+
from google.oauth2 import service_account
|
| 26 |
+
import pygsheets
|
| 27 |
#############################################################################################
|
| 28 |
|
| 29 |
'''push output to dropbox'''
|
|
|
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
+
def drawAllContours(plan,green2,img,number,finalColorArray,num1,num2,flag):
|
| 686 |
# colors=[color,color1,color2,color3,color4,color5,color6,color7]
|
| 687 |
# img=np.array(img)
|
| 688 |
areasinImage=[]
|
|
|
|
| 898 |
return imgPerimeter1,image_new1,SimilarAreaDictionary , s
|
| 899 |
# drawAllContours(img,0,[],1.11,25579,'area') #,[190,47,250] ,[47,251,255] ,[80,240,15],[253,163,40]
|
| 900 |
# imgPerimeter1,image_new1,Dictionary=drawAllContours(img,220,[47,251,255],[251,163,47],1.105,27233.5,'area')
|
| 901 |
+
###############################################
|
| 902 |
+
##Google Sheets Legend
|
| 903 |
+
def getTitle(path):
|
| 904 |
+
planName= path.split("/")[-1].split('.')
|
| 905 |
+
LegendName='Legend of ' + str(planName[0]) + ' plan'
|
| 906 |
+
return LegendName
|
| 907 |
+
|
| 908 |
+
def getTitle(path):
|
| 909 |
+
planName= path.split("/")[-1].split('.')
|
| 910 |
+
LegendName='Legend of ' + str(planName[0]) + ' plan'
|
| 911 |
+
return LegendName
|
| 912 |
+
|
| 913 |
+
def getdropdownValues(gc,spreadsheet_service,spreadsheetid):
|
| 914 |
+
dropdownValues=[]
|
| 915 |
+
ws=gc.open_by_key('1lIIpv6jR0aSWQRtc-TPYn2Lxh17U6H_XrZE4EjTK69Y') ## spreadsheet containing mc-t names
|
| 916 |
+
worksheet = ws.worksheet(0)
|
| 917 |
+
response = spreadsheet_service.spreadsheets().get(
|
| 918 |
+
spreadsheetId=spreadsheetid, fields='*',
|
| 919 |
+
ranges='A2:A60',includeGridData=True).execute()
|
| 920 |
+
r=list(response['sheets'][0]['data'][0]['rowData'][0]['values'][0])
|
| 921 |
+
print(r)
|
| 922 |
+
if 'dataValidation' in r:
|
| 923 |
+
print('yes')
|
| 924 |
+
colvals= response['sheets'][0]['data'][0]['rowData'][0]['values'][0]['dataValidation']
|
| 925 |
+
colvalsList=list(colvals.items())
|
| 926 |
+
print(colvalsList[0][1])
|
| 927 |
+
lengthVals=len(colvalsList[0][1]['values'])
|
| 928 |
+
for i in range(lengthVals):
|
| 929 |
+
dictVal=(colvalsList[0][1]['values'][i].values())
|
| 930 |
+
# val=[*dictVal]
|
| 931 |
+
|
| 932 |
+
dropdownValues.append(*dictVal)
|
| 933 |
+
print(dropdownValues)
|
| 934 |
+
worksheet.update_col(index=1, values=dropdownValues)
|
| 935 |
+
return dropdownValues
|
| 936 |
+
|
| 937 |
+
def retrieveMCCol(gc):
|
| 938 |
+
ws=gc.open_by_key('1lIIpv6jR0aSWQRtc-TPYn2Lxh17U6H_XrZE4EjTK69Y')
|
| 939 |
+
worksheet = ws.worksheet(0)
|
| 940 |
+
mcT_Names=worksheet.get_col(1)
|
| 941 |
+
newMcTNames=[]
|
| 942 |
+
for i in mcT_Names:
|
| 943 |
+
if i != '':
|
| 944 |
+
newMcTNames.append(i)
|
| 945 |
+
return newMcTNames
|
| 946 |
+
|
| 947 |
+
def legendGoogleSheets(SimilarAreaDictionary,colorsUsed):
|
| 948 |
+
# authorize uing json file
|
| 949 |
+
# SimilarAreaDictionary.drop(['Rounded', 'Width','Height','R','G','B'], axis=1, inplace=True)
|
| 950 |
+
SCOPES = [
|
| 951 |
+
'https://www.googleapis.com/auth/spreadsheets',
|
| 952 |
+
'https://www.googleapis.com/auth/drive'
|
| 953 |
+
]
|
| 954 |
+
credentials = service_account.Credentials.from_service_account_file('/content/credentials.json', scopes=SCOPES)
|
| 955 |
+
spreadsheet_service = build('sheets', 'v4', credentials=credentials)
|
| 956 |
+
drive_service = build('drive', 'v3', credentials=credentials)
|
| 957 |
+
gc = pygsheets.authorize(custom_credentials=credentials, client_secret='/content/credentials.json')
|
| 958 |
+
|
| 959 |
+
|
| 960 |
+
########
|
| 961 |
+
legendTitle=getTitle(path)
|
| 962 |
+
titles=gc.spreadsheet_titles()
|
| 963 |
+
# print(titles)
|
| 964 |
+
if legendTitle in titles:
|
| 965 |
+
print('found sheet ')
|
| 966 |
+
else:
|
| 967 |
+
####### create new sheet
|
| 968 |
+
print('creating new sheeet')
|
| 969 |
+
|
| 970 |
+
|
| 971 |
+
LegendName=getTitle(path)
|
| 972 |
+
spreadsheet_details = {
|
| 973 |
+
'properties': {
|
| 974 |
+
'title': LegendName
|
| 975 |
+
}
|
| 976 |
+
}
|
| 977 |
+
sheet = spreadsheet_service.spreadsheets().create(body=spreadsheet_details,
|
| 978 |
+
fields='spreadsheetId').execute()
|
| 979 |
+
|
| 980 |
+
spreadsheetId = sheet.get('spreadsheetId')
|
| 981 |
+
# print('Spreadsheet ID: {0}'.format(spreadsheetId))
|
| 982 |
+
permission1 = {
|
| 983 |
+
'type': 'anyone',
|
| 984 |
+
'role': 'writer',
|
| 985 |
+
# 'emailAddress': 'marthe.adr@gmail.com'
|
| 986 |
+
}
|
| 987 |
+
drive_service.permissions().create(fileId=spreadsheetId, body=permission1).execute()
|
| 988 |
+
###################3
|
| 989 |
+
#open sheet
|
| 990 |
+
spreadsheetId='1dtDi_6-g3jkn6ePVlzM6PM3FE8wIHzyL2Rt4ksH59SE'
|
| 991 |
+
ws=gc.open_by_key(spreadsheetId)
|
| 992 |
+
worksheet = ws.worksheet(0)
|
| 993 |
+
|
| 994 |
+
#get lengths of df
|
| 995 |
+
columnsLen=len(SimilarAreaDictionary.columns.values.tolist()) #kam column -- last col = columnsLen+1 3shan base0
|
| 996 |
+
lastUsedCol=columnsLen+1
|
| 997 |
+
|
| 998 |
+
rowsLen=len(SimilarAreaDictionary.values.tolist()) #kam row -- last row = rowsLen +1
|
| 999 |
+
lastUsedRow=rowsLen+1
|
| 1000 |
+
#append to googlesheet
|
| 1001 |
+
worksheet.update_row(1,SimilarAreaDictionary.columns.values.tolist() ,col_offset=1)
|
| 1002 |
+
worksheet.append_table(SimilarAreaDictionary.values.tolist(), dimension='ROWS' )
|
| 1003 |
+
#names
|
| 1004 |
+
worksheet.update_col(index=1,values=['MC-Template Names'],row_offset=0)
|
| 1005 |
+
|
| 1006 |
+
#apply 'A1' notation
|
| 1007 |
+
firstcell=worksheet.cell((2,1)) #row,col
|
| 1008 |
+
firstcellNotation=str(firstcell.address.label)
|
| 1009 |
+
|
| 1010 |
+
lastcell=worksheet.cell((rowsLen+1,1)) #row,col
|
| 1011 |
+
lastcellNotation=str(lastcell.address.label)
|
| 1012 |
+
|
| 1013 |
+
lastcolumn=worksheet.cell((1,lastUsedCol)) #row,col
|
| 1014 |
+
lastcolumnNotation=str(lastcolumn.address.label)
|
| 1015 |
+
|
| 1016 |
+
#dropdowns -
|
| 1017 |
+
mcT_Names=retrieveMCCol(gc)
|
| 1018 |
+
worksheet.set_data_validation(firstcellNotation,lastcellNotation, condition_type='ONE_OF_LIST', condition_values=mcT_Names, showCustomUi=True)
|
| 1019 |
+
#format first row as bold
|
| 1020 |
+
model_cell =worksheet.cell('A1')
|
| 1021 |
+
model_cell.set_text_format('bold', True)
|
| 1022 |
+
pygsheets.DataRange('A1',lastcolumnNotation, worksheet=worksheet).apply_format(model_cell)
|
| 1023 |
+
worksheet.adjust_column_width(start=1,end=lastUsedCol)
|
| 1024 |
+
|
| 1025 |
+
|
| 1026 |
+
sheetId = '0' # Please set sheet ID.
|
| 1027 |
+
for i in range(len(colorsUsed)):
|
| 1028 |
+
|
| 1029 |
+
print(colorsUsed[i])
|
| 1030 |
+
r,g,b=colorsUsed[i]
|
| 1031 |
+
body = {
|
| 1032 |
+
"requests": [
|
| 1033 |
+
{
|
| 1034 |
+
"updateCells": {
|
| 1035 |
+
"range": {
|
| 1036 |
+
"sheetId": sheetId,
|
| 1037 |
+
"startRowIndex": i+1,
|
| 1038 |
+
# "endRowIndex":4 ,
|
| 1039 |
+
"startColumnIndex":1,
|
| 1040 |
+
|
| 1041 |
+
# "endColumnIndex": 0
|
| 1042 |
+
},
|
| 1043 |
+
|
| 1044 |
+
"rows": [
|
| 1045 |
+
{
|
| 1046 |
+
"values": [
|
| 1047 |
+
{
|
| 1048 |
+
"userEnteredFormat": {
|
| 1049 |
+
"backgroundColor": {
|
| 1050 |
+
|
| 1051 |
+
"red": r/255,
|
| 1052 |
+
"green": g/255,
|
| 1053 |
+
"blue": b/255,
|
| 1054 |
+
# "alpha": 0.8
|
| 1055 |
+
|
| 1056 |
+
}
|
| 1057 |
+
|
| 1058 |
+
}
|
| 1059 |
+
}
|
| 1060 |
+
]
|
| 1061 |
+
}
|
| 1062 |
+
],
|
| 1063 |
+
"fields": "userEnteredFormat.backgroundColor",
|
| 1064 |
+
|
| 1065 |
+
}
|
| 1066 |
+
}
|
| 1067 |
+
]
|
| 1068 |
+
}
|
| 1069 |
+
res = spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body=body).execute()
|
| 1070 |
+
spreadsheet_url = "https://docs.google.com/spreadsheets/d/%s" % spreadsheetId
|
| 1071 |
+
print(spreadsheet_url)
|
| 1072 |
+
|
| 1073 |
+
return gc,spreadsheet_service,spreadsheetId
|
| 1074 |
+
gc,spreadsheet_service,spreadsheetId=legendGoogleSheets(SimilarAreaDictionary,colorsUsed)
|
| 1075 |
|
| 1076 |
|
| 1077 |
+
def MainFunc(plan,green2,img,dp,finalColorArray,number,num1,num2,flag):
|
| 1078 |
|
| 1079 |
+
imgPerimeter1,image_new1,Df2,s=drawAllContours(plan,green2,img,number,finalColorArray,num1,num2,flag)
|
| 1080 |
# x = path.split("/")
|
| 1081 |
# x=x.pop()
|
| 1082 |
Df2=Df2.T
|
|
|
|
| 1097 |
# display(Df2)
|
| 1098 |
return Df2, imgPerimeter1,image_new1 ,s
|
| 1099 |
|
| 1100 |
+
def
|
| 1101 |
+
Contours(plan,dp,img,radioButton,radioButton1, color,color1,color2,color3,color4,color5,color6,color7,color8,num1=0,num2=0):
|
| 1102 |
print(type(img))
|
| 1103 |
green2=allpreSteps(img)
|
| 1104 |
|
|
|
|
| 1114 |
if radioButton=="Measure Full Image" :
|
| 1115 |
|
| 1116 |
if radioButton1=='Area':
|
| 1117 |
+
imgPerimeter1,image_new1,df ,s =drawAllContours(plan,green2,img,0,finalColorArray,num1,num2,'area')
|
| 1118 |
return image_new1
|
| 1119 |
else:
|
| 1120 |
+
imgPerimeter1,image_new1,df ,s =drawAllContours(plan,green2,img,0,finalColorArray,num1,num2,'perimeter')
|
| 1121 |
return imgPerimeter1
|
| 1122 |
else:
|
| 1123 |
if radioButton1=='Area':
|
| 1124 |
+
imgPerimeter1,image_new1,df ,s =drawAllContours(plan,green2,img,220,finalColorArray,num1,num2,'area') #rgbValue
|
| 1125 |
return image_new1
|
| 1126 |
else:
|
| 1127 |
+
imgPerimeter1,image_new1,df ,s =drawAllContours(plan,green2,img,220,finalColorArray,num1,num2,'perimeter') #rgbValue
|
| 1128 |
return imgPerimeter1
|
| 1129 |
else:
|
| 1130 |
if radioButton=="Measure Full Image":
|
| 1131 |
if radioButton1=='Area':
|
| 1132 |
+
Dictionary, imgPerimeter1,image_new1 ,s =MainFunc(plan,green2,img,dp,finalColorArray,0,num1,num2,'area')
|
| 1133 |
else:
|
| 1134 |
+
Dictionary, imgPerimeter1,image_new1 ,s =MainFunc(plan,green2,img,dp,finalColorArray,0,num1,num2,'perimeter')
|
| 1135 |
|
| 1136 |
else:
|
| 1137 |
if radioButton1=='Area':
|
| 1138 |
+
Dictionary, imgPerimeter1,image_new1,s =MainFunc(plan,green2,img,dp,finalColorArray,220,num1,num2,'area')
|
| 1139 |
else:
|
| 1140 |
+
Dictionary, imgPerimeter1,image_new1,s =MainFunc(plan,green2,img,dp,finalColorArray,220,num1,num2,'perimeter')
|
| 1141 |
|
| 1142 |
Dictionary=Dictionary.T
|
| 1143 |
s=s.to_html()
|
|
|
|
| 1167 |
|
| 1168 |
|
| 1169 |
if num1!=0 and num2!=0:
|
| 1170 |
+
imgPerimeter1,Dictionary , s=
|
| 1171 |
+
Contours(plan1,dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12,num1,num2)
|
| 1172 |
imgPerimeter1= cv2.cvtColor(imgPerimeter1, cv2.COLOR_RGB2BGR)
|
| 1173 |
if SaveOP:
|
| 1174 |
pushToDropbox(plan,imgPerimeter1,Dictionary)
|
|
|
|
| 1176 |
exportToExcel(plan,Dictionary)
|
| 1177 |
return imgPerimeter1,Dictionary , s
|
| 1178 |
else:
|
| 1179 |
+
area=
|
| 1180 |
+
Contours(plan1,dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12)
|
| 1181 |
area = cv2.cvtColor(area, cv2.COLOR_BGR2RGB)
|
| 1182 |
# if SaveOP:
|
| 1183 |
# pushToDropbox(plan, area)
|
| 1184 |
return area
|
| 1185 |
# else:
|
| 1186 |
+
# areaPerimeterImg,df=
|
| 1187 |
+
Contours(dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,num1,num2)
|
| 1188 |
# if SaveOP:
|
| 1189 |
# pushToDropbox(plan,area,perim,df)
|
| 1190 |
|
|
|
|
| 1287 |
show_button.click(fn=getMeasurement, inputs=[ drop, check ,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12],outputs=img1)
|
| 1288 |
buttonSaveDf.click(fn=saveExcel,inputs=[out2,project])
|
| 1289 |
# clr_btn.click(fn=clear,outputs=[project,radio_button,check,drop])
|
| 1290 |
+
# btn1.click(fn=
|
| 1291 |
+
Contours, inputs=[dp,in1,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11], outputs=out1)
|
| 1292 |
#secoond part
|
| 1293 |
+
# btn.click(fn=
|
| 1294 |
+
Contours, inputs=[dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,num1,num2], outputs=outputs1)
|
| 1295 |
btn.click(fn=getMeasurement, inputs=[ drop, check,check1 ,dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12,num1,num2],outputs=[out1,out2,out3])
|
| 1296 |
project.change(fn=update_dropdown, inputs=[project], outputs=drop)
|
| 1297 |
|