Find random points inside binary mask
이전 댓글 표시
I am extracting random tiles from huge binary image masks. I do this by finding the random upper left corner of the tiles as shown below. And then check if enough of the tile is inside the mask. But I have some memory issues.
[y_cord, x_cord] = find(mask); % Find all xy-pairs inside mask
xy_rand = randperm(length(x_cord), 1e4); % Select 1e4 random xy-pairs
This works fine for most of my masks, but when the masks are getting really big I'm running out of memory. As an example: one of the masks ( 48500x63000 logical) result in x_cord and y_cord having the dim 11e9 x 1, which is more than my machine can handle.
Any ideas on how to solve this more memory efficient?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!