MATLAB Answers

how to divide an image of 400x500pixels into 100 blocks each of size 40x50 pixels

2 views (last 30 days)
how to divide an image of 400x500 pixels into 100 blocks each of size 40x50 pixels.and check each blocks for threshold value and turn whole block into white depending upon threshold value

  0 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 6 Mar 2016
Edited: Image Analyst on 6 Mar 2016
Two different ways are shown in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_split_an_image_into_non-overlapping_blocks.3F. Inside the loop, you can call graythresh() or some other threshold picking algorithm, and im2bw().

  4 Comments

Show 1 older comment
Image Analyst
Image Analyst on 10 Mar 2016
You have to keep track of what the indexes are for the block you're in, and then just write directly to that block in image. For example if you know you're processing rows 30-40 and columns 400-420, you'd do this to turn it white
yourImage(30-40, 400-420) = 255;
Image Analyst
Image Analyst on 11 Mar 2016
If you can, it might be best to just process it in place without chopping up into separate variables or cells. But if you must have different images, then you can stitch them together like this:
tallImage = [topImage; bottomImage];
wideImage = [leftImage, rightImage];
You'll need to change the images as you move along from blobk to block.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by