how to preserve RGB values of an image while making it gray image

1 回表示 (過去 30 日間)
ASHWIN JOSHY
ASHWIN JOSHY 2022 年 5 月 2 日
編集済み: DGM 2022 年 5 月 2 日
I need to convert an RGB image to gray image, but after processing i want the image back to RGB,
So how can i preserve the RGB values of an image
I am using
RGBImage=imread('RGBImage.tiff')
to read the image
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 5 月 2 日
Store the image in a variable and use rgb2gray to store in another variable?

サインインしてコメントする。

採用された回答

DGM
DGM 2022 年 5 月 2 日
編集済み: DGM 2022 年 5 月 2 日
You don't. When you convert a color image to grayscale, you are discarding the color information. It's gone.
If you want to keep the color image, simply keep the color image and make a grayscale copy.
rgbpict = imread('peppers.png');
graypict = rgb2gray(rgbpict); % BT601 luma
If instead you intend to do some operations on the color image by using the grayscale image as a proxy, I'd have to know what kind of operation you're trying to do. If that's your intent, you'll have to describe the task.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by