convolve3

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Computes a sliding window kernel convolution.(AKA kernel filter, smooth). Same as convolve, only a somewhat faster algorithm is used.

Arguments and Return Values

Arguments: A numeric array, a kernel (filtering array) and an ignore value

Return Value: An array the size of the input object.

Usage

Syntax: convolve(object = VAL, kernel = VAL [, norm = BOOL] [, ignore = VAL])

For each pixel in object, the weighted sum of the neighboring pixels is computed, with the weights being specified by the kernel.

The norm parameter specifies whether or not each pixel is to be divided by the number of pixels used in the calculation. The neighborhood of edge pixels is smaller than center pixels. If norm=0, the edge pixels will be much smaller than the center pixels. The default is norm=1.

Examples

 dv> a
 100x1x1 array of float, bsq format [400 bytes]
 53.9788 57.6900 54.0981 58.6861 56.6364 57.1844 51.5344 59.0345 59.9379 58.6052 53.0549 54.7863 59.7489 58.6505 57.5061 55.9742
 53.9737 56.7772 57.6349 57.0474 58.0184 51.3361 58.7491 59.8550 56.4486 56.0352 58.8567 58.4009 56.8651 56.4712 56.4956 54.6221
 58.8233 59.4161 54.7317 58.1370 57.3661 57.5358 53.5277 57.8457 56.1029 52.6918 55.7651 58.3988 57.1452 54.4621 54.0289 58.8286
 59.5696 53.9693 58.9322 57.8385 57.1589 58.8464 57.6993 57.0087 54.1821 59.5195 52.4622 56.6321 54.2951 59.4223 54.7540 58.6589
 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
 58.5271 59.9844 55.6486 59.4911 55.3317 52.1642 58.8132 59.1644 54.9611 54.2263 59.2408 56.2664 59.2647 51.6016 59.2431 55.7747
 58.8142 59.9822 57.2909 59.0275

 dv> kernel = clone(1.0,5,1,1)
 5x1x1 array of float, bsq format [20 bytes]
 1.00000 1.00000 1.00000 1.00000 1.00000

 dv> convolved_5 = convolve(a,kernel,ignore=0)
 100x1x1 array of float, bsq format [400 bytes]
 55.2556 56.1133 56.2179 56.8590 55.6279 56.6152 56.8655 57.2593 56.4334 57.0838 57.2266 56.9692 56.7494 57.3332 57.1707 56.5764
 56.3732 56.2815 56.6903 56.1628 56.5572 57.0012 56.8814 56.4848 57.9889 57.9193 57.3213 57.3258 57.4179 56.5710 56.6555 57.1657
 56.8178 57.1460 57.6949 57.4373 56.2597 56.8825 56.4757 55.5408 55.1866 56.1609 56.0207 55.6926 55.9600 56.5727 56.8069 56.1717
 57.0657 57.8277 57.4937 57.3491 58.0951 57.7104 56.9791 57.4512 56.1744 55.9609 55.4182 56.4663 55.5132 56.7525 56.7826 57.6117
 56.7064 58.6589 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 58.5271 59.2557
 58.0534 58.4128 57.7966 56.5240 56.2897 56.9929 56.0869 55.8658 57.2812 56.7718 56.7919 56.1200 57.1233 56.4301 56.9397 57.0832
 58.2210 58.1779 58.7787 58.7669

 dv> kernel = clone(1.0,21,1,1)
 21x1x1 array of float, bsq format [84 bytes]
 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000
 1.00000 1.00000 1.00000 1.00000 1.00000

 dv> convolved_21 = convolve(a,kernel,ignore=0)
 100x1x1 array of float, bsq format [400 bytes]
 56.4037 56.2689 56.5366 56.6876 56.7422 56.6942 56.5342 56.5477 56.6049 56.6270 56.6933 56.5674 56.6179 56.8920 56.7854 56.7568
 56.8364 57.1634 57.0601 56.8950 56.7946 56.8692 57.0614 57.0456 56.8590 56.8890 56.9553 57.1249 56.9702 56.9802 56.9352 56.6816
 56.8925 56.8758 56.7468 56.6522 56.5567 56.5553 56.6110 56.4731 56.5903 56.6542 56.7750 56.7761 56.6944 56.8028 56.6145 56.7170
 56.4754 56.6232 56.4542 56.6122 56.7104 56.8482 56.7707 56.7510 56.8782 57.0458 56.9343 56.7586 56.9579 56.8060 56.7200 56.6801
 56.4634 56.3261 56.2408 56.5349 56.0374 56.7525 57.1315 58.2693 57.5146 58.4620 57.7966 56.8578 57.1372 57.3906 57.1206 56.8312
 57.0503 56.9849 57.1603 56.7633 56.9286 56.8565 56.9716 57.1389 57.1469 57.2409 57.2409 57.1732 57.0170 57.0975 56.9479 57.0557
 57.4051 57.2968 57.1411 57.3393

Images

convolveimg.jpg

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 07-06-2009

Personal tools