how do i divide an image into blocks?
Ältere Kommentare anzeigen
I have this image (2848 x 4288) and i want to divide it into 9 blocks and perform some operations on individual or each block. For example i perform this operations on an image:;
y = rgb2gray(imresize(imread('DSC_0009.jpg'),.2));
z = 255.0 - 1.0 * double(y);
z = z ./5 ;
z2 = imfilter(z, fspecial('average', 15));
z2(z2 > 35) = 35;
z2(z2 < 30) = 0;
surface(z2);
shading interp;
axis ij;
axis tight;
I want to do a similar operation on each of the blocks and output it as well.
thank you.
1 Kommentar
Rena Berman
am 24 Jan. 2017
(Answers dev) Restored question.
Antworten (2)
Image Analyst
am 16 Aug. 2015
0 Stimmen
See the FAQ for code to perform it two different ways, normal indexing, and the cell2mat() function: http://matlab.wikia.com/wiki/FAQ#How_do_I_split_an_image_into_non-overlapping_blocks.3F
Image Analyst
am 16 Aug. 2015
0 Stimmen
You can also use blockproc() if you don't need to store the subimages but just need to perform some operation on them and give you an output image. See attached demos for a variety of ways to use blockproc().
5 Kommentare
Rey Kelvin Peralta
am 16 Aug. 2015
Bearbeitet: Walter Roberson
am 16 Aug. 2015
Image Analyst
am 16 Aug. 2015
Follow the example of blockproc_demo2 where I use myFilter. You can put whatever code you want into that function, such as the code you showed above.
Rey Kelvin Peralta
am 18 Aug. 2015
Image Analyst
am 19 Aug. 2015
I don't know. I've never used blender. However using fwrite() or fprintf() you can create any file you want.
Walter Roberson
am 19 Aug. 2015
Kategorien
Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!