26 #define _USE_MATH_DEFINES
44 IUFillBLOB(&DownloadB,
"CONVOLUTION_DOWNLOAD",
"Convolution Matrix",
"");
65 bool Convolution::ISNewBLOB(
const char *dev,
const char *name,
int sizes[],
int blobsizes[],
char *blobs[],
char *formats[],
70 if(!strcmp(name, DownloadBP.
name))
72 IUUpdateBLOB(&DownloadBP, sizes, blobsizes, blobs, formats, names, n);
79 matrix =
loadFITS(blobs[0], sizes[0]);
80 if (matrix !=
nullptr)
94 if(!matrix_loaded)
return false;
95 setStream(buf, dims, sizes, bits_per_sample);
108 sprintf(strname,
"WAVELET_%0d", i);
109 sprintf(strlabel,
"%d pixels Gaussian Wavelet", (i + 1) * 3);
110 IUFillNumber(&WaveletsN[i], strname, strlabel,
"%3.3f", -15.0, 255.0, 1.0, 0.0);
145 setStream(buf, dims, sizes, bits_per_sample);
149 for (
int i = 0; i < WaveletsNP.
nnp; i++)
151 int size = (i + 1) * 3;
157 for(
int y = 0; y < size; y++)
159 for(
int x = 0; x < size; x++)
161 matrix->
buf[x + y * size] = sin(
static_cast<double>(x) * M_PI /
static_cast<double>(size)) * sin(
static_cast<double>
162 (y) * M_PI /
static_cast<double>(size));
void Activated() override
Activated Called after activation from client application.
void Deactivated() override
Deactivated Called after deactivation from client application.
bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Convolution(INDI::DefaultDevice *dev)
virtual bool processBLOB(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override
processBLOB Propagate to Callback and generate BLOBs for parent device.
const char * getDeviceName()
virtual void Activated()
Activated Called after activation from client application.
virtual bool processBLOB(uint8_t *buf, uint32_t ndims, int *dims, int bits_per_sample)
processBLOB Propagate to Callback and generate BLOBs for parent device.
bool setStream(void *buf, uint32_t dims, int *sizes, int bits_per_sample)
INDI::DefaultDevice * m_Device
dsp_stream_p loadFITS(char *buf, int len)
loadFITS Converts FITS data into a dsp_stream structure pointer.
virtual void Deactivated()
Deactivated Called after deactivation from client application.
virtual bool processBLOB(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override
processBLOB Propagate to Callback and generate BLOBs for parent device.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
void Deactivated() override
Deactivated Called after deactivation from client application.
Wavelets(INDI::DefaultDevice *dev)
void Activated() override
Activated Called after activation from client application.
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
int * sizes
Sizes of each dimension.
int dims
Number of dimensions of the buffers.
int len
The buffers length.
void dsp_buffer_sum(dsp_stream_p stream, dsp_t *in, int inlen)
Sum elements of one stream to another's.
#define dsp_buffer_normalize(buf, len, mn, mx)
Normalize the input stream to the minimum and maximum values.
void dsp_buffer_sub(dsp_stream_p stream, dsp_t *in, int inlen)
Subtract elements of one stream from another's.
void dsp_buffer_mul1(dsp_stream_p stream, double val)
Multiply elements of the input stream to a value.
void dsp_convolution_convolution(dsp_stream_p stream, dsp_stream_p matrix)
A cross-convolution processor.
DLL_EXPORT void dsp_stream_free(dsp_stream_p stream)
Free the DSP stream passed as argument.
DLL_EXPORT dsp_stream_p dsp_stream_copy(dsp_stream_p stream)
Create a copy of the DSP stream passed as argument.
DLL_EXPORT dsp_stream_p dsp_stream_new(void)
Allocate a new DSP stream type.
DLL_EXPORT void dsp_stream_add_dim(dsp_stream_p stream, int len)
Add a dimension with length len to a DSP stream.
DLL_EXPORT void dsp_stream_alloc_buffer(dsp_stream_p stream, int len)
Allocate a buffer with length len on the stream passed as argument.
DLL_EXPORT void dsp_stream_free_buffer(dsp_stream_p stream)
Free the buffer of the DSP Stream passed as argument.
#define dsp_stats_min(buf, len)
Gets the minimum value of the input stream.
#define dsp_stats_max(buf, len)
Gets the maximum value of the input stream.
Implementations for common driver routines.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
void IUFillBLOBVector(IBLOBVectorProperty *bvp, IBLOB *bp, int nbp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a BLOB vector property. The vector's auxiliary elements will be set to NULL.
void IUFillBLOB(IBLOB *bp, const char *name, const char *label, const char *format)
Assign attributes for a BLOB property. The BLOB's data and auxiliary elements will be set to NULL.
int IUUpdateBLOB(IBLOBVectorProperty *bvp, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update all BLOB members in a BLOB vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
#define LOGF_INFO(fmt,...)
The DSP Namespace adds signal processing to INDI drivers. Primarily written for sensors and detectors...
Contains a set of informations and data relative to a buffer and how to use it.