Filter löschen
Filter löschen

Change the black of grayscale image into color

8 Ansichten (letzte 30 Tage)
Markus Kokot
Markus Kokot am 29 Dez. 2020
Kommentiert: Image Analyst am 29 Dez. 2020
Hallo I gernerated with "bwperim" borders around my particles and switched them to black instead of white with a black background.
I would like to visualize the difference between multiple images by diffrent colors. Right now all the images are black and white.
how can I change the black sourrounding into a diffrent color for each picture?

Akzeptierte Antwort

Image Analyst
Image Analyst am 29 Dez. 2020
Threshold or somehow segment your images to get a mask of the "black" parts, then use
rgbImage = imoverlay(grayImage, mask, yourColor);
where yourColor is a 3 element array where each number of the fraction from black to bright for red, green, and blue, like [0.3, 0.6, 0.9] or whatever.
  2 Kommentare
Markus Kokot
Markus Kokot am 29 Dez. 2020
Thank you very much :) it works!
Image Analyst
Image Analyst am 29 Dez. 2020
Then can you please "Accept this answer"? Thanks in advance.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 29 Dez. 2020
mask = ~YourLogicalMap;
MapR = mask .* ColorForRed;
MapG = mask .* ColorForGreen;
MapB = mask .* ColorForBlue;
MapRGB = cat(3, MapR, MapG, MapB);

Kategorien

Mehr zu Image Processing Toolbox 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!

Translated by