Determining orientation of grains based on EBSD color map

조회 수: 27 (최근 30일)
Yashas Shivakumar
Yashas Shivakumar 2023년 2월 23일
댓글: Yashas Shivakumar 2023년 2월 27일
I am trying to determine grain orienation based on this color maps I have. It has color maping co-ordinates or scale as attched.
Can you help me with a code to find tha number of orientations close to each of these. I am very new to coding but I have seen codes which give out number of grains close to (001), (101), (111) planes. And also how do I find the grains sizes.(Like aspect ratio of the grain size) to form a bell curve.
Thank you
  댓글 수: 1
DGM
DGM 2023년 2월 26일
편집: DGM 2023년 2월 26일
So is the color of the region the orientation, or is it some ratio of constituent orientations? The question suggests both.
If a region is yellow [255 255 0], magenta [255 0 255], or white [255 255 255], what is the expected output?
If a region color is [128 0 0], in what way is it different than [255 0 0]? Both colors are purely red, and the map diagram provides no information that would distinguish the two.

댓글을 달려면 로그인하십시오.

답변 (2개)

DGM
DGM 2023년 2월 26일
편집: DGM 2023년 2월 26일
I only ever did enough crystallography studies that I could answer a few leftfield questions on an interdisciplinary exam. I had to drag out my book, and who knows if this is even close to right.
We have three options:
  1. process every pixel
  2. find the representative colors in each region and process them
  3. pick some points and process them
Because the image is antialiased and has markers on it, the classification is ambiguous in certain places. That makes #2 difficult. Similarly, #1 is costly, and the results are questionable in those same regions. Given that, I'm going to opt to just do #3 for demonstration purposes. You can always modify the example to process the image however you want. Until it's accepted that the process is correct, it makes sense to operate on a smaller set of information anyway.
I'm going to assume that the mapping is linear in sRGB.
Let's start with a simpler image. This is an image of primary-secondary colors. It should make it easier to see how the mapping is working.
inpict = imread('triad.png');
% red, yellow, green, cyan, blue, magenta, white
querypoints = [42 142; 96 146; 149 146; 134 86; 102 41; 65 87; 104 105]; % [x y]
% display the image and mark the selected points for clarity
imshow(inpict); hold on
plot(querypoints(:,1),querypoints(:,2),'ko','linewidth',2,'markersize',10)
% get miller index for the selected points
MI = getmi(inpict,querypoints)
MI = 7×3
1 0 0 2 0 1 1 0 1 2 1 2 1 1 1 2 1 1 3 1 2
So you can see that primary red maps to [1 0 0], primary green maps to [1 0 1], and primary blue maps to [1 1 1]. Everything in between is the sum of the constituent normal vectors. I'm assuming that's what's intended.
We can apply the same to the given image, though it's hard to interpret what those results mean. I imagine that this image isn't actually representative of real data.
clf
% i'm assuming this is just pseudo data
inpict = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1304500/image.png');
% pick some points
% this can be done interactively using ginput() or other means
querypoints = [72 143; 132 103; 178 101; 228 162; 230 198]; % [x y]
% display the image and mark the selected points for clarity
imshow(inpict); hold on
plot(querypoints(:,1),querypoints(:,2),'ro','linewidth',2,'markersize',10)
% get miller index for the selected points
MI = getmi(inpict,querypoints)
MI = 5×3
647 225 447 370 72 323 116 53 112 256 145 226 152 23 141
These are the functions where the work is done
function MI = getmi(inpict,querypoints)
% calculate the miller index for the color at each point
mimap = [1 0 0; 1 0 1; 1 1 1];
npoints = size(querypoints,1);
MI = zeros(npoints,3);
for k = 1:npoints
% get the color at this point
thiscolor = inpict(querypoints(k,2),querypoints(k,1),:);
thiscolor = im2double(thiscolor);
% convert color to miller index
thismi = sum(thiscolor(:).*mimap,1); % sum of normal vectors
MI(k,:) = fixmi(thismi); % adjust non-integer MI
end
end
function mi = fixmi(mi)
% fix non-integer miller indices
mi = mi/max(mi); % normalize wrt max
% find LCD
[~,D] = rat(mi);
lcd = prod(D) / (gcd(D(1),D(2))*gcd(D(1),D(3))*gcd(D(2),D(3)));
% multiply by LCD and round to get rid of any remaining rounding errors
mi = round(mi*lcd);
end
Anyone is free to tell me this is nonsense. I wouldn't know.
  댓글 수: 1
Yashas Shivakumar
Yashas Shivakumar 2023년 2월 27일
Thank you this would mostly work.
The image was only example. In reality the color map would have more than these covering most of the color from 0-255. I'll try this once I have the results.
Thank you again

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2023년 2월 23일
What does "orientation" mean for some arbitrarily-shaped polygon?
If you use regionprops you can get the angle of an ellipse fitted to the shape. You can also get the size of the polygon, and the bounding box and aspect ratio. Is that what you want?
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
  댓글 수: 2
Yashas Shivakumar
Yashas Shivakumar 2023년 2월 26일
Here Orientation means at the microstructure level we see grain texure orientaion in different crystallographic planes. Each plane will be color coded as the attched tesselation image.
Thanks for the answer I'll check with your tutorial
Image Analyst
Image Analyst 2023년 2월 26일
If you're looking for an answer like 011 or 010, then regionprops won't give that to you. It gives angle of orientation of the region in degrees, like 0-360 or -180 to +180 degrees. It doesn't know anything about crystallography.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by