- “strel” function: https://www.mathworks.com/help/images/ref/strel.html
- “imopen” function: https://www.mathworks.com/help/images/ref/imopen.html
- “imclose” function: https://www.mathworks.com/help/images/ref/imclose.html
- "regionprops" function: https://www.mathworks.com/help/images/ref/regionprops.html
detect MSER output - reduce output
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to get a reasonable count of the number of busses in a satellite image, using `detectMSER` looks great as a starting point - except for the fact that each region has numerous almost identical ellipsoids that overlap. This is the best I can get it, and I've played around with all the input variables. For example, in the image below I expect to have about a 100 regions but there are over 2200. Each bus has 7 or 8 ellipsoids.
I can use regionprops to, for the most part, remove artifacts, but not sure how to just keep just one region for each bus.
Ive tried rounding together centroid location significant digits, using bounding box overlap, filtering based on orientation, etc, but everything I do seems to remove good values.
This has to scale (I have 20k images to cycle through, so need to automate this). Thanks in advance.
[regions, mserConnComp] = detectMSERFeatures(img_bw, ...
'RegionAreaRange',[300 900], ...
'ThresholdDelta', 3,...
'MaxAreaVariation', 0.2);
0 Commenti
Risposta accettata
Aishwarya
il 3 Nov 2023
Hello,
I understand that you are facing difficulty when implementing "detectMSERFeatures" function to count the number of buses in the satellite image.
I would like to suggest an alternative method to count the number of buses in the image.
The approach is to use morphological operations on a binary image to extract the buses as blobs. Then, the "regionprops" function can be utilized to count the number of blobs using the "Area" property as a threshold.
Here is an example implementation of this technique on a sample image:
% Read the image
img = imread('top_view.jpg');
% Convert the image to grayscale
gray_img = rgb2gray(img);
% Threshold the image to create a binary image (adjust the threshold as required)
binary_img = gray_img > 150;
% Perform morphological operations to remove noise and fill gaps (adjust structuring element as required)
se = strel('disk', 7);
binary_img = imopen(binary_img, se);
binary_img = imclose(binary_img, se);
% Perform blob analysis to count the number of buses
blob_analysis = regionprops(binary_img, 'Area');
num_buses = length(find([blob_analysis.Area] > 1000));
% Display the result
disp(['Number of buses: ', num2str(num_buses)]);
Please refer to the below MathWorks documentations for more information about the functions used:
I hope this helps!
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!