Kavindu99 commited on
Commit
746d2d7
1 Parent(s): 007b7f3

bugs fixes

Browse files
Files changed (2) hide show
  1. .vscode/settings.json +3 -0
  2. app.py +4 -3
.vscode/settings.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "python.pythonPath": "/home/kavindu99/mambaforge/envs/spaces/bin/python"
3
+ }
app.py CHANGED
@@ -24,11 +24,12 @@ weighted_average = torch.tensor([[1/16,2/16, 1/16],
24
  [2/16,4/16, 2/16],
25
  [1/16,2/16, 1/16]]).float()
26
 
27
- def apply_kernel(img, row, col, kernel):
28
- return (img[row-1:row+2,col-1:col+2] * kernel).sum()
29
 
30
  def convolve(img, kernel):
31
- return ([[apply_kernel(i,j,kernel) for j in rng] for i in rng])
 
 
 
32
 
33
  def app(img, op):
34
  if op =="sobel_verticle":
 
24
  [2/16,4/16, 2/16],
25
  [1/16,2/16, 1/16]]).float()
26
 
 
 
27
 
28
  def convolve(img, kernel):
29
+ out_img = img.dot(kernel.T)
30
+ outimg /= out_img.max()
31
+ return out_img
32
+
33
 
34
  def app(img, op):
35
  if op =="sobel_verticle":