How to find the area of only garbage collected in sea using SIFT algorithm?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have used SIFT to locate keypoints in some garbage part collected in ocean. How can i calculate area of all garbage only? In the given figure blue points are the keypoints formed through SIFT algorithm. I'm new to matlab.
0 Kommentare
Antworten (2)
Will Nitsch
am 1 Mai 2017
A simple method would be to try the following:
1) Get rid of the outliers in your output image (like that one lone blue cross at the top middle/left). You could do this by getting the mean/std dev for the location of each point. Any point further than 3*sigma in terms of it's distance from the mean location could be an outlier. Or you could just have multiple clusters of garbage.
2) Create a mask image full of zeros that is the same size as the input (not color though). If Iin is color, then:
Imask = zeros(size(rgb2gray(Iin)));
If Iin is grayscale, then:
Imask = zeros(size(Iin));
3) At each (x,y) point in the image contained within the SIFT output, set Imask(y,x) (the dimensions are flipped for images since it is a matrix) equal to 1. This would give you a logical mask of where the SIFT points are located.
4) You can then do a convex hull and get the area that way. Or you might use morphological operations such as 'imdilate', 'imerode', 'imopen' and 'imclose' to grow the cluster of points and defragment the region. There are other methods too, but the objective here would be to get solid clusters encompassing all the garbage. A convex hull might get extra area and throw your numbers off (consider a cluster of garbage shaped like an 'S' or 'C', both would end up looking like oval or circular shapes after a convex hull.
5) Use 'regionprops' if you have multiple clusters and you want to know their individual areas. If you just want to know the total area in the image where garbage exists, you can just sum up all pixels in the 'Imask' image:
totalGarbage = sum(sum(Imask))
0 Kommentare
Image Analyst
am 1 Mai 2017
Since it looks like SIFT is missing quite a bit of the garbage, I'd try a different approach. I'd use color segmentation to try to find the water, assuming you have a color image and enough water in the scene and it's all pretty much the same color. Use the Color Thresholder on the Apps tab. Then everything that is not water color is garbage. Then use bwarea() or regionprops() to measure the area or simply sum the pixels in the mask.
Another approach is to use texture segmentation. This assumes the trash is variable and the water is smooth. So take a gray scale version of your image and run it through stdfilt() and then threshold, and count the pixels:
filteredImage = stdfilt(grayImage);
trashMask = filteredImage > 5;
numTrashPixels = sum(trashMask(:));
Now that's not calibrated so you'll have to take into account that not every pixel in your scene has the same size because your scene is tilted with respect to the optic axis. You can use the camera calibration capability of the Computer Vision System Toolbox. https://www.mathworks.com/products/computer-vision/features.html#camera-calibration
0 Kommentare
Siehe auch
Kategorien
Mehr zu SIFT - Scale Invariant Feature Transform finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!