Author Topic: KernelFilter coefficients  (Read 4446 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
KernelFilter coefficients
« on: 2010 April 29 10:58:36 »
Here is a doubt about setting and reading a specifical coefficient in a KernelFilter object.

Let's say that the inner matrix is defined like "coefficients
  • [y]". How do I read that specific value? Do I have to use Coefficients() and get the whole matrix?


What if I want to change that specific value (i.e. coefficients
  • [y] = value)? Do I have to create the propper matrix, and then use the "=" operator to set it?
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: KernelFilter coefficients
« Reply #1 on: 2010 April 29 11:46:26 »
KernelFilter does not allow you to write kernel filter coefficients. You must work with a FMatrix, then create a KernelFilter from it. For example:

Code: [Select]
#include <pcl/KernelFilter.h>

FMatrix M( .0F, 5, 5 ); // a matrix of float elements, 5 rows and 5 columns, initialized with zeros
M[2][2] = 1; // set the central element to 1
M[1][1] = M[1][2] = M[1][3] = // now set its surrounding elements to 1/2
M[2][1] = M[2][3] =
M[3][1] = M[3][2] = M[3][3] = 0.5;
KernelFilter F( M ); // convert matrix coefficients into a filter
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: KernelFilter coefficients
« Reply #2 on: 2010 April 29 16:08:10 »
ok... That's the reason I was using my own class :D
Back to an earlier version... today I modified everything to use KernelFilter, with that detail the only pending thing :P I'll return to my own kernel, using FMatrix instead of the matrix I had defined and simplifying the code a bit. Cross fingers. ;)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com