[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9957] Nonlinear filter for image package

From: Tony Richardson
Subject: [Octave-patch-tracker] [patch #9957] Nonlinear filter for image package (colfilt2)
Date: Sun, 19 Jul 2020 11:08:07 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36


                 Summary: Nonlinear filter for image package (colfilt2)
                 Project: GNU Octave
            Submitted by: amrichardson
            Submitted on: Sun 19 Jul 2020 03:08:05 PM UTC
                Category: Forge : new function
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any



I have attached code for a function I've called colfilt2.  It is similar to
colfilt but allows you to process only neighborhoods of selected pixels. It
also allows you to choose members of the neighborhood by specifying row and
column index offsets instead of using all members of a rectangular region.

Like colfilt, colfilt2 requires that a processing function be passed as an
argument. The processing function must accept a matrix argument. In the
processing function for colfilt each column of the matrix contains the
neighbors in a rectangular region around an element of the input image. The
number of columns is equal to the number of pixels in the image.  In the
processing function for colfilt2 each column contains only the specified
neighbors of a pixel.  The number of columns is equal to the number of
selected pixels.  This processing function is only called once (unlike in
nlfilter where the processing function is called once for each pixel in the
input image).

Here is example code that illustrates usage:

%% Replace diagonal elements with average of left and right
%% neighbors. Zero-padding is used at the edges
A = magic (12)
SELECT = eye(size(A), 'logical');
NEIGHBORS = [0 -1; 0 1];
colfilt2 (A, SELECT, NEIGHBORS, @mean)

This example is included as "demo" code in the function. It is  a modified
version of the demo code in colfilt.

Tony Richardson


File Attachments:

Date: Sun 19 Jul 2020 03:08:05 PM UTC  Name: colfilt2.m  Size: 5KiB   By:



Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]