# How can I make a single filter using MATLAB code to get galaxy image to be negative image so that dim parts of the original image are bright, and bright parts are dark?

6 visualizzazioni (ultimi 30 giorni)
Aya Ahmed il 16 Feb 2020
Commentato: Aya Ahmed il 18 Feb 2020
Two images of the same spiral galaxy are shown in Fig. The left panel shows the familiar image that you would see
if you took a picture of the galaxy through a single filter. The image on the right shows the "negative" (or "inverse")
of the image on the left. The negative image has been altered so that dim parts of the original image are now
white, and bright parts are now dark.
How can I make filter using MATLAB code the RGB galaxy image to be like that image??
I tried this code but it does not give me what I want -- the result image is not clear.
negativeImage = 255 - positiveImage;
imshow(negativeImage)
_________________________
d=255-a;
d=a;
for row=1:size(a,1)
for col=1:size(a,2)
d(row,col,:)=255-a(row,col,:);
end
end
imshow(d)
________________________
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Image Analyst il 16 Feb 2020
Your for loop just undid what your d=255-a statement did. Simply do this
d = 255 - a;
imshow(d, []);
without the for loop at all.
Try imadjust(). From the help:
J = imadjust(RGB,[low_in high_in]) maps the values in truecolor image RGB to new values in J. You can apply the same mapping or unique mappings for each color channel.
You could also try adapthisteq() if you want the contrast stretch to be locally adaptive.
##### 4 CommentiMostra 2 commenti meno recentiNascondi 2 commenti meno recenti
Aya Ahmed il 17 Feb 2020
Thank you my dear ,,Iam using database images from telescope hubble called EFIGI .
i try this code that you make it but i dont under stand the functioin clearly ..
whats number should me Puts her >> deltaGL = 10; >> i try to put different number but i didn't notice a difference ,,
i typed the code like that:
____________________________________________________
% convert from rgb to grayscale
positiveImage = rgb2gray(rgb_image);
%complement of grayscale image
negativeImage = 255 - positiveImage;
deltaGL = 10;
newImage = uint8(double(negativeImage) + deltaGL * rand(size(negativeImage)) - deltaGL/2);
%show the image
imshowpair(positiveImage,newImage,'montage')
____________________________________________________
is that true??
Image Analyst il 18 Feb 2020
Why do you want to change the image? Just to make it look "better" than what is actually there in the original image? Is your image the original image directly from NASA? Or is it second or third hand, possibly changed along the way? Attach your PNG image if you need more help.

Accedi per commentare.

Aya Ahmed il 18 Feb 2020
Modificato: Aya Ahmed il 18 Feb 2020
Thank you very match @Image Analyst ..I just trying to make the image look better .
the database EFIGI that Iam use .. from site called https://www.astromatic.net/projects/efigi .
this result image that i get first before apply saturation
and this after apply saturation
What is your opinion ?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Aya Ahmed il 18 Feb 2020
this some image that i work in it

Accedi per commentare.

### Categorie

Scopri di più su Image Category Classification in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by