Normalization of figure based on colour (RGB)

Hello,
I have my code here;
color_image = {};
map = hsv(256);
for i = 1:size(Data_SWS_BMd_A3,2)
image = Data_SWS_BMd_A3{i}.SWS_Img;
uint_image = uint8(255*mat2gray(image));
color_image{i} = ind2rgb(uint_image, map);
end
I want to normalize my figures base on one range colour to find a relationship between them.
Can anyone help me 1) how I can nomalize it?
2) how should I change the binary of my picture to expand the range of colour?
I need the answer soon, I would be grateful if anyone can help me regarding that.
Regards
Thanks

Answers (1)

I can't really tell you how to standardize the images unless I know what's in it, and your intent. I mean you could simply use rescale(rgbImage, 0, 255) but that may not be what you want. Maybe you have a Color Checker Chart in the image and want to use that do to a true color standardization like the pros do. I don't know. Anyway, see my attached tutorial.

6 Comments

Thanks so much for your response. If you just see my attachment, different colours represent different layers and components from my trapezius muscle (these information extracted from ultrasound). Transducer was rotating at the same area from 90 degree to -90 degree and mad 31 data pixels. While the green colour should be skin, the size of green area is increasing at each points from 31 data. So it means that data are not following the same range of colour and I can not compare each figure with the previous one.
Please let me wheter my explanation is clear or not.
Thanks so much for your help
You don't want to do that in color. It's just applying a pseudocolor look up table to grayscale data. You need to figure out what the gray scales are of the pixels in the area you want to look at and then apply a colormap that will be appropriate to see those. Can you post the same layout in gray scale. Make sure you call impixelinfo after you display each one.
In addition to my previous explanation, now I want a normalization for colour range and then define it for my map. Then my figures can follow the same range. (can rescale function help me for that?)
This one is in a grayscale way, but I need that in a colorful way then I can understand different components better based on different colours.
for i = 1:size(Data_SWS_BMd_A3,2)
image = Data_SWS_BMd_A3{i}.SWS_Img;
%uint_image = uint8(255*mat2gray(image));
%color_image{i} = ind2rgb(uint_image, map);
grayscale{i}= image
end
for k = 1: 19
subplot(3,7,k);
imshow(grayscale{k})
end
impixelinfo
please let me know if it is the one that you meant.
thanks so much
What is the class and range of your images? Are they uint8 (0-255), or uint16 (0-65535), or double?
Zip up your images and attach the zip file and let me know what intensity range should be each color. Like what values should be green, what values should be yellow, etc.
They are 0 to 255. a
The zipped file exceeds 5 MB and does not allow me to upload it here. Please let me know how I can send them to you?
Also, please see the attachment which provides 3D cylindrical figures at all point and also I just pasted the codes here as well:
load clown
figure(2)
hold on
for i = 1:size(Data_SWS_BMd_A3,2)
imgRGB = Data_SWS_BMd_A3{i}.SWS_Img;
[imgRows,imgCols,imgPlanes] = size(imgRGB);
[X,Y,Z] = cylinder(imgRows,imgCols);
surface(X,Y,Z,flipud(imgRGB),...
'FaceColor','texturemap',...
'EdgeColor','none',...
'CDataMapping','direct')
mymap = [0 0 0
1 0 0
0 1 0
0 0 1
1 1 1];
colormap(mymap)
colorbar
angle = prb_angle(i);
view(0,45);
%0 is azimuth
end
hold off
As you can see, I would prefer to have my figures in the value of my map that I have defined in my codes.
I want 19 figures which is extracted from 19 angles and have the same colour as this cylinder but as a surface not cylindrical.
Thanks so much for all your help and I do really appreciate it.

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!