00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <QDebug>
00026 #include <QVImage>
00027
00028 #include <iostream>
00029
00030 template <> const char * QVImage<uChar,1>::getTypeQString() const { return "QVImage<uChar,1>"; }
00031 template <> const char * QVImage<uChar,3>::getTypeQString() const { return "QVImage<uChar,3>"; }
00032 template <> const char * QVImage<sChar,1>::getTypeQString() const { return "QVImage<sChar,1>"; }
00033 template <> const char * QVImage<sChar,3>::getTypeQString() const { return "QVImage<sChar,3>"; }
00034 template <> const char * QVImage<uShort,1>::getTypeQString() const { return "QVImage<uShort,1>"; }
00035 template <> const char * QVImage<uShort,3>::getTypeQString() const { return "QVImage<uShort,3>"; }
00036 template <> const char * QVImage<sShort,1>::getTypeQString() const { return "QVImage<sShort,1>"; }
00037 template <> const char * QVImage<sShort,3>::getTypeQString() const { return "QVImage<sShort,3>"; }
00038 template <> const char * QVImage<sInt,1>::getTypeQString() const { return "QVImage<sInt,1>"; }
00039 template <> const char * QVImage<sInt,3>::getTypeQString() const { return "QVImage<sInt,3>"; }
00040 template <> const char * QVImage<uInt,1>::getTypeQString() const { return "QVImage<uInt,1>"; }
00041 template <> const char * QVImage<uInt,3>::getTypeQString() const { return "QVImage<uInt,3>"; }
00042 template <> const char * QVImage<sFloat,1>::getTypeQString() const { return "QVImage<sFloat,1>"; }
00043 template <> const char * QVImage<sFloat,3>::getTypeQString() const { return "QVImage<sFloat,3>"; }
00044
00045
00046 #define CREATE_COPY_CONSTRUCTOR(TYPE, C) \
00047 template <> QVImage<TYPE, C>::QVImage(QVImage<TYPE, C> const &img):QVGenericImage(img) \
00048 { \
00049 imageBuffer = img.imageBuffer; \
00050 step_div_type_size = getStep()/sizeof(TYPE); \
00051 }
00052
00053 CREATE_COPY_CONSTRUCTOR(uChar, 1);
00054 CREATE_COPY_CONSTRUCTOR(uChar, 3);
00055 CREATE_COPY_CONSTRUCTOR(sChar, 1);
00056 CREATE_COPY_CONSTRUCTOR(sChar, 3);
00057 CREATE_COPY_CONSTRUCTOR(uShort, 1);
00058 CREATE_COPY_CONSTRUCTOR(uShort, 3);
00059 CREATE_COPY_CONSTRUCTOR(sShort, 1);
00060 CREATE_COPY_CONSTRUCTOR(sShort, 3);
00061 CREATE_COPY_CONSTRUCTOR(uInt, 1);
00062 CREATE_COPY_CONSTRUCTOR(uInt, 3);
00063 CREATE_COPY_CONSTRUCTOR(sInt, 1);
00064 CREATE_COPY_CONSTRUCTOR(sInt, 3);
00065 CREATE_COPY_CONSTRUCTOR(sFloat, 1);
00066 CREATE_COPY_CONSTRUCTOR(sFloat, 3);
00067
00068
00069 #define CREATE_COPY_OPERATOR(TYPE, C) \
00070 template <> QVImage<TYPE,C> & QVImage<TYPE, C>::operator=(const QVImage<TYPE, C> &img) \
00071 { \
00072 imageBuffer = img.imageBuffer; \
00073 setROI(img.getROI()); setAnchor(img.getAnchor()); \
00074 step_div_type_size = getStep()/sizeof(TYPE); \
00075 return *this; \
00076 }
00077
00078 CREATE_COPY_OPERATOR(uChar, 1);
00079 CREATE_COPY_OPERATOR(uChar, 3);
00080 CREATE_COPY_OPERATOR(sChar, 1);
00081 CREATE_COPY_OPERATOR(sChar, 3);
00082 CREATE_COPY_OPERATOR(uShort, 1);
00083 CREATE_COPY_OPERATOR(uShort, 3);
00084 CREATE_COPY_OPERATOR(sShort, 1);
00085 CREATE_COPY_OPERATOR(sShort, 3);
00086 CREATE_COPY_OPERATOR(uInt, 1);
00087 CREATE_COPY_OPERATOR(uInt, 3);
00088 CREATE_COPY_OPERATOR(sInt, 1);
00089 CREATE_COPY_OPERATOR(sInt, 3);
00090 CREATE_COPY_OPERATOR(sFloat, 1);
00091 CREATE_COPY_OPERATOR(sFloat, 3);
00092
00094
00095 #ifdef QVIPP
00096 #include <qvipp.h>
00097 #endif // QVIPP
00098
00099
00100 #define CREATE_COMPOSE_COPY_CONSTRUCTOR(TYPE) \
00101 template <> QVImage<TYPE, 3>::QVImage(QVImage<TYPE,1> const &red, QVImage<TYPE,1> const &green, QVImage<TYPE,1> const &blue):QVGenericImage(red) \
00102 { \
00103 imageBuffer = new QVImageBuffer<TYPE>(3*red.getCols(), red.getRows()); \
00104 Copy(red, green, blue, *this); \
00105 setROI(red.getROI()); setAnchor(red.getAnchor()); \
00106 step_div_type_size = getStep()/sizeof(TYPE); \
00107 }
00108
00109
00110 CREATE_COMPOSE_COPY_CONSTRUCTOR(uChar);
00111 CREATE_COMPOSE_COPY_CONSTRUCTOR(uShort);
00112 CREATE_COMPOSE_COPY_CONSTRUCTOR(sShort);
00113 CREATE_COMPOSE_COPY_CONSTRUCTOR(sInt);
00114 CREATE_COMPOSE_COPY_CONSTRUCTOR(sFloat);
00115
00116
00117
00118 #define CREATE_CONVERT_CONSTRUCTOR(TYPE1, TYPE2, C) \
00119 template <> QVImage<TYPE2, C>::QVImage(QVImage<TYPE1, C> const &img):QVGenericImage(img) \
00120 { \
00121 imageBuffer = new QVImageBuffer<TYPE2>(C*img.getCols(), img.getRows()); \
00122 setAnchor(img.getROI().x(),img.getROI().y()); \
00123 Convert(img, *this); \
00124 setROI(img.getROI()); setAnchor(img.getAnchor()); \
00125 step_div_type_size = getStep()/sizeof(TYPE2); \
00126 }
00127
00128
00129
00130
00131
00132 CREATE_CONVERT_CONSTRUCTOR(sFloat, uChar, 1);
00133 CREATE_CONVERT_CONSTRUCTOR(sFloat, sChar, 1);
00134 CREATE_CONVERT_CONSTRUCTOR(sFloat, sInt, 1);
00135 CREATE_CONVERT_CONSTRUCTOR(sFloat, uInt, 1);
00136 CREATE_CONVERT_CONSTRUCTOR(sFloat, sShort, 1);
00137 CREATE_CONVERT_CONSTRUCTOR(sFloat, uShort, 1);
00138
00139
00140 CREATE_CONVERT_CONSTRUCTOR(sFloat, uChar, 3);
00141 CREATE_CONVERT_CONSTRUCTOR(sFloat, sChar, 3);
00142 CREATE_CONVERT_CONSTRUCTOR(sFloat, sInt, 3);
00143 CREATE_CONVERT_CONSTRUCTOR(sFloat, uInt, 3);
00144 CREATE_CONVERT_CONSTRUCTOR(sFloat, sShort, 3);
00145 CREATE_CONVERT_CONSTRUCTOR(sFloat, uShort, 3);
00146
00147
00148 CREATE_CONVERT_CONSTRUCTOR(uChar, sFloat, 1);
00149
00150 CREATE_CONVERT_CONSTRUCTOR(uChar, sChar, 1);
00151 CREATE_CONVERT_CONSTRUCTOR(uChar, sInt, 1);
00152 CREATE_CONVERT_CONSTRUCTOR(uChar, uInt, 1);
00153 CREATE_CONVERT_CONSTRUCTOR(uChar, sShort, 1);
00154 CREATE_CONVERT_CONSTRUCTOR(uChar, uShort, 1);
00155
00156 CREATE_CONVERT_CONSTRUCTOR(uChar, sFloat, 3);
00157
00158 CREATE_CONVERT_CONSTRUCTOR(uChar, sChar, 3);
00159 CREATE_CONVERT_CONSTRUCTOR(uChar, sInt, 3);
00160 CREATE_CONVERT_CONSTRUCTOR(uChar, uInt, 3);
00161 CREATE_CONVERT_CONSTRUCTOR(uChar, sShort, 3);
00162 CREATE_CONVERT_CONSTRUCTOR(uChar, uShort, 3);
00163
00164
00165 CREATE_CONVERT_CONSTRUCTOR(sChar, sFloat, 1);
00166 CREATE_CONVERT_CONSTRUCTOR(sChar, uChar, 1);
00167
00168 CREATE_CONVERT_CONSTRUCTOR(sChar, sInt, 1);
00169 CREATE_CONVERT_CONSTRUCTOR(sChar, uInt, 1);
00170 CREATE_CONVERT_CONSTRUCTOR(sChar, sShort, 1);
00171 CREATE_CONVERT_CONSTRUCTOR(sChar, uShort, 1);
00172
00173 CREATE_CONVERT_CONSTRUCTOR(sChar, sFloat, 3);
00174 CREATE_CONVERT_CONSTRUCTOR(sChar, uChar, 3);
00175
00176 CREATE_CONVERT_CONSTRUCTOR(sChar, sInt, 3);
00177 CREATE_CONVERT_CONSTRUCTOR(sChar, uInt, 3);
00178 CREATE_CONVERT_CONSTRUCTOR(sChar, sShort, 3);
00179 CREATE_CONVERT_CONSTRUCTOR(sChar, uShort, 3);
00180
00181
00182 CREATE_CONVERT_CONSTRUCTOR(sInt, sFloat, 1);
00183 CREATE_CONVERT_CONSTRUCTOR(sInt, uChar, 1);
00184 CREATE_CONVERT_CONSTRUCTOR(sInt, sChar, 1);
00185
00186 CREATE_CONVERT_CONSTRUCTOR(sInt, uInt, 1);
00187 CREATE_CONVERT_CONSTRUCTOR(sInt, sShort, 1);
00188 CREATE_CONVERT_CONSTRUCTOR(sInt, uShort, 1);
00189
00190 CREATE_CONVERT_CONSTRUCTOR(sInt, sFloat, 3);
00191 CREATE_CONVERT_CONSTRUCTOR(sInt, uChar, 3);
00192 CREATE_CONVERT_CONSTRUCTOR(sInt, sChar, 3);
00193
00194 CREATE_CONVERT_CONSTRUCTOR(sInt, uInt, 3);
00195 CREATE_CONVERT_CONSTRUCTOR(sInt, sShort, 3);
00196 CREATE_CONVERT_CONSTRUCTOR(sInt, uShort, 3);
00197
00198
00199 CREATE_CONVERT_CONSTRUCTOR(uInt, sFloat, 1);
00200 CREATE_CONVERT_CONSTRUCTOR(uInt, uChar, 1);
00201 CREATE_CONVERT_CONSTRUCTOR(uInt, sChar, 1);
00202 CREATE_CONVERT_CONSTRUCTOR(uInt, sInt, 1);
00203
00204 CREATE_CONVERT_CONSTRUCTOR(uInt, sShort, 1);
00205 CREATE_CONVERT_CONSTRUCTOR(uInt, uShort, 1);
00206
00207 CREATE_CONVERT_CONSTRUCTOR(uInt, sFloat, 3);
00208 CREATE_CONVERT_CONSTRUCTOR(uInt, uChar, 3);
00209 CREATE_CONVERT_CONSTRUCTOR(uInt, sChar, 3);
00210 CREATE_CONVERT_CONSTRUCTOR(uInt, sInt, 3);
00211
00212 CREATE_CONVERT_CONSTRUCTOR(uInt, sShort, 3);
00213 CREATE_CONVERT_CONSTRUCTOR(uInt, uShort, 3);
00214
00215
00216 CREATE_CONVERT_CONSTRUCTOR(sShort, sFloat, 1);
00217 CREATE_CONVERT_CONSTRUCTOR(sShort, uChar, 1);
00218 CREATE_CONVERT_CONSTRUCTOR(sShort, sChar, 1);
00219 CREATE_CONVERT_CONSTRUCTOR(sShort, sInt, 1);
00220 CREATE_CONVERT_CONSTRUCTOR(sShort, uInt, 1);
00221
00222 CREATE_CONVERT_CONSTRUCTOR(sShort, uShort, 1);
00223
00224 CREATE_CONVERT_CONSTRUCTOR(sShort, sFloat, 3);
00225 CREATE_CONVERT_CONSTRUCTOR(sShort, uChar, 3);
00226 CREATE_CONVERT_CONSTRUCTOR(sShort, sChar, 3);
00227 CREATE_CONVERT_CONSTRUCTOR(sShort, sInt, 3);
00228 CREATE_CONVERT_CONSTRUCTOR(sShort, uInt, 3);
00229
00230 CREATE_CONVERT_CONSTRUCTOR(sShort, uShort, 3);
00231
00232
00233 CREATE_CONVERT_CONSTRUCTOR(uShort, sFloat, 1);
00234 CREATE_CONVERT_CONSTRUCTOR(uShort, uChar, 1);
00235 CREATE_CONVERT_CONSTRUCTOR(uShort, sChar, 1);
00236 CREATE_CONVERT_CONSTRUCTOR(uShort, sInt, 1);
00237 CREATE_CONVERT_CONSTRUCTOR(uShort, uInt, 1);
00238 CREATE_CONVERT_CONSTRUCTOR(uShort, sShort, 1);
00239
00240
00241 CREATE_CONVERT_CONSTRUCTOR(uShort, sFloat, 3);
00242 CREATE_CONVERT_CONSTRUCTOR(uShort, uChar, 3);
00243 CREATE_CONVERT_CONSTRUCTOR(uShort, sChar, 3);
00244 CREATE_CONVERT_CONSTRUCTOR(uShort, sInt, 3);
00245 CREATE_CONVERT_CONSTRUCTOR(uShort, uInt, 3);
00246 CREATE_CONVERT_CONSTRUCTOR(uShort, sShort, 3);
00247
00248
00249 #define CREATE_CONVERT_CONSTRUCTOR_C3_C1(TYPE) \
00250 template <> QVImage<TYPE, 1>::QVImage(QVImage<TYPE, 3> const &img):QVGenericImage(img) \
00251 { \
00252 imageBuffer = new QVImageBuffer<TYPE>(img.getCols(), img.getRows()); \
00253 setAnchor(img.getROI().x(),img.getROI().y()); \
00254 RGBToGray(img, *this); \
00255 setROI(img.getROI()); setAnchor(img.getAnchor()); \
00256 step_div_type_size = getStep()/sizeof(TYPE); \
00257 }
00258
00259 CREATE_CONVERT_CONSTRUCTOR_C3_C1(uChar);
00260 CREATE_CONVERT_CONSTRUCTOR_C3_C1(sChar);
00261 CREATE_CONVERT_CONSTRUCTOR_C3_C1(uInt);
00262 CREATE_CONVERT_CONSTRUCTOR_C3_C1(sInt);
00263 CREATE_CONVERT_CONSTRUCTOR_C3_C1(uShort);
00264 CREATE_CONVERT_CONSTRUCTOR_C3_C1(sShort);
00265 CREATE_CONVERT_CONSTRUCTOR_C3_C1(sFloat);
00266
00267 #define CREATE_CONVERT_CONSTRUCTOR_C1_C3(TYPE) \
00268 template <> QVImage<TYPE, 3>::QVImage(QVImage<TYPE, 1> const &img):QVGenericImage(img) \
00269 { \
00270 imageBuffer = new QVImageBuffer<TYPE>(3*img.getCols(), img.getRows()); \
00271 setAnchor(img.getROI().x(),img.getROI().y()); \
00272 Copy(img, img, img, *this); \
00273 setROI(img.getROI()); setAnchor(img.getAnchor()); \
00274 step_div_type_size = getStep()/sizeof(TYPE); \
00275 }
00276
00277 CREATE_CONVERT_CONSTRUCTOR_C1_C3(uChar);
00278 CREATE_CONVERT_CONSTRUCTOR_C1_C3(sChar);
00279 CREATE_CONVERT_CONSTRUCTOR_C1_C3(uShort);
00280 CREATE_CONVERT_CONSTRUCTOR_C1_C3(sShort);
00281 CREATE_CONVERT_CONSTRUCTOR_C1_C3(uInt);
00282 CREATE_CONVERT_CONSTRUCTOR_C1_C3(sInt);
00283 CREATE_CONVERT_CONSTRUCTOR_C1_C3(sFloat);
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 template <> QVImage<uChar, 3>::QVImage(const QImage &qimg):QVGenericImage()
00430 {
00431 imageBuffer = new QVImageBuffer<uChar>(3*qimg.size().width(), qimg.size().height());
00432 setROI(0, 0, qimg.size().width(), qimg.size().height());
00433 setAnchor(getROI().x(), getROI().y());
00434 step_div_type_size = getStep()/sizeof(uChar);
00435
00436 const int step = getStep();
00437 uChar *imagerawdata = getWriteData();
00438 for(uint row=0; row != getRows(); row++)
00439 for(uint col=0; col != getCols(); col++)
00440 {
00441 imagerawdata[row*step + 3*col] = qRed(qimg.pixel(col,row));
00442 imagerawdata[row*step + 3*col + 1] = qGreen(qimg.pixel(col,row));
00443 imagerawdata[row*step + 3*col + 2] = qBlue(qimg.pixel(col,row));
00444 }
00445 }
00446
00447 template <> QVImage<uChar, 3>::operator QImage() const
00448 {
00449 QRect roi = getROI();
00450 const int x=roi.x(), y=roi.y(), w=roi.width(), h=roi.height(), step = getStep();
00451 QImage qImage(w, h, QImage::Format_RGB32);
00452 const uChar *imagerawdata = getReadData();
00453 for(int row = y; row < y+h; row++)
00454 for(int col = x; col < x+w; col++)
00455 {
00456 const int idx = row*step + 3*col;
00457 uChar r = imagerawdata[idx + 0],
00458 g = imagerawdata[idx + 1],
00459 b = imagerawdata[idx + 2];
00460 qImage.setPixel(col-x, row-y, qRgb(r,g,b));
00461 }
00462
00463 return qImage;
00464 }
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00501 #define CREATE_IPLIMAGE_CONSTRUCTOR(TYPE, C, DEPTH) \
00502 template <> QVImage<TYPE, C>::QVImage(const IplImage *iplImage):QVGenericImage() \
00503 { \
00504 if (iplImage->nChannels != C) \
00505 qWarning("Conversion from incompatible OpenCV image: incompatible channel number"); \
00506 if (iplImage->depth != DEPTH) \
00507 qWarning("Conversion from incompatible OpenCV image: incompatible depth"); \
00508 \
00509 \
00510 imageBuffer = new QVImageBuffer<TYPE>(C*iplImage->width, iplImage->height ); \
00511 setROI(0, 0, iplImage->width, iplImage->height); \
00512 step_div_type_size = getStep()/sizeof(TYPE); \
00513 setAnchor(0, 0); \
00514 \
00515 const int lineSize = getCols() * C; \
00516 \
00517 for (uInt y=0 ;y<getRows(); y++) \
00518 memcpy(getWriteData() + getStep() * y, iplImage->imageData + iplImage->widthStep*y, lineSize); \
00519 }
00520
00521 #ifdef QVOPENCV
00522 CREATE_IPLIMAGE_CONSTRUCTOR(uChar, 1, IPL_DEPTH_8U);
00523 CREATE_IPLIMAGE_CONSTRUCTOR(uChar, 3, IPL_DEPTH_8U);
00524 CREATE_IPLIMAGE_CONSTRUCTOR(sFloat, 1, IPL_DEPTH_32F);
00525 CREATE_IPLIMAGE_CONSTRUCTOR(sFloat, 3, IPL_DEPTH_32F);
00526 #endif
00527
00528 #define CREATE_IPLIMAGE_CONVERSION(TYPE, C, DEPTH) \
00529 template <> QVImage<TYPE, C>::operator IplImage *() const \
00530 { \
00531 IplImage *imageDest = cvCreateImageHeader(cvSize(getCols(), getRows()), DEPTH, C); \
00532 cvCreateImageData(imageDest); \
00533 \
00534 const int lineSize = getCols() * C; \
00535 \
00536 for (uInt y=0 ;y<getRows(); y++) \
00537 memcpy(imageDest->imageData + imageDest->widthStep*y, getReadData() + getStep() * y, lineSize); \
00538 \
00539 return imageDest; \
00540 }
00541
00542 #ifdef QVOPENCV
00543 CREATE_IPLIMAGE_CONVERSION(uChar, 1, IPL_DEPTH_8U);
00544 CREATE_IPLIMAGE_CONVERSION(uChar, 3, IPL_DEPTH_8U);
00545 CREATE_IPLIMAGE_CONVERSION(sFloat, 1, IPL_DEPTH_32F);
00546 CREATE_IPLIMAGE_CONVERSION(sFloat, 3, IPL_DEPTH_32F);
00547 #endif
00548
00549
00550 #define CREATE_OPERATOR(NAME, OPERATOR, TYPE, C) \
00551 template <> QVImage<TYPE, C> QVImage<TYPE,C>::OPERATOR(const QVImage<TYPE, C> &img) const \
00552 { \
00553 QVImage<TYPE, C> result = *this; \
00554 NAME(*this, img, result); \
00555 return result; \
00556 }
00557
00558 #ifdef QVIPP
00559 CREATE_OPERATOR(Add, operator+, uChar, 1);
00560 CREATE_OPERATOR(Mul, operator*, uChar, 1);
00561 CREATE_OPERATOR(Sub, operator-, uChar, 1);
00562 CREATE_OPERATOR(Div, operator/, uChar, 1);
00563 CREATE_OPERATOR(Add, operator+, uChar, 3);
00564 CREATE_OPERATOR(Mul, operator*, uChar, 3);
00565 CREATE_OPERATOR(Sub, operator-, uChar, 3);
00566 CREATE_OPERATOR(Div, operator/, uChar, 3);
00567
00568 CREATE_OPERATOR(Add, operator+, uShort, 1);
00569 CREATE_OPERATOR(Mul, operator*, uShort, 1);
00570 CREATE_OPERATOR(Sub, operator-, uShort, 1);
00571 CREATE_OPERATOR(Div, operator/, uShort, 1);
00572 CREATE_OPERATOR(Add, operator+, uShort, 3);
00573 CREATE_OPERATOR(Mul, operator*, uShort, 3);
00574 CREATE_OPERATOR(Sub, operator-, uShort, 3);
00575 CREATE_OPERATOR(Div, operator/, uShort, 3);
00576
00577 CREATE_OPERATOR(Add, operator+, sShort, 1);
00578 CREATE_OPERATOR(Mul, operator*, sShort, 1);
00579 CREATE_OPERATOR(Sub, operator-, sShort, 1);
00580 CREATE_OPERATOR(Div, operator/, sShort, 1);
00581 CREATE_OPERATOR(Add, operator+, sShort, 3);
00582 CREATE_OPERATOR(Mul, operator*, sShort, 3);
00583 CREATE_OPERATOR(Sub, operator-, sShort, 3);
00584 CREATE_OPERATOR(Div, operator/, sShort, 3);
00585 #endif
00586
00587 #define CREATE_OPERATOR_INT_C1(OPERATOR, OPERATION, TYPE) \
00588 template <> QVImage<TYPE, 1> QVImage<TYPE, 1>::OPERATOR(const QVImage<TYPE, 1> &img) const \
00589 { \
00590 QVImage<TYPE, 1> result = *this; \
00591 QVIMAGE_PTR_INIT_READ(TYPE, this); \
00592 QVIMAGE_INIT_READ(TYPE, img); \
00593 QVIMAGE_INIT_WRITE(TYPE, result); \
00594 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00595 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00596 QVIMAGE_PIXEL(result, col, row, 0) = QVIMAGE_PIXEL(img, col, row, 0) OPERATION QVIMAGE_PIXEL(this, col, row, 0); \
00597 return result; \
00598 }
00599
00600 #ifdef QVIPP
00601 CREATE_OPERATOR_INT_C1(operator+, +, sInt);
00602 CREATE_OPERATOR_INT_C1(operator*, *, sInt);
00603 CREATE_OPERATOR_INT_C1(operator-, -, sInt);
00604 CREATE_OPERATOR_INT_C1(operator/, /, sInt);
00605 #endif
00606
00607 #define CREATE_OPERATOR_INT_C3(OPERATOR, OPERATION, TYPE) \
00608 template <> QVImage<TYPE, 3> QVImage<TYPE, 3>::OPERATOR(const QVImage<TYPE, 3> &img) const \
00609 { \
00610 QVImage<TYPE, 3> result = *this; \
00611 QVIMAGE_PTR_INIT_READ(TYPE, this); \
00612 QVIMAGE_INIT_READ(TYPE, img); \
00613 QVIMAGE_INIT_WRITE(TYPE, result); \
00614 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00615 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00616 { \
00617 QVIMAGE_PIXEL(result, col, row, 0) = QVIMAGE_PIXEL(img, col, row, 0) OPERATION QVIMAGE_PIXEL(this, col, row, 0); \
00618 QVIMAGE_PIXEL(result, col, row, 1) = QVIMAGE_PIXEL(img, col, row, 1) OPERATION QVIMAGE_PIXEL(this, col, row, 1); \
00619 QVIMAGE_PIXEL(result, col, row, 2) = QVIMAGE_PIXEL(img, col, row, 2) OPERATION QVIMAGE_PIXEL(this, col, row, 2); \
00620 } \
00621 return result; \
00622 }
00623
00624 #ifdef QVIPP
00625 CREATE_OPERATOR_INT_C3(operator+, +, sInt);
00626 CREATE_OPERATOR_INT_C3(operator*, *, sInt);
00627 CREATE_OPERATOR_INT_C3(operator-, -, sInt);
00628 CREATE_OPERATOR_INT_C3(operator/, /, sInt);
00629 #endif
00630
00631 #define CREATE_CONST_OPERATOR(NAME, OPERATOR, TYPE, C) \
00632 template <> QVImage<TYPE, C> QVImage<TYPE,C>::OPERATOR(const TYPE value) const \
00633 { \
00634 QVImage<TYPE, C> result = *this; \
00635 NAME(*this, value, result); \
00636 return result; \
00637 }
00638
00639 #ifdef QVIPP
00640 CREATE_CONST_OPERATOR(AddC, operator+, uChar, 1);
00641 CREATE_CONST_OPERATOR(MulC, operator*, uChar, 1);
00642 CREATE_CONST_OPERATOR(SubC, operator-, uChar, 1);
00643 CREATE_CONST_OPERATOR(DivC, operator/, uChar, 1);
00644 CREATE_CONST_OPERATOR(AddC, operator+, uShort, 1);
00645 CREATE_CONST_OPERATOR(MulC, operator*, uShort, 1);
00646 CREATE_CONST_OPERATOR(SubC, operator-, uShort, 1);
00647 CREATE_CONST_OPERATOR(DivC, operator/, uShort, 1);
00648 CREATE_CONST_OPERATOR(AddC, operator+, sShort, 1);
00649 CREATE_CONST_OPERATOR(MulC, operator*, sShort, 1);
00650 CREATE_CONST_OPERATOR(SubC, operator-, sShort, 1);
00651 CREATE_CONST_OPERATOR(DivC, operator/, sShort, 1);
00652 CREATE_CONST_OPERATOR(AddC, operator+, sFloat, 1);
00653 CREATE_CONST_OPERATOR(MulC, operator*, sFloat, 1);
00654 CREATE_CONST_OPERATOR(SubC, operator-, sFloat, 1);
00655 CREATE_CONST_OPERATOR(DivC, operator/, sFloat, 1);
00656 CREATE_CONST_OPERATOR(LShiftC, operator<<, uChar, 1);
00657 CREATE_CONST_OPERATOR(RShiftC, operator>>, uChar, 1);
00658 CREATE_CONST_OPERATOR(LShiftC, operator<<, uShort, 1);
00659 CREATE_CONST_OPERATOR(RShiftC, operator>>, uShort, 1);
00660 CREATE_CONST_OPERATOR(LShiftC, operator<<, sInt, 1);
00661 CREATE_CONST_OPERATOR(RShiftC, operator>>, sInt, 1);
00662 CREATE_CONST_OPERATOR(AndC, operator&, uChar, 1);
00663 CREATE_CONST_OPERATOR(OrC, operator|, uChar, 1);
00664 CREATE_CONST_OPERATOR(XorC, operator^, uChar, 1);
00665 CREATE_CONST_OPERATOR(AndC, operator&, uShort, 1);
00666 CREATE_CONST_OPERATOR(OrC, operator|, uShort, 1);
00667 CREATE_CONST_OPERATOR(XorC, operator^, uShort, 1);
00668 CREATE_CONST_OPERATOR(AndC, operator&, sInt, 1);
00669 CREATE_CONST_OPERATOR(OrC, operator|, sInt, 1);
00670 CREATE_CONST_OPERATOR(XorC, operator^, sInt, 1);
00671 #endif
00672
00674
00675 #define CREATE_CONST_OPERATOR_C3(NAME, OPERATOR, TYPE, C) \
00676 template <> QVImage<TYPE, C> QVImage<TYPE,C>::OPERATOR(const TYPE value) const \
00677 { \
00678 const TYPE values[3] = { value, value, value }; \
00679 QVImage<TYPE, C> result = *this; \
00680 NAME(*this, values, result); \
00681 return result; \
00682 }
00683
00684 #ifdef QVIPP
00685 CREATE_CONST_OPERATOR_C3(AddC, operator+, uChar, 3);
00686 CREATE_CONST_OPERATOR_C3(MulC, operator*, uChar, 3);
00687 CREATE_CONST_OPERATOR_C3(SubC, operator-, uChar, 3);
00688 CREATE_CONST_OPERATOR_C3(DivC, operator/, uChar, 3);
00689 CREATE_CONST_OPERATOR_C3(AddC, operator+, sShort, 3);
00690 CREATE_CONST_OPERATOR_C3(MulC, operator*, sShort, 3);
00691 CREATE_CONST_OPERATOR_C3(SubC, operator-, sShort, 3);
00692 CREATE_CONST_OPERATOR_C3(DivC, operator/, sShort, 3);
00693 CREATE_CONST_OPERATOR_C3(AddC, operator+, uShort, 3);
00694 CREATE_CONST_OPERATOR_C3(MulC, operator*, uShort, 3);
00695 CREATE_CONST_OPERATOR_C3(SubC, operator-, uShort, 3);
00696 CREATE_CONST_OPERATOR_C3(DivC, operator/, uShort, 3);
00697 CREATE_CONST_OPERATOR_C3(AddC, operator+, sFloat, 3);
00698 CREATE_CONST_OPERATOR_C3(MulC, operator*, sFloat, 3);
00699 CREATE_CONST_OPERATOR_C3(SubC, operator-, sFloat, 3);
00700 CREATE_CONST_OPERATOR_C3(DivC, operator/, sFloat, 3);
00701 CREATE_CONST_OPERATOR_C3(AndC, operator&, uChar, 3);
00702 CREATE_CONST_OPERATOR_C3(OrC, operator|, uChar, 3);
00703 CREATE_CONST_OPERATOR_C3(XorC, operator^, uChar, 3);
00704 CREATE_CONST_OPERATOR_C3(AndC, operator&, uShort, 3);
00705 CREATE_CONST_OPERATOR_C3(OrC, operator|, uShort, 3);
00706 CREATE_CONST_OPERATOR_C3(XorC, operator^, uShort, 3);
00707 CREATE_CONST_OPERATOR_C3(AndC, operator&, sInt, 3);
00708 CREATE_CONST_OPERATOR_C3(OrC, operator|, sInt, 3);
00709 CREATE_CONST_OPERATOR_C3(XorC, operator^, sInt, 3);
00710 #endif
00711
00712 #define CREATE_CONST_OPERATOR_C4(NAME, OPERATOR, TYPE, C) \
00713 template <> QVImage<TYPE, C> QVImage<TYPE,C>::OPERATOR(const TYPE value) const \
00714 { \
00715 const uInt values[3] = { value, value, value }; \
00716 QVImage<TYPE, C> result = *this; \
00717 NAME(*this, values, result); \
00718 return result; \
00719 }
00720
00721 #ifdef QVIPP
00722 CREATE_CONST_OPERATOR_C4(LShiftC, operator<<, uChar, 3);
00723 CREATE_CONST_OPERATOR_C4(RShiftC, operator>>, uChar, 3);
00724 CREATE_CONST_OPERATOR_C4(LShiftC, operator<<, uShort, 3);
00725 CREATE_CONST_OPERATOR_C4(RShiftC, operator>>, uShort, 3);
00726 CREATE_CONST_OPERATOR_C4(LShiftC, operator<<, sInt, 3);
00727 CREATE_CONST_OPERATOR_C4(RShiftC, operator>>, sInt, 3);
00728 #endif
00729
00730 #define CREATE_CONST_OPERATOR_INT_C1(OPERATOR, OPERATION, TYPE) \
00731 template <> QVImage<TYPE, 1> QVImage<TYPE, 1>::OPERATOR(const TYPE value) const \
00732 { \
00733 QVImage<TYPE, 1> result = *this; \
00734 QVIMAGE_PTR_INIT_READ(TYPE, this); \
00735 QVIMAGE_INIT_WRITE(TYPE, result); \
00736 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00737 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00738 QVIMAGE_PIXEL(result, col, row, 0) = QVIMAGE_PIXEL(this, col, row, 0) OPERATION value; \
00739 return result; \
00740 }
00741
00742 #ifdef QVIPP
00743 CREATE_CONST_OPERATOR_INT_C1(operator+, +, sInt);
00744 CREATE_CONST_OPERATOR_INT_C1(operator*, *, sInt);
00745 CREATE_CONST_OPERATOR_INT_C1(operator-, -, sInt);
00746 CREATE_CONST_OPERATOR_INT_C1(operator/, /, sInt);
00747 #endif
00748
00749 #define CREATE_CONST_OPERATOR_INT_C3(OPERATOR, OPERATION, TYPE) \
00750 template <> QVImage<TYPE, 3> QVImage<TYPE, 3>::OPERATOR(const TYPE value) const \
00751 { \
00752 QVImage<TYPE, 3> result = *this; \
00753 QVIMAGE_PTR_INIT_READ(TYPE, this); \
00754 QVIMAGE_INIT_WRITE(TYPE, result); \
00755 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00756 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00757 { \
00758 QVIMAGE_PIXEL(result, col, row, 0) = QVIMAGE_PIXEL(this, col, row, 0) OPERATION value; \
00759 QVIMAGE_PIXEL(result, col, row, 1) = QVIMAGE_PIXEL(this, col, row, 1) OPERATION value; \
00760 QVIMAGE_PIXEL(result, col, row, 2) = QVIMAGE_PIXEL(this, col, row, 2) OPERATION value; \
00761 } \
00762 return result; \
00763 }
00764
00765 #ifdef QVIPP
00766 CREATE_CONST_OPERATOR_INT_C3(operator+, +, sInt);
00767 CREATE_CONST_OPERATOR_INT_C3(operator*, *, sInt);
00768 CREATE_CONST_OPERATOR_INT_C3(operator-, -, sInt);
00769 CREATE_CONST_OPERATOR_INT_C3(operator/, /, sInt);
00770 #endif
00771
00772 #define CREATE_NOT_OPERATOR(NAME, OPERATOR, TYPE, C) \
00773 template <> QVImage<TYPE, C> QVImage<TYPE,C>::OPERATOR() const \
00774 { \
00775 QVImage<TYPE, C> result = *this; \
00776 NAME(*this, result); \
00777 return result; \
00778 }
00779
00780 #ifdef QVIPP
00781 CREATE_NOT_OPERATOR(Not, operator!, uChar, 1);
00782 CREATE_NOT_OPERATOR(Not, operator!, uChar, 3);
00783 #endif
00784
00785 #define CREATE_COMPARE_OPERATOR(NAME, OPERATOR, CMP, TYPE, C) \
00786 template <> QVImage<uChar> QVImage<TYPE,C>::OPERATOR(const QVImage<TYPE, C> &img) const \
00787 { \
00788 QVImage<uChar> result(getCols(), getRows()); \
00789 NAME(*this, img, result, CMP); \
00790 return result; \
00791 }
00792
00793 #ifdef QVIPP
00794
00795 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, uChar, 1);
00796 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, uShort, 1);
00797 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, sShort, 1);
00798 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, sFloat, 1);
00799
00800 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, uChar, 3);
00801 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, uShort, 3);
00802 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, sShort, 3);
00803 CREATE_COMPARE_OPERATOR(Compare, operator<, ippCmpLess, sFloat, 3);
00804
00805
00806 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, uChar, 1);
00807 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, uShort, 1);
00808 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, sShort, 1);
00809 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, sFloat, 1);
00810
00811 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, uChar, 3);
00812 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, uShort, 3);
00813 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, sShort, 3);
00814 CREATE_COMPARE_OPERATOR(Compare, operator>, ippCmpGreater, sFloat, 3);
00815
00816
00817 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, uChar, 1);
00818 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, uShort, 1);
00819 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, sShort, 1);
00820 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, sFloat, 1);
00821
00822 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, uChar, 3);
00823 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, uShort, 3);
00824 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, sShort, 3);
00825 CREATE_COMPARE_OPERATOR(Compare, operator<=, ippCmpLessEq, sFloat, 3);
00826
00827
00828 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, uChar, 1);
00829 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, uShort, 1);
00830 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, sShort, 1);
00831 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, sFloat, 1);
00832
00833 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, uChar, 3);
00834 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, uShort, 3);
00835 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, sShort, 3);
00836 CREATE_COMPARE_OPERATOR(Compare, operator>=, ippCmpGreaterEq, sFloat, 3);
00837 #endif
00838
00839 #define CREATE_GENERIC_COMPARE_OPERATOR_C1(OPERATOR, OPERATION, TYPE1, TYPE2) \
00840 template <> QVImage<uChar> QVImage<TYPE1, 1>::OPERATOR(const QVImage<TYPE2, 1> &img) const \
00841 { \
00842 QVImage<uChar> result(getCols(), getRows()); \
00843 result.setROI(getROI()); result.setAnchor(getAnchor()); \
00844 QVIMAGE_PTR_INIT_READ(TYPE1, this); \
00845 QVIMAGE_INIT_READ(TYPE2, img); \
00846 QVIMAGE_INIT_WRITE(uChar, result); \
00847 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00848 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00849 if (QVIMAGE_PIXEL(this, col, row, 0) OPERATION QVIMAGE_PIXEL(img, col, row, 0)) \
00850 QVIMAGE_PIXEL(result, col, row, 0) = IPP_MAX_8U; \
00851 else QVIMAGE_PIXEL(result, col, row, 0) = 0; \
00852 return result; \
00853 }
00854
00855 #ifdef QVIPP
00856 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uChar, uShort);
00857 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uChar, uShort);
00858 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uChar, uShort);
00859 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uChar, uShort);
00860 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uChar, sShort);
00861 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uChar, sShort);
00862 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uChar, sShort);
00863 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uChar, sShort);
00864 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uChar, sInt);
00865 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uChar, sInt);
00866 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uChar, sInt);
00867 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uChar, sInt);
00868 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uChar, sFloat);
00869 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uChar, sFloat);
00870 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uChar, sFloat);
00871 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uChar, sFloat);
00872
00873 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uShort, uChar);
00874 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uShort, uChar);
00875 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uShort, uChar);
00876 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uShort, uChar);
00877 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uShort, sShort);
00878 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uShort, sShort);
00879 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uShort, sShort);
00880 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uShort, sShort);
00881 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uShort, sInt);
00882 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uShort, sInt);
00883 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uShort, sInt);
00884 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uShort, sInt);
00885 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, uShort, sFloat);
00886 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, uShort, sFloat);
00887 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, uShort, sFloat);
00888 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, uShort, sFloat);
00889
00890 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sShort, uChar);
00891 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sShort, uChar);
00892 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sShort, uChar);
00893 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sShort, uChar);
00894 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sShort, uShort);
00895 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sShort, uShort);
00896 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sShort, uShort);
00897 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sShort, uShort);
00898 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sShort, sInt);
00899 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sShort, sInt);
00900 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sShort, sInt);
00901 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sShort, sInt);
00902 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sShort, sFloat);
00903 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sShort, sFloat);
00904 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sShort, sFloat);
00905 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sShort, sFloat);
00906
00907 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sInt, uChar);
00908 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sInt, uChar);
00909 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sInt, uChar);
00910 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sInt, uChar);
00911 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sInt, uShort);
00912 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sInt, uShort);
00913 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sInt, uShort);
00914 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sInt, uShort);
00915 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sInt, sShort);
00916 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sInt, sShort);
00917 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sInt, sShort);
00918 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sInt, sShort);
00919 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sInt, sInt);
00920 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sInt, sInt);
00921 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sInt, sInt);
00922 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sInt, sInt);
00923 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sInt, sFloat);
00924 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sInt, sFloat);
00925 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sInt, sFloat);
00926 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sInt, sFloat);
00927
00928 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sFloat, uChar);
00929 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sFloat, uChar);
00930 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sFloat, uChar);
00931 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sFloat, uChar);
00932 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sFloat, uShort);
00933 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sFloat, uShort);
00934 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sFloat, uShort);
00935 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sFloat, uShort);
00936 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sFloat, sShort);
00937 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sFloat, sShort);
00938 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sFloat, sShort);
00939 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sFloat, sShort);
00940 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<, <, sFloat, sInt);
00941 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>, >, sFloat, sInt);
00942 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator<=, <=, sFloat, sInt);
00943 CREATE_GENERIC_COMPARE_OPERATOR_C1(operator>=, >=, sFloat, sInt);
00944 #endif
00945
00946 #define CREATE_GENERIC_COMPARE_OPERATOR_C3(OPERATOR, OPERATION, TYPE1, TYPE2) \
00947 template <> QVImage<uChar> QVImage<TYPE1, 3>::OPERATOR(const QVImage<TYPE2, 3> &img) const \
00948 { \
00949 QVImage<uChar> result(getCols(), getRows()); \
00950 result.setROI(getROI()); result.setAnchor(getAnchor()); \
00951 QVIMAGE_PTR_INIT_READ(TYPE1, this); \
00952 QVIMAGE_INIT_READ(TYPE2, img); \
00953 QVIMAGE_INIT_WRITE(uChar, result); \
00954 for (int col = result.getROI().left(); col < result.getROI().right(); col++) \
00955 for (int row = result.getROI().top(); row < result.getROI().bottom(); row++) \
00956 { \
00957 if( (QVIMAGE_PIXEL(this, col, row, 0) OPERATION QVIMAGE_PIXEL(img, col, row, 0)) && \
00958 (QVIMAGE_PIXEL(this, col, row, 1) OPERATION QVIMAGE_PIXEL(img, col, row, 1)) && \
00959 (QVIMAGE_PIXEL(this, col, row, 2) OPERATION QVIMAGE_PIXEL(img, col, row, 2)) ) \
00960 QVIMAGE_PIXEL(result, col, row, 0) = IPP_MAX_8U; \
00961 else QVIMAGE_PIXEL(result, col, row, 0) = 0; \
00962 } \
00963 return result; \
00964 }
00965
00966 #ifdef QVIPP
00967 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uChar, uShort);
00968 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uChar, uShort);
00969 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uChar, uShort);
00970 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uChar, uShort);
00971 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uChar, sShort);
00972 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uChar, sShort);
00973 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uChar, sShort);
00974 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uChar, sShort);
00975 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uChar, sInt);
00976 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uChar, sInt);
00977 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uChar, sInt);
00978 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uChar, sInt);
00979 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uChar, sFloat);
00980 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uChar, sFloat);
00981 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uChar, sFloat);
00982 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uChar, sFloat);
00983
00984 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uShort, uChar);
00985 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uShort, uChar);
00986 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uShort, uChar);
00987 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uShort, uChar);
00988 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uShort, sShort);
00989 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uShort, sShort);
00990 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uShort, sShort);
00991 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uShort, sShort);
00992 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uShort, sInt);
00993 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uShort, sInt);
00994 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uShort, sInt);
00995 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uShort, sInt);
00996 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, uShort, sFloat);
00997 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, uShort, sFloat);
00998 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, uShort, sFloat);
00999 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, uShort, sFloat);
01000
01001 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sShort, uChar);
01002 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sShort, uChar);
01003 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sShort, uChar);
01004 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sShort, uChar);
01005 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sShort, uShort);
01006 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sShort, uShort);
01007 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sShort, uShort);
01008 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sShort, uShort);
01009 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sShort, sInt);
01010 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sShort, sInt);
01011 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sShort, sInt);
01012 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sShort, sInt);
01013 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sShort, sFloat);
01014 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sShort, sFloat);
01015 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sShort, sFloat);
01016 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sShort, sFloat);
01017
01018 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sInt, uChar);
01019 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sInt, uChar);
01020 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sInt, uChar);
01021 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sInt, uChar);
01022 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sInt, uShort);
01023 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sInt, uShort);
01024 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sInt, uShort);
01025 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sInt, uShort);
01026 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sInt, sShort);
01027 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sInt, sShort);
01028 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sInt, sShort);
01029 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sInt, sShort);
01030 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sInt, sInt);
01031 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sInt, sInt);
01032 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sInt, sInt);
01033 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sInt, sInt);
01034 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sInt, sFloat);
01035 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sInt, sFloat);
01036 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sInt, sFloat);
01037 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sInt, sFloat);
01038
01039 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sFloat, uChar);
01040 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sFloat, uChar);
01041 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sFloat, uChar);
01042 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sFloat, uChar);
01043 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sFloat, uShort);
01044 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sFloat, uShort);
01045 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sFloat, uShort);
01046 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sFloat, uShort);
01047 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sFloat, sShort);
01048 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sFloat, sShort);
01049 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sFloat, sShort);
01050 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sFloat, sShort);
01051 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<, <, sFloat, sInt);
01052 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>, >, sFloat, sInt);
01053 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator<=, <=, sFloat, sInt);
01054 CREATE_GENERIC_COMPARE_OPERATOR_C3(operator>=, >=, sFloat, sInt);
01055 #endif
01056
01057
01058 #define CREATE_SET_FUNCTION_C1(TYPE) \
01059 template <> void QVImage<TYPE>::set(TYPE c1, TYPE, TYPE) \
01060 { Set(c1, *this); }
01061
01062 CREATE_SET_FUNCTION_C1(uChar);
01063 CREATE_SET_FUNCTION_C1(uShort);
01064 CREATE_SET_FUNCTION_C1(sShort);
01065 CREATE_SET_FUNCTION_C1(sInt);
01066 CREATE_SET_FUNCTION_C1(sFloat);
01067
01068 #define CREATE_SET_FUNCTION_C3(TYPE) \
01069 template <> void QVImage<TYPE,3>::set(TYPE c1, TYPE c2, TYPE c3) \
01070 { \
01071 const TYPE values[3] = { c1, c2, c3 }; \
01072 Set(values, *this); \
01073 }
01074
01075 CREATE_SET_FUNCTION_C3(uChar);
01076 CREATE_SET_FUNCTION_C3(uShort);
01077 CREATE_SET_FUNCTION_C3(sShort);
01078 CREATE_SET_FUNCTION_C3(sInt);
01079 CREATE_SET_FUNCTION_C3(sFloat);
01080
01082
01083 #define CREATE_CONVERT_OPERATOR(TYPE1, TYPE2, C) \
01084 template <> QVImage<TYPE2, C> & QVImage<TYPE2, C>::operator=(const QVImage<TYPE1, C> &img) \
01085 { \
01086 imageBuffer = new QVImageBuffer<TYPE2>(C*img.getCols(), img.getRows()); \
01087 setAnchor(img.getROI().x(),img.getROI().y()); \
01088 Convert(img, *this); \
01089 setROI(img.getROI()); setAnchor(img.getAnchor()); \
01090 step_div_type_size = getStep()/sizeof(TYPE2); \
01091 return *this; \
01092 }
01093
01094
01095 CREATE_CONVERT_OPERATOR(uChar, uShort, 1);
01096 CREATE_CONVERT_OPERATOR(uChar, sShort, 1);
01097 CREATE_CONVERT_OPERATOR(uChar, sInt, 1);
01098 CREATE_CONVERT_OPERATOR(uChar, sFloat, 1);
01099 CREATE_CONVERT_OPERATOR(uChar, uShort, 3);
01100 CREATE_CONVERT_OPERATOR(uChar, sShort, 3);
01101 CREATE_CONVERT_OPERATOR(uChar, sInt, 3);
01102 CREATE_CONVERT_OPERATOR(uChar, sFloat, 3);
01103 CREATE_CONVERT_OPERATOR(uShort, uChar, 1);
01104 CREATE_CONVERT_OPERATOR(uShort, sInt, 1);
01105 CREATE_CONVERT_OPERATOR(uShort, sFloat, 1);
01106 CREATE_CONVERT_OPERATOR(uShort, uChar, 3);
01107 CREATE_CONVERT_OPERATOR(uShort, sInt, 3);
01108 CREATE_CONVERT_OPERATOR(uShort, sFloat, 3);
01109 CREATE_CONVERT_OPERATOR(sShort, uChar, 1);
01110 CREATE_CONVERT_OPERATOR(sShort, sInt, 1);
01111 CREATE_CONVERT_OPERATOR(sShort, sFloat, 1);
01112 CREATE_CONVERT_OPERATOR(sShort, uChar, 3);
01113 CREATE_CONVERT_OPERATOR(sShort, sInt, 3);
01114 CREATE_CONVERT_OPERATOR(sShort, sFloat, 3);
01115 CREATE_CONVERT_OPERATOR(sInt, uChar, 1);
01116 CREATE_CONVERT_OPERATOR(sInt, uChar, 3);
01117 CREATE_CONVERT_OPERATOR(sFloat, uChar, 1);
01118 CREATE_CONVERT_OPERATOR(sFloat, uShort, 1);
01119 CREATE_CONVERT_OPERATOR(sFloat, sShort, 1);
01120 CREATE_CONVERT_OPERATOR(sFloat, uChar, 3);
01121 CREATE_CONVERT_OPERATOR(sFloat, uShort, 3);
01122 CREATE_CONVERT_OPERATOR(sFloat, sShort, 3);
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192 #define CREATE_CONVERT_OPERATOR_C3_C1(TYPE) \
01193 template <> QVImage<TYPE, 1> & QVImage<TYPE, 1>::operator=(const QVImage<TYPE, 3> &img) \
01194 { \
01195 imageBuffer = new QVImageBuffer<TYPE>(img.getCols(), img.getRows()); \
01196 setAnchor(img.getROI().x(),img.getROI().y()); \
01197 RGBToGray(img, *this); \
01198 setROI(img.getROI()); setAnchor(img.getAnchor()); \
01199 step_div_type_size = getStep()/sizeof(TYPE); \
01200 return *this; \
01201 }
01202
01203
01204 CREATE_CONVERT_OPERATOR_C3_C1(uChar);
01205 CREATE_CONVERT_OPERATOR_C3_C1(sChar);
01206 CREATE_CONVERT_OPERATOR_C3_C1(uInt);
01207 CREATE_CONVERT_OPERATOR_C3_C1(sInt);
01208 CREATE_CONVERT_OPERATOR_C3_C1(uShort);
01209 CREATE_CONVERT_OPERATOR_C3_C1(sShort);
01210 CREATE_CONVERT_OPERATOR_C3_C1(sFloat);
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240 #define CREATE_CONVERT_OPERATOR_C1_C3(TYPE) \
01241 template <> QVImage<TYPE, 3> & QVImage<TYPE, 3>::operator=(const QVImage<TYPE, 1> &img) \
01242 { \
01243 imageBuffer = new QVImageBuffer<TYPE>(3*img.getCols(), img.getRows()); \
01244 setAnchor(img.getROI().x(),img.getROI().y()); \
01245 Copy(img, img, img, *this); \
01246 setROI(img.getROI()); setAnchor(img.getAnchor()); \
01247 step_div_type_size = getStep()/sizeof(TYPE); \
01248 return *this; \
01249 }
01250
01251 #ifdef QVIPP
01252 CREATE_CONVERT_OPERATOR_C1_C3(uChar);
01253 CREATE_CONVERT_OPERATOR_C1_C3(uShort);
01254 CREATE_CONVERT_OPERATOR_C1_C3(sShort);
01255 CREATE_CONVERT_OPERATOR_C1_C3(sInt);
01256 CREATE_CONVERT_OPERATOR_C1_C3(sFloat);
01257 #endif
01258
01259
01260 #define CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(TYPE1, TYPE2) \
01261 template <> QVImage<TYPE2, 1>::QVImage(QVImage<TYPE1, 3> const &img):QVGenericImage(img) \
01262 { \
01263 QVImage<TYPE1, 1> temp1(img); \
01264 QVImage<TYPE2, 1> temp2(temp1); \
01265 *this = temp2; \
01266 }
01267
01268 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uChar, uShort);
01269 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uChar, sShort);
01270 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uChar, sInt);
01271 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uChar, sFloat);
01272 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uShort, uChar);
01273 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uShort, sShort);
01274 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uShort, sInt);
01275 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(uShort, sFloat);
01276 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sShort, uChar);
01277 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sShort, uShort);
01278 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sShort, sInt);
01279 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sShort, sFloat);
01280 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sInt, uChar);
01281 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sInt, uShort);
01282 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sInt, sShort);
01283 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sInt, sFloat);
01284 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sFloat, uChar);
01285 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sFloat, uShort);
01286 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sFloat, sShort);
01287 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C3_C1(sFloat, sInt);
01288
01289 #define CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(TYPE1, TYPE2) \
01290 template <> QVImage<TYPE2, 3>::QVImage(QVImage<TYPE1, 1> const &img):QVGenericImage(img) \
01291 { \
01292 QVImage<TYPE1, 3> temp1(img); \
01293 QVImage<TYPE2, 3> temp2(temp1); \
01294 *this = temp2; \
01295 }
01296
01297 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uChar, uShort);
01298 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uChar, sShort);
01299 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uChar, sInt);
01300 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uChar, sFloat);
01301 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uShort, uChar);
01302 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uShort, sShort);
01303 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uShort, sInt);
01304 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(uShort, sFloat);
01305 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sShort, uChar);
01306 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sShort, uShort);
01307 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sShort, sInt);
01308 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sShort, sFloat);
01309 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sInt, uChar);
01310 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sInt, uShort);
01311 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sInt, sShort);
01312 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sInt, sFloat);
01313 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sFloat, uChar);
01314 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sFloat, uShort);
01315 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sFloat, sShort);
01316 CREATE_CONVERT_CONSTRUCTOR_DOUBLE_C1_C3(sFloat, sInt);
01317
01318
01319 #define CREATE_ACCESS_CONSTRUCTOR(OPERATOR, TYPE, C) \
01320 template <> QVImage<TYPE, 1> QVImage<TYPE, C>::OPERATOR(const uInt channel) const \
01321 { \
01322 QVImage<TYPE, 1> result(getCols(), getRows()); \
01323 Copy(*this, channel, result); \
01324 result.setROI(getROI()); result.setAnchor(getAnchor()); \
01325 return result; \
01326 }
01327
01328 CREATE_ACCESS_CONSTRUCTOR(operator(), uChar, 1);
01329 CREATE_ACCESS_CONSTRUCTOR(operator(), uChar, 3);
01330 CREATE_ACCESS_CONSTRUCTOR(operator(), uShort, 1);
01331 CREATE_ACCESS_CONSTRUCTOR(operator(), uShort, 3);
01332 CREATE_ACCESS_CONSTRUCTOR(operator(), sShort, 1);
01333 CREATE_ACCESS_CONSTRUCTOR(operator(), sShort, 3);
01334 CREATE_ACCESS_CONSTRUCTOR(operator(), sInt, 1);
01335 CREATE_ACCESS_CONSTRUCTOR(operator(), sInt, 3);
01336 CREATE_ACCESS_CONSTRUCTOR(operator(), sFloat, 1);
01337 CREATE_ACCESS_CONSTRUCTOR(operator(), sFloat, 3);
01338
01339
01340
01341
01342 #ifndef DOXYGEN_IGNORE_THIS
01343 template<typename Type> void CopyC1x3C3( const QVImage<Type, 1> &src1,
01344 const QVImage<Type, 1> &src2,
01345 const QVImage<Type, 1> &src3,
01346 QVImage<Type, 3> &dst)
01347 {
01348 const uInt cols = src1.getCols(), rows = src1.getRows();
01349
01350 Q_ASSERT_X(src2.getCols() == cols, "CopyC1x3C3", "Number of columns for images 1 and 2 do not match");
01351 Q_ASSERT_X(src2.getRows() == rows, "CopyC1x3C3", "Number of rows for images 1 and 2 do not match");
01352 Q_ASSERT_X(src3.getCols() == cols, "CopyC1x3C3", "Number of columns for images 1 and 3 do not match");
01353 Q_ASSERT_X(src3.getRows() == rows, "CopyC1x3C3", "Number of rows for images 1 and 3 do not match");
01354
01355 dst = QVImage<Type, 3>(cols, rows);
01356 dst.setROI(src1.getROI());
01357
01358 Type const *src1Data = src1.getReadData(),
01359 *src2Data = src2.getReadData(),
01360 *src3Data = src3.getReadData();
01361
01362 Type *dstData = dst.getWriteData();
01363 const uInt src1Step = src1.getStep(),
01364 src2Step = src2.getStep(),
01365 src3Step = src3.getStep(),
01366 dstStep = dst.getStep();
01367
01368 for(uInt i = 0; i < rows; i++)
01369 {
01370 for(uInt j = 0; j < cols; j++)
01371 {
01372 dstData[3*j+0] = src1Data[j];
01373 dstData[3*j+1] = src2Data[j];
01374 dstData[3*j+2] = src3Data[j];
01375 }
01376
01377 src1Data += src1Step;
01378 src2Data += src2Step;
01379 src3Data += src3Step;
01380 dstData += dstStep;
01381 }
01382 }
01383
01384 template<typename Type> void ConvertC1C3(const QVImage<Type, 1> &src, QVImage<Type, 3> &dst)
01385 {
01386 const int cols = src.getCols(), rows = src.getRows();
01387
01388 dst = QVImage<Type, 3>(cols, rows);
01389 dst.setROI(src.getROI());
01390
01391 Type const *srcData = src.getReadData();
01392 Type *dstData = dst.getWriteData();
01393 const int srcStep = src.getStep(),
01394 dstStep = dst.getStep();
01395
01396 for(int i = 0; i < rows; i++)
01397 {
01398 for(int j = 0; j < cols; j++)
01399 dstData[3*j+0] = dstData[3*j+1] = dstData[3*j+2] = srcData[j];
01400 srcData += srcStep;
01401 dstData += dstStep;
01402 }
01403 }
01404
01405 template<typename Type> void ConvertC3C1(const QVImage<Type, 3> &src, QVImage<Type, 1> &dst)
01406 {
01407 const int cols = src.getCols(), rows = src.getRows();
01408
01409 dst = QVImage<Type, 1>(cols, rows);
01410 dst.setROI(src.getROI());
01411
01412 Type const *srcData = src.getReadData();
01413 Type *dstData = dst.getWriteData();
01414 const int srcStep = src.getStep(),
01415 dstStep = dst.getStep();
01416
01417 for(int i = 0; i < rows; i++)
01418 {
01419 for(int j = 0; j < cols; j++)
01420 dstData[j] = (srcData[3*j+0] + srcData[3*j+1] + srcData[3*j+2])/3;
01421 srcData += srcStep;
01422 dstData += dstStep;
01423 }
01424 }
01425
01426 template<typename Type1, typename Type2, int C> void ConvertType(const QVImage<Type1, C> &src, QVImage<Type2, C> &dst)
01427 {
01428 const int cols = src.getCols(), rows = src.getRows();
01429
01430 dst = QVImage<Type2, C>(cols, rows);
01431 dst.setROI(src.getROI());
01432
01433 Type1 const *srcData = src.getReadData();
01434 Type2 *dstData = dst.getWriteData();
01435 const int srcStep = src.getStep(),
01436 dstStep = dst.getStep();
01437
01438 for(int i = 0; i < rows; i++)
01439 {
01440 for(int j = 0; j < C*cols; j++)
01441 dstData[j] = srcData[j];
01442 srcData += srcStep;
01443 dstData += dstStep;
01444 }
01445 }
01446
01447 template<typename Type> void CopyC3C1(const QVImage<Type, 3> &src, const uChar channel, QVImage<Type, 1> &dst)
01448 {
01449 const int cols = src.getCols(), rows = src.getRows();
01450
01451 dst = QVImage<Type, 1>(cols, rows);
01452 dst.setROI(src.getROI());
01453
01454 Type const *srcData = src.getReadData();
01455 Type *dstData = dst.getWriteData();
01456 const int srcStep = src.getStep(),
01457 dstStep = dst.getStep();
01458
01459 for(int i = 0; i < rows; i++)
01460 {
01461 for(int j = 0; j < cols; j++)
01462 dstData[j] = srcData[3*j+channel];
01463 srcData += srcStep;
01464 dstData += dstStep;
01465 }
01466 }
01467
01468 #endif // DOXYGEN_IGNORE_THIS
01469
01470 #ifndef QVIPP
01471 #define CREATE_SET_NO_IPP_C1(TYPE) \
01472 void Set(const TYPE value, QVImage<TYPE, 1> &image) \
01473 { \
01474 const int cols = image.getCols(), rows = image.getRows(); \
01475 \
01476 QVIMAGE_INIT_WRITE(TYPE,image); \
01477 for(int row = 0; row < rows; row++) \
01478 for(int col = 0; col < cols; col++) \
01479 QVIMAGE_PIXEL(image, col, row, 0) = value; \
01480 }
01481
01482 CREATE_SET_NO_IPP_C1(uChar);
01483 CREATE_SET_NO_IPP_C1(sFloat);
01484 CREATE_SET_NO_IPP_C1(sInt);
01485 CREATE_SET_NO_IPP_C1(uInt);
01486 CREATE_SET_NO_IPP_C1(sShort);
01487 CREATE_SET_NO_IPP_C1(uShort);
01488
01489 #define CREATE_SET_NO_IPP_C3(TYPE) \
01490 void Set(const TYPE value[3], QVImage<TYPE, 3> &image) \
01491 { \
01492 const int cols = image.getCols(), rows = image.getRows(); \
01493 \
01494 QVIMAGE_INIT_WRITE(TYPE, image); \
01495 for(int row = 0; row < rows; row++) \
01496 for(int col = 0; col < cols; col++) \
01497 { \
01498 QVIMAGE_PIXEL(image, col, row, 0) = value[0]; \
01499 QVIMAGE_PIXEL(image, col, row, 1) = value[1]; \
01500 QVIMAGE_PIXEL(image, col, row, 2) = value[2]; \
01501 } \
01502 }
01503
01504 CREATE_SET_NO_IPP_C3(uChar);
01505 CREATE_SET_NO_IPP_C3(sFloat);
01506 CREATE_SET_NO_IPP_C3(sInt);
01507 CREATE_SET_NO_IPP_C3(uInt);
01508 CREATE_SET_NO_IPP_C3(sShort);
01509 CREATE_SET_NO_IPP_C3(uShort);
01510
01511 #define CREATE_COPY_NO_IPP(TYPE, C) \
01512 void Copy(const QVImage<TYPE, C> &src, QVImage<TYPE, C> &dest) \
01513 { \
01514 dest = src; \
01515 }
01516
01517 CREATE_COPY_NO_IPP(uChar, 1);
01518 CREATE_COPY_NO_IPP(sFloat, 1);
01519 CREATE_COPY_NO_IPP(sInt, 1);
01520 CREATE_COPY_NO_IPP(uInt, 1);
01521 CREATE_COPY_NO_IPP(sShort, 1);
01522 CREATE_COPY_NO_IPP(uShort, 1);
01523
01524 CREATE_COPY_NO_IPP(uChar, 3);
01525 CREATE_COPY_NO_IPP(sFloat, 3);
01526 CREATE_COPY_NO_IPP(sInt, 3);
01527 CREATE_COPY_NO_IPP(uInt, 3);
01528 CREATE_COPY_NO_IPP(sShort, 3);
01529 CREATE_COPY_NO_IPP(uShort, 3);
01530
01531 void Copy(const QVImage<sFloat, 3> &src, const uChar channel, QVImage<sFloat, 1> &dst) { CopyC3C1<sFloat>(src, channel, dst); }
01532 void Copy(const QVImage<uChar, 3> &src, const uChar channel, QVImage<uChar, 1> &dst) { CopyC3C1<uChar>(src, channel, dst); }
01533 void Copy(const QVImage<sChar, 3> &src, const uChar channel, QVImage<sChar, 1> &dst) { CopyC3C1<sChar>(src, channel, dst); }
01534 void Copy(const QVImage<sInt, 3> &src, const uChar channel, QVImage<sInt, 1> &dst) { CopyC3C1<sInt>(src, channel, dst); }
01535 void Copy(const QVImage<uInt, 3> &src, const uChar channel, QVImage<uInt, 1> &dst) { CopyC3C1<uInt>(src, channel, dst); }
01536 void Copy(const QVImage<sShort, 3> &src, const uChar channel, QVImage<sShort, 1> &dst) { CopyC3C1<sShort>(src, channel, dst); }
01537 void Copy(const QVImage<uShort, 3> &src, const uChar channel, QVImage<uShort, 1> &dst) { CopyC3C1<uShort>(src, channel, dst); }
01538
01539
01540
01541
01542 void Convert(const QVImage<sFloat, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<sFloat, uChar, 1>(src, dst); }
01543 void Convert(const QVImage<sFloat, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sFloat, sChar, 1>(src, dst); }
01544 void Convert(const QVImage<sFloat, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<sFloat, sInt, 1>(src, dst); }
01545 void Convert(const QVImage<sFloat, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sFloat, uInt, 1>(src, dst); }
01546 void Convert(const QVImage<sFloat, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<sFloat, sShort, 1>(src, dst); }
01547 void Convert(const QVImage<sFloat, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sFloat, uShort, 1>(src, dst); }
01548
01549
01550 void Convert(const QVImage<sFloat, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<sFloat, uChar, 3>(src, dst); }
01551 void Convert(const QVImage<sFloat, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sFloat, sChar, 3>(src, dst); }
01552 void Convert(const QVImage<sFloat, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<sFloat, sInt, 3>(src, dst); }
01553 void Convert(const QVImage<sFloat, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sFloat, uInt, 3>(src, dst); }
01554 void Convert(const QVImage<sFloat, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<sFloat, sShort, 3>(src, dst); }
01555 void Convert(const QVImage<sFloat, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sFloat, uShort, 3>(src, dst); }
01556
01557
01558 void Convert(const QVImage<uChar, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<uChar, sFloat, 1>(src, dst); }
01559
01560 void Convert(const QVImage<uChar, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uChar, sChar, 1>(src, dst); }
01561 void Convert(const QVImage<uChar, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<uChar, sInt, 1>(src, dst); }
01562 void Convert(const QVImage<uChar, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<uChar, uInt, 1>(src, dst); }
01563 void Convert(const QVImage<uChar, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<uChar, sShort, 1>(src, dst); }
01564 void Convert(const QVImage<uChar, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<uChar, uShort, 1>(src, dst); }
01565
01566 void Convert(const QVImage<uChar, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<uChar, sFloat, 3>(src, dst); }
01567
01568 void Convert(const QVImage<uChar, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uChar, sChar, 3>(src, dst); }
01569 void Convert(const QVImage<uChar, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<uChar, sInt, 3>(src, dst); }
01570 void Convert(const QVImage<uChar, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<uChar, uInt, 3>(src, dst); }
01571 void Convert(const QVImage<uChar, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<uChar, sShort, 3>(src, dst); }
01572 void Convert(const QVImage<uChar, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<uChar, uShort, 3>(src, dst); }
01573
01574
01575 void Convert(const QVImage<sChar, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<sChar, sFloat, 1>(src, dst); }
01576 void Convert(const QVImage<sChar, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<sChar, uChar, 1>(src, dst); }
01577
01578 void Convert(const QVImage<sChar, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<sChar, sInt, 1>(src, dst); }
01579 void Convert(const QVImage<sChar, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sChar, uInt, 1>(src, dst); }
01580 void Convert(const QVImage<sChar, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<sChar, sShort, 1>(src, dst); }
01581 void Convert(const QVImage<sChar, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sChar, uShort, 1>(src, dst); }
01582
01583 void Convert(const QVImage<sChar, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<sChar, sFloat, 3>(src, dst); }
01584 void Convert(const QVImage<sChar, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<sChar, uChar, 3>(src, dst); }
01585
01586 void Convert(const QVImage<sChar, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<sChar, sInt, 3>(src, dst); }
01587 void Convert(const QVImage<sChar, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sChar, uInt, 3>(src, dst); }
01588 void Convert(const QVImage<sChar, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<sChar, sShort, 3>(src, dst); }
01589 void Convert(const QVImage<sChar, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sChar, uShort, 3>(src, dst); }
01590
01591
01592 void Convert(const QVImage<sInt, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<sInt, sFloat, 1>(src, dst); }
01593 void Convert(const QVImage<sInt, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<sInt, uChar, 1>(src, dst); }
01594 void Convert(const QVImage<sInt, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sInt, sChar, 1>(src, dst); }
01595
01596 void Convert(const QVImage<sInt, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sInt, uInt, 1>(src, dst); }
01597 void Convert(const QVImage<sInt, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<sInt, sShort, 1>(src, dst); }
01598 void Convert(const QVImage<sInt, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sInt, uShort, 1>(src, dst); }
01599
01600 void Convert(const QVImage<sInt, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<sInt, sFloat, 3>(src, dst); }
01601 void Convert(const QVImage<sInt, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<sInt, uChar, 3>(src, dst); }
01602 void Convert(const QVImage<sInt, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sInt, sChar, 3>(src, dst); }
01603
01604 void Convert(const QVImage<sInt, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sInt, uInt, 3>(src, dst); }
01605 void Convert(const QVImage<sInt, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<sInt, sShort, 3>(src, dst); }
01606 void Convert(const QVImage<sInt, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sInt, uShort, 3>(src, dst); }
01607
01608
01609 void Convert(const QVImage<uInt, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<uInt, sFloat, 1>(src, dst); }
01610 void Convert(const QVImage<uInt, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<uInt, uChar, 1>(src, dst); }
01611 void Convert(const QVImage<uInt, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uInt, sChar, 1>(src, dst); }
01612 void Convert(const QVImage<uInt, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<uInt, sInt, 1>(src, dst); }
01613
01614 void Convert(const QVImage<uInt, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<uInt, sShort, 1>(src, dst); }
01615 void Convert(const QVImage<uInt, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<uInt, uShort, 1>(src, dst); }
01616
01617 void Convert(const QVImage<uInt, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<uInt, sFloat, 3>(src, dst); }
01618 void Convert(const QVImage<uInt, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<uInt, uChar, 3>(src, dst); }
01619 void Convert(const QVImage<uInt, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uInt, sChar, 3>(src, dst); }
01620 void Convert(const QVImage<uInt, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<uInt, sInt, 3>(src, dst); }
01621
01622 void Convert(const QVImage<uInt, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<uInt, sShort, 3>(src, dst); }
01623 void Convert(const QVImage<uInt, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<uInt, uShort, 3>(src, dst); }
01624
01625
01626 void Convert(const QVImage<sShort, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<sShort, sFloat, 1>(src, dst); }
01627 void Convert(const QVImage<sShort, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<sShort, uChar, 1>(src, dst); }
01628 void Convert(const QVImage<sShort, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sShort, sChar, 1>(src, dst); }
01629 void Convert(const QVImage<sShort, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<sShort, sInt, 1>(src, dst); }
01630 void Convert(const QVImage<sShort, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sShort, uInt, 1>(src, dst); }
01631
01632 void Convert(const QVImage<sShort, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sShort, uShort, 1>(src, dst); }
01633
01634 void Convert(const QVImage<sShort, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<sShort, sFloat, 3>(src, dst); }
01635 void Convert(const QVImage<sShort, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<sShort, uChar, 3>(src, dst); }
01636 void Convert(const QVImage<sShort, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sShort, sChar, 3>(src, dst); }
01637 void Convert(const QVImage<sShort, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<sShort, sInt, 3>(src, dst); }
01638 void Convert(const QVImage<sShort, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sShort, uInt, 3>(src, dst); }
01639
01640 void Convert(const QVImage<sShort, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sShort, uShort, 3>(src, dst); }
01641
01642
01643 void Convert(const QVImage<uShort, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<uShort, sFloat, 1>(src, dst); }
01644 void Convert(const QVImage<uShort, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<uShort, uChar, 1>(src, dst); }
01645 void Convert(const QVImage<uShort, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uShort, sChar, 1>(src, dst); }
01646 void Convert(const QVImage<uShort, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<uShort, sInt, 1>(src, dst); }
01647 void Convert(const QVImage<uShort, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<uShort, uInt, 1>(src, dst); }
01648 void Convert(const QVImage<uShort, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<uShort, sShort, 1>(src, dst); }
01649
01650
01651 void Convert(const QVImage<uShort, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<uShort, sFloat, 3>(src, dst); }
01652 void Convert(const QVImage<uShort, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<uShort, uChar, 3>(src, dst); }
01653 void Convert(const QVImage<uShort, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uShort, sChar, 3>(src, dst); }
01654 void Convert(const QVImage<uShort, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<uShort, sInt, 3>(src, dst); }
01655 void Convert(const QVImage<uShort, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<uShort, uInt, 3>(src, dst); }
01656 void Convert(const QVImage<uShort, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<uShort, sShort, 3>(src, dst); }
01657
01658
01659
01660 void Convert(const QVImage<sFloat, 3> &src, QVImage<sFloat, 1> &dst) { ConvertC3C1<sFloat>(src, dst); }
01661 void Convert(const QVImage<sChar, 3> &src, QVImage<sChar, 1> &dst) { ConvertC3C1<sChar>(src, dst); }
01662 void Convert(const QVImage<uChar, 3> &src, QVImage<uChar, 1> &dst) { ConvertC3C1<uChar>(src, dst); }
01663 void Convert(const QVImage<sInt, 3> &src, QVImage<sInt, 1> &dst) { ConvertC3C1<sInt>(src, dst); }
01664 void Convert(const QVImage<uInt, 3> &src, QVImage<uInt, 1> &dst) { ConvertC3C1<uInt>(src, dst); }
01665 void Convert(const QVImage<sShort, 3> &src, QVImage<sShort, 1> &dst) { ConvertC3C1<sShort>(src, dst); }
01666 void Convert(const QVImage<uShort, 3> &src, QVImage<uShort, 1> &dst) { ConvertC3C1<uShort>(src, dst); }
01667
01668 void RGBToGray(const QVImage<sFloat, 3> &src, QVImage<sFloat, 1> &dst) { ConvertC3C1<sFloat>(src, dst); }
01669 void RGBToGray(const QVImage<sChar, 3> &src, QVImage<sChar, 1> &dst) { ConvertC3C1<sChar>(src, dst); }
01670 void RGBToGray(const QVImage<uChar, 3> &src, QVImage<uChar, 1> &dst) { ConvertC3C1<uChar>(src, dst); }
01671 void RGBToGray(const QVImage<sInt, 3> &src, QVImage<sInt, 1> &dst) { ConvertC3C1<sInt>(src, dst); }
01672 void RGBToGray(const QVImage<uInt, 3> &src, QVImage<uInt, 1> &dst) { ConvertC3C1<uInt>(src, dst); }
01673 void RGBToGray(const QVImage<sShort, 3> &src, QVImage<sShort, 1> &dst) { ConvertC3C1<sShort>(src, dst); }
01674 void RGBToGray(const QVImage<uShort, 3> &src, QVImage<uShort, 1> &dst) { ConvertC3C1<uShort>(src, dst); }
01675
01676 void Convert(const QVImage<sFloat, 1> &src, QVImage<sFloat, 3> &dst) { ConvertC1C3<sFloat>(src, dst); }
01677 void Convert(const QVImage<sChar, 1> &src, QVImage<sChar, 3> &dst) { ConvertC1C3<sChar>(src, dst); }
01678 void Convert(const QVImage<uChar, 1> &src, QVImage<uChar, 3> &dst) { ConvertC1C3<uChar>(src, dst); }
01679 void Convert(const QVImage<sInt, 1> &src, QVImage<sInt, 3> &dst) { ConvertC1C3<sInt>(src, dst); }
01680 void Convert(const QVImage<uInt, 1> &src, QVImage<uInt, 3> &dst) { ConvertC1C3<uInt>(src, dst); }
01681 void Convert(const QVImage<sShort, 1> &src, QVImage<sShort, 3> &dst) { ConvertC1C3<sShort>(src, dst); }
01682 void Convert(const QVImage<uShort, 1> &src, QVImage<uShort, 3> &dst) { ConvertC1C3<uShort>(src, dst); }
01683
01684 void Copy(const QVImage<sFloat, 1> &src1, const QVImage<sFloat, 1> &src2, const QVImage<sFloat, 1> &src3, QVImage<sFloat, 3> &dst) { CopyC1x3C3<sFloat>(src1, src2, src3, dst); }
01685 void Copy(const QVImage<uChar, 1> &src1, const QVImage<uChar, 1> &src2, const QVImage<uChar, 1> &src3, QVImage<uChar, 3> &dst) { CopyC1x3C3<uChar>(src1, src2, src3, dst); }
01686 void Copy(const QVImage<sChar, 1> &src1, const QVImage<sChar, 1> &src2, const QVImage<sChar, 1> &src3, QVImage<sChar, 3> &dst) { CopyC1x3C3<sChar>(src1, src2, src3, dst); }
01687 void Copy(const QVImage<uInt, 1> &src1, const QVImage<uInt, 1> &src2, const QVImage<uInt, 1> &src3, QVImage<uInt, 3> &dst) { CopyC1x3C3<uInt>(src1, src2, src3, dst); }
01688 void Copy(const QVImage<sInt, 1> &src1, const QVImage<sInt, 1> &src2, const QVImage<sInt, 1> &src3, QVImage<sInt, 3> &dst) { CopyC1x3C3<sInt>(src1, src2, src3, dst); }
01689 void Copy(const QVImage<uShort, 1> &src1, const QVImage<uShort, 1> &src2, const QVImage<uShort, 1> &src3, QVImage<uShort, 3> &dst) { CopyC1x3C3<uShort>(src1, src2, src3, dst); }
01690 void Copy(const QVImage<sShort, 1> &src1, const QVImage<sShort, 1> &src2, const QVImage<sShort, 1> &src3, QVImage<sShort, 3> &dst) { CopyC1x3C3<sShort>(src1, src2, src3, dst); }
01691
01692
01693 void Resize(const QVImage<uChar> &src, QVImage<uChar> &dest)
01694 {
01695 std::cout << "Warning: Resize function without IPP is to be implemented soon." << std::endl;
01696 dest = src;
01697 }
01698
01699 void Resize(const QVImage<uChar,3> &src, QVImage<uChar,3> &dest)
01700 {
01701 std::cout << "Warning: Resize function without IPP is to be implemented soon." << std::endl;
01702 dest = src;
01703 }
01704
01705 void YUV420ToRGB(const QVImage<uChar, 1> &srcY, const QVImage<uChar, 1> &srcU, const QVImage<uChar, 1> &srcV,
01706 QVImage<uChar, 3> &destRGB)
01707 {
01708 std::cout << "Warning: YUV420ToRGB function without IPP is to be implemented soon." << std::endl;
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737 Convert(srcY, destRGB);
01738 }
01739
01740 void RGBToYUV420(const QVImage<uChar, 3> &src, QVImage<uChar, 1> &dstY, QVImage<uChar, 1> &dstU, QVImage<uChar, 1> &dstV)
01741 {
01742 std::cout << "Warning: RGBToYUV420 function without IPP is to be implemented soon." << std::endl;
01743
01744
01745
01746
01747
01748 Convert(src, dstY);
01749 dstU = dstV = QVImage<uChar, 1>(src.getCols() / 2, src.getRows() / 2);
01750 Set(128, dstU);
01751 Set(128, dstV);
01752 }
01753
01754 #else
01755
01756
01757 void Convert(const QVImage<sFloat, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sFloat, sChar, 1>(src, dst); }
01758 void Convert(const QVImage<sFloat, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<sFloat, sInt, 1>(src, dst); }
01759 void Convert(const QVImage<sFloat, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sFloat, uInt, 1>(src, dst); }
01760 void Convert(const QVImage<sFloat, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sFloat, sChar, 3>(src, dst); }
01761 void Convert(const QVImage<sFloat, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<sFloat, sInt, 3>(src, dst); }
01762 void Convert(const QVImage<sFloat, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sFloat, uInt, 3>(src, dst); }
01763
01764
01765 void Convert(const QVImage<uChar, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uChar, sChar, 1>(src, dst); }
01766 void Convert(const QVImage<uChar, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<uChar, uInt, 1>(src, dst); }
01767 void Convert(const QVImage<uChar, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uChar, sChar, 3>(src, dst); }
01768 void Convert(const QVImage<uChar, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<uChar, uInt, 3>(src, dst); }
01769
01770
01771 void Convert(const QVImage<sChar, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<sChar, sFloat, 1>(src, dst); }
01772 void Convert(const QVImage<sChar, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<sChar, uChar, 1>(src, dst); }
01773 void Convert(const QVImage<sChar, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<sChar, sInt, 1>(src, dst); }
01774 void Convert(const QVImage<sChar, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sChar, uInt, 1>(src, dst); }
01775 void Convert(const QVImage<sChar, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<sChar, sShort, 1>(src, dst); }
01776 void Convert(const QVImage<sChar, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sChar, uShort, 1>(src, dst); }
01777 void Convert(const QVImage<sChar, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<sChar, sFloat, 3>(src, dst); }
01778 void Convert(const QVImage<sChar, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<sChar, uChar, 3>(src, dst); }
01779 void Convert(const QVImage<sChar, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<sChar, sInt, 3>(src, dst); }
01780 void Convert(const QVImage<sChar, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sChar, uInt, 3>(src, dst); }
01781 void Convert(const QVImage<sChar, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<sChar, sShort, 3>(src, dst); }
01782 void Convert(const QVImage<sChar, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sChar, uShort, 3>(src, dst); }
01783
01784
01785 void Convert(const QVImage<sInt, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<sInt, sFloat, 1>(src, dst); }
01786 void Convert(const QVImage<sInt, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sInt, sChar, 1>(src, dst); }
01787 void Convert(const QVImage<sInt, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sInt, uInt, 1>(src, dst); }
01788 void Convert(const QVImage<sInt, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<sInt, sShort, 1>(src, dst); }
01789 void Convert(const QVImage<sInt, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sInt, uShort, 1>(src, dst); }
01790 void Convert(const QVImage<sInt, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<sInt, sFloat, 3>(src, dst); }
01791 void Convert(const QVImage<sInt, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sInt, sChar, 3>(src, dst); }
01792 void Convert(const QVImage<sInt, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sInt, uInt, 3>(src, dst); }
01793 void Convert(const QVImage<sInt, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<sInt, sShort, 3>(src, dst); }
01794 void Convert(const QVImage<sInt, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sInt, uShort, 3>(src, dst); }
01795
01796
01797 void Convert(const QVImage<uInt, 1> &src, QVImage<sFloat, 1> &dst) { ConvertType<uInt, sFloat, 1>(src, dst); }
01798 void Convert(const QVImage<uInt, 1> &src, QVImage<uChar, 1> &dst) { ConvertType<uInt, uChar, 1>(src, dst); }
01799 void Convert(const QVImage<uInt, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uInt, sChar, 1>(src, dst); }
01800 void Convert(const QVImage<uInt, 1> &src, QVImage<sInt, 1> &dst) { ConvertType<uInt, sInt, 1>(src, dst); }
01801 void Convert(const QVImage<uInt, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<uInt, sShort, 1>(src, dst); }
01802 void Convert(const QVImage<uInt, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<uInt, uShort, 1>(src, dst); }
01803 void Convert(const QVImage<uInt, 3> &src, QVImage<sFloat, 3> &dst) { ConvertType<uInt, sFloat, 3>(src, dst); }
01804 void Convert(const QVImage<uInt, 3> &src, QVImage<uChar, 3> &dst) { ConvertType<uInt, uChar, 3>(src, dst); }
01805 void Convert(const QVImage<uInt, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uInt, sChar, 3>(src, dst); }
01806 void Convert(const QVImage<uInt, 3> &src, QVImage<sInt, 3> &dst) { ConvertType<uInt, sInt, 3>(src, dst); }
01807 void Convert(const QVImage<uInt, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<uInt, sShort, 3>(src, dst); }
01808 void Convert(const QVImage<uInt, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<uInt, uShort, 3>(src, dst); }
01809
01810
01811 void Convert(const QVImage<sShort, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<sShort, sChar, 1>(src, dst); }
01812 void Convert(const QVImage<sShort, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<sShort, uInt, 1>(src, dst); }
01813 void Convert(const QVImage<sShort, 1> &src, QVImage<uShort, 1> &dst) { ConvertType<sShort, uShort, 1>(src, dst); }
01814 void Convert(const QVImage<sShort, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<sShort, sChar, 3>(src, dst); }
01815 void Convert(const QVImage<sShort, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<sShort, uInt, 3>(src, dst); }
01816 void Convert(const QVImage<sShort, 3> &src, QVImage<uShort, 3> &dst) { ConvertType<sShort, uShort, 3>(src, dst); }
01817
01818
01819 void Convert(const QVImage<uShort, 1> &src, QVImage<sChar, 1> &dst) { ConvertType<uShort, sChar, 1>(src, dst); }
01820 void Convert(const QVImage<uShort, 1> &src, QVImage<uInt, 1> &dst) { ConvertType<uShort, uInt, 1>(src, dst); }
01821 void Convert(const QVImage<uShort, 1> &src, QVImage<sShort, 1> &dst) { ConvertType<uShort, sShort, 1>(src, dst); }
01822 void Convert(const QVImage<uShort, 3> &src, QVImage<sChar, 3> &dst) { ConvertType<uShort, sChar, 3>(src, dst); }
01823 void Convert(const QVImage<uShort, 3> &src, QVImage<uInt, 3> &dst) { ConvertType<uShort, uInt, 3>(src, dst); }
01824 void Convert(const QVImage<uShort, 3> &src, QVImage<sShort, 3> &dst) { ConvertType<uShort, sShort, 3>(src, dst); }
01825
01826 void RGBToGray(const QVImage<sChar, 3> &src, QVImage<sChar, 1> &dst) { ConvertC3C1<sChar>(src, dst); }
01827 void RGBToGray(const QVImage<uInt, 3> &src, QVImage<uInt, 1> &dst) { ConvertC3C1<uInt>(src, dst); }
01828 void RGBToGray(const QVImage<sInt, 3> &src, QVImage<sInt, 1> &dst) { ConvertC3C1<sInt>(src, dst); }
01829
01830 void Copy(const QVImage<sChar, 1> &src1, const QVImage<sChar, 1> &src2, const QVImage<sChar, 1> &src3, QVImage<sChar, 3> &dst) { CopyC1x3C3<sChar>(src1, src2, src3, dst); }
01831 void Copy(const QVImage<uInt, 1> &src1, const QVImage<uInt, 1> &src2, const QVImage<uInt, 1> &src3, QVImage<uInt, 3> &dst) { CopyC1x3C3<uInt>(src1, src2, src3, dst); }
01832
01833 #endif // QVIPP