Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: Giải MãVàCắtJpeg
#include <image_ops.h>
Giải mã và cắt hình ảnh được mã hóa JPEG thành tenxơ uint8.
Bản tóm tắt
channels
attr cho biết số lượng kênh màu mong muốn cho hình ảnh được giải mã.
Các giá trị được chấp nhận là:
- 0: Sử dụng số kênh trong hình ảnh được mã hóa JPEG.
- 1: xuất ra hình ảnh thang độ xám.
- 3: xuất hình ảnh RGB.
Nếu cần, hình ảnh được mã hóa JPEG sẽ được chuyển đổi để phù hợp với số lượng kênh màu được yêu cầu.
ratio
attr cho phép thu nhỏ hình ảnh theo hệ số nguyên trong quá trình giải mã. Các giá trị được phép là: 1, 2, 4 và 8. Điều này nhanh hơn nhiều so với việc thu nhỏ hình ảnh sau này.
Nó tương đương với sự kết hợp giữa giải mã và cắt xén, nhưng nhanh hơn nhiều khi chỉ giải mã một phần hình ảnh jpeg.
Lập luận:
- phạm vi: Một đối tượng phạm vi
- nội dung: 0-D. Hình ảnh được mã hóa JPEG.
- crop_window: 1-D. Cửa sổ cắt: [crop_y, crop_x, crop_height, crop_width].
Thuộc tính tùy chọn (xem Attrs
):
- kênh: Số lượng kênh màu cho hình ảnh được giải mã.
- tỷ lệ: Tỷ lệ giảm tỷ lệ.
- Fancy_upscaling: Nếu đúng, hãy sử dụng khả năng nâng cấp các mặt phẳng sắc độ chậm hơn nhưng đẹp hơn (chỉ yuv420/422).
- try_recover_truncated: Nếu đúng, hãy thử khôi phục hình ảnh từ đầu vào bị cắt bớt.
- chấp nhận_phân số: Phần dòng bắt buộc tối thiểu trước khi đầu vào bị cắt ngắn được chấp nhận.
- dct_method: chuỗi chỉ định gợi ý về thuật toán được sử dụng để giải nén. Mặc định là "" ánh xạ tới mặc định của hệ thống cụ thể. Các giá trị hợp lệ hiện tại là ["INTEGER_FAST", "INTEGER_ACCURATE"]. Gợi ý có thể bị bỏ qua (ví dụ: thư viện jpeg nội bộ thay đổi thành phiên bản không có tùy chọn cụ thể đó.)
Trả về:
-
Output
: 3-D với hình dạng [height, width, channels]
..
Thuộc tính công khai
Chức năng công cộng
nút
::tensorflow::Node * node() const
operator::tensorflow::Input() const
toán tử::tenorflow::Đầu ra
operator::tensorflow::Output() const
Các hàm tĩnh công khai
Phần chấp nhận được
Attrs AcceptableFraction(
float x
)
Kênh
Attrs Channels(
int64 x
)
Phương thức Dct
Attrs DctMethod(
StringPiece x
)
FancyUpscaling
Attrs FancyUpscaling(
bool x
)
Tỷ lệ
Attrs Ratio(
int64 x
)
ThửPhục hồiĐã cắt ngắn
Attrs TryRecoverTruncated(
bool x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::DecodeAndCropJpeg Class Reference\n\ntensorflow::ops::DecodeAndCropJpeg\n==================================\n\n`#include \u003cimage_ops.h\u003e`\n\nDecode and Crop a JPEG-encoded image to a uint8 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 JPEG-encoded image.\n- 1: output a grayscale image.\n- 3: output an RGB image.\n\n\u003cbr /\u003e\n\nIf needed, the JPEG-encoded image is transformed to match the requested number of color channels.\n\nThe attr `ratio` allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.\n\nIt is equivalent to a combination of decode and crop, but much faster by only decoding partial jpeg image.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- contents: 0-D. The JPEG-encoded image.\n- crop_window: 1-D. The crop window: \\[crop_y, crop_x, crop_height, crop_width\\].\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs)):\n\n- channels: Number of color channels for the decoded image.\n- ratio: Downscaling ratio.\n- fancy_upscaling: If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only).\n- try_recover_truncated: If true try to recover an image from truncated input.\n- acceptable_fraction: The minimum required fraction of lines before a truncated input is accepted.\n- dct_method: string specifying a hint about the algorithm used for decompression. Defaults to \"\" which maps to a system-specific default. Currently valid values are \\[\"INTEGER_FAST\", \"INTEGER_ACCURATE\"\\]. The hint may be ignored (e.g., the internal jpeg library changes to a version that does not have that specific option.)\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.2/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| [DecodeAndCropJpeg](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a40f8322a3956b1982d0d78a7452613fc)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` crop_window)` ||\n| [DecodeAndCropJpeg](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a04b3586218bf0c15f49ea73f733b7aa9)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` crop_window, const `[DecodeAndCropJpeg::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [image](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ac86d4abf1b4381950b01a3d3b7b42033) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a7ca3572e2a7b2f2efbb2dfffca5d6bef) | [Operation](/versions/r2.2/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab81a0fc51718ab73147ccc00f8a859fe)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a4bd46410ee7c7deb85a864042934ac25)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a6676c18a287c62f936e7bc369b687625)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AcceptableFraction](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a03aa63bbe5a02cfb5735272956cfe14a)`(float x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n| [Channels](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1aafeb21d91856f8799a33028b25ed30f5)`(int64 x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n| [DctMethod](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a5aad56954952a3823b7446d5db735018)`(StringPiece x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n| [FancyUpscaling](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab270c3550997fa6825093eb3e76de49d)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n| [Ratio](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab5ff568c17de19ad85cd4e78585603ce)`(int64 x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n| [TryRecoverTruncated](#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1adb9221ee465f54e8ee30ea452d2bf2b9)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DecodeAndCropJpeg::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs) | Optional attribute setters for [DecodeAndCropJpeg](/versions/r2.2/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg). |\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### DecodeAndCropJpeg\n\n```gdscript\n DecodeAndCropJpeg(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n ::tensorflow::Input crop_window\n)\n``` \n\n### DecodeAndCropJpeg\n\n```gdscript\n DecodeAndCropJpeg(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n ::tensorflow::Input crop_window,\n const DecodeAndCropJpeg::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### AcceptableFraction\n\n```text\nAttrs AcceptableFraction(\n float x\n)\n``` \n\n### Channels\n\n```text\nAttrs Channels(\n int64 x\n)\n``` \n\n### DctMethod\n\n```text\nAttrs DctMethod(\n StringPiece x\n)\n``` \n\n### FancyUpscaling\n\n```text\nAttrs FancyUpscaling(\n bool x\n)\n``` \n\n### Ratio\n\n```text\nAttrs Ratio(\n int64 x\n)\n``` \n\n### TryRecoverTruncated\n\n```text\nAttrs TryRecoverTruncated(\n bool x\n)\n```"]]