34 #include <visp3/ustk_elastography/usSignalProcessing.h>
60 vpMatrix t_out(height, width);
63 for (i = -a; i <= a; i++) {
64 for (j = -b; j <= b; j++) {
65 mul = (exp((-1.0 * ((i * i) + (j * j))) / (2.0 * sigma * sigma))) / (2 * M_PI * sigma);
66 t_out[j + b][i + a] = mul;
69 t_out = t_out / t_out.getMaxValue();
85 for (uint i = 0; i < image.
getHeight(); i++) {
86 t_out[i][0] = image(i, 1) - image(i, 0);
90 for (uint i = 0; i < image.
getHeight(); i++)
91 for (uint j = 1; j < image.
getWidth() - 1; j++)
92 t_out[i][j] = (image(i, j + 1) - image(i, j - 1)) * 0.5;
109 for (uint j = 0; j < image.
getWidth(); j++) {
110 t_out[0][j] = image(1, j) - image(0, j);
114 for (uint i = 1; i < image.
getHeight() - 1; i++)
115 for (uint j = 0; j < image.
getWidth(); j++)
116 t_out[i][j] = (image(i + 1, j) - image(i - 1, j)) * 0.5;
133 throw(vpException(vpException::dimensionError,
134 "usSignalProcessing::Difference(), input matrices dimentions mismatch."));
139 for (uint j = 0; j < A.
getWidth(); j++)
140 t_out[i][j] = A(i, j) - B(i, j);
154 vpMatrix ivec(newH, newW);
155 double tx = (double)(In.getCols() - 1.0) / newW;
156 double ty = (double)(In.getRows() - 1.0) / newH;
157 double x_diff, y_diff;
160 for (uint i = 0; i < newH; i++) {
161 for (uint j = 0; j < newW; j++) {
162 int x = (int)(tx * j);
163 int y = (int)(ty * i);
164 x_diff = ((tx * j) - x);
165 y_diff = ((ty * i) - y);
170 D = In[y + 1][x + 1];
172 double vi = (double)(A * (1.0 - x_diff) * (1.0 - y_diff) + B * (x_diff) * (1.0 - y_diff) +
173 C * (y_diff) * (1.0 - x_diff) + D * (x_diff * y_diff));
174 ivec.data[j + i * newW] = vi;
190 assert(matrix1.getRows() == matrix2.getRows());
191 assert(matrix1.getCols() == matrix2.getCols());
192 uint t_rows = matrix2.getRows();
193 uint t_cols = matrix2.getCols();
194 vpMatrix t_out(t_rows, t_cols);
195 for (uint i = 0; i < t_rows; i++)
196 for (uint j = 0; j < t_cols; j++)
197 t_out[i][j] = matrix1[i][j] * matrix2[i][j];
unsigned int getHeight() const
unsigned int getWidth() const
static vpMatrix BilinearInterpolation(vpMatrix In, uint newW, uint newH)
Bilinear Interpolation.
usSignalProcessing()
Constructor.
static vpMatrix GaussianFilter(int height, int width, double sigma)
Gaussian Kernel generator.
static vpMatrix Difference(const usImageRF2D< short int > &A, const usImageRF2D< short int > &B)
static vpMatrix HadamardProd(vpMatrix matrix1, vpMatrix matrix2)
Element-wise product.
static vpMatrix getXGradient(const usImageRF2D< short > &image)
Computation of gradients.
virtual ~usSignalProcessing()
Virtual destructor.
static vpMatrix getYGradient(const usImageRF2D< short int > &image)