|
Post by mans94 on Feb 24, 2020 8:07:30 GMT
hello everyone i am having an issue with numpy doing the following m = np.array([[20, 30, 120, 110.110], [30, 30, 130, 120,110], [20, 50, 130, 140,130], [40, 30, 140, 150,120], [50, 40, 150, 140,130]]) prewitt = np.array([[1, 1, 1], [0, 0, 0], [-1, -1, -1]]) res = np.dot(prewitt,m) i want to 201 + 301 + 201 + 300 +300+ 500 + 120*-1 + 130* -1 + 130* -1 = the total is going to be in a new array of 4 by 4 so on and so furth i tried numpy matrix array but did not work i.imgur.com/5jQBVzY.png
|
|
|
Post by Martin McBride on Feb 26, 2020 8:51:50 GMT
I think the Prewitt algorithm requires you to convolve the matrix with the image, rather than simply do a matrix multiply. You could try numpy.convolve.
|
|