Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Convert Image to array
Replies: 3   Last Post: Jun 29, 2012 9:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,537
Registered: 12/7/04
Re: Convert Image to array
Posted: Jun 29, 2012 9:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Winnie " <nivedhadvrj89@gmail.com> wrote in message
news:jsjoa5$3ac$1@newscl01ah.mathworks.com...
> "Matt J" wrote in message <jsi98i$pct$1@newscl01ah.mathworks.com>...
>> "Winnie" wrote in message <jsi8g5$me8$1@newscl01ah.mathworks.com>...
>> > Hi Someone pleasseee help! I have a JPG image which I need to convert
>> > into R,G, and B arrays. At first I thought it was RGB channels but it's
>> > wrong! Can someone help me what code to write to give me the R, G and B
>> > arrays???

>> =======
>>
>> RGB=imread('YourFile.jpg');
>> R=RGB(:,:,1);
>> G=RGB(:,:,2);
>> B=RGB(:,:,3);

>
> Hi Matt..That's what I tried at first but it's actually wrong..Don't know
> what the question actually means?


That code will work if your JPG file is an RGB image. If it's not, try
calling IMREAD with two outputs (to obtain the indexed data and the
colormap) and use IND2RGB.

If that doesn't do what you want it to do, show exactly the code you tried
to read it in and indicate specifically what it's doing or not doing that
you want it to not do or do respectively.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.