How to find pixels aligned along a certain direction on satellite image?
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone.
I need some help.
This image represents all the hot pixels recognized in a certain period of time by analysis of sentinel-2. As you see on the left there are many anomalous pixels that are not actually really hot, but are recognized as anomalous because of the seam/stripes artifact effect in the sentinel-2 images.
I need to eliminate these pixels. Is there an automatic way to recognize pixels aligned in a certain direction, and/or to recognize automatically those pixels on the left part of the image?
Thanks!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1691006/image.png)
1 个评论
Josh
2024-5-9
编辑:Josh
2024-5-9
are you wanting to do this over and over again? ...as in need to implement an intuitive solution via code?
if just wanting one-time, you can probably get away with just deleting the pixels with a column value < 14°59'E or using region-of-interest (ROI) image processing (https://www.mathworks.com/help/images/roi-based-processing.html)
otherwise, an image processing algorithm is needed to identify those pixels first. you mention "aligned in a certain direction" but not sure that's going to be an easy approach unless you're wanting to manually draw a line for each image. it seems you have an ROI with high density of pixels and then the pixels scattered around elsewhere are what you want to eliminate. in that case you could use convolution to scan for pixels/regions that are below/above a threshold and elimate the ones below
回答(2 个)
Josh
2024-5-11
编辑:Josh
2024-5-11
Thinking that's going to be one of the easier options for getting started with a solution:
n=1;
input=imread('testSat.png');
inputGray=im2gray(input);
inputAdj=imadjust(inputGray);
inputBW=imbinarize(inputAdj,'global');
output=bwareafilt(inputBW,n);
imwrite(output,'outputN1.jpg');
imshow(output)
bwareafilt can be used to extract the n largest/smallest objects from a binary image. It can also extract objects of a specified area, but I found the above to be more useful for your situation. Using the image you provided, I get the following for output at various value of n:
n=1
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1692606/image.jpeg)
n=2
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1692611/image.jpeg)
n=5
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1692616/image.jpeg)
n=15
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1692621/image.jpeg)
Around n=10 to n=15 the pixels you're seeking to eliminate begin returning. n=1 may work for some of your images, since the traced shape won't be present. However, you may need a higher value of n to preserve the detail of your ROI.
3 个评论
Josh
2024-5-11
my approach is still based around pixel/region density vs direction... i'd have to put some more thought into approaching the problem with a solution that relies on direction
Josh
2024-5-15
移动:Image Analyst
2024-5-15
did my solution work for you? if so, would you please consider accepting my answer?
Image Analyst
2024-5-15
@fransec see my attached demo on fiber orientation. It identifies the local orientation of every pixel in an image. Adapt as needed.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1696036/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1696041/image.png)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!