I am trying to implement Scales to adjust threshold values for the canny image detection in python however I am unable to change the values using Scales. the value remains 0 no matter what. please help me out. Here is my code.
from tkinter import *
import cv2
v1 =0
v2 =0
def print_value1(val1):
v1 = val1
print (v1)
def print_value2(val2):
v2 = val2
print (v2)
def edge_detection():
img = cv2.imread("C:/Users/Shah Lamaan
Rana/Pictures/modernvsoldforehand.jpg")
edges = cv2.Canny(img, v1, v2)
cv2.imshow('test image', edges)
root =Tk()
scale1 = Scale(orient = 'horizontal', from_=0, to=200, command=print_value1)
scale1.pack()
scale2 = Scale(orient = 'horizontal', from_=0, to=400, command=print_value2)
scale2.pack()
button = Button(root,text = "find edges", command = edge_detection,bg = 'red'
,height = 1, width = 24, borderwidth=6)
button.pack()
root.mainloop()