00001
00002
00003
00004
00005
00006
00007
00008 #ifndef V_VImage_h
00009 #define V_VImage_h 1
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "viaio/Vlib.h"
00027 #include "viaio/file.h"
00028
00029
00030 #include <stdio.h>
00031
00032
00033 #include <sys/types.h>
00034
00035
00036 #include <X11/Xfuncproto.h>
00037
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041
00042
00043
00044
00045
00046
00047
00048 typedef struct V_ImageRec {
00049 int nbands;
00050 int nrows;
00051 int ncolumns;
00052 VRepnKind pixel_repn;
00053 unsigned long flags;
00054 VAttrList attributes;
00055 VPointer data;
00056 VPointer *row_index;
00057 VPointer **band_index;
00058 int nframes;
00059 int nviewpoints;
00060 int ncolors;
00061 int ncomponents;
00062 } VImageRec;
00063
00064
00065 enum {
00066 VImageSingleAlloc = 0x01
00067 };
00068
00069
00070
00071
00072
00073
00074
00075 #define VImageNBands(image) ((image)->nbands)
00076 #define VImageNRows(image) ((image)->nrows)
00077 #define VImageNColumns(image) ((image)->ncolumns)
00078 #define VImageNFrames(image) ((image)->nframes)
00079 #define VImageNViewpoints(image) ((image)->nviewpoints)
00080 #define VImageNColors(image) ((image)->ncolors)
00081 #define VImageNComponents(image) ((image)->ncomponents)
00082
00083
00084 #define VPixelRepn(image) ((image)->pixel_repn)
00085
00086
00087 #define VImageData(image) ((image)->data)
00088
00089
00090 #define VImageAttrList(image) ((image)->attributes)
00091
00092
00093 #define VImageNPixels(image) \
00094 ((image)->nbands * (image)->nrows * (image)->ncolumns)
00095
00096
00097 #define VPixelSize(image) (VRepnSize ((image)->pixel_repn))
00098
00099
00100 #define VPixelPrecision(image) (VRepnPrecision ((image)->pixel_repn))
00101
00102
00103 #define VPixelRepnName(image) (VRepnName ((image)->pixel_repn))
00104
00105
00106 #define VPixelMinValue(image) (VRepnMinValue ((image)->pixel_repn))
00107 #define VPixelMaxValue(image) (VRepnMaxValue ((image)->pixel_repn))
00108
00109
00110 #define VImageSize(image) (VImageNPixels(image) * VPixelSize(image))
00111
00112
00113 #define VPixelPtr(image, band, row, column) \
00114 ((VPointer) ((char *) ((image)->band_index[band][row]) + \
00115 (column) * VPixelSize (image)))
00116
00117
00118 #define VPixel(image, band, row, column, type) \
00119 (* ((type *) (image)->band_index[band][row] + (column)))
00120
00121
00122 #define VPixelArray(image, type) \
00123 ((type ***) (image)->band_index)
00124
00125
00126 #define VBandIndex(image, frame, viewpoint, color, component) \
00127 (((((frame) * (image)->nviewpoints + (viewpoint)) * (image)->ncolors + \
00128 (color)) * (image)->ncomponents) + (component))
00129
00130
00131 #define VSameImageRange(image1, image2) \
00132 ((image1)->nbands == (image2)->nbands && \
00133 (image1)->nrows == (image2)->nrows && \
00134 (image1)->ncolumns == (image2)->ncolumns && \
00135 (image1)->pixel_repn == (image2)->pixel_repn)
00136
00137
00138 #define VSameImageSize(image1, image2) \
00139 ((image1)->nbands == (image2)->nbands && \
00140 (image1)->nrows == (image2)->nrows && \
00141 (image1)->ncolumns == (image2)->ncolumns)
00142
00143
00144
00145
00146
00147
00148 #define VColorInterpAttr "color_interp"
00149 #define VComponentInterpAttr "component_interp"
00150 #define VFrameInterpAttr "frame_interp"
00151 #define VNBandsAttr "nbands"
00152 #define VNColorsAttr "ncolors"
00153 #define VNComponentsAttr "ncomponents"
00154 #define VNFramesAttr "nframes"
00155 #define VNViewpointsAttr "nviewpoints"
00156 #define VPixelAspectRatioAttr "pixel_aspect_ratio"
00157 #define VViewpointInterpAttr "viewpoint_interp"
00158
00159
00160 typedef enum {
00161
00162
00163 VBandInterpNone,
00164 VBandInterpOther,
00165
00166
00167
00168
00169 VBandInterpStereoPair,
00170
00171
00172 VBandInterpRGB,
00173
00174
00175 VBandInterpComplex,
00176 VBandInterpGradient,
00177 VBandInterpIntensity,
00178 VBandInterpOrientation
00179 } VBandInterp;
00180
00181 extern VDictEntry VBandInterpDict[];
00182
00183
00184
00185
00186
00187
00188
00189 typedef int VBand;
00190 #define VAllBands -1
00191
00192
00193 typedef enum {
00194 VConvolvePadNone,
00195 VConvolvePadZero,
00196 VConvolvePadBorder,
00197 VConvolvePadWrap,
00198 VConvolvePadTrim
00199 } VConvolvePadMethod;
00200
00201
00202 typedef enum {
00203 VFilterGaussian,
00204 VFilterGaussianDx,
00205 VFilterGaussianDy
00206 } VFilterKind;
00207
00208
00209 typedef enum {
00210
00211
00212 VImageOpAbs,
00213 VImageOpExp,
00214 VImageOpLog,
00215 VImageOpNot,
00216 VImageOpSqrt,
00217 VImageOpSquare,
00218
00219
00220 VImageOpAdd,
00221 VImageOpAnd,
00222 VImageOpDist,
00223 VImageOpDiv,
00224 VImageOpMax,
00225 VImageOpMin,
00226 VImageOpMult,
00227 VImageOpOr,
00228 VImageOpSub,
00229 VImageOpXor
00230 } VImageOpKind;
00231
00232
00233
00234
00235
00236
00237
00238
00239 extern VImage VAdjustImage (
00240 #if NeedFunctionPrototypes
00241 VImage ,
00242 VImage ,
00243 VBand ,
00244 double ,
00245 double
00246 #endif
00247 );
00248
00249
00250
00251 extern VImage VCanny (
00252 #if NeedFunctionPrototypes
00253 VImage ,
00254 VImage ,
00255 VBand ,
00256 double ,
00257 VImage * ,
00258 double *
00259 #endif
00260 );
00261
00262
00263
00264 extern VImage VBuildComplexImage (
00265 #if NeedFunctionPrototypes
00266 VImage ,
00267 VBand ,
00268 VImage ,
00269 VBand ,
00270 VImage ,
00271 VRepnKind
00272 #endif
00273 );
00274
00275 extern VImage VImageMagnitude (
00276 #if NeedFunctionPrototypes
00277 VImage ,
00278 VImage ,
00279 VBand
00280 #endif
00281 );
00282
00283 extern VImage VImagePhase (
00284 #if NeedFunctionPrototypes
00285 VImage ,
00286 VImage ,
00287 VBand
00288 #endif
00289 );
00290
00291
00292
00293 extern VImage VConvertImageCopy (
00294 #if NeedFunctionPrototypes
00295 VImage ,
00296 VImage ,
00297 VBand ,
00298 VRepnKind
00299 #endif
00300 );
00301
00302
00303
00304 extern VImage VConvertImageLinear (
00305 #if NeedFunctionPrototypes
00306 VImage ,
00307 VImage ,
00308 VBand ,
00309 VRepnKind ,
00310 double ,
00311 double
00312 #endif
00313 );
00314
00315
00316
00317 extern VImage VConvertImageOpt (
00318 #if NeedFunctionPrototypes
00319 VImage ,
00320 VImage ,
00321 VBand ,
00322 VRepnKind ,
00323 int
00324 #endif
00325 );
00326
00327
00328
00329 extern VImage VConvertImageRange (
00330 #if NeedFunctionPrototypes
00331 VImage ,
00332 VImage ,
00333 VBand ,
00334 VRepnKind
00335 #endif
00336 );
00337
00338
00339
00340 extern VImage VConvolveImage (
00341 #if NeedFunctionPrototypes
00342 VImage ,
00343 VImage ,
00344 VBand ,
00345 VImage ,
00346 VConvolvePadMethod ,
00347 int
00348 #endif
00349 );
00350
00351
00352
00353 extern VImage VConvolveImageSep (
00354 #if NeedFunctionPrototypes
00355 VImage ,
00356 VImage ,
00357 VBand ,
00358 VImage [3] ,
00359 VConvolvePadMethod [3] ,
00360 int [3]
00361 #endif
00362 );
00363
00364
00365
00366 extern VImage VCropImage (
00367 #if NeedFunctionPrototypes
00368 VImage ,
00369 VImage ,
00370 VBand ,
00371 int ,
00372 int ,
00373 int ,
00374 int
00375 #endif
00376 );
00377
00378
00379
00380 extern VBoolean VDither (
00381 #if NeedFunctionPrototypes
00382 VImage ,
00383 VImage ,
00384 VBand ,
00385 int ,
00386 int ,
00387 int ,
00388 int ,
00389 int [] ,
00390 VBooleanPromoted
00391 #endif
00392 );
00393
00394
00395
00396 extern VImage VImageFFT (
00397 #if NeedFunctionPrototypes
00398 VImage ,
00399 VImage ,
00400 VBooleanPromoted ,
00401 double
00402 #endif
00403 );
00404
00405
00406
00407 extern VBoolean VFillImage (
00408 #if NeedFunctionPrototypes
00409 VImage ,
00410 VBand ,
00411 VDoublePromoted
00412 #endif
00413 );
00414
00415
00416
00417 extern VImage VFlipImage (
00418 #if NeedFunctionPrototypes
00419 VImage ,
00420 VImage ,
00421 VBand ,
00422 VBooleanPromoted
00423 #endif
00424 );
00425
00426
00427
00428 extern pid_t VForkImageDisplay (
00429 #if NeedFunctionPrototypes
00430 VImage ,
00431 VStringConst ,
00432 VStringConst
00433 #endif
00434 );
00435
00436
00437
00438 extern VImage VGaussianConvolveImage (
00439 #if NeedFunctionPrototypes
00440 VImage ,
00441 VImage ,
00442 VBand ,
00443 double ,
00444 int ,
00445 VFilterKind
00446 #endif
00447 );
00448
00449
00450
00451 extern VImage VImageGradient (
00452 #if NeedFunctionPrototypes
00453 VImage ,
00454 VImage ,
00455 VBand
00456 #endif
00457 );
00458
00459
00460
00461 extern VImage VImageGradientSeq (
00462 #if NeedFunctionPrototypes
00463 VImage ,
00464 VImage ,
00465 VBand ,
00466 int ,
00467 VDouble []
00468 #endif
00469 );
00470
00471
00472
00473 extern VImage VCreateImage (
00474 #if NeedFunctionPrototypes
00475 int ,
00476 int ,
00477 int ,
00478 VRepnKind
00479 #endif
00480 );
00481
00482 extern VImage VCreateImageLike (
00483 #if NeedFunctionPrototypes
00484 VImage
00485 #endif
00486 );
00487
00488 extern void VDestroyImage (
00489 #if NeedFunctionPrototypes
00490 VImage
00491 #endif
00492 );
00493
00494 extern VDouble VGetPixel (
00495 #if NeedFunctionPrototypes
00496 VImage ,
00497 int ,
00498 int ,
00499 int
00500 #endif
00501 );
00502
00503 extern void VSetPixel (
00504 #if NeedFunctionPrototypes
00505 VImage ,
00506 int ,
00507 int ,
00508 int ,
00509 VDoublePromoted
00510 #endif
00511 );
00512
00513 extern VImage VCopyImage (
00514 #if NeedFunctionPrototypes
00515 VImage ,
00516 VImage ,
00517 VBand
00518 #endif
00519 );
00520
00521 extern VImage VCopyImageAttrs (
00522 #if NeedFunctionPrototypes
00523 VImage ,
00524 VImage
00525 #endif
00526 );
00527
00528 extern VImage VCopyImagePixels (
00529 #if NeedFunctionPrototypes
00530 VImage ,
00531 VImage ,
00532 VBand
00533 #endif
00534 );
00535
00536 extern VBoolean VCopyBand (
00537 #if NeedFunctionPrototypes
00538 VImage ,
00539 VBand ,
00540 VImage ,
00541 VBand
00542 #endif
00543 );
00544
00545 extern VImage VCombineBands (
00546 #if NeedFunctionPrototypes
00547 int ,
00548 VImage [] ,
00549 VBand [] ,
00550 VImage
00551 #endif
00552 );
00553
00554 extern VImage VCombineBandsVa (
00555 #if NeedVarargsPrototypes
00556 VImage ,
00557 ...
00558 #endif
00559 );
00560
00561 extern VImage VSelectDestImage (
00562 #if NeedFunctionPrototypes
00563 VStringConst ,
00564 VImage ,
00565 int ,
00566 int ,
00567 int ,
00568 VRepnKind
00569 #endif
00570 );
00571
00572 extern VBoolean VSelectBand (
00573 #if NeedFunctionPrototypes
00574 VStringConst ,
00575 VImage ,
00576 VBand ,
00577 int * ,
00578 VPointer *
00579 #endif
00580 );
00581
00582 extern VBandInterp VImageFrameInterp (
00583 #if NeedFunctionPrototypes
00584 VImage
00585 #endif
00586 );
00587
00588 extern VBandInterp VImageViewpointInterp (
00589 #if NeedFunctionPrototypes
00590 VImage
00591 #endif
00592 );
00593
00594 extern VBandInterp VImageColorInterp (
00595 #if NeedFunctionPrototypes
00596 VImage
00597 #endif
00598 );
00599
00600 extern VBandInterp VImageComponentInterp (
00601 #if NeedFunctionPrototypes
00602 VImage
00603 #endif
00604 );
00605
00606 extern VBoolean VSetBandInterp (
00607 #if NeedFunctionPrototypes
00608 VImage ,
00609 VBandInterp ,
00610 int ,
00611 VBandInterp ,
00612 int ,
00613 VBandInterp ,
00614 int ,
00615 VBandInterp ,
00616 int
00617 #endif
00618 );
00619
00620 extern int VReadImages (
00621 #if NeedFunctionPrototypes
00622 FILE * ,
00623 VAttrList * ,
00624 VImage **
00625 #endif
00626 );
00627
00628 extern VBoolean VWriteImages (
00629 #if NeedFunctionPrototypes
00630 FILE * ,
00631 VAttrList ,
00632 int ,
00633 VImage []
00634 #endif
00635 );
00636
00637
00638
00639 extern void VImageWindowSize (
00640 #if NeedFunctionPrototypes
00641 VImage ,
00642 int ,
00643 int ,
00644 int * ,
00645 int *
00646 #endif
00647 );
00648
00649
00650
00651 extern VBoolean VImageBandToPS (
00652 #if NeedFunctionPrototypes
00653 FILE * ,
00654 VImage ,
00655 VBand
00656 #endif
00657 );
00658
00659 extern VBoolean VRGBImageToPS (
00660 #if NeedFunctionPrototypes
00661 FILE * ,
00662 VImage ,
00663 VBand
00664 #endif
00665 );
00666
00667 extern VBoolean VGradientImageToPS (
00668 #if NeedFunctionPrototypes
00669 FILE * ,
00670 VImage ,
00671 VBand ,
00672 double
00673 #endif
00674 );
00675
00676
00677
00678 extern VImage VInvertImage (
00679 #if NeedFunctionPrototypes
00680 VImage ,
00681 VImage ,
00682 VBand
00683 #endif
00684 );
00685
00686 extern VImage VNegateImage (
00687 #if NeedFunctionPrototypes
00688 VImage ,
00689 VImage ,
00690 VBand
00691 #endif
00692 );
00693
00694
00695
00696 extern VBoolean VGaussianKernel (
00697 #if NeedFunctionPrototypes
00698 int ,
00699 VDouble [] ,
00700 double
00701 #endif
00702 );
00703
00704 extern VBoolean VGaussianD1Kernel (
00705 #if NeedFunctionPrototypes
00706 int ,
00707 VDouble [] ,
00708 double
00709 #endif
00710 );
00711
00712 extern VBoolean VGaussianSplineKernel (
00713 #if NeedFunctionPrototypes
00714 int ,
00715 VDouble [] ,
00716 double
00717 #endif
00718 );
00719
00720
00721
00722 extern VImage VImageOpI (
00723 #if NeedFunctionPrototypes
00724 VImage ,
00725 VImage ,
00726 VBand ,
00727 VImageOpKind ,
00728 VImage ,
00729 VBand ,
00730 VDouble * ,
00731 VDouble *
00732 #endif
00733 );
00734
00735 extern VImage VImageOpU (
00736 #if NeedFunctionPrototypes
00737 VImage ,
00738 VImage ,
00739 VBand ,
00740 VImageOpKind ,
00741 VDouble * ,
00742 VDouble *
00743 #endif
00744 );
00745
00746 extern VImage VImageOpV (
00747 #if NeedFunctionPrototypes
00748 VImage ,
00749 VImage ,
00750 VBand ,
00751 VImageOpKind ,
00752 double ,
00753 VDouble * ,
00754 VDouble *
00755 #endif
00756 );
00757
00758
00759
00760 VImage VOptFlowWLS (
00761 #if NeedFunctionPrototypes
00762 VImage ,
00763 VImage ,
00764 int ,
00765 double ,
00766 double ,
00767 double [2] ,
00768 double
00769 #endif
00770 );
00771
00772
00773
00774 VImage VReadPlain (
00775 #if NeedFunctionPrototypes
00776 FILE *
00777 #endif
00778 );
00779
00780
00781
00782 VImage VReadPnm (
00783 #if NeedFunctionPrototypes
00784 FILE *
00785 #endif
00786 );
00787
00788
00789
00790 extern VImage VRGBImageToGray (
00791 #if NeedFunctionPrototypes
00792 VImage ,
00793 VImage ,
00794 VBand
00795 #endif
00796 );
00797
00798
00799
00800 extern VImage VRotateImage (
00801 #if NeedFunctionPrototypes
00802 VImage ,
00803 VImage ,
00804 VBand ,
00805 double
00806 #endif
00807 );
00808
00809
00810
00811 extern VImage VSampleImage (
00812 #if NeedFunctionPrototypes
00813 VImage ,
00814 VImage ,
00815 VBand ,
00816 int ,
00817 int
00818 #endif
00819 );
00820
00821
00822
00823 VImage VScaleImage (
00824 #if NeedFunctionPrototypes
00825 VImage ,
00826 VImage ,
00827 VBand ,
00828 double ,
00829 double
00830 #endif
00831 );
00832
00833 VImage VReduceImage (
00834 #if NeedFunctionPrototypes
00835 VImage ,
00836 VImage ,
00837 VBand ,
00838 int ,
00839 int
00840 #endif
00841 );
00842
00843 VImage VExpandImage (
00844 #if NeedFunctionPrototypes
00845 VImage ,
00846 VImage ,
00847 VBand ,
00848 int ,
00849 int
00850 #endif
00851 );
00852
00853
00854
00855 extern VImage VShearImageX (
00856 #if NeedFunctionPrototypes
00857 VImage ,
00858 VImage ,
00859 VBand ,
00860 double
00861 #endif
00862 );
00863
00864 extern VImage VShearImageY (
00865 #if NeedFunctionPrototypes
00866 VImage ,
00867 VImage ,
00868 VBand ,
00869 double
00870 #endif
00871 );
00872
00873
00874
00875 extern VBoolean VImageStats (
00876 #if NeedFunctionPrototypes
00877 VImage ,
00878 VBand ,
00879 VDouble * ,
00880 VDouble * ,
00881 VDouble * ,
00882 VDouble *
00883 #endif
00884 );
00885
00886
00887
00888
00889 VBoolean VRampImage (
00890 #if NeedFunctionPrototypes
00891 VImage ,
00892 VBand ,
00893 double [2] ,
00894 double ,
00895 double ,
00896 double
00897 #endif
00898 );
00899
00900 VBoolean VSineGratingImage (
00901 #if NeedFunctionPrototypes
00902 VImage ,
00903 VBand ,
00904 double [2] ,
00905 double ,
00906 double ,
00907 double ,
00908 double ,
00909 double
00910 #endif
00911 );
00912
00913 VBoolean VZonePlateImage (
00914 #if NeedFunctionPrototypes
00915 VImage ,
00916 VBand ,
00917 double [2] ,
00918 double ,
00919 double ,
00920 double ,
00921 double
00922 #endif
00923 );
00924
00925 VBoolean VBinomialNoiseImage (
00926 #if NeedFunctionPrototypes
00927 VImage ,
00928 VBand ,
00929 VDoublePromoted ,
00930 VDoublePromoted ,
00931 double
00932 #endif
00933 );
00934
00935 VBoolean VNormalNoiseImage (
00936 #if NeedFunctionPrototypes
00937 VImage ,
00938 VBand ,
00939 double ,
00940 double
00941 #endif
00942 );
00943
00944 VBoolean VUniformNoiseImage (
00945 #if NeedFunctionPrototypes
00946 VImage ,
00947 VBand ,
00948 VDoublePromoted ,
00949 VDoublePromoted
00950 #endif
00951 );
00952
00953
00954
00955 extern VImage VTransposeImage (
00956 #if NeedFunctionPrototypes
00957 VImage ,
00958 VImage ,
00959 VBand
00960 #endif
00961 );
00962
00963
00964
00965 extern VImage VReadUbcIff (
00966 #if NeedFunctionPrototypes
00967 FILE *
00968 #endif
00969 );
00970
00971 extern VBoolean VWriteUbcIff (
00972 #if NeedFunctionPrototypes
00973 FILE * ,
00974 VImage ,
00975 VBand
00976 #endif
00977 );
00978
00979
00980
00981 extern VImage VZeroCrossings (
00982 #if NeedFunctionPrototypes
00983 VImage ,
00984 VImage ,
00985 VBand
00986 #endif
00987 );
00988
00989 #ifdef __cplusplus
00990 }
00991 #endif
00992
00993 #endif