CONVOL : no subscripting with POLYFILLV? [message #14108] |
Fri, 22 January 1999 00:00  |
Tom Wassenaar
Messages: 15 Registered: August 1998
|
Junior Member |
|
|
I'd like to use polygon vertices directly to determine the image subset
to convolve, but is it right that CONVOL only operates on simple square
subscripts ?
a simple example :
ENVI> a = findgen(10, 20)
ENVI> kernel = fltarr(3, 3) + 1
ENVI> b = convol(a[2:8, 4:15], kernel, total(kernel))
; this works fine !
ENVI> x = POLYFILLV([2,2,8,8], [4,15,15,4], 10, 20)
ENVI> b = convol(a[x], kernel, total(kernel))
% CONVOL: Kernel's dimensions are incompatible with operand's.
WHY ?
--
���������� ���������� ���������� ���������� ���
Tom Wassenaar
INRA Science du Sol, 2 place Pierre Viala
34060 Montpellier Cedex 02, tel. +33 (0)499612764
M�l : wassenaar@ensam.inra.fr
���������� ���������� ���������� ���������� ���
|
|
|
Re: CONVOL : no subscripting with POLYFILLV? [message #14175 is a reply to message #14108] |
Mon, 25 January 1999 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Tom Wassenaar wrote:
>
> I'd like to use polygon vertices directly to determine the image subset
> to convolve, but is it right that CONVOL only operates on simple square
> subscripts ?
>
> a simple example :
> ENVI> a = findgen(10, 20)
> ENVI> kernel = fltarr(3, 3) + 1
> ENVI> b = convol(a[2:8, 4:15], kernel, total(kernel))
> ; this works fine !
> ENVI> x = POLYFILLV([2,2,8,8], [4,15,15,4], 10, 20)
> ENVI> b = convol(a[x], kernel, total(kernel))
> % CONVOL: Kernel's dimensions are incompatible with operand's.
>
> WHY ?
> --
Tom -
CONVOL() operates on arrays, and it could just as well operate on
a limited range of an array, but this would still be a rectangular
region.
For what you want, I would recommend making a copy of your array,
or better yet a copy of the smallest rectangular region that contains
your region of interest(*), and applying your convolution to the
copy. Then use this copy to update the pixels in the ROI of your
original array.
(*) If your copy is a subregion, be sure it is larger than the
region of your polygon. Add half the size of your kernel (3/2 or 1
in your case)
pixels in all directions, so that the convolution is applied
to all pixels within the region. (If you don't do this then
the boundary pixels of your ROI are not processed.)
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|