تدفق التوتر:: العمليات:: فك التشفير
#include <image_ops.h>
قم بفك تشفير الصورة المشفرة بـ PNG إلى موتر uint8 أو uint16.
ملخص
تشير channels
attr إلى العدد المطلوب من قنوات الألوان للصورة التي تم فك تشفيرها.
القيم المقبولة هي:
- 0: استخدم عدد القنوات في الصورة المشفرة بـ PNG.
- 1: إخراج صورة ذات تدرج رمادي.
- 3: إخراج صورة RGB.
- 4: إخراج صورة RGBA.
إذا لزم الأمر، يتم تحويل الصورة المشفرة بـ PNG لتتناسب مع العدد المطلوب من قنوات الألوان.
تدعم هذه العملية أيضًا فك تشفير ملفات JPEG وملفات GIF غير المتحركة نظرًا لأن الواجهة هي نفسها، على الرغم من أنه من الأسهل استخدام tf.image.decode_image
.
الحجج:
- النطاق: كائن النطاق
- المحتويات: 0-د. الصورة بصيغة PNG.
السمات الاختيارية (انظر Attrs
):
- القنوات: عدد قنوات الألوان للصورة التي تم فك تشفيرها.
العوائد:
-
Output
: ثلاثي الأبعاد بالشكل [height, width, channels]
.
الصفات العامة
صورة
::tensorflow::Output image
عملية
Operation operation
الوظائف العامة
فك التشفير
DecodePng(
const ::tensorflow::Scope & scope,
::tensorflow::Input contents
)
فك التشفير
DecodePng(
const ::tensorflow::Scope & scope,
::tensorflow::Input contents,
const DecodePng::Attrs & attrs
)
العقدة
::tensorflow::Node * node() const
operator::tensorflow::Input() const
المشغل::tensorflow::الإخراج
operator::tensorflow::Output() const
وظائف ثابتة العامة
القنوات
Attrs Channels(
int64 x
)
نوع D
Attrs Dtype(
DataType x
)
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# tensorflow::ops::DecodePng Class Reference\n\ntensorflow::ops::DecodePng\n==========================\n\n`#include \u003cimage_ops.h\u003e`\n\nDecode a PNG-encoded image to a uint8 or uint16 tensor.\n\nSummary\n-------\n\nThe attr `channels` indicates the desired number of color channels for the decoded image.\n\nAccepted values are:\n\n\n- 0: Use the number of channels in the PNG-encoded image.\n- 1: output a grayscale image.\n- 3: output an RGB image.\n- 4: output an RGBA image.\n\n\u003cbr /\u003e\n\nIf needed, the PNG-encoded image is transformed to match the requested number of color channels.\n\nThis op also supports decoding JPEGs and non-animated GIFs since the interface is the same, though it is cleaner to use `tf.image.decode_image`.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- contents: 0-D. The PNG-encoded image.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)):\n\n- channels: Number of color channels for the decoded image.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 3-D with shape `[height, width, channels]`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1ab7adeeb5aa6b10893fb6063ee8d6fc87)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents)` ||\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1aa2df55e8e1eed056df69f127ca4cba25)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, const `[DecodePng::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [image](#classtensorflow_1_1ops_1_1_decode_png_1a493e0f58c502e83895b5ab8df3ed277c) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_decode_png_1ac11da6e89a194ee86e7a82442fb33ed4) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_decode_png_1adea6247b44969accb1513a6b237bd2d3)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_decode_png_1a1449fe5081528b4cb081cb224ba20d96)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_decode_png_1a19025343d7746c9091afcf01dbba03fd)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [Channels](#classtensorflow_1_1ops_1_1_decode_png_1ac0322c095dfd2d11bca81c46b421847a)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n| [Dtype](#classtensorflow_1_1ops_1_1_decode_png_1a656dedb17c75247c916d54efef9fb4f6)`(DataType x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DecodePng::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs) | Optional attribute setters for [DecodePng](/versions/r1.15/api_docs/cc/class/tensorflow/ops/decode-png#classtensorflow_1_1ops_1_1_decode_png). |\n\nPublic attributes\n-----------------\n\n### image\n\n```text\n::tensorflow::Output image\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents\n)\n``` \n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n const DecodePng::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Channels\n\n```text\nAttrs Channels(\n int64 x\n)\n``` \n\n### Dtype\n\n```carbon\nAttrs Dtype(\n DataType x\n)\n```"]]