Matlab shrink image array based on another array
I have an array that is holding an image of size (560 x 296) which is the original image that I input into my program. Now I have another array of the same size (560 x 296) that is filled with 0s and 1s. The 1s mark the position of pixels I want to keep in the original image, and the 0s mark the pixels I want to remove from the original image.
Is there开发者_JAVA百科 some sort of fancy matlab function that shrinks an array based on another array?
Any help/links would be awesome as I am new to Matlab.
Thanks
Assuming B
is a logical array, you want either
A(~B) = 0;
or
A(~B) = [];
Only the first is guaranteed to preserve the shape of A, but it doesn't really remove them: it only blanks them.
精彩评论