How to divide image and calculating quantized mean values of hsv and lab color channel.

3 次查看(过去 30 天)
I want to divide an image into 8* 16 overlapping blocks,
blocks are overlapping of 50% in horizontal and vertical.
then from each block, I want to compute quantized mean values
of HSV and lab color channel.

采纳的回答

Image Analyst
Image Analyst 2016-4-13
Easily accomplished with blockproc(). See my attached demos for about 6 or 8 different ways to call blockproc(). Find the one you want and adapt it to your situation. Post your adapted code back here if you still need help.
  1 个评论
s malik
s malik 2016-4-14
I have read your tutorial and It is quite helpful. Specifically I have changed the code as under.
Img=imread('v1.tif');% specifically the size of the image is 128*48
hsvImg=rgb2hsv(Img);% as I want the mean HSV values
% meanFilterFunction = @(theBlockStructure) mean2(theBlockStructure.data(:)) ;
blockSize = [8 16];
overlap=[4 8];
blockyImage = blockproc(hsvImg, blockSize, meanFilterFunction,'BorderSize', overlap,'TrimBorder', 0);
[rows, columns] = size(blockyImage);
please tell me whether overlapping is correct as i need 50% blocks overlapping.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by