Today I want to show you a handy little function,
imsplit
, for splitting color images into their components.
Also, for no reason other than
WOW
, I want to show one of the images just released by the James Webb Space Telescope program (
home page
,
flickr galleries
).
url ="https://live.staticflickr.com/65535/52211883534_7fe30b9955_o_d.png";
text(size(rgb,2),size(rgb,1),"Image credits: NASA, ESA, CSA, and STScl",...
VerticalAlignment ="top",...
HorizontalAlignment ="right")
Anyway, back to
imsplit
. Long-time readers have seen me use code like this to split up color images (sometimes RGB, sometimes
$ L^* a^* b^* $
) into component images:
That code is not hard to write, but now I've become fond of using
imsplit
instead, just because it is a bit more compact, without sacrificing understandability. The function
imsplit
, introduced in release R2018b, is used this way:
url ="https://blogs.mathworks.com/images/steve/2010/mms.jpg";
That's it, really. There's nothing more to it. Give it a try the next time you need to do this; it'll save you 2.7183 seconds.
Before I go, let's look at that Webb telescope image one more time, just because.
댓글
댓글을 남기려면링크를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.