如何在MATLAB中将彩色图像转换为灰度图像? [英] How can I convert a color image to grayscale in MATLAB?

查看:204
本文介绍了如何在MATLAB中将彩色图像转换为灰度图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在计算机视觉中实现一个算法,我想尝试一组图片。图片都是彩色的,但我不想处理。

I am trying to implement an algorithm in computer vision and I want to try it on a set of pictures. The pictures are all in color, but I don't want to deal with that. I want to convert them to grayscale which is enough for testing the algorithm.

如何将彩色图像转换为灰度图?

How can I convert a color image to grayscale?

我正在阅读它:

x = imread('bla.jpg');

有任何参数我可以添加到 imread 将其读为灰度?在读取之后,是否有任何方式将 x 更改为灰度

Is there any argument I can add to imread to read it as grayscale? Is there any way I change x to grayscale after reading it?

推荐答案

使用 rgb2gray 来去除色相和饱和度(即转换为灰度)。 文档

Use rgb2gray to strip hue and saturation (ie, convert to grayscale). Documentation

这篇关于如何在MATLAB中将彩色图像转换为灰度图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆