| OLD | NEW |
| (Empty) |
| 1 | |
| 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
| 3 <html><head><title>Python: module telemetry.util.image_util</title> | |
| 4 <meta charset="utf-8"> | |
| 5 </head><body bgcolor="#f0f0f8"> | |
| 6 | |
| 7 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | |
| 8 <tr bgcolor="#7799ee"> | |
| 9 <td valign=bottom> <br> | |
| 10 <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a hre
f="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry
.util.html"><font color="#ffffff">util</font></a>.image_util</strong></big></big
></font></td | |
| 11 ><td align=right valign=bottom | |
| 12 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href=
"../telemetry/util/image_util.py">telemetry/util/image_util.py</a></font></td></
tr></table> | |
| 13 <p><tt>Provides implementations of basic image proc
essing functions.<br> | |
| 14 <br> | |
| 15 Implements basic image processing functions, such
as reading/writing images,<br> | |
| 16 cropping, finding the bounding box of a color
and diffing images.<br> | |
| 17 <br> | |
| 18 When numpy is present, image_util_numpy_impl is us
ed for the implementation of<br> | |
| 19 this interface. The old bitmap implementation (ima
ge_util_bitmap_impl) is used<br> | |
| 20 as a fallback when numpy is not present.</tt>
</p> | |
| 21 <p> | |
| 22 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
| 23 <tr bgcolor="#aa55cc"> | |
| 24 <td colspan=3 valign=bottom> <br> | |
| 25 <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big
></font></td></tr> | |
| 26 | |
| 27 <tr><td bgcolor="#aa55cc"><tt> </tt></td><td>
</td> | |
| 28 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=t
op><a href="base64.html">base64</a><br> | |
| 29 <a href="telemetry.internal.util.external_modules.html">telemetry.internal.util.
external_modules</a><br> | |
| 30 </td><td width="25%" valign=top><a href="telemetry.internal.image_processing.ima
ge_util_numpy_impl.html">telemetry.internal.image_processing.image_util_numpy_im
pl</a><br> | |
| 31 <a href="telemetry.internal.image_processing.image_util_numpy_impl.html">telemet
ry.internal.image_processing.image_util_numpy_impl</a><br> | |
| 32 </td><td width="25%" valign=top><a href="numpy.html">numpy</a><br> | |
| 33 </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> | |
| 34 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
| 35 <tr bgcolor="#eeaa77"> | |
| 36 <td colspan=3 valign=bottom> <br> | |
| 37 <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></b
ig></font></td></tr> | |
| 38 | |
| 39 <tr><td bgcolor="#eeaa77"><tt> </tt></td><td>
</td> | |
| 40 <td width="100%"><dl><dt><a name="-AreEqual"><strong>AreEqual</strong></a>(image
1, image2, tolerance<font color="#909090">=0</font>, likely_equal<font color="#9
09090">=True</font>)</dt><dd><tt>Determines whether two images&nb
sp;are identical within a given tolerance.<br> | |
| 41 Setting likely_equal to False enables short-circuit&nbs
p;equality testing, which<br> | |
| 42 is about 2-3x slower for equal images, but&nb
sp;can be image height times faster<br> | |
| 43 if the images are not equal.</tt></dd></dl> | |
| 44 <dl><dt><a name="-Channels"><strong>Channels</strong></a>(image)</dt><dd><tt>Nu
mber of color channels in the image.</tt></dd></dl
> | |
| 45 <dl><dt><a name="-Crop"><strong>Crop</strong></a>(image, left, top, width, heig
ht)</dt><dd><tt>Crops the current image down to th
e specified box.</tt></dd></dl> | |
| 46 <dl><dt><a name="-Diff"><strong>Diff</strong></a>(image1, image2)</dt><dd><tt>R
eturns a new image that represents the differ
ence between this image<br> | |
| 47 and another image.</tt></dd></dl> | |
| 48 <dl><dt><a name="-FromBase64Png"><strong>FromBase64Png</strong></a>(base64_png)
</dt><dd><tt>Create an image from raw PNG data&nbs
p;encoded in base64.</tt></dd></dl> | |
| 49 <dl><dt><a name="-FromPng"><strong>FromPng</strong></a>(png_data)</dt><dd><tt>C
reate an image from raw PNG data.</tt></dd></dl> | |
| 50 <dl><dt><a name="-FromPngFile"><strong>FromPngFile</strong></a>(path)</dt><dd><
tt>Create an image from a PNG file.<br> | |
| 51 <br> | |
| 52 Args:<br> | |
| 53 path: The path to the PNG file.</tt></
dd></dl> | |
| 54 <dl><dt><a name="-FromRGBPixels"><strong>FromRGBPixels</strong></a>(width, heig
ht, pixels, bpp<font color="#909090">=3</font>)</dt><dd><tt>Create an
image from an array of rgb pixels.<br> | |
| 55 <br> | |
| 56 Ignores alpha channel if present.<br> | |
| 57 <br> | |
| 58 Args:<br> | |
| 59 width, height: int, the width and heig
ht of the image.<br> | |
| 60 pixels: The flat array of pixels in&nb
sp;the form of [r,g,b[,a],r,g,b[,a],...]<br> | |
| 61 bpp: 3 for RGB, 4 for RGBA.</tt></dd><
/dl> | |
| 62 <dl><dt><a name="-GetBoundingBox"><strong>GetBoundingBox</strong></a>(image, co
lor, tolerance<font color="#909090">=0</font>)</dt><dd><tt>Finds the m
inimum box surrounding all occurrences of bgr 
;|color|.<br> | |
| 63 <br> | |
| 64 Ignores the alpha channel.<br> | |
| 65 <br> | |
| 66 Args:<br> | |
| 67 color: RbgaColor, bounding box color.<br> | |
| 68 tolerance: int, per-channel tolerance for t
he bounding box color.<br> | |
| 69 <br> | |
| 70 Returns:<br> | |
| 71 (top, left, width, height), match_count</tt></dd
></dl> | |
| 72 <dl><dt><a name="-GetColorHistogram"><strong>GetColorHistogram</strong></a>(ima
ge, ignore_color<font color="#909090">=None</font>, tolerance<font color="#90909
0">=0</font>)</dt><dd><tt>Computes a histogram of the p
ixel colors in this image.<br> | |
| 73 Args:<br> | |
| 74 ignore_color: An RgbaColor to exclude from&
nbsp;the bucket counts.<br> | |
| 75 tolerance: A tolerance for the ignore_color
.<br> | |
| 76 <br> | |
| 77 Returns:<br> | |
| 78 A ColorHistogram namedtuple with 256 intege
rs in each field: r, g, and b.</tt></dd></dl> | |
| 79 <dl><dt><a name="-GetPixelColor"><strong>GetPixelColor</strong></a>(image, x, y
)</dt><dd><tt>Returns a RgbaColor for the pixel at
(x, y).</tt></dd></dl> | |
| 80 <dl><dt><a name="-Height"><strong>Height</strong></a>(image)</dt><dd><tt>Height
of the image.</tt></dd></dl> | |
| 81 <dl><dt><a name="-Pixels"><strong>Pixels</strong></a>(image)</dt><dd><tt>Flat&n
bsp;RGB pixel array of the image.</tt></dd></dl> | |
| 82 <dl><dt><a name="-Width"><strong>Width</strong></a>(image)</dt><dd><tt>Width&nb
sp;of the image.</tt></dd></dl> | |
| 83 <dl><dt><a name="-WritePngFile"><strong>WritePngFile</strong></a>(image, path)<
/dt><dd><tt>Write an image to a PNG file.<br> | |
| 84 <br> | |
| 85 Args:<br> | |
| 86 image: an image object.<br> | |
| 87 path: The path to the PNG file. M
ust end in 'png' or an<br> | |
| 88 AssertionError will be
raised.</tt></dd></dl> | |
| 89 </td></tr></table> | |
| 90 </body></html> | |
| OLD | NEW |