Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Basic number problem

ResetterResetter Posts: 2Member
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:
[code]clear
t='c:usersmy.selfdesktop estIMG_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
[/code]

So looking at 50x50 grids. Any ideas? Thanks.
Sign In or Register to comment.