opencv读取图片单通道
时间: 2023-10-22 14:03:49 浏览: 96
当使用OpenCV读取灰度图像时,默认情况下会读取为三通道图像。这是因为OpenCV在读取图像时会将缺失的图像通道进行复制,因此会得到三通道的图像。为了获得单通道图像,可以在读取图像时在路径后面的参数中设置为0,或者使用cv2.cvtColor()函数对图像进行颜色转换来生成单通道图像。例如,可以在cv.imread()函数后面加上参数-1来按照图像的原有格式进行读取,否则图像将自动转换为三通道图像。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [opencv读取单通道为三通道问题](https://blog.csdn.net/sinat_29219939/article/details/120347477)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [OpenCV保存/读取单通道(二值)图片](https://blog.csdn.net/ShakalakaPHD/article/details/110350578)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文