Assigning random values to image pixels
19 次查看(过去 30 天)
显示 更早的评论
I am trying to assign random values to the elements of a rectangular region within an image matrix, so that the result looks something like this:

This is my approach:
I = zeros(128,128);
for i=32:96
for j=32:96
I(i,j) = rand();
end
end
imshow(I);
Is there a more efficient way of doing this, perhaps without a double for-loop?
Any suggestions would be greatly appreciated.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing and Computer Vision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!