I need some help,(i.e) my image is 192x192, i need to divide it into 3x3,and from each 3x3 block,by taking center pixel value as threshold, i need to compare with other neighbouring 8 pixel values, if that value is less than threshld, put 0, else 1
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
kaavya subramani
el 30 de Ag. de 2016
Editada: Teja Muppirala
el 30 de Ag. de 2016
x=imread('192x192' image); g=mat2tiles(x,[3,3]); f=cellfun(..............)% i need ur help plzzzzzzz
0 comentarios
Respuesta aceptada
Image Analyst
el 30 de Ag. de 2016
No need to mess with the complication of cell arrays, simply index to subsample, resize, and then use "<" (less than operator).
data = randi(99, 192,192); % Sample data
[rows, columns] = size(data);
thresholds = data(2:3:end, 2:3:end); % Get centers of 3x3
% Make same size as data
thresholds = imresize(thresholds, [rows, columns], 'nearest');
% Apply threshold.
out = data > thresholds;
0 comentarios
Más respuestas (1)
Teja Muppirala
el 30 de Ag. de 2016
Editada: Teja Muppirala
el 30 de Ag. de 2016
If you have the Image Processing Toolbox, you can use BLOCKPROC , which is a general function for block processing.
x = randi(99, 192,192); % Sample data
out = blockproc(x, [3 3], @(I)I.data >= I.data(2,2)) % Is the block data greater than the middle element?
0 comentarios
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!