machine learning model-with hough transform algorithm

6 visualizzazioni (ultimi 30 giorni)
nini
nini il 13 Mar 2023
Risposto: Aastha il 12 Giu 2025
Hi,
so I have 150 images of capillaries and want to use a machine learning model with a hough transform algorithm to try and detect these capillaries. I tried the excecises for pre-processing and have gotten them to work, but now want to try a machine learning model to input this data in one go and see how to train a model. Does anyone have a code I can use/work on please? I know there's a lot of components in the images that will probably be detected instead, so I'm not too fussed if it doesn't work perfectly but more so I undertsand how the model works with these images. (I attached one of the pictures because it wouldt let me d the whole zip file)
Thanks

Risposte (1)

Aastha
Aastha il 12 Giu 2025
Hi @nini,
As I understand, you want to extract lines from images of capillaries using the Hough Transform and use them to train a machine learning model to detect these capillaries. You may refer to the following steps to achieve this:
1. First, convert your RGB image to grayscale using the "rgb2gray" function in MATLAB, and then extract edges from the grayscale image. These edges will be used to compute the Hough Transform.
grayI = rgb2gray(I);
BW = edge(grayI, 'canny');
You can experiment with different edge detection methods available as Name-Value arguments in the "edge" function in MATLAB. For more information on the "rgb2gray" and "edge" functions, please refer to the MathWorks documentation linked below:
2. Use the "hough" function, followed by the "houghpeaks" and "houghlines" functions in MATLAB to extract the lines present in the image. You may refer to the following MATLAB code snippet to do so:
[H, theta, rho] = hough(BW);
P = houghpeaks(H, 5, 'threshold', ceil(0.3 * max(H(:))));
lines = houghlines(BW, theta, rho, P, 'FillGap', 5, 'MinLength', 7);
Refer to the documentation for the "hough", "houghpeaks", and "houghlines" functions to tune the input arguments according to your requirements:
To train a machine learning model, you may refer to the MathWorks documentation on Machine Learning, Deep Learning, Object Detection, and Image Segmentation at the linked below:
I hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by