Is the number of points in a line image equals the number of pixels?
古いコメントを表示
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 件のコメント
Mohammadreza
2018 年 10 月 6 日
編集済み: Image Analyst
2018 年 10 月 6 日
No,
[m,n]=size(image);
number_of_pixels=m*n;
sali
2018 年 10 月 6 日
Mohammadreza
2018 年 10 月 6 日
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
2018 年 10 月 6 日
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
2018 年 10 月 6 日
Image Analyst
2018 年 10 月 7 日
Then you'll want to use
skelImage = bwmorph(binaryImage, 'skel', inf);
See my answer below for a full demo with your image.
採用された回答
その他の回答 (1 件)
Matt J
2018 年 10 月 6 日
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 件のコメント
sali
2018 年 10 月 6 日
Image Analyst
2018 年 10 月 7 日
Definitely not. DO NOT use image as a variable name since that's a built-in function that you'd destroy.
Image Analyst
2018 年 10 月 7 日
No, there are still things wrong with it even if you fixed that. See my code below for a correct version.
カテゴリ
ヘルプ センター および File Exchange で Signal Attributes and Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
