Is the number of points in a line image equals the number of pixels?
Afficher commentaires plus anciens
Dear all, Is there any matlab image operator or function that tell the matlab to process an image of line as a group of pixels in such each point in the line is expressed as one pixel? Thanks
6 commentaires
Mohammadreza
le 6 Oct 2018
Modifié(e) : Image Analyst
le 6 Oct 2018
No,
[m,n]=size(image);
number_of_pixels=m*n;
sali
le 6 Oct 2018
Mohammadreza
le 6 Oct 2018
My pleasure sali; I know from your explanation, you need one pixcel of each line width. you can use 'for' loop and select for example first or second pixel of each 2 pixel of line width.
Image Analyst
le 6 Oct 2018
I have no idea what this means "process an image of line as a group of pixels in such each point in the line is expressed as one pixel". Do you want to do area processing of a group of pixels in a sliding window centered over the image pixel, like
img = conv(img, kernel, 'same');
or do you want to do point processing where you just process each pixel by itself as a single pixel, like
img = image * 0.5;
Or do you mean how to skeletonize an image, like
skelImage = bwmorph(binaryImage, 'skel', inf);
Please try to clarify your problem statement so as to not waste our time or yours and get you a speedy solution.
sali
le 6 Oct 2018
Image Analyst
le 7 Oct 2018
Then you'll want to use
skelImage = bwmorph(binaryImage, 'skel', inf);
See my answer below for a full demo with your image.
Réponse acceptée
Plus de réponses (1)
Matt J
le 6 Oct 2018
I think what you are asking is if there is a way to reduce the image of the lines to 1 pixel in width. If so, you can use bwskel or
bwmorph(BW,'skel',inf)
5 commentaires
sali
le 6 Oct 2018
Image Analyst
le 7 Oct 2018
Definitely not. DO NOT use image as a variable name since that's a built-in function that you'd destroy.
Image Analyst
le 7 Oct 2018
No, there are still things wrong with it even if you fixed that. See my code below for a correct version.
Catégories
En savoir plus sur Signal Attributes and Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
