Is the number of points in a line image equals the number of pixels?
Ältere Kommentare anzeigen
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 Kommentare
Mohammadreza
am 6 Okt. 2018
Bearbeitet: Image Analyst
am 6 Okt. 2018
No,
[m,n]=size(image);
number_of_pixels=m*n;
sali
am 6 Okt. 2018
Mohammadreza
am 6 Okt. 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
am 6 Okt. 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
am 6 Okt. 2018
Image Analyst
am 7 Okt. 2018
Then you'll want to use
skelImage = bwmorph(binaryImage, 'skel', inf);
See my answer below for a full demo with your image.
Akzeptierte Antwort
Weitere Antworten (1)
Matt J
am 6 Okt. 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 Kommentare
sali
am 6 Okt. 2018
Image Analyst
am 7 Okt. 2018
Definitely not. DO NOT use image as a variable name since that's a built-in function that you'd destroy.
Image Analyst
am 7 Okt. 2018
No, there are still things wrong with it even if you fixed that. See my code below for a correct version.
Kategorien
Mehr zu Signal Attributes and Indexing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
