how to divided n matrix to PA and PT?

hi, I have a matrix divided into two groups A and B point, I have mask of A and B, my question is how to divided n matrix and putting points in Group A in a vector and points of B in the other this program gives me only the results of the first matrix (t = 1)
%--------------------------------
for t=1:220
PAA=[];
PTT=[];
m=Im(:,:,t); % image de 220 bandes
m=m(:);
ff=masquePA;
ff=ff(:);
PAA= [PAA;nonzeros(m.*ff)];
bb=masquePT;
bb=bb(:)
PTT=[PTT;nonzeros(m.*bb)]
end
%---------------------------------

Answers (1)

Image Analyst
Image Analyst on 17 Oct 2012
Well it must be because nonzeros(m.*bb) is null. And the only way that can happen is if masquePT is all 0 or m is all 0, or each is zero where the other has some non-zero values. Make a mask for PT, masquePT, that has some non-zero values in it. Then, make sure your channels 2-220 of m have non-zero values in it at the same places where your mask has non-zero values. Then PTT will have some values in it.

5 Comments

thank you for your reponce, but my 220 bands does not contain the 0, so I think the problem arises at the writing of   (AAP = [AAP nonzeros (m. * ff)];) that just gives me the result of the first band and not adds other point PA of other bands, pray you helped me to find a good shape
What is AAP? Did you mean PAA? After your loop exits, put this
size(PAA) % No semicolon.
size(PTT)
Tell me what it says, so I know which one is missing data from 2 onwards.
size(PAA)%taille de points d'apprentissage
>> 5181 1
size(PTT) %taille des points de tests
>> 5185 1
alors que notre
size(Im) %taille de notre image (220 bande)
>> 145 145 220
end
Image Analyst
Image Analyst on 17 Oct 2012
Edited: Image Analyst on 17 Oct 2012
OK, they're different. That's bad. Do the same thing for masquePA and masquePT so we can see which mask is not the same size as the image. But 145*145 = 21025, so after each iteration, the vectors should grow by 21025. Why are they not doing that? If you multiply a mask by an image, they MUST be the same size.
it gives me
size(masquePA)
>> 145 145
size(masquePT)
>>145 145
it has the same size of a single band

Sign in to comment.

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Tags

Asked:

on 17 Oct 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!