convert from binary to grayscale without affecting the binary image

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

 Respuesta aceptada

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 comentarios

Like I said,I am mostly interested in finding out the x and y points for the skeleton.I can't divulge into more details about the usage of the x and y points because of work related issues.
However,I can say this that the methods like bwperimeter and bwboundary won't work on the above image.Subpixel edge detection has been useful b'cause the edges obtained after doing proper linking tend to give a more smoother boundary as compared to contourf or bwperimeter.
So thanks for answering,if you don't mind any suggestions/tips on how to get the x,y coordinates of the skeletonized portion.
Also,if it was my choice,I would have computed feature descriptors out of these images and then trained an appropriate algorithm on it.But i am part of the corporate empire where "your boss is always right"
To find the rows and columns of a skeleton image you can do
[rows, columns] = find(yourSkeletonImage);
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)?
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Sept. de 2021

Comentada:

el 7 de Sept. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by