rapot Posted February 19, 2011 Share Posted February 19, 2011 I was looking around forum but AutoIt but do not found any topic to write about Convolution two array.I just found this>>Convolution.Au3It Convolution with image.So i find function Convolution two array with assembly in autoitAnyone can write a function Convolution like this:http://www.ece.umd.edu/~tretter/commlab/c6713slides/convol1.saPlease share meThanksConvolution.au3Fasm.rar Link to comment Share on other sites More sharing options...
MvGulik Posted February 19, 2011 Share Posted February 19, 2011 Sure they can.Question is will they.What you think MOD. Naa they wont.O wait ... let me help you a little.I was looking around forum but AutoIt but do not found any topic to write about Convolution two array.I just found this>>Convolution.Au3It Convolution with image.So i find function Convolution two array with assembly in autoitAnyone can write a function Convolution like this:http://www.ece.umd.edu/~tretter/commlab/c6713slides/convol1.saPlease share meThanks "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
rapot Posted February 20, 2011 Author Share Posted February 20, 2011 I can't do i still wait for help forever Link to comment Share on other sites More sharing options...
Malkey Posted February 21, 2011 Share Posted February 21, 2011 Here is an attempt at convoluting two 2D arrays. I do not know whether the results are conventionally correct or not. expandcollapse popup#include <Array.au3> ; Ref: http://www.songho.ca/dsp/convolution/convolution2d_example.html Local $arr[5][5] = [ _ [1, 2, 3, 4, 5], _ [6, 7, 8, 9, 10], _ [11, 12, 13, 14, 15], _ [16, 17, 18, 19, 20], _ [21, 21, 23, 24, 25]] Local $k[3][3] = [ _ [0, -1, 0], _ [0, 2, 0], _ [0, 0, 0]] Local $aAnswer = _ArrayConvolve($arr, $k) _ArrayDisplay($aAnswer, "Convolve Arrays 5x5 and 3x3") Local $k2[2][2] = [[1, 0],[0, 1]] Local $aAnswer2 = _ArrayConvolveEx($arr, $k2) _ArrayDisplay($aAnswer2, "Convolve Arrays 5x5 and 2x2") ; Only accepts array $k being [Ubound ($k) = odd number] and [Ubound ($k, 2) = odd number]. Func _ArrayConvolve($arr, $k) Local $aResult[UBound($arr)][UBound($arr, 2)] Local $sum = 0 For $x = 0 To UBound($arr) - 1 For $y = 0 To UBound($arr, 2) - 1 $sum = 0 For $i = -Int(UBound($k) / 2) To Int(UBound($k) / 2) For $j = -Int(UBound($k, 2) / 2) To Int(UBound($k, 2) / 2) If $x + $i >= 0 And ($x + $i < UBound($arr)) And $y + $j >= 0 And ($y + $j < UBound($arr, 2)) Then _ $sum += $arr[$x + $i][$y + $j] * $k[$i + Int(UBound($k) / 2)][$j + Int(UBound($k, 2) / 2)] Next Next $aResult[$x][$y] = $sum Next Next Return $aResult EndFunc ;==>_ArrayConvolve ; Accepts any size $k array. Func _ArrayConvolveEx($arr, $k) Local $aResult[UBound($arr)][UBound($arr, 2)] Local $sum = 0 For $x = 0 To UBound($arr) - 1 For $y = 0 To UBound($arr, 2) - 1 $sum = 0 For $i = -Int(UBound($k) / 2) To Int(UBound($k) / 2) - (1 * Mod(UBound($k), 2) = 0) For $j = -Int(UBound($k, 2) / 2) To Int(UBound($k, 2) / 2) - (1 * Mod(UBound($k, 2), 2) = 0) If $x + $i >= 0 And ($x + $i < UBound($arr)) And $y + $j >= 0 And ($y + $j < UBound($arr, 2)) Then _ $sum += $arr[$x + $i][$y + $j] * $k[$i + Int(UBound($k) / 2)][$j + Int(UBound($k, 2) / 2)] Next Next $aResult[$x][$y] = $sum Next Next Return $aResult EndFunc ;==>_ArrayConvolveEx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now