Visual Servoing Platform  version 3.3.0 under development (2020-02-17)
vpImageFilter.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Various image tools, convolution, ...
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpImageFilter_H
40 #define vpImageFilter_H
41 
48 #include <visp3/core/vpImage.h>
49 #include <visp3/core/vpImageException.h>
50 #include <visp3/core/vpMath.h>
51 #include <visp3/core/vpMatrix.h>
52 #include <visp3/core/vpRGBa.h>
53 
54 #include <fstream>
55 #include <iostream>
56 #include <math.h>
57 #include <string.h>
58 
67 class VISP_EXPORT vpImageFilter
68 {
69 public:
70 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
71  static void canny(const vpImage<unsigned char> &I, vpImage<unsigned char> &Ic, unsigned int gaussianFilterSize,
72  double thresholdCanny, unsigned int apertureSobel);
73 #endif
74 
82  template <class T> static double derivativeFilterX(const vpImage<T> &I, unsigned int r, unsigned int c)
83  {
84  return (2047.0 * (I[r][c + 1] - I[r][c - 1]) + 913.0 * (I[r][c + 2] - I[r][c - 2]) +
85  112.0 * (I[r][c + 3] - I[r][c - 3])) /
86  8418.0;
87  }
88 
96  template <class T> static double derivativeFilterY(const vpImage<T> &I, unsigned int r, unsigned int c)
97  {
98  return (2047.0 * (I[r + 1][c] - I[r - 1][c]) + 913.0 * (I[r + 2][c] - I[r - 2][c]) +
99  112.0 * (I[r + 3][c] - I[r - 3][c])) /
100  8418.0;
101  }
102 
116  template <class T>
117  static double derivativeFilterX(const vpImage<T> &I, unsigned int r, unsigned int c, const double *filter,
118  unsigned int size)
119  {
120  unsigned int i;
121  double result;
122 
123  result = 0;
124 
125  for (i = 1; i <= (size - 1) / 2; i++) {
126  result += filter[i] * (I[r][c + i] - I[r][c - i]);
127  }
128  return result;
129  }
130 
143  template <class T>
144  static double derivativeFilterY(const vpImage<T> &I, unsigned int r, unsigned int c, const double *filter,
145  unsigned int size)
146  {
147  unsigned int i;
148  double result;
149 
150  result = 0;
151 
152  for (i = 1; i <= (size - 1) / 2; i++) {
153  result += filter[i] * (I[r + i][c] - I[r - i][c]);
154  }
155  return result;
156  }
157 
158  static void filter(const vpImage<double> &I, vpImage<double> &Iu, vpImage<double> &Iv, const vpMatrix &M,
159  bool convolve = false);
160 
161  static void filter(const vpImage<unsigned char> &I, vpImage<double> &If, const vpMatrix &M,
162  bool convolve = false);
163 
164  static void sepFilter(const vpImage<unsigned char> &I, vpImage<double> &If, const vpColVector &kernelH,
165  const vpColVector &kernelV);
166 
167  static void filter(const vpImage<unsigned char> &I, vpImage<double> &GI, const double *filter, unsigned int size);
168  static void filter(const vpImage<double> &I, vpImage<double> &GI, const double *filter, unsigned int size);
169 
170  static inline unsigned char filterGaussXPyramidal(const vpImage<unsigned char> &I, unsigned int i, unsigned int j)
171  {
172  return (unsigned char)((1. * I[i][j - 2] + 4. * I[i][j - 1] + 6. * I[i][j] + 4. * I[i][j + 1] + 1. * I[i][j + 2]) /
173  16.);
174  }
175  static inline unsigned char filterGaussYPyramidal(const vpImage<unsigned char> &I, unsigned int i, unsigned int j)
176  {
177  return (unsigned char)((1. * I[i - 2][j] + 4. * I[i - 1][j] + 6. * I[i][j] + 4. * I[i + 1][j] + 1. * I[i + 2][j]) /
178  16.);
179  }
180 
181  static void filterX(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
182  static void filterX(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
183  static void filterX(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
184  static void filterXR(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
185  static void filterXG(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
186  static void filterXB(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
187 
188  static inline double filterX(const vpImage<unsigned char> &I, unsigned int r, unsigned int c, const double *filter,
189  unsigned int size)
190  {
191  double result;
192 
193  result = 0;
194 
195  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
196  result += filter[i] * (I[r][c + i] + I[r][c - i]);
197  }
198  return result + filter[0] * I[r][c];
199  }
200 
201  static inline double filterXR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
202  unsigned int size)
203  {
204  double result;
205 
206  result = 0;
207 
208  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
209  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
210  }
211  return result + filter[0] * I[r][c].R;
212  }
213 
214  static inline double filterXG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
215  unsigned int size)
216  {
217  double result;
218 
219  result = 0;
220 
221  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
222  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
223  }
224  return result + filter[0] * I[r][c].G;
225  }
226 
227  static inline double filterXB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
228  unsigned int size)
229  {
230  double result;
231 
232  result = 0;
233 
234  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
235  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
236  }
237  return result + filter[0] * I[r][c].B;
238  }
239 
240  static inline double filterXLeftBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
241  const double *filter, unsigned int size)
242  {
243  double result;
244 
245  result = 0;
246 
247  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
248  if (c > i)
249  result += filter[i] * (I[r][c + i] + I[r][c - i]);
250  else
251  result += filter[i] * (I[r][c + i] + I[r][i - c]);
252  }
253  return result + filter[0] * I[r][c];
254  }
255 
256  static inline double filterXLeftBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
257  const double *filter, unsigned int size)
258  {
259  double result;
260 
261  result = 0;
262 
263  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
264  if (c > i)
265  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
266  else
267  result += filter[i] * (I[r][c + i].R + I[r][i - c].R);
268  }
269  return result + filter[0] * I[r][c].R;
270  }
271 
272  static inline double filterXLeftBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
273  const double *filter, unsigned int size)
274  {
275  double result;
276 
277  result = 0;
278 
279  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
280  if (c > i)
281  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
282  else
283  result += filter[i] * (I[r][c + i].G + I[r][i - c].G);
284  }
285  return result + filter[0] * I[r][c].G;
286  }
287 
288  static inline double filterXLeftBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
289  const double *filter, unsigned int size)
290  {
291  double result;
292 
293  result = 0;
294 
295  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
296  if (c > i)
297  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
298  else
299  result += filter[i] * (I[r][c + i].B + I[r][i - c].B);
300  }
301  return result + filter[0] * I[r][c].B;
302  }
303 
304  static inline double filterXRightBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
305  const double *filter, unsigned int size)
306  {
307  double result;
308 
309  result = 0;
310 
311  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
312  if (c + i < I.getWidth())
313  result += filter[i] * (I[r][c + i] + I[r][c - i]);
314  else
315  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1] + I[r][c - i]);
316  }
317  return result + filter[0] * I[r][c];
318  }
319 
320  static inline double filterXRightBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
321  const double *filter, unsigned int size)
322  {
323  double result;
324 
325  result = 0;
326 
327  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
328  if (c + i < I.getWidth())
329  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
330  else
331  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].R + I[r][c - i].R);
332  }
333  return result + filter[0] * I[r][c].R;
334  }
335 
336  static inline double filterXRightBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
337  const double *filter, unsigned int size)
338  {
339  double result;
340 
341  result = 0;
342 
343  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
344  if (c + i < I.getWidth())
345  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
346  else
347  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].G + I[r][c - i].G);
348  }
349  return result + filter[0] * I[r][c].G;
350  }
351 
352  static inline double filterXRightBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
353  const double *filter, unsigned int size)
354  {
355  double result;
356 
357  result = 0;
358 
359  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
360  if (c + i < I.getWidth())
361  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
362  else
363  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].B + I[r][c - i].B);
364  }
365  return result + filter[0] * I[r][c].B;
366  }
367 
368  static inline double filterX(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
369  unsigned int size)
370  {
371  double result;
372 
373  result = 0;
374 
375  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
376  result += filter[i] * (I[r][c + i] + I[r][c - i]);
377  }
378  return result + filter[0] * I[r][c];
379  }
380 
381  static inline double filterXLeftBorder(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
382  unsigned int size)
383  {
384  double result;
385 
386  result = 0;
387 
388  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
389  if (c > i)
390  result += filter[i] * (I[r][c + i] + I[r][c - i]);
391  else
392  result += filter[i] * (I[r][c + i] + I[r][i - c]);
393  }
394  return result + filter[0] * I[r][c];
395  }
396 
397  static inline double filterXRightBorder(const vpImage<double> &I, unsigned int r, unsigned int c,
398  const double *filter, unsigned int size)
399  {
400  double result;
401 
402  result = 0;
403 
404  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
405  if (c + i < I.getWidth())
406  result += filter[i] * (I[r][c + i] + I[r][c - i]);
407  else
408  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1] + I[r][c - i]);
409  }
410  return result + filter[0] * I[r][c];
411  }
412 
413  static void filterY(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
414  static void filterY(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
415  static void filterYR(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
416  static void filterYG(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
417  static void filterYB(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
418  static void filterY(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
419  static inline double filterY(const vpImage<unsigned char> &I, unsigned int r, unsigned int c, const double *filter,
420  unsigned int size)
421  {
422  double result;
423 
424  result = 0;
425 
426  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
427  result += filter[i] * (I[r + i][c] + I[r - i][c]);
428  }
429  return result + filter[0] * I[r][c];
430  }
431 
432  static inline double filterYR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
433  unsigned int size)
434  {
435  double result;
436 
437  result = 0;
438 
439  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
440  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
441  }
442  return result + filter[0] * I[r][c].R;
443  }
444  static inline double filterYG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
445  unsigned int size)
446  {
447  double result;
448 
449  result = 0;
450 
451  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
452  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
453  }
454  return result + filter[0] * I[r][c].G;
455  }
456  static inline double filterYB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
457  unsigned int size)
458  {
459  double result;
460 
461  result = 0;
462 
463  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
464  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
465  }
466  return result + filter[0] * I[r][c].B;
467  }
468 
469  double static inline filterYTopBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
470  const double *filter, unsigned int size)
471  {
472  double result;
473 
474  result = 0;
475 
476  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
477  if (r > i)
478  result += filter[i] * (I[r + i][c] + I[r - i][c]);
479  else
480  result += filter[i] * (I[r + i][c] + I[i - r][c]);
481  }
482  return result + filter[0] * I[r][c];
483  }
484 
485  double static inline filterYTopBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
486  const double *filter, unsigned int size)
487  {
488  double result;
489 
490  result = 0;
491 
492  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
493  if (r > i)
494  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
495  else
496  result += filter[i] * (I[r + i][c].R + I[i - r][c].R);
497  }
498  return result + filter[0] * I[r][c].R;
499  }
500 
501  double static inline filterYTopBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
502  const double *filter, unsigned int size)
503  {
504  double result;
505 
506  result = 0;
507 
508  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
509  if (r > i)
510  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
511  else
512  result += filter[i] * (I[r + i][c].G + I[i - r][c].G);
513  }
514  return result + filter[0] * I[r][c].G;
515  }
516 
517  double static inline filterYTopBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
518  const double *filter, unsigned int size)
519  {
520  double result;
521 
522  result = 0;
523 
524  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
525  if (r > i)
526  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
527  else
528  result += filter[i] * (I[r + i][c].B + I[i - r][c].B);
529  }
530  return result + filter[0] * I[r][c].B;
531  }
532 
533  double static inline filterYBottomBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
534  const double *filter, unsigned int size)
535  {
536  double result;
537 
538  result = 0;
539 
540  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
541  if (r + i < I.getHeight())
542  result += filter[i] * (I[r + i][c] + I[r - i][c]);
543  else
544  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c] + I[r - i][c]);
545  }
546  return result + filter[0] * I[r][c];
547  }
548 
549  double static inline filterYBottomBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
550  const double *filter, unsigned int size)
551  {
552  double result;
553 
554  result = 0;
555 
556  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
557  if (r + i < I.getHeight())
558  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
559  else
560  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].R + I[r - i][c].R);
561  }
562  return result + filter[0] * I[r][c].R;
563  }
564 
565  double static inline filterYBottomBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
566  const double *filter, unsigned int size)
567  {
568  double result;
569 
570  result = 0;
571 
572  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
573  if (r + i < I.getHeight())
574  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
575  else
576  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].G + I[r - i][c].G);
577  }
578  return result + filter[0] * I[r][c].G;
579  }
580 
581  double static inline filterYBottomBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
582  const double *filter, unsigned int size)
583  {
584  double result;
585 
586  result = 0;
587 
588  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
589  if (r + i < I.getHeight())
590  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
591  else
592  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].B + I[r - i][c].B);
593  }
594  return result + filter[0] * I[r][c].B;
595  }
596 
597  static inline double filterYTopBorder(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
598  unsigned int size)
599  {
600  double result;
601 
602  result = 0;
603 
604  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
605  if (r > i)
606  result += filter[i] * (I[r + i][c] + I[r - i][c]);
607  else
608  result += filter[i] * (I[r + i][c] + I[i - r][c]);
609  }
610  return result + filter[0] * I[r][c];
611  }
612 
613  static inline double filterYBottomBorder(const vpImage<double> &I, unsigned int r, unsigned int c,
614  const double *filter, unsigned int size)
615  {
616  double result;
617 
618  result = 0;
619 
620  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
621  if (r + i < I.getHeight())
622  result += filter[i] * (I[r + i][c] + I[r - i][c]);
623  else
624  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c] + I[r - i][c]);
625  }
626  return result + filter[0] * I[r][c];
627  }
628 
629  static inline double filterY(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
630  unsigned int size)
631  {
632  double result;
633 
634  result = 0;
635 
636  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
637  result += filter[i] * (I[r + i][c] + I[r - i][c]);
638  }
639  return result + filter[0] * I[r][c];
640  }
641 
642  static void gaussianBlur(const vpImage<unsigned char> &I, vpImage<double> &GI, unsigned int size = 7,
643  double sigma = 0., bool normalize = true);
644  static void gaussianBlur(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &GI, unsigned int size = 7,
645  double sigma = 0., bool normalize = true);
646  static void gaussianBlur(const vpImage<double> &I, vpImage<double> &GI, unsigned int size = 7, double sigma = 0.,
647  bool normalize = true);
655  template <class T> static double gaussianFilter(const vpImage<T> &fr, unsigned int r, unsigned int c)
656  {
657  // filter Gaussien
658  return (15.0 * fr[r][c] + 12.0 * (fr[r - 1][c] + fr[r][c - 1] + fr[r + 1][c] + fr[r][c + 1]) +
659  9.0 * (fr[r - 1][c - 1] + fr[r + 1][c - 1] + fr[r - 1][c + 1] + fr[r + 1][c + 1]) +
660  5.0 * (fr[r - 2][c] + fr[r][c - 2] + fr[r + 2][c] + fr[r][c + 2]) +
661  4.0 * (fr[r - 2][c + 1] + fr[r - 2][c - 1] + fr[r - 1][c - 2] + fr[r + 1][c - 2] + fr[r + 2][c - 1] +
662  fr[r + 2][c + 1] + fr[r - 1][c + 2] + fr[r + 1][c + 2]) +
663  2.0 * (fr[r - 2][c - 2] + fr[r + 2][c - 2] + fr[r - 2][c + 2] + fr[r + 2][c + 2])) /
664  159.0;
665  }
666  // operation pour pyramide gaussienne
667  static void getGaussPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
668  static void getGaussXPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
669  static void getGaussYPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
670 
671  static void getGaussianKernel(double *filter, unsigned int size, double sigma = 0., bool normalize = true);
672  static void getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma = 0., bool normalize = true);
673 
674  // fonction renvoyant le gradient en X de l'image I pour traitement
675  // pyramidal => dimension /2
676  static void getGradX(const vpImage<unsigned char> &I, vpImage<double> &dIx);
677  static void getGradX(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
678  static void getGradX(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
679  static void getGradXGauss2D(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *gaussianKernel,
680  const double *gaussianDerivativeKernel, unsigned int size);
681 
682  // fonction renvoyant le gradient en Y de l'image I
683  static void getGradY(const vpImage<unsigned char> &I, vpImage<double> &dIy);
684  static void getGradY(const vpImage<unsigned char> &I, vpImage<double> &dIy, const double *filter, unsigned int size);
685  static void getGradY(const vpImage<double> &I, vpImage<double> &dIy, const double *filter, unsigned int size);
686  static void getGradYGauss2D(const vpImage<unsigned char> &I, vpImage<double> &dIy, const double *gaussianKernel,
687  const double *gaussianDerivativeKernel, unsigned int size);
688 
689  static double getSobelKernelX(double *filter, unsigned int size);
690  static double getSobelKernelY(double *filter, unsigned int size);
691 };
692 
693 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:164
static double filterXLeftBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYTopBorderG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYBottomBorderG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double derivativeFilterX(const vpImage< T > &I, unsigned int r, unsigned int c)
Definition: vpImageFilter.h:82
static double filterXLeftBorder(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterX(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double derivativeFilterY(const vpImage< T > &I, unsigned int r, unsigned int c)
Definition: vpImageFilter.h:96
static double derivativeFilterX(const vpImage< T > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYBottomBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static unsigned char filterGaussYPyramidal(const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
static double filterXLeftBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorder(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYTopBorderR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterY(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYTopBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double derivativeFilterY(const vpImage< T > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYBottomBorder(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorderG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterX(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYTopBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double gaussianFilter(const vpImage< T > &fr, unsigned int r, unsigned int c)
static double filterXLeftBorderG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterY(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYTopBorder(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
unsigned int getHeight() const
Definition: vpImage.h:186
static double filterYBottomBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
static unsigned char filterGaussXPyramidal(const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
static double filterXLeftBorderR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorderR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
unsigned int getWidth() const
Definition: vpImage.h:244
static double filterYR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterYBottomBorderR(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
Various image filter, convolution, etc...
Definition: vpImageFilter.h:67