How can we find no of channels of the images of a datasets?

21 ビュー (過去 30 日間)
Awais Khan
Awais Khan 2019 年 5 月 27 日
回答済み: Moh Moumouh 2021 年 4 月 29 日
scenario, we have a dataset which contains multiple images in it. we want to find number of channel of each images because in these images max are rgb images and few gray scale, and for further processing it is required to convert all gray scale images(which are 1 channel) into 3 channel gray scale image. but first we find gray-scale images in a dataset then we will able to convert them from 1 channel to 3 channel gray scale image. so for that array is required which hold all images channel numbers, so help me how can implement it.

回答 (2 件)

KSSV
KSSV 2019 年 5 月 27 日
Let I be your image.
if size(I,3) == 1
fprintf('Your image is Gray\n')
elseif size(I,3) == 3
fprintf('Your image is RGB\n')
end

Moh Moumouh
Moh Moumouh 2021 年 4 月 29 日
I'm looking for a solution, because I have the same problem

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by