Images in Digital micrograph

10 views (last 30 days)
Antonio Sereira
Antonio Sereira on 5 Mar 2017
Commented: Antonio Sereira on 19 Mar 2017
Hi,
I would like to extract the dark pixels of an DM3 image. For that I thought to get the line profile and set a threshold. Each pixel below the certain threshold would be identified as a "dark" pixel. Now my question: How can I draw such line profiles atomatically?

Answers (2)

Image Analyst
Image Analyst on 5 Mar 2017
You can use line() to draw lines in the overlay above an image. You might like to look at improfile(). What is your definition of "automatically"?
To get the dark pixels, you can mask bright pixels to 0
brightPixels = grayImage > someValue;
grayImage(brightPixels) = 0;
imshow(grayImage, []);

Antonio Sereira
Antonio Sereira on 6 Mar 2017
Hi, I extracted the data of the image and I got now a big matrix. I plot them and choose only certain columns. If I want to set a threshold and separate the data below and above the threshold into new matrices, I could solve the problem. What kind of function should I use? It is clear that I should use a for loop but how to set a threshold and save them into two different groups?
  6 Comments
Image Analyst
Image Analyst on 7 Mar 2017
Not quite sure I understand. You lost me when you said that you took an average vertical profile (1-D of 1000 elements) and turned it into a 100x100 2-D array and then called that a "data cube" which, to me, means a 3-D array, not a 2-D array. Did you subsample and replicate? Just reshape()? Is this something like meshgrid() produces? I have no idea what went on.
A small 4 by 4 by 3 slice example might help.
In general to extract values according to their value, try thresholding:
indexesToExtract = z >= lowValue & z <= highValue;
extractedZ = z(indexesToExtract);
where z is a 1-d vector.
Antonio Sereira
Antonio Sereira on 19 Mar 2017
Hi,
to get more clear: I set two for loops (for i=1:100 and j=1:100) and put in the for loop a if condition. If value is above threshold than save it into matrix A(i,j). Now, Matrix A corresponds to certain k-values of a hyperspectral data cube B (three dimensional array). I want to correlate the pixel (i,j) of A with B(i,j,k) so that I only have values for (i,j) whose values are above the threshold and zero else. A simple matrix dot product is not possible. Any idea?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!