how to change the value of Neighbour pixels

4 vues (au cours des 30 derniers jours)
daniel
daniel le 31 Juil 2013
hello,
i wonder how can i change the value of Neighbour pixels around specific point without using massive loop..?
for example:
i have binary image and i want to remove (change the value of the pixel) an area of 5x5 pixels around specific point (x,y). i.e
is there any easy way to do this?
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
i want to the pixels in the range of 3x3 matrix around the point i,j=(3,5) will turn zero's
1 1 1 1 1 1 1 1 1 1
1 1 1 0 0 0 1 1 1 1
1 1 1 0 1 0 1 1 1 1
1 1 1 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1
  1 commentaire
Image Analyst
Image Analyst le 31 Juil 2013
3 by 3 is a massive loop????

Connectez-vous pour commenter.

Réponse acceptée

Iain
Iain le 31 Juil 2013
map = false(size(image_to_mod));
map(down,along) = true;
dmap = imdilate(map,true(3,3));
change = xor(map,dmap);
image_to_mod(change) = false;

Plus de réponses (1)

Image Analyst
Image Analyst le 31 Juil 2013
% Create original binary image.
binaryImage = true(5, 10)
% Assign ring of false
binaryImage(2:4, 4:6) = [false, false, false; false, true, false; false, false, false]

Catégories

En savoir plus sur Modify Image Colors dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by