日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python cv2.imencode()(将图像编码到内存缓冲区中。)(图像压缩原理)

發(fā)布時(shí)間:2025/3/20 python 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python cv2.imencode()(将图像编码到内存缓冲区中。)(图像压缩原理) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

from cv2\__init__.py

def imencode(ext, img, params=None): # real signature unknown; restored from __doc__"""imencode(ext, img[, params]) -> retval, buf. @brief Encodes an image into a memory buffer.將圖像編碼到內(nèi)存緩沖區(qū)中。. . The function imencode compresses the image and stores it in the memory buffer that is resized to fit the. result. See cv::imwrite for the list of supported formats and flags description.imencode函數(shù)壓縮圖像并將其存儲(chǔ)在已調(diào)整大小以適合結(jié)果的內(nèi)存緩沖區(qū)中。 有關(guān)支持的格式和標(biāo)志說明的列表,請參見cv :: imwrite。. . @param ext File extension that defines the output format.定義輸出格式的文件擴(kuò)展名。. @param img Image to be written.要寫入的圖像。. @param buf Output buffer resized to fit the compressed image.調(diào)整輸出緩沖區(qū)的大小以適合壓縮圖像。. @param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.特定于格式的參數(shù)。 參見cv :: imwrite和cv :: ImwriteFlags。"""pass

發(fā)現(xiàn)被壓縮后的圖片數(shù)據(jù)量是原來的23分之一了,難道不會(huì)造成數(shù)據(jù)、像素值丟失?
它壓縮的原理是什么?

應(yīng)該是用到了某種算法,將有聯(lián)系的數(shù)據(jù)形成一塊打包,從而減少數(shù)據(jù)量,底層暫時(shí)不用管它,知道怎么用imencode()和imdecode()就行

參考文章1:利用Opencv提供的imencode和imdecode進(jìn)行圖像視頻傳輸(發(fā)送端支持Linux和Windows雙系統(tǒng))

總結(jié)

以上是生活随笔為你收集整理的python cv2.imencode()(将图像编码到内存缓冲区中。)(图像压缩原理)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。