47 #include <visp3/core/vpConfig.h> 48 #include <visp3/core/vpDebug.h> 49 #include <visp3/core/vpException.h> 50 #include <visp3/core/vpImageException.h> 51 #include <visp3/core/vpImagePoint.h> 52 #include <visp3/core/vpRGBa.h> 53 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)) 54 #include <visp3/core/vpThread.h> 119 template <
class Type> std::ostream &operator<<(std::ostream &, const vpImage<Type> &);
121 std::ostream &operator<<(std::ostream &, const vpImage<unsigned char> &);
122 std::ostream &operator<<(std::ostream &, const vpImage<char> &);
123 std::ostream &operator<<(std::ostream &, const vpImage<float> &);
124 std::ostream &operator<<(std::ostream &, const vpImage<double> &);
128 template <
class Type>
class vpImage 140 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 144 vpImage(
unsigned int height,
unsigned int width);
147 vpImage(
unsigned int height,
unsigned int width, Type value);
149 vpImage(Type *
const array,
const unsigned int height,
const unsigned int width,
const bool copyData =
false);
169 inline unsigned int getCols()
const {
return width; }
178 inline unsigned int getHeight()
const {
return height; }
207 inline unsigned int getRows()
const {
return height; }
215 inline unsigned int getSize()
const {
return width * height; }
218 Type
getValue(
double i,
double j)
const;
229 inline unsigned int getWidth()
const {
return width; }
235 void init(
unsigned int height,
unsigned int width);
237 void init(
unsigned int height,
unsigned int width, Type value);
239 void init(Type *
const array,
const unsigned int height,
const unsigned int width,
const bool copyData =
false);
246 inline Type *
operator[](
const unsigned int i) {
return row[i]; }
250 inline const Type *
operator[](
unsigned int i)
const {
return row[i]; }
251 inline const Type *
operator[](
int i)
const {
return row[i]; }
260 inline Type
operator()(
const unsigned int i,
const unsigned int j)
const {
return bitmap[i * width + j]; }
266 inline void operator()(
const unsigned int i,
const unsigned int j,
const Type &v) { bitmap[i * width + j] = v; }
280 unsigned int i = (
unsigned int)ip.
get_i();
281 unsigned int j = (
unsigned int)ip.
get_j();
283 return bitmap[i * width + j];
296 unsigned int i = (
unsigned int)ip.
get_i();
297 unsigned int j = (
unsigned int)ip.
get_j();
299 bitmap[i * width + j] = v;
310 friend std::ostream &operator<<<>(std::ostream &s,
const vpImage<Type> &I);
311 friend std::ostream &operator<<(std::ostream &s, const vpImage<unsigned char> &I);
312 friend std::ostream &operator<<(std::ostream &s, const vpImage<char> &I);
313 friend std::ostream &operator<<(std::ostream &s, const vpImage<float> &I);
314 friend std::ostream &operator<<(std::ostream &s, const vpImage<double> &I);
317 void performLut(
const Type (&lut)[256],
const unsigned int nbThreads = 1);
323 void resize(
const unsigned int h,
const unsigned int w);
325 void resize(
const unsigned int h,
const unsigned int w,
const Type &val);
336 unsigned int npixels;
342 template <
class Type> std::ostream &operator<<(std::ostream &s, const vpImage<Type> &I)
348 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
349 for (
unsigned int j = 0; j < I.
getWidth() - 1; j++) {
357 if (i < I.getHeight() - 1) {
365 inline std::ostream &operator<<(std::ostream &s, const vpImage<unsigned char> &I)
371 std::ios_base::fmtflags original_flags = s.flags();
373 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
374 for (
unsigned int j = 0; j < I.
getWidth() - 1; j++) {
375 s << std::setw(3) << static_cast<unsigned>(I[i][j]) <<
" ";
379 s << std::setw(3) << static_cast<unsigned>(I[i][I.
getWidth() - 1]);
387 s.flags(original_flags);
391 inline std::ostream &operator<<(std::ostream &s, const vpImage<char> &I)
397 std::ios_base::fmtflags original_flags = s.flags();
399 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
400 for (
unsigned int j = 0; j < I.
getWidth() - 1; j++) {
401 s << std::setw(4) << static_cast<int>(I[i][j]) <<
" ";
405 s << std::setw(4) << static_cast<int>(I[i][I.
getWidth() - 1]);
413 s.flags(original_flags);
417 inline std::ostream &operator<<(std::ostream &s, const vpImage<float> &I)
423 std::ios_base::fmtflags original_flags = s.flags();
426 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
427 for (
unsigned int j = 0; j < I.
getWidth() - 1; j++) {
435 if (i < I.getHeight() - 1) {
440 s.flags(original_flags);
444 inline std::ostream &operator<<(std::ostream &s, const vpImage<double> &I)
450 std::ios_base::fmtflags original_flags = s.flags();
453 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
454 for (
unsigned int j = 0; j < I.
getWidth() - 1; j++) {
462 if (i < I.getHeight() - 1) {
467 s.flags(original_flags);
471 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)) 474 struct ImageLut_Param_t {
475 unsigned int m_start_index;
476 unsigned int m_end_index;
478 unsigned char m_lut[256];
479 unsigned char *m_bitmap;
481 ImageLut_Param_t() : m_start_index(0), m_end_index(0), m_lut(), m_bitmap(NULL) {}
483 ImageLut_Param_t(
const unsigned int start_index,
const unsigned int end_index,
unsigned char *
bitmap)
484 : m_start_index(start_index), m_end_index(end_index), m_lut(), m_bitmap(bitmap)
491 ImageLut_Param_t *imageLut_param =
static_cast<ImageLut_Param_t *
>(args);
492 unsigned int start_index = imageLut_param->m_start_index;
493 unsigned int end_index = imageLut_param->m_end_index;
495 unsigned char *
bitmap = imageLut_param->m_bitmap;
497 unsigned char *ptrStart = bitmap + start_index;
498 unsigned char *ptrEnd = bitmap + end_index;
499 unsigned char *ptrCurrent = ptrStart;
506 if (end_index - start_index >= 8) {
508 for (; ptrCurrent <= ptrEnd - 8;) {
509 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
512 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
515 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
518 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
521 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
524 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
527 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
530 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
535 for (; ptrCurrent != ptrEnd; ++ptrCurrent) {
536 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent];
542 struct ImageLutRGBa_Param_t {
543 unsigned int m_start_index;
544 unsigned int m_end_index;
547 unsigned char *m_bitmap;
549 ImageLutRGBa_Param_t() : m_start_index(0), m_end_index(0), m_lut(), m_bitmap(NULL) {}
551 ImageLutRGBa_Param_t(
const unsigned int start_index,
const unsigned int end_index,
unsigned char *
bitmap)
552 : m_start_index(start_index), m_end_index(end_index), m_lut(), m_bitmap(bitmap)
559 ImageLutRGBa_Param_t *imageLut_param =
static_cast<ImageLutRGBa_Param_t *
>(args);
560 unsigned int start_index = imageLut_param->m_start_index;
561 unsigned int end_index = imageLut_param->m_end_index;
563 unsigned char *
bitmap = imageLut_param->m_bitmap;
565 unsigned char *ptrStart = bitmap + start_index * 4;
566 unsigned char *ptrEnd = bitmap + end_index * 4;
567 unsigned char *ptrCurrent = ptrStart;
569 if (end_index - start_index >= 4 * 2) {
571 for (; ptrCurrent <= ptrEnd - 4 * 2;) {
572 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].R;
574 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].G;
576 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].B;
578 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].A;
581 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].R;
583 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].G;
585 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].B;
587 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].A;
592 while (ptrCurrent != ptrEnd) {
593 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].R;
596 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].G;
599 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].B;
602 *ptrCurrent = imageLut_param->m_lut[*ptrCurrent].A;
628 for (
unsigned int i = 0; i < npixels; i++)
651 if (h != this->height) {
659 if ((h != this->height) || (w != this->width)) {
670 npixels = width * height;
673 bitmap =
new Type[npixels];
680 row =
new Type *[height];
686 for (i = 0; i < height; i++)
687 row[i] =
bitmap + i * width;
703 template <
class Type>
704 void vpImage<Type>::init(Type *
const array,
const unsigned int h,
const unsigned int w,
const bool copyData)
706 if (h != this->height) {
714 if ((copyData && ((h != this->height) || (w != this->width))) || !copyData) {
724 npixels = width * height;
728 bitmap =
new Type[npixels];
735 memcpy(
bitmap, array, (
size_t)(npixels *
sizeof(Type)));
742 row =
new Type *[height];
747 for (
unsigned int i = 0; i < height; i++) {
748 row[i] =
bitmap + i * width;
770 template <
class Type>
772 :
bitmap(NULL),
display(NULL), npixels(0), width(0), height(0), row(NULL)
794 template <
class Type>
796 :
bitmap(NULL),
display(NULL), npixels(0), width(0), height(0), row(NULL)
816 template <
class Type>
818 :
bitmap(NULL),
display(NULL), npixels(0), width(0), height(0), row(NULL)
820 init(array, h, w, copyData);
915 template <
class Type>
922 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 926 template <
class Type>
947 for (
unsigned int i = 0; i < npixels; i++) {
962 for (
unsigned int i = 0; i < npixels; i++)
977 for (
unsigned int i = 0; i < npixels; i++) {
1009 for (
unsigned int i = 0; i < npixels; i++)
1029 for (
unsigned int i = 0; i < npixels; i++) {
1056 return !(*
this == I);
1104 int itl = (int)topLeft.
get_i();
1105 int jtl = (int)topLeft.
get_j();
1107 int dest_ibegin = 0;
1108 int dest_jbegin = 0;
1111 int dest_w = (int)this->
getWidth();
1118 if (itl >= dest_h || jtl >= dest_w)
1131 if (src_w - src_jbegin > dest_w - dest_jbegin)
1132 wsize = dest_w - dest_jbegin;
1134 wsize = src_w - src_jbegin;
1136 if (src_h - src_ibegin > dest_h - dest_ibegin)
1137 hsize = dest_h - dest_ibegin;
1139 hsize = src_h - src_ibegin;
1141 for (
int i = 0; i < hsize; i++) {
1142 Type *srcBitmap = src.
bitmap + ((src_ibegin + i) * src_w + src_jbegin);
1143 Type *destBitmap = this->
bitmap + ((dest_ibegin + i) * dest_w + dest_jbegin);
1145 memcpy(destBitmap, srcBitmap, (
size_t)wsize *
sizeof(Type));
1181 unsigned int h = height / 2;
1182 unsigned int w = width / 2;
1184 for (
unsigned int i = 0; i < h; i++)
1185 for (
unsigned int j = 0; j < w; j++)
1186 res[i][j] = (*
this)[i << 1][j << 1];
1206 template <
class Type>
1209 unsigned int h = height / v_scale;
1210 unsigned int w = width / h_scale;
1212 for (
unsigned int i = 0; i < h; i++)
1213 for (
unsigned int j = 0; j < w; j++)
1214 sampled[i][j] = (*
this)[i * v_scale][j * h_scale];
1243 unsigned int h = height / 4;
1244 unsigned int w = width / 4;
1246 for (
unsigned int i = 0; i < h; i++)
1247 for (
unsigned int j = 0; j < w; j++)
1248 res[i][j] = (*
this)[i << 2][j << 2];
1291 for (
int i = 0; i < h; i++)
1292 for (
int j = 0; j < w; j++)
1293 res[i][j] = (*
this)[i >> 1][j >> 1];
1304 for (
int i = 0; i < h; i += 2)
1305 for (
int j = 1; j < w - 1; j += 2)
1306 res[i][j] = (Type)(0.5 * ((*this)[i >> 1][j >> 1] + (*this)[i >> 1][(j >> 1) + 1]));
1309 for (
int i = 1; i < h - 1; i += 2)
1310 for (
int j = 0; j < w; j += 2)
1311 res[i][j] = (Type)(0.5 * ((*this)[i >> 1][j >> 1] + (*this)[(i >> 1) + 1][j >> 1]));
1314 for (
int i = 1; i < h - 1; i += 2)
1315 for (
int j = 1; j < w - 1; j += 2)
1316 res[i][j] = (Type)(0.25 * ((*this)[i >> 1][j >> 1] + (*this)[i >> 1][(j >> 1) + 1] +
1317 (*
this)[(i >> 1) + 1][j >> 1] + (*
this)[(i >> 1) + 1][(j >> 1) + 1]));
1340 unsigned int iround, jround;
1341 double rfrac, cfrac;
1343 iround = (
unsigned int)floor(i);
1344 jround = (
unsigned int)floor(j);
1346 if (iround >= height || jround >= width) {
1351 i = (double)(height - 1);
1354 j = (double)(width - 1);
1356 double rratio = i - (double)iround;
1359 double cratio = j - (double)jround;
1363 rfrac = 1.0f - rratio;
1364 cfrac = 1.0f - cratio;
1366 double value = ((double)row[iround][jround] * rfrac + (
double)row[iround + 1][jround] * rratio) * cfrac +
1367 ((
double)row[iround][jround + 1] * rfrac + (double)row[iround + 1][jround + 1] * rratio) * cratio;
1390 unsigned int iround, jround;
1391 double rfrac, cfrac;
1393 iround = (
unsigned int)floor(i);
1394 jround = (
unsigned int)floor(j);
1396 if (iround >= height || jround >= width) {
1401 i = (double)(height - 1);
1404 j = (double)(width - 1);
1406 double rratio = i - (double)iround;
1409 double cratio = j - (double)jround;
1413 rfrac = 1.0f - rratio;
1414 cfrac = 1.0f - cratio;
1416 double value = ((double)row[iround][jround] * rfrac + (
double)row[iround + 1][jround] * rratio) * cfrac +
1417 ((
double)row[iround][jround + 1] * rfrac + (double)row[iround + 1][jround + 1] * rratio) * cratio;
1423 unsigned int iround, jround;
1424 double rfrac, cfrac;
1426 iround = (
unsigned int)floor(i);
1427 jround = (
unsigned int)floor(j);
1429 if (iround >= height || jround >= width) {
1434 i = (double)(height - 1);
1437 j = (double)(width - 1);
1439 double rratio = i - (double)iround;
1442 double cratio = j - (double)jround;
1446 rfrac = 1.0f - rratio;
1447 cfrac = 1.0f - cratio;
1449 double valueR = ((double)row[iround][jround].R * rfrac + (
double)row[iround + 1][jround].R * rratio) * cfrac +
1450 ((
double)row[iround][jround + 1].R * rfrac + (double)row[iround + 1][jround + 1].R * rratio) * cratio;
1451 double valueG = ((double)row[iround][jround].G * rfrac + (
double)row[iround + 1][jround].G * rratio) * cfrac +
1452 ((
double)row[iround][jround + 1].G * rfrac + (double)row[iround + 1][jround + 1].G * rratio) * cratio;
1453 double valueB = ((double)row[iround][jround].B * rfrac + (
double)row[iround + 1][jround].B * rratio) * cfrac +
1454 ((
double)row[iround][jround + 1].B * rfrac + (double)row[iround + 1][jround + 1].B * rratio) * cratio;
1478 unsigned int iround, jround;
1479 double rfrac, cfrac;
1481 iround = (
unsigned int)floor(ip.
get_i());
1482 jround = (
unsigned int)floor(ip.
get_j());
1484 if (iround >= height || jround >= width) {
1488 if (ip.
get_i() > height - 1)
1489 ip.
set_i((
double)(height - 1));
1491 if (ip.
get_j() > width - 1)
1492 ip.
set_j((
double)(width - 1));
1494 double rratio = ip.
get_i() - (double)iround;
1497 double cratio = ip.
get_j() - (double)jround;
1501 rfrac = 1.0f - rratio;
1502 cfrac = 1.0f - cratio;
1504 double value = ((double)row[iround][jround] * rfrac + (
double)row[iround + 1][jround] * rratio) * cfrac +
1505 ((
double)row[iround][jround + 1] * rfrac + (double)row[iround + 1][jround + 1] * rratio) * cratio;
1511 unsigned int iround, jround;
1512 double rfrac, cfrac;
1514 iround = (
unsigned int)floor(ip.
get_i());
1515 jround = (
unsigned int)floor(ip.
get_j());
1517 if (iround >= height || jround >= width) {
1521 if (ip.
get_i() > height - 1)
1522 ip.
set_i((
double)(height - 1));
1524 if (ip.
get_j() > width - 1)
1525 ip.
set_j((
double)(width - 1));
1527 double rratio = ip.
get_i() - (double)iround;
1530 double cratio = ip.
get_j() - (double)jround;
1534 rfrac = 1.0f - rratio;
1535 cfrac = 1.0f - cratio;
1537 double value = ((double)row[iround][jround] * rfrac + (
double)row[iround + 1][jround] * rratio) * cfrac +
1538 ((
double)row[iround][jround + 1] * rfrac + (double)row[iround + 1][jround + 1] * rratio) * cratio;
1544 unsigned int iround, jround;
1545 double rfrac, cfrac;
1547 iround = (
unsigned int)floor(ip.
get_i());
1548 jround = (
unsigned int)floor(ip.
get_j());
1550 if (iround >= height || jround >= width) {
1554 if (ip.
get_i() > height - 1)
1555 ip.
set_i((
double)(height - 1));
1557 if (ip.
get_j() > width - 1)
1558 ip.
set_j((
double)(width - 1));
1560 double rratio = ip.
get_i() - (double)iround;
1563 double cratio = ip.
get_j() - (double)jround;
1567 rfrac = 1.0f - rratio;
1568 cfrac = 1.0f - cratio;
1570 double valueR = ((double)row[iround][jround].R * rfrac + (
double)row[iround + 1][jround].R * rratio) * cfrac +
1571 ((
double)row[iround][jround + 1].R * rfrac + (double)row[iround + 1][jround + 1].R * rratio) * cratio;
1572 double valueG = ((double)row[iround][jround].G * rfrac + (
double)row[iround + 1][jround].G * rratio) * cfrac +
1573 ((
double)row[iround][jround + 1].G * rfrac + (double)row[iround + 1][jround + 1].G * rratio) * cratio;
1574 double valueB = ((double)row[iround][jround].B * rfrac + (
double)row[iround + 1][jround].B * rratio) * cfrac +
1575 ((
double)row[iround][jround + 1].B * rfrac + (double)row[iround + 1][jround + 1].B * rratio) * cratio;
1616 std::cout << me << std::endl;
1647 std::cout << me << std::endl;
1672 std::cerr <<
"Not implemented !" << std::endl;
1687 unsigned char *ptrStart = (
unsigned char *)
bitmap;
1688 unsigned char *ptrEnd = ptrStart + size;
1689 unsigned char *ptrCurrent = ptrStart;
1691 bool use_single_thread = (nbThreads == 0 || nbThreads == 1);
1692 #if !defined(VISP_HAVE_PTHREAD) && !defined(_WIN32) 1693 use_single_thread =
true;
1696 if (!use_single_thread &&
getSize() <= nbThreads) {
1697 use_single_thread =
true;
1700 if (use_single_thread) {
1703 while (ptrCurrent != ptrEnd) {
1704 *ptrCurrent = lut[*ptrCurrent];
1708 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)) 1711 std::vector<vpThread *> threadpool;
1712 std::vector<ImageLut_Param_t *> imageLutParams;
1714 unsigned int image_size =
getSize();
1715 unsigned int step = image_size / nbThreads;
1716 unsigned int last_step = image_size - step * (nbThreads - 1);
1718 for (
unsigned int index = 0; index < nbThreads; index++) {
1719 unsigned int start_index = index * step;
1720 unsigned int end_index = (index + 1) * step;
1722 if (index == nbThreads - 1) {
1723 end_index = start_index + last_step;
1726 ImageLut_Param_t *imageLut_param =
new ImageLut_Param_t(start_index, end_index,
bitmap);
1727 memcpy(imageLut_param->m_lut, lut, 256 *
sizeof(
unsigned char));
1729 imageLutParams.push_back(imageLut_param);
1733 threadpool.push_back(imageLut_thread);
1736 for (
size_t cpt = 0; cpt < threadpool.size(); cpt++) {
1738 threadpool[cpt]->join();
1742 for (
size_t cpt = 0; cpt < threadpool.size(); cpt++) {
1743 delete threadpool[cpt];
1746 for (
size_t cpt = 0; cpt < imageLutParams.size(); cpt++) {
1747 delete imageLutParams[cpt];
1764 unsigned char *ptrStart = (
unsigned char *)
bitmap;
1765 unsigned char *ptrEnd = ptrStart + size * 4;
1766 unsigned char *ptrCurrent = ptrStart;
1768 bool use_single_thread = (nbThreads == 0 || nbThreads == 1);
1769 #if !defined(VISP_HAVE_PTHREAD) && !defined(_WIN32) 1770 use_single_thread =
true;
1773 if (!use_single_thread &&
getSize() <= nbThreads) {
1774 use_single_thread =
true;
1777 if (use_single_thread) {
1779 while (ptrCurrent != ptrEnd) {
1780 *ptrCurrent = lut[*ptrCurrent].R;
1783 *ptrCurrent = lut[*ptrCurrent].G;
1786 *ptrCurrent = lut[*ptrCurrent].B;
1789 *ptrCurrent = lut[*ptrCurrent].A;
1793 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)) 1795 std::vector<vpThread *> threadpool;
1796 std::vector<ImageLutRGBa_Param_t *> imageLutParams;
1798 unsigned int image_size =
getSize();
1799 unsigned int step = image_size / nbThreads;
1800 unsigned int last_step = image_size - step * (nbThreads - 1);
1802 for (
unsigned int index = 0; index < nbThreads; index++) {
1803 unsigned int start_index = index * step;
1804 unsigned int end_index = (index + 1) * step;
1806 if (index == nbThreads - 1) {
1807 end_index = start_index + last_step;
1810 ImageLutRGBa_Param_t *imageLut_param =
new ImageLutRGBa_Param_t(start_index, end_index, (
unsigned char *)
bitmap);
1811 memcpy(imageLut_param->m_lut, lut, 256 *
sizeof(
vpRGBa));
1813 imageLutParams.push_back(imageLut_param);
1817 threadpool.push_back(imageLut_thread);
1820 for (
size_t cpt = 0; cpt < threadpool.size(); cpt++) {
1822 threadpool[cpt]->join();
1826 for (
size_t cpt = 0; cpt < threadpool.size(); cpt++) {
1827 delete threadpool[cpt];
1830 for (
size_t cpt = 0; cpt < imageLutParams.size(); cpt++) {
1831 delete imageLutParams[cpt];
1842 swap(first.npixels, second.npixels);
1843 swap(first.width, second.width);
1844 swap(first.height, second.height);
1845 swap(first.row, second.row);
void doubleSizeImage(vpImage< Type > &res)
Class that defines generic functionnalities for display.
void halfSizeImage(vpImage< Type > &res) const
Type getMinValue() const
Return the minimum value within the bitmap.
void init(unsigned int height, unsigned int width)
Set the size of the image.
unsigned int getRows() const
Type * bitmap
points toward the bitmap
void subsample(unsigned int v_scale, unsigned int h_scale, vpImage< Type > &sampled) const
error that can be emited by ViSP classes.
Type operator()(const vpImagePoint &ip) const
Type * operator[](const unsigned int i)
operator[] allows operation like I[i] = x.
virtual ~vpImage()
destructor
static int round(const double x)
vpImage< Type > & operator=(vpImage< Type > other)
Copy operator.
const Type * operator[](unsigned int i) const
operator[] allows operation like x = I[i]
void set_i(const double ii)
Type operator()(const unsigned int i, const unsigned int j) const
friend void swap(vpImage< Type > &first, vpImage< Type > &second)
bool operator!=(const vpImage< Type > &I)
void operator()(const vpImagePoint &ip, const Type &v)
unsigned int getCols() const
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
Type getMaxValue() const
Return the maximum value within the bitmap.
Type getValue(double i, double j) const
void insert(const vpImage< Type > &src, const vpImagePoint &topLeft)
void destroy()
Destructor : Memory de-allocation.
const Type * operator[](int i) const
void quarterSizeImage(vpImage< Type > &res) const
unsigned int getNumberOfPixel() const
void set_j(const double jj)
unsigned int getHeight() const
unsigned int getSize() const
Type * operator[](const int i)
vpImage< Type > operator-(const vpImage< Type > &B)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void operator()(const unsigned int i, const unsigned int j, const Type &v)
void performLut(const Type(&lut)[256], const unsigned int nbThreads=1)
unsigned int getWidth() const
Definition of the vpImage class member functions.
bool operator==(const vpImage< Type > &I)
void getMinMaxValue(Type &min, Type &max) const
Look for the minimum and the maximum value within the bitmap.
void sub(const vpImage< Type > &B, vpImage< Type > &C)