Need to extract the curve above the red line in the binary image

1 visualización (últimos 30 días)
So i drew in a red line onto a matlab image i post processed using paint. The code I wrote does NOT create the red line
Is there a way to ignore all the linear parts of a binary image and extract the curved line?
Either;
1. delete all white pixels (not part of the curve) that are not above the red line
or
2. Simply plot what is above the red line..
If it helps this is the original project:
I need to crop out the droplet of water from the image named 'OG_image' without the user doing anything. The end goal is to be able to send multiple pictures similar to the one titled 'OG_image' to automatically get measurements
The image simply titled 'image' is as far as I got without seeking help.
If i can crop out just the droplet, I can finish the rest of the project...
This image is titled 'image' :
This image is titled: 'OG_image'

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Nov. de 2019
Don't do an edge detection - beginners always try that first for some reason even when it's not appropriate. Try thresholding to get the dark stuff. Then use bwareafilt() to take the largest blob. Then what I'd do is to scan the binary image column by bolumn to get the top row. Then use the RANSAC function in the Computer Vision toolbox to find that slanted baseline. Once you have that you can erase the image below it, or even a little above it and below it if you want. Here's a start and I want you to try to finish it:
grayImage = imread(filename);
binaryImage = grayImage < someValue;
binaryImage = bwareafilt(binaryImage, 1);
[rows, columns] = size(binaryImage);
for col = 1 : columns
thisColumn = binaryImage(:, col);
topRows(col) = find(thisColumn, 1, 'first');
end
hold on;
plot(1:columns, topRows, 'r-', 'LineWidth', 2)
% Now call RANSAC
P = fitpolynomialRansac(topRows, 1)
% Get equation of a line (TO DO)
% Now erase from that line down
for col = 1 : columns
binaryImage(linesRow(col) : end, col) = false;
end
See if you can fill out the missing parts.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by