フィルターのクリア

can blkproc function is used in LBP?

1 回表示 (過去 30 日間)
elfrida
elfrida 2013 年 8 月 2 日
can you explain me fun function in blkproc below:
I = imread('liftingbody.png');
fun = @(x) std2(x)*ones(size(x));
I2 = blkproc(I,[32 32],fun);
figure, imshow(I), figure, imshow(I2,[])
what the function of 'fun' if I use LBP?
thx before

採用された回答

Anand
Anand 2013 年 8 月 2 日
You can use the nlfilter function to implement this. It will be slow, though. Here's a mocked up implementation that you could try:
function out = computeLLBP(im,kernel_width)
%COMPUTELLBP - Compute Local Line Binary Pattern of an image.
validateattributes(im,{'numeric'},{'2d'},mfilename,'im',1);
validateattributes(kernel_width,{'numeric'},{'odd','numel',2},mfilename,'kernel_width',2);
out = nlfilter(im,kernel_width,@processLLBP);
function c = processLLBP(block)
sz = size(block);
center = (sz+1)/2;
vertical = block(: ,center(2))>block(center(1),center(2));
horizontal = block(center(1),: )>block(center(1),center(2));
llbpv = bin2dec( (int2str(vertical(1 :center(2)-1)))') +...
bin2dec(fliplr((int2str(vertical(center(2)+1:end )))'));
llbph = bin2dec( int2str(horizontal(1 :center(1)-1))) +...
bin2dec(fliplr(int2str(horizontal(center(1)+1:end ))));
c = hypot(llbpv,llbph);
end
end
  2 件のコメント
elfrida
elfrida 2013 年 8 月 29 日
can you give me the function of @processLLBP ?
Anand
Anand 2013 年 8 月 29 日
Its a nested function thats defined right after the call to nlfilter in the code above.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 8 月 2 日
It takes the standard deviation of a block and replaces every pixel in the block with the standard deviation of that block.

Community Treasure Hunt

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

Start Hunting!

Translated by