動画をカラーとグレー​スケールの2画面で表​示したい。

8 visualizaciones (últimos 30 días)
025015
025015 el 12 de Jul. de 2018
Respondida: Kei Otsuka el 18 de Jul. de 2018
カラー動画の出力は出来るが、グレースケールとの2画面同時表示が出来ない。
cam1=vcapg2;%カメラから画像行列取得
image(cam1);%画像表示
pause(0.02);
rgbValues = cam1;%RGBの画像行列
hsvValues = rgb2hsv(rgbValues);%HSVの画像行列

Respuestas (1)

Kei Otsuka
Kei Otsuka el 18 de Jul. de 2018
グレースケールへの変換はrgb2grayで行えますが、Image Processing Toolboxはお持ちでないということでしたので、
まずR2014b以降の版数へアップグレードされてから以下を試してみてください。
●グレースケールへの変換
gray = rgb2gray(rgbValues);
ここからRGB画像とグレースケール画像を2画面で表示したいということですが、方法がいくつかあります。
●RGB画像とグレースケール画像を結合し、1枚の画像として表示
%RGB画像読み込み
img = imread('coloredchips.png');
%グレースケール変換
gray = rgb2gray(img);
%結合用に次元を拡張
gray3 = repmat(gray, [1,1,3]);
%列方向に結合
pair = [img, gray3];
%可視化
figure, imshow(pair)
●サブプロットの利用
%RGB画像読み込み
img = imread('coloredchips.png');
%グレースケール変換
gray = rgb2gray(img);
%Subplotで可視化
figure,
subplot(1,2,1), imshow(img)
subplot(1,2,2), imshow(gray)
もしImage Processing Toolboxが使える状況であれば、imshowpairという関数も非常に便利です。
figure, imshowpair(img, gray, 'montage')

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Productos


Versión

R2013a

Community Treasure Hunt

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

Start Hunting!