Changeset 20742 in project


Ignore:
Timestamp:
10/09/10 01:22:01 (9 years ago)
Author:
petercrlane
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/leptonica

    r20675 r20742  
    8282==== Manipulating images
    8383
     84<procedure>(pix-abs-difference pix-1 pix-2)</procedure>
     85Returns pointer to new image which is formed by taking the pixel-wise absolute difference between {{pix-1}} and{{pix-2}}.  The two source images must have identical dimensions and colour depth.  {{#f}} is returned on an error.
     86
    8487<procedure>(pix-add-gray pix-d pix-1 pix-2)</procedure>
    8588Returns pointer to image which is pixel sum of {{pix-1}} and {{pix-2}}.  Unless {{#f}}, {{pix-d}} may specify
    8689the destination image, and {{pix-d}} may be equal to {{pix-1}} for an in-place change.
     90
     91<procedure>(pix-add-constant-gray pix-s value)</procedure>
     92In-place modification of {{pix-s}} by adding {{value}} to each pixel.  Returns 0 if OK or 1 if error.
    8793
    8894<procedure>(pix-close-gray pix h-size v-size)</procedure>
     
    97103Returns a pointer to a new {{pix}}, based on the given {{pix}}.
    98104
     105<procedure>(pix-dither-to-binary pix)</procedure>
     106Uses Floyd-Steinberg error diffusion dithering algorithm to convert given {{pix}} to a new {{pix}}.  Returns {{#f}} on error.
     107
     108<procedure>(pix-dither-to-binary-spec pix lowerclip upperclip)</procedure>
     109Similar to {{pix-dither-to-binary}}, but the integers {{lowerclip}} and {{upperclip}} specific the distance to 0 or 255 respectively beyond which the routine stops propagating excess.
     110
    99111<procedure>(pix-erode-gray pix h-size v-size)</procedure>
    100112{{h-size}} and {{v-size}} must be odd values.
     
    107119Inverts the image {{pix-s}}.  If {{pix-d}} is {{#f}}, then a pointer to a new {{pix}} is returned; otherwise, {{pix-d}} holds the inverted image.
    108120
     121<procedure>(pix-max-dynamic-range pix scale-type)</procedure>
     122Returns a new pointer to an image which stretches the colour values in {{pix}} to the full available range.  Returns {{#f} if error.  {{scale-type}} is constant given below.
     123
     124<procedure>(pix-min-or-max pix-d pix-1 pix-2 choose-type)</procedure>
     125Returns a pointer to an image which is formed either from the pixel-wise min or max of the two source images (the
     126type determined by {{choose-type}}, defined below).  If {{pix-d}} is {{#f}} then a new image is created and returned.  If {{pix-d}} is an image, then that image is updated.  If {{pix-d}} is the same as {{pix-1}} then an in-place change is made.
     127
     128<procedure>(pix-mult-constant-gray pix-s value)</procedure>
     129In-place modification of {{pix-s}} by multiplying each pixel value by {{value}}.  Returns 0 if OK, or 1 if error.
     130
    109131<procedure>(pix-open-gray pix h-size v-size)</procedure>
    110132{{h-size}} and {{v-size}} must be odd values.
     
    114136Returns a pointer to a new 8bpp {{pix}} created by rotating the given 8 bpp {{pix}} through the given {{angle}}; {{filler}} specifies the gray value to be brought in to fill blanks, 0 for black, 255 for white.
    115137
     138<procedure>(pix-subtract-gray pix-d pix-1 pix-2)</procedure>
     139Returns pointer to image which is pixel difference of {{pix-1}} and {{pix-2}}.  Unless {{#f}}, {{pix-d}} may specify the destination image, and {{pix-d}} may be equal to {{pix-1}} for an in-place change.
     140
    116141<procedure>(pix-threshold-to-binary pix threshold</procedure>
    117142Returns a pointer to a new {{pix}} created from the given {{pix}}.  The given {{pix}} should be a 4 or 8 bpp colour image; the given threshold value is used to convert the image to binary.
     
    120145If {{pix-d}} is {{#f}}, returns a pointer to a new {{pix}}.  Else, {{pix-d}} must be equal to {{pix-s}} and thresholding is done in place.  If set-value > threshold, then all pixels with a value >= threshold are set to set-value;
    121146else, if set-value < threshold, then all pixels with value <= threshold are set to set-value. 
     147
     148<procedure>(pix-var-threshold-to-binary pix-s pix-g)</procedure>
     149Returns a pointer to a new {{pix}} created from the given 8 bpp {{pix-s}} by thresholding each corresponding pixel according to the value in {{pix-g}}. 
    122150
    123151<procedure>(rotate pix angle rotation-type in-colour width height)</procedure>
     
    134162==== Constants
    135163
     164; choose-type : L-CHOOSE-MAX, L-CHOOSE-MIN
    136165; image-type : IFF-UNKNOWN, IFF-BMP, IFF-JFIF-JPEG, IFF-PNG, IFF-TIFF, IFF-TIFF-PACKBITS, IFF-TIFF-RLE, IFF-TIFF-G3, IFF-TIFF-G4, IFF-TIFF-LZW, IFF-TIFF-ZIP, IFF-PNM, IFF-PS, IFF-GIF, IFF-JP2, IFF-DEFAULT, IFF-SPIX.
    137166; in-colour : L-BRING-IN-WHITE, L-BRING-IN-BLACK.
    138167; rotation-type : L-ROTATE-AREA-MAP, L-ROTATE-SHEAR, L-ROTATE-SAMPLING.
     168; scale-type : L-LINEAR-SCALE, L-LOG-SCALE
    139169
    140170=== Examples
Note: See TracChangeset for help on using the changeset viewer.