Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1495
Number of posts: 2175

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Basic number problem Posted by Resetter on 21 Aug 2012 at 1:06 PM
Hi, new to this forum and quite the novice at MatLab. Anyway, I am trying to analyze the RGB of images. I made some quick code to look at three squares of one image, taking the sum of each RGB. However, the matrix results are always 255. i read that in MatLab i don't have to declare variable types, but something isn't right; the numbers should be much larger. Here's the code:
clear
t='c:\users\my.self\desktop\test\IMG_0001.jpg';
h=[700, 1020, 1450];
v=1700;
rcol=0;
gcol=0;
bcol=0;
mag=zeros(3);
q=imread(t);
for i=1:3
    ybeg=h(i);
    for x=v:v+50
        for y=ybeg:ybeg+50
            rcol=q(x,y,1);
            gcol=q(x,y,2);
            bcol=q(x,y,3);
            mag(i)=mag(i)+rcol+gcol+bcol;
        end
    end
end


So looking at 50x50 grids. Any ideas? Thanks.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.