defimwrite(filename, img, params=None):# real signature unknown; restored from __doc__"""imwrite(filename, img[, params]) -> retval. @brief Saves an image to a specified file. 將圖像保存到指定文件. . The function imwrite saves the image to the specified file. The image format is chosen based on the. filename extension (see cv::imread for the list of extensions). In general, only 8-bit. single-channel or 3-channel (with 'BGR' channel order) images. can be saved using this function, with these exceptions:· imwrite函數將圖像保存到指定文件。 圖像格式是根據文件擴展名選擇的(擴展名列表請參見cv :: imread)。 · 通常,使用此功能只能保存8位單通道或3通道(具有“ BGR”通道順序)圖像,但以下情況除外:. - 16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats. - 32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats;· 對于PNG,JPEG 2000和TIFF格式,可以保存16位無符號(CV_16U)圖像;· 可以PFM,TIFF,OpenEXR和Radiance HDR格式保存32位浮點(CV_32F)圖像;. 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding. (4 bytes per pixel). - PNG images with an alpha channel can be saved using this function. To do this, create. 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels. should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).· 使用LogLuv高動態范圍編碼(每像素4個字節)將保存3通道(CV_32FC3)TIFF圖像-使用此功能可以保存具有alpha通道的PNG圖像。 · 為此,創建8位(或16位)4通道圖像BGRA,其中alpha通道位于最后。 · 完全透明的像素應將alpha設置為0,完全不透明的像素應將alpha設置為255/65535(請參見下面的代碼示例)。. . If the format, depth or channel order is different, use. Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O. functions to save the image to XML or YAML format.· · 如果格式,深度或通道順序不同,請在保存之前使用Mat :: convertTo和cv :: cvtColor進行轉換。 · 或者,使用通用的FileStorage I / O功能將圖像保存為XML或YAML格式。. . The sample below shows how to create a BGRA image and save it to a PNG file. It also demonstrates how to set custom. compression parameters:· 下面的示例演示如何創建BGRA圖像并將其保存到PNG文件。 它還演示了如何設置自定義壓縮參數:. @include snippets/imgcodecs_imwrite.cpp. @param filename Name of the file. 文件名。. @param img Image to be saved. 要保存的圖像。. @param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags特定格式的參數編碼為對(paramId_1,paramValue_1,paramId_2,paramValue_2等)。請參見cv :: ImwriteFlags"""pass