开发者

Matlab shrink image array based on another array

开发者 https://www.devze.com 2023-04-09 22:34 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号