How to remove stars and other objects from the FITS galaxy image using Matlab?

I have the following image in fits format. I want to remove all stars and other small dots from this image using matlab.enter image description here

I performed the following operations with the matrix to remove stars in it.

I = imread('NGC_0253.jpg');
if size(I,3)==3
   I=rgb2gray(I);
end
K = imcomplement(I);
L = I-K;
M = medfilt2(L);
imshow(M)

I get the image as follows: enter image description here

I also try the following:

I = imread('NGC_0253.jpg');
if size(I,3)==3
   I=rgb2gray(I);
end
K = imcomplement(I);
L = I-K;
M = bwareaopen(L,1000);
N = medfilt2(M);
imshow(N)

but it also does not satisfy me: enter image description here

This is not my goal. My goal is to remove all stars from the image.

So, what should I do to remove all stars left without a galaxy from the image?

+4
source share
1 answer

bwareaopen, . ( , )

I = imread('NGC_0253.jpg');
I = im2bw(I,0.5); %the second parameter correspond to the threshold ∈ [0-1]
I = ~bwareaopen(~I,400); %where 400 = the minimal number of connected pixel needed to not be removed.

imshow(I)

INPUT:

enter image description here

:

enter image description here

:

, .

enter image description here

fit_ellipse, .

Iedge = edge(mat2gray(I),'Canny');
[x,y] = find(Iedge');
hold on
A = fit_ellipse(x,y,h);
+4

Source: https://habr.com/ru/post/1657981/


All Articles