如何使用IMSPLIT彩色图像分割成组件图片吗
今天,我想给你一个方便的小函数,
imsplit
,把彩色图像分解为组件。
url =“https://live.staticflickr.com/65535/52211883534_7fe30b9955_o_d.png”;
rgb = imread (url);
imshow (rgb)
文本(大小(rgb, 2),大小(rgb, 1),“影像学分:NASA、ESA, CSA,和STScl”,…
VerticalAlignment =“顶级”,…
HorizontalAlignment =“正确”)
不管怎样,回到
imsplit
。长期读者看到我使用下面这样的代码分割彩色图像(有时RGB,有时
$ L ^ * ^ * ^ * $
)组件图片:
L = lab (:, :, 1);
一个=实验室(:,:,2);
b =实验室(:,:,3);
See, for example, the posts about two - dimensional histograms (
23日- 12月- 2010
)和分割图像
美元(a ^ * ^ *)美元
Space (
04 - 2月- 2011
)。
这些代码并不难写,但是现在我变得喜欢使用
imsplit
相反,仅仅因为它是一个更紧凑,不牺牲可理解性。这个函数
imsplit
,介绍了释放R2018b,这样使用:
url ="Https://blogs.mathworks.com/images/steve/2010/mms.jpg";
糖果= imread (url);
Lab = rgb2lab (candy);
[L、a、b] = imsplit(实验室);
Tiledlayout (“流”)
nexttile
Imshow (candy)
nexttile
imshow (L, 100年[0])
标题(“L”)
nexttile
imshow(, 90年[-90])
标题(“一个”)
nexttile
imshow (b, 90年[-90])
标题("B")
就这样,真的。没有什么更多的。试一试你下次需要这样做;它会节省你的2.7183秒。
Before I go, let 's look at that Webb telescope image one more time, just because.
(R, G, B) = imsplit (rgb);
Tiledlayout (“流”)
nexttile
imshow (rgb)
nexttile
imshow(右)
标题("R")
nexttile
imshow (G)
标题(“G”)
nexttile
imshow (B)
标题("B")
评论
要发表评论,请点击此处登录到您的MathWorks帐户或创建一个新帐户。