Visual Servoing Platform  version 3.5.1 under development (2022-07-01)
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, bool convolve = false);
162 
163  static void sepFilter(const vpImage<unsigned char> &I, vpImage<double> &If, const vpColVector &kernelH,
164  const vpColVector &kernelV);
165 
166  static void filter(const vpImage<unsigned char> &I, vpImage<double> &GI, const double *filter, unsigned int size);
167  static void filter(const vpImage<double> &I, vpImage<double> &GI, const double *filter, unsigned int size);
168 
169  static inline unsigned char filterGaussXPyramidal(const vpImage<unsigned char> &I, unsigned int i, unsigned int j)
170  {
171  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]) /
172  16.);
173  }
174  static inline unsigned char filterGaussYPyramidal(const vpImage<unsigned char> &I, unsigned int i, unsigned int j)
175  {
176  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]) /
177  16.);
178  }
179 
180  static void filterX(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
181  static void filterX(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
182  static void filterX(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
183  static void filterXR(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
184  static void filterXG(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
185  static void filterXB(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
186 
187  static inline double filterX(const vpImage<unsigned char> &I, unsigned int r, unsigned int c, const double *filter,
188  unsigned int size)
189  {
190  double result;
191 
192  result = 0;
193 
194  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
195  result += filter[i] * (I[r][c + i] + I[r][c - i]);
196  }
197  return result + filter[0] * I[r][c];
198  }
199 
200  static inline double filterXR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
201  unsigned int size)
202  {
203  double result;
204 
205  result = 0;
206 
207  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
208  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
209  }
210  return result + filter[0] * I[r][c].R;
211  }
212 
213  static inline double filterXG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
214  unsigned int size)
215  {
216  double result;
217 
218  result = 0;
219 
220  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
221  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
222  }
223  return result + filter[0] * I[r][c].G;
224  }
225 
226  static inline double filterXB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
227  unsigned int size)
228  {
229  double result;
230 
231  result = 0;
232 
233  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
234  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
235  }
236  return result + filter[0] * I[r][c].B;
237  }
238 
239  static inline double filterXLeftBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
240  const double *filter, unsigned int size)
241  {
242  double result;
243 
244  result = 0;
245 
246  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
247  if (c > i)
248  result += filter[i] * (I[r][c + i] + I[r][c - i]);
249  else
250  result += filter[i] * (I[r][c + i] + I[r][i - c]);
251  }
252  return result + filter[0] * I[r][c];
253  }
254 
255  static inline double filterXLeftBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
256  const double *filter, unsigned int size)
257  {
258  double result;
259 
260  result = 0;
261 
262  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
263  if (c > i)
264  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
265  else
266  result += filter[i] * (I[r][c + i].R + I[r][i - c].R);
267  }
268  return result + filter[0] * I[r][c].R;
269  }
270 
271  static inline double filterXLeftBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
272  const double *filter, unsigned int size)
273  {
274  double result;
275 
276  result = 0;
277 
278  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
279  if (c > i)
280  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
281  else
282  result += filter[i] * (I[r][c + i].G + I[r][i - c].G);
283  }
284  return result + filter[0] * I[r][c].G;
285  }
286 
287  static inline double filterXLeftBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
288  const double *filter, unsigned int size)
289  {
290  double result;
291 
292  result = 0;
293 
294  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
295  if (c > i)
296  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
297  else
298  result += filter[i] * (I[r][c + i].B + I[r][i - c].B);
299  }
300  return result + filter[0] * I[r][c].B;
301  }
302 
303  static inline double filterXRightBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
304  const double *filter, unsigned int size)
305  {
306  double result;
307 
308  result = 0;
309 
310  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
311  if (c + i < I.getWidth())
312  result += filter[i] * (I[r][c + i] + I[r][c - i]);
313  else
314  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1] + I[r][c - i]);
315  }
316  return result + filter[0] * I[r][c];
317  }
318 
319  static inline double filterXRightBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
320  const double *filter, unsigned int size)
321  {
322  double result;
323 
324  result = 0;
325 
326  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
327  if (c + i < I.getWidth())
328  result += filter[i] * (I[r][c + i].R + I[r][c - i].R);
329  else
330  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].R + I[r][c - i].R);
331  }
332  return result + filter[0] * I[r][c].R;
333  }
334 
335  static inline double filterXRightBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
336  const double *filter, unsigned int size)
337  {
338  double result;
339 
340  result = 0;
341 
342  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
343  if (c + i < I.getWidth())
344  result += filter[i] * (I[r][c + i].G + I[r][c - i].G);
345  else
346  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].G + I[r][c - i].G);
347  }
348  return result + filter[0] * I[r][c].G;
349  }
350 
351  static inline double filterXRightBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
352  const double *filter, unsigned int size)
353  {
354  double result;
355 
356  result = 0;
357 
358  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
359  if (c + i < I.getWidth())
360  result += filter[i] * (I[r][c + i].B + I[r][c - i].B);
361  else
362  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1].B + I[r][c - i].B);
363  }
364  return result + filter[0] * I[r][c].B;
365  }
366 
367  static inline double filterX(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
368  unsigned int size)
369  {
370  double result;
371 
372  result = 0;
373 
374  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
375  result += filter[i] * (I[r][c + i] + I[r][c - i]);
376  }
377  return result + filter[0] * I[r][c];
378  }
379 
380  static inline double filterXLeftBorder(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
381  unsigned int size)
382  {
383  double result;
384 
385  result = 0;
386 
387  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
388  if (c > i)
389  result += filter[i] * (I[r][c + i] + I[r][c - i]);
390  else
391  result += filter[i] * (I[r][c + i] + I[r][i - c]);
392  }
393  return result + filter[0] * I[r][c];
394  }
395 
396  static inline double filterXRightBorder(const vpImage<double> &I, unsigned int r, unsigned int c,
397  const double *filter, unsigned int size)
398  {
399  double result;
400 
401  result = 0;
402 
403  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
404  if (c + i < I.getWidth())
405  result += filter[i] * (I[r][c + i] + I[r][c - i]);
406  else
407  result += filter[i] * (I[r][2 * I.getWidth() - c - i - 1] + I[r][c - i]);
408  }
409  return result + filter[0] * I[r][c];
410  }
411 
412  static void filterY(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
413  static void filterY(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
414  static void filterYR(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
415  static void filterYG(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
416  static void filterYB(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &dIx, const double *filter, unsigned int size);
417  static void filterY(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
418  static inline double filterY(const vpImage<unsigned char> &I, unsigned int r, unsigned int c, const double *filter,
419  unsigned int size)
420  {
421  double result;
422 
423  result = 0;
424 
425  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
426  result += filter[i] * (I[r + i][c] + I[r - i][c]);
427  }
428  return result + filter[0] * I[r][c];
429  }
430 
431  static inline double filterYR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
432  unsigned int size)
433  {
434  double result;
435 
436  result = 0;
437 
438  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
439  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
440  }
441  return result + filter[0] * I[r][c].R;
442  }
443  static inline double filterYG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
444  unsigned int size)
445  {
446  double result;
447 
448  result = 0;
449 
450  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
451  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
452  }
453  return result + filter[0] * I[r][c].G;
454  }
455  static inline double filterYB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
456  unsigned int size)
457  {
458  double result;
459 
460  result = 0;
461 
462  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
463  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
464  }
465  return result + filter[0] * I[r][c].B;
466  }
467 
468  double static inline filterYTopBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
469  const double *filter, unsigned int size)
470  {
471  double result;
472 
473  result = 0;
474 
475  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
476  if (r > i)
477  result += filter[i] * (I[r + i][c] + I[r - i][c]);
478  else
479  result += filter[i] * (I[r + i][c] + I[i - r][c]);
480  }
481  return result + filter[0] * I[r][c];
482  }
483 
484  double static inline filterYTopBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
485  unsigned int size)
486  {
487  double result;
488 
489  result = 0;
490 
491  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
492  if (r > i)
493  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
494  else
495  result += filter[i] * (I[r + i][c].R + I[i - r][c].R);
496  }
497  return result + filter[0] * I[r][c].R;
498  }
499 
500  double static inline filterYTopBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
501  unsigned int size)
502  {
503  double result;
504 
505  result = 0;
506 
507  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
508  if (r > i)
509  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
510  else
511  result += filter[i] * (I[r + i][c].G + I[i - r][c].G);
512  }
513  return result + filter[0] * I[r][c].G;
514  }
515 
516  double static inline filterYTopBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c, const double *filter,
517  unsigned int size)
518  {
519  double result;
520 
521  result = 0;
522 
523  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
524  if (r > i)
525  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
526  else
527  result += filter[i] * (I[r + i][c].B + I[i - r][c].B);
528  }
529  return result + filter[0] * I[r][c].B;
530  }
531 
532  double static inline filterYBottomBorder(const vpImage<unsigned char> &I, unsigned int r, unsigned int c,
533  const double *filter, unsigned int size)
534  {
535  double result;
536 
537  result = 0;
538 
539  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
540  if (r + i < I.getHeight())
541  result += filter[i] * (I[r + i][c] + I[r - i][c]);
542  else
543  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c] + I[r - i][c]);
544  }
545  return result + filter[0] * I[r][c];
546  }
547 
548  double static inline filterYBottomBorderR(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
549  const double *filter, unsigned int size)
550  {
551  double result;
552 
553  result = 0;
554 
555  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
556  if (r + i < I.getHeight())
557  result += filter[i] * (I[r + i][c].R + I[r - i][c].R);
558  else
559  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].R + I[r - i][c].R);
560  }
561  return result + filter[0] * I[r][c].R;
562  }
563 
564  double static inline filterYBottomBorderG(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
565  const double *filter, unsigned int size)
566  {
567  double result;
568 
569  result = 0;
570 
571  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
572  if (r + i < I.getHeight())
573  result += filter[i] * (I[r + i][c].G + I[r - i][c].G);
574  else
575  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].G + I[r - i][c].G);
576  }
577  return result + filter[0] * I[r][c].G;
578  }
579 
580  double static inline filterYBottomBorderB(const vpImage<vpRGBa> &I, unsigned int r, unsigned int c,
581  const double *filter, unsigned int size)
582  {
583  double result;
584 
585  result = 0;
586 
587  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
588  if (r + i < I.getHeight())
589  result += filter[i] * (I[r + i][c].B + I[r - i][c].B);
590  else
591  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c].B + I[r - i][c].B);
592  }
593  return result + filter[0] * I[r][c].B;
594  }
595 
596  static inline double filterYTopBorder(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
597  unsigned int size)
598  {
599  double result;
600 
601  result = 0;
602 
603  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
604  if (r > i)
605  result += filter[i] * (I[r + i][c] + I[r - i][c]);
606  else
607  result += filter[i] * (I[r + i][c] + I[i - r][c]);
608  }
609  return result + filter[0] * I[r][c];
610  }
611 
612  static inline double filterYBottomBorder(const vpImage<double> &I, unsigned int r, unsigned int c,
613  const double *filter, unsigned int size)
614  {
615  double result;
616 
617  result = 0;
618 
619  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
620  if (r + i < I.getHeight())
621  result += filter[i] * (I[r + i][c] + I[r - i][c]);
622  else
623  result += filter[i] * (I[2 * I.getHeight() - r - i - 1][c] + I[r - i][c]);
624  }
625  return result + filter[0] * I[r][c];
626  }
627 
628  static inline double filterY(const vpImage<double> &I, unsigned int r, unsigned int c, const double *filter,
629  unsigned int size)
630  {
631  double result;
632 
633  result = 0;
634 
635  for (unsigned int i = 1; i <= (size - 1) / 2; i++) {
636  result += filter[i] * (I[r + i][c] + I[r - i][c]);
637  }
638  return result + filter[0] * I[r][c];
639  }
640 
641  static void gaussianBlur(const vpImage<unsigned char> &I, vpImage<double> &GI, unsigned int size = 7,
642  double sigma = 0., bool normalize = true);
643  static void gaussianBlur(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &GI, unsigned int size = 7, double sigma = 0.,
644  bool normalize = true);
645  static void gaussianBlur(const vpImage<double> &I, vpImage<double> &GI, unsigned int size = 7, double sigma = 0.,
646  bool normalize = true);
654  template <class T> static double gaussianFilter(const vpImage<T> &fr, unsigned int r, unsigned int c)
655  {
656  // filter Gaussien
657  return (15.0 * fr[r][c] + 12.0 * (fr[r - 1][c] + fr[r][c - 1] + fr[r + 1][c] + fr[r][c + 1]) +
658  9.0 * (fr[r - 1][c - 1] + fr[r + 1][c - 1] + fr[r - 1][c + 1] + fr[r + 1][c + 1]) +
659  5.0 * (fr[r - 2][c] + fr[r][c - 2] + fr[r + 2][c] + fr[r][c + 2]) +
660  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] +
661  fr[r + 2][c + 1] + fr[r - 1][c + 2] + fr[r + 1][c + 2]) +
662  2.0 * (fr[r - 2][c - 2] + fr[r + 2][c - 2] + fr[r - 2][c + 2] + fr[r + 2][c + 2])) /
663  159.0;
664  }
665  // operation pour pyramide gaussienne
666  static void getGaussPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
667  static void getGaussXPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
668  static void getGaussYPyramidal(const vpImage<unsigned char> &I, vpImage<unsigned char> &GI);
669 
670  static void getGaussianKernel(double *filter, unsigned int size, double sigma = 0., bool normalize = true);
671  static void getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma = 0., bool normalize = true);
672 
673  // fonction renvoyant le gradient en X de l'image I pour traitement
674  // pyramidal => dimension /2
675  static void getGradX(const vpImage<unsigned char> &I, vpImage<double> &dIx);
676  static void getGradX(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
677  static void getGradX(const vpImage<double> &I, vpImage<double> &dIx, const double *filter, unsigned int size);
678  static void getGradXGauss2D(const vpImage<unsigned char> &I, vpImage<double> &dIx, const double *gaussianKernel,
679  const double *gaussianDerivativeKernel, unsigned int size);
680 
681  // fonction renvoyant le gradient en Y de l'image I
682  static void getGradY(const vpImage<unsigned char> &I, vpImage<double> &dIy);
683  static void getGradY(const vpImage<unsigned char> &I, vpImage<double> &dIy, const double *filter, unsigned int size);
684  static void getGradY(const vpImage<double> &I, vpImage<double> &dIy, const double *filter, unsigned int size);
685  static void getGradYGauss2D(const vpImage<unsigned char> &I, vpImage<double> &dIy, const double *gaussianKernel,
686  const double *gaussianDerivativeKernel, unsigned int size);
687 
688  static double getSobelKernelX(double *filter, unsigned int size);
689  static double getSobelKernelY(double *filter, unsigned int size);
690 };
691 
692 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
Various image filter, convolution, etc...
Definition: vpImageFilter.h:68
static unsigned char filterGaussXPyramidal(const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
static double filterXG(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 filterYTopBorderG(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static void filterYB(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, 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 filterXLeftBorder(const vpImage< unsigned char > &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 derivativeFilterY(const vpImage< T > &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 filterXRightBorderB(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)
static double filterYTopBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static void filterXB(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, const double *filter, unsigned int size)
static double filterYR(const vpImage< vpRGBa > &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 filterXLeftBorderB(const vpImage< vpRGBa > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static void filterYR(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, 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 filterXR(const vpImage< vpRGBa > &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 filterYBottomBorder(const vpImage< unsigned char > &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 filterXLeftBorderR(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 filterY(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXLeftBorderG(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, 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)
static double filterXLeftBorder(const vpImage< double > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static void filterXR(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, 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 void filterYG(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, 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 void filterXG(const vpImage< vpRGBa > &I, vpImage< vpRGBa > &dIx, 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 filterX(const vpImage< unsigned char > &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 filterYBottomBorderG(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 gaussianFilter(const vpImage< T > &fr, unsigned int r, unsigned int c)
unsigned int getWidth() const
Definition: vpImage.h:246
unsigned int getHeight() const
Definition: vpImage.h:188
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:154