Split an image into two sets
显示 更早的评论
Hi, I need to split an image into two sets of pixels A and B, each randomly containing half of the pixels (using the rand function). Thanks in advance for any help.
回答(1 个)
Matt J
2019-10-27
N=numel(yourImage);
indices=randperm(N,round(N/2));
A=yourImage(indices);
B=yourImage; B(indices)=[];
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!