Is the number of points in a line image equals the number of pixels?
Mostra commenti meno recenti
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 Commenti
Mohammadreza
il 6 Ott 2018
Modificato: Image Analyst
il 6 Ott 2018
No,
[m,n]=size(image);
number_of_pixels=m*n;
sali
il 6 Ott 2018
Mohammadreza
il 6 Ott 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
il 6 Ott 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
il 6 Ott 2018
Image Analyst
il 7 Ott 2018
Then you'll want to use
skelImage = bwmorph(binaryImage, 'skel', inf);
See my answer below for a full demo with your image.
Risposta accettata
Più risposte (1)
Matt J
il 6 Ott 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 Commenti
sali
il 6 Ott 2018
Image Analyst
il 7 Ott 2018
Definitely not. DO NOT use image as a variable name since that's a built-in function that you'd destroy.
Image Analyst
il 7 Ott 2018
No, there are still things wrong with it even if you fixed that. See my code below for a correct version.
Categorie
Scopri di più su Signal Attributes and Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
