convert from binary to grayscale without affecting the binary image

조회 수: 2 (최근 30일)
I am using the zhang-suen skeletonization on the following image
The result of skeletonization is as follows
I would like to perform subpixel edge detection on this,and for that to work the image needs to be changed back to grayscale or double.How do I go about that.In the end I am interested in finding the points corresponding to the skeleton.
Basically i want something like this
I tried running skeletonization on this but i was unable to produce the result similar to the one shown in the second image.
https://in.mathworks.com/matlabcentral/fileexchange/48908-accurate-subpixel-edge-location

채택된 답변

Image Analyst
Image Analyst 2021년 9월 7일
Why do you think you need edge detection? Why do you want/need to "perform subpixel edge detection"?
The vast majority of time people here do edge detection they don't need it and it's the wrong thing to do.
If you really want the edges, you can use bwperim() or bwboundaries() but they are on pixels, not subpixels.
To cast a uint8 image to double, use
dblImage = mat2gray(grayImage) ; % Puts into 0-1 range.
or
dblImage = double(grayImage); % Leaves as original range
  댓글 수: 4
sparsh garg
sparsh garg 2021년 9월 7일
ok i will try that and get back to you.Also wouldn't that give me the foreground values also,the ones in the white(Just asking)?
Image Analyst
Image Analyst 2021년 9월 7일
Yes. If you want the black pixels for some reason, do
[rows, columns] = find(~yourSkeletonImage);
Also, they may not be in the order you want. They will be in column major order. Basically all rows in a column, then all rows in the next column and so on across the image. So, for example it would not be adjacent coordinates like would follow a sprial.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by