Jail - SGIPerl extension for grabbing video, modifying images and display images
use Jail;
$font = openBDF Font ("helvetica50.bdf"); if ($font->getStatus) { print $font->getErrorString() . "\n"; exit(1); }
$font = openBDF Font ("helvetica50.bdf");
if ($font->getStatus) {
print $font->getErrorString() . "\n";
exit(1);
}
$dateStr = localtime(time); $glArray = $font->getText("$dateStr",$count); $glyph = merge Glyph ($glArray, $count);
$dateStr = localtime(time);
$glArray = $font->getText("$dateStr",$count);
getText("$dateStr",$count)
$glyph = merge Glyph ($glArray, $count);
$glyph->setForeground(255,255,255,0);
$jg = new JailGlyph(); $jg->addGlyph($glyph); if ($jg->getStatus()) { print $jg->getErrorString() . "\n"; exit(1); }
$jg = new JailGlyph();
$jg->addGlyph($glyph);
if ($jg->getStatus()) {
print $jg->getErrorString() . "\n";
$imgStream = new JailArray(); if (!$imgStream->getVideoStream(2)) { $imgStream->printError(); exit(1); }
$imgStream = new JailArray();
if (!$imgStream->getVideoStream(2)) {
$imgStream->printError();
$image = $imgStream->pop();
$wi = $image->getWidth(); $hi = $image->getHeight(); $wg = $jg->getWidth(); $hg = $jg->getHeight();
$wi = $image->getWidth();
$hi = $image->getHeight();
$wg = $jg->getWidth();
$hg = $jg->getHeight();
if (!$jg->blittInImage($image, $wi - $wg, $hi - $hg)) { print "BLITT1: "; print $jg->getErrorString() . "\n"; print $image->getErrorString() . "\n"; exit(1); } $image->blur(180,5,5); $image->rotateZoom(45, 0.6, 0.6); if (!$image->save("/tmp/jail_2.sgi","SGI")) { $image->printError(); exit(1); }
if (!$jg->blittInImage($image, $wi - $wg, $hi - $hg)) {
print "BLITT1: ";
print $image->getErrorString() . "\n";
} $image->blur(180,5,5); $image->rotateZoom(45, 0.6, 0.6); if (!$image->save("/tmp/jail_2.sgi","SGI")) { $image->printError(); exit(1); }
$image->blur(180,5,5);
$image->rotateZoom(45, 0.6, 0.6);
if (!$image->save("/tmp/jail_2.sgi","SGI")) { $image->printError(); exit(1); }
if (!$image->save("/tmp/jail_2.sgi","SGI")) {
$image->printError();
$image = $imgStream->pop(); $image->sharp(2.5); $wi = $image->getWidth(); $hi = $image->getHeight();
$image->sharp(2.5);
if (!$jg->blittInImage($image, $wi - $wg, $hi - $hg)) { print "BLITT2: "; print $jg->getErrorString() . "\n"; print $image->getErrorString() . "\n"; exit(1); } if (!$image->save("/tmp/jail_1.gif","GIF")) { $image->printError(); exit(1); }
print "BLITT2: ";
} if (!$image->save("/tmp/jail_1.gif","GIF")) { $image->printError(); exit(1); }
if (!$image->save("/tmp/jail_1.gif","GIF")) {
Jail - Just an_other Image Library This extension is running _only_ on SGI IRIX systems. You need the Image Vision Library, Video Library and STL. You need a X11 Display _only_ if you want to display an image. The newest version you can get under http://www.artcom.net/~karo/Jail/. You can get there also a precompiled version.
A 'better' documentation are may be the examples.
The package C<Jail> exports the following functions
Load an existing image. The method guesses the right file type.
Save this image with a given filename. The imgFormat is one of the supported file formats from the Image Vision Library. Have a look under File Formats or execute the imgformats command.
File Formats
Save this image to a already opened filehandle. For the imgFormat see above. This function works only for the GIF format. The IL seeks during saving on the filedescriptor, I try to get the IL output over a pipe. That does not work. YET
Returns the width of the image in pixels.
Returns the height of the image in pixels.
Returns for the image the amount of channels.
This method is usefull if you have loaded an image. So you can get the file format for that image.
Copy a tile from srcImage with the given coord. to this image.
srcImage
Add a image logical to this image.
Set a pixel with the given color
Get a copy of this image.
Get a image from the default video input. See also videoin(1) and videopanel(1).
Rotate this image with a given angle. And/Or zoom this image. 0 <= angle < 360 0.0 < zoomFactor <= 1.0 See also ilRotZoomImg(3)
This method blurs an image by convolving it with a 2D gaussian kernel. Parameter: blur : the degree of blur width,height : the kernel size
See also ilGBlurImg(3)
This method sharpens the source image, by convolving it with a special sharpening kernel. The size of the kernel and the degree of sharpness can be controlled by the radius and sharpness parameters.
See also ilSharpenImg(3)
This method performs a directional gradient transform of the image. This is similar to doing a first derivative operation in the direction of the gradient. Given a direction, a square kernel is generated and then the source image is convolved with this kernel. A kernel size and additive bias can be supplied.
See also ilCompassImg(3)
This method performs a 2D convolution on an image using one of two predefined 3x3 Laplacian kernels. The resulting image is edge-enhanced.
kern := 1 | 2
See also ilLaplaceImg(3)
This method performs two orthogonal 2D convolutions on an image using two predefined 2x2 Roberts kernels. The resulting image is edge enhanced.
See also ilRobertsImg(3)
This method takes an other image which will be blend into this image. If you specify the alphaValue indicate thatthe alpha values are to be taken from the alpha channel of the foreground and background images. The alpha pixels are normalized to the range (0.0-1.0), based on the minimum and maximum pixel values of the foreground and background images. If you specify an alphaImg the first channel of that is interpreted as alpha channel for the blending.
See also ilBlendImg(3)
This displays the image in a window.. damn this is totaly buggy
Normaly the return value is 0. Otherwise an error occured.
Returns the amount of images.
Push an image to the end of the array.
Pops and returns the last image in the array.
Shifts the first image of the array off and returns it.
Prepends an other image to the front of the array.
Loads images with a given prefix, an additional number and a given suffix. For Example: prefix: blub startSuffix: 23 suffix: .gif amount: 3
So the method would load 3 images: blub23.gif, blub24.gif and blub25.gif
Saves images with the same name convention as loadIndexed.
Get a videostream of amount images.
amount
This static factory method loads a BDF font with the given filename and returns a Font Object. BDF stands for Glyph Bitmap Distribution Format. See: http://www.adobe.com/supportservice/devrelations/typeforum/ftypes.html You can get BDF fonts from the X source or get them from your X server, have a look: fstobdf(1), xfontsel(1)
This methods builds a GlyphArray Object from a given text. In the countVar Variable will be the amount of found Glyphs returned.
Returns the encoding value for the font.
Returns the name.
This static factory method returns a new Glyph Object which is build from the given GlyphArray.
You set the Name for the Glyph object.
Get the char encoding for the Glyph. For a merged Glyph it is always 0.
merge
Get the width of the Bounding Box.
Get the height of the Bounding Box.
Get the X coord. of the virtual point Zero of the BBX.
Get the Y coord. of the virtual point Zero of the BBX.
Select a color for the foreground of the Glyph. Every '1' in the Glyph will be treated as foreground.If you select for 'a' color a 255, the foreground will not be painted.
Select a color for the background of the Glyph. Every '0' in the Glyph will be treated as background.If you select for 'a' color a 255, the background will not be painted.
This is for debuging. This prints the glyph in ascii.
This method collects Glyph objects.
This method returns a Jail object. The returned object depends on the added Glyphs.
This method expect a Jail object and a x and y coord. The added Glyphs will be rendered in the given Jail image.
This returns the witdh, for that the JailGlyph will create a Imgage. Thats the same as: $jailObj = $JailglyphObj->createImg(); -->> $jailObj->getWidth();
Get the X coord of the virtual point zero.
In general, bias is a constant value added to each pixel luminance value to make it scale correctly. If, for example, the raw pixel luminance covers values between 100 and 200, some operators are able to scale the luminance values over the entire depth of pixel luminance values, for example, 0 - 255. When you scale the luminance values in this way, you need a bias value that adjusts the initial, raw luminance value, 100, in this example, to zero.
Specifies how the neighborhood is defined for pixels at the edge of the image. Have look at the EDGE_* Flags.
Determining the procedure used by IL to alter the geometric aspects of an image Have a look under Flags RT_*
SGI Docs: The kernel is the group or neighborhood of pixels used in calculations to sharpen or blur an image. Generally, the larger the kernel radius, the more pronounced the effect of either sharpening or blurring the image using the Enhance subpanel. However, using a larger kernel radius also results in a more time-consuming process.
arg, thats heavy to explain shortly please have look at ilBlendImg(3) and in /usr/include/il/ilTypes.h
No padding is done, and the output image shrinks by the size of the kernel minus one in each dimension.
The edge of the input image is padded with the input images fill value so that a full-sized output image can be processed.
Similar to ilNoPad, except that the output, images border is sufficiently padded with its fill value so that the final image is the same size as the source image.
Sufficient data is taken from the opposite edge of the source image so that a full-sized output image can be processed.
Sufficient data near the edge of the image is reflected so that a full-sized output image can be processed without producing artifacts at the image edge. This mode gives the best results for most operators.
Nearest, standing for Nearest Neighbor, works quickly but produces lower-quality results.
Bilinear uses more complex, time-consuming methods than Nearest Neighbor, but produces higher-quality results.
Bicubic is more time-consuming than either Nearest Neighbor or Bilinear, but produces the best results.
If you choose the Bicubic resampling method, you can also choose the specific Bicubic Family, each of which produces a somewhat different effect: B-Spline, which is the default option, produces smoother images. Catmul produces more sharpening. Mitchell results in an effect between that of the other two.
The Minify method produces the best results if you are reducing the magnification of an image. Again, however, it is a more time-consuming process.
See also imgformats(1)
PNG implements the PNG file format using version 0.88 of the Portable Network Graphics library, libpng, and version 1.0 of the ZIP deflate/inflate compression library, libzlib.
The GIF file format is used to read image files stored in the CompuServe Graphics Image File (GIF) format. GIF does not support paging. It stores images in palette-color-compressed using the Lempel-Ziv & Welch algorithmThe compression algorithm has become the focus of patent infringement litigation which has inspired the creation of a new image format to replace GIF. This new format is the Portable Network Graphics (PNG) image format. It is also supported by Jail.
SGI is the first format defined by Silicon Graphics for storing image data. SGI files are typically stored in files suffixed by .bw, .rgb, .rgba, .sgi, or .screen. SGI files support full color, color palette, and monochrome images of either one or two bytes per color component. Image data can be stored in either raw form or run-length encoding (RLE) compression. You can create SGI files with RLE compression but you cannot later rewrite a portion of a compressed SGI file.
The TIFF file format, created by Aldus Corporation, is an extended version of the Tag Image File Format, using version 3.4beta24 of Sam Lefflers TIFF library, libtiff. This library implements version 6.0 of the TIFF specification.
JFIF implements the JPEG file format using the JPEG library, libjpeg, made available by the Independent JPEG Group. In addition to providing the IFL image I/O abstraction, the entire JPEG library is provided as is for use by software that has been developed for use with libjpeg.
PPM, PGM, and PBM implement the PPM, PGM, and PBM file formats using release 7, December 1993 of the NETPBM libraries, libppm, libpgm, and libpbm.
The Alias file format supports both variations of the format: 8-bit RGB and 8-bit matte.
The SOFTIMAGE file format supports reading all types of image files and writes only mixed RLE compressed. There is no current support for depth buffer files or rendered subregions.
The YUV file format is the standard 8-bit 4:2:2 (YUV) format used by the Sirius board and almost all digital disk recorders ( Abekas, Accom etc ).
The PCD file format supports image files produced by the Kodak Photo CD system. Photo CD establishes a system for storing high-resolution, digital photographic images on compact discs.
Every Kodak Photo CD contains a file in the Kodak Photo CD Overview Pac format. This format contains a low resolution representation of each image on the Photo CD.
There is a small memory leak somewhere in the save routine. Do not know if it is in my or in the SGI IL routines.
add a thrash hold operator
The display object is _VERY_ buggy and not finished yet.
Thats a SGI IFL Bug.
The Problem is the IL core dumpes if I am trying to copy a GIF. So i have to convert GIF->RGB->GIF.
Write a better documentation
Oh, yes there are some. Especially in the display routine. Please, please, please, send me a short note if you found a bug.
This module has been written by Benjamin Pannier (B<karo@artcom.net>).
http://www.artcom.net/~karo/Jail/ perl(1), il(3), ifl(3), vl(3)
2 POD Errors
The following errors were encountered while parsing the POD:
Unterminated C<C<C<...>>> sequence
Unterminated C<...> sequence
To install Jail, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jail
CPAN shell
perl -MCPAN -e shell install Jail
For more information on module installation, please visit the detailed CPAN module installation guide.