Blockproc handle function problem
이전 댓글 표시
Hello i have a question about using blockproc i have create this code, its a simple blockproc usage i took this from example file :
% read image
awal = imread('h.jpg');
% global threshold
global_thres = graythresh(awal);
% callback function
fun=@(block_struct)...
im2bw(block_struct.data,graythresh(block_struct.data));
% partition
info_gambar = imfinfo('h.jpg');
tinggi = info_gambar.Height/5;
lebar = info_gambar.Width/5;
I2 = blockproc(awal,[tinggi lebar],fun);
figure;
imshow(awal);
figure;
imshow(I2,[]);
in this part of code i know that we can set a custom callback function for each block created by blockproc, but if i use this code i cant add an if else condition, i want to use if else condition to determine threshold method for each block. this is a pseudocode i want to achieve
if global_threshold > then otsu local threshold on block
use otsu threshold
else
use other threshold method
end
is there a clue for me to do this ? what i have to do with the code, i am new to matlab and maybe the solution is a kind of very basic things on matlab, any answers will help.
Thank you Regards, Putra
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Neighborhood and Block Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!