Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Convert Image to array
Posted:
Jun 29, 2012 9:25 AM
|
|
"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
|
|
|
|