separate colors of image

9 ビュー (過去 30 日間)
PK
PK 2016 年 10 月 8 日
コメント済み: PK 2016 年 10 月 8 日
I want to extract red part and green part of attached image. I want to extract Red part is to one image and green part is to next image. Please help me.

採用された回答

Guillaume
Guillaume 2016 年 10 月 8 日
Have you tried using the Color thresholder app?
I wouldn't perform the separation in RGB. HSV or Lab are probably more suitable.
I get reasonable results with:
img = imread('three_rose.jpg');
hsvimg = rgb2hsv(img);
huemin = 0.03; huemax = 0.945;
huemask = hsvimg(:, :, 1) < 0.03 | hsvimg(:, :, 1) > 0.945; %filter on hue
roses = hsvimg;
roses(repmat(~humask, [1 1 3]) = 0; %set anything not red to black
imshow(hsv2rgb(roses)) %display after converting back to rgb
  2 件のコメント
PK
PK 2016 年 10 月 8 日
thanks a lot!
PK
PK 2016 年 10 月 8 日
Please again me with image file.

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

その他の回答 (1 件)

Massimo Zanetti
Massimo Zanetti 2016 年 10 月 8 日
Here is an example with a default matlab image to extract color bands:
IMG=imread('peppers.png');
RED=IMG(:,:,1);
GREEN=IMG(:,:,2);
BLUE=IMG(:,:,3);
If this answer helped you, please accept it.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by