patchGNU Octave - Patches: patch #9957, Nonlinear filter for image package...

 
 

patch #9957: Nonlinear filter for image package (colfilt2)

Submitted by:  Tony Richardson <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 Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 20 Jul 2020 02:07:43 PM UTC, comment #2: 

One last (??) version that is completely vectorized.  Previous versions looped over the number of neighbors.

Tony

(file #49519)

Tony Richardson <amrichardson>
Sun 19 Jul 2020 11:26:22 PM UTC, comment #1: 

Found a bug in the way the number of rows and columns of padding were determined.  I've fixed the bug and uploaded a new version.

Tony

(file #49514)

Tony Richardson <amrichardson>
Sun 19 Jul 2020 03:08:05 PM UTC, original submission:  

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

Tony Richardson <amrichardson>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49519:  colfilt2.m added by amrichardson (4KiB - text/plain)
file #49514:  colfilt2.m added by amrichardson (5KiB - application/octet-stream)
file #49512:  colfilt2.m added by amrichardson (5KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amrichardson (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-20 amrichardson Attached File- => Added colfilt2.m, #49519
    2020-07-19 amrichardson Attached File- => Added colfilt2.m, #49514
    2020-07-19 amrichardson Attached File- => Added colfilt2.m, #49512

    Back to the top


    Powered by Savane 3.6