Make one result for multiple images
2 views (last 30 days)
Show older comments
Hello all;
I'm using 'imread' to read a single image and make three different types of image intensity analyse on them. I have nine images (same resolutions and details) from a polarised microscope)).
The problem is this:
I can give images one by one. Then I'll have three results for each of them (at all, I'll have 27 results). I want to give all of the nine images at the same time and get just three results for all of them. I want to make a 3D Polar Plot (I have one sample with different angles). So, do you have any idea to give all of my images and have just three results for all of them at the same time instead of one by one?
Here is my code (I've removed some parts):
D=imread('xxxxxx.tif','tif');
im_out=D;
figure;
imshow(im_out);
[p,o,~]=size(im_out);
for j=1:1
b=im_out(:,:,j);
tb=b;
tb=double(tb);
00000000000
figure;
mesh(tb)
title('Normalized light intensity of focal plane')
xlabel('Pixels')
ylabel('Pixels')
zlabel('Normalized Intensity')
axis auto
colorbar
end
mtb=max(max(tb));
0000000000
[aa,bb]=size(tb);
for i=1:aa
f=find(tb(:,i)==1);
if ~isempty(f)
figure(50);
hold on;
axis auto
xlabel('Pixels')
ylabel('Normalised Intensity')
plot(tb(:,i))
end
end
1 Comment
yanqi liu
on 21 Feb 2022
yes,sir,may be use Parallel Computing Toolbox to get parallel for loop process
Answers (2)
Udit06
on 20 Oct 2023
Hi Mehrzad,
I understand you want to want to take multiple images and apply some preprocessing on them in one go. You can achieve the same using MATLAB's "imageDatastore" object and "tranform" function. "imageDatastore" is used to manage a collection of image files and using "transform" function can be used to apply a specific function to each image in the image datastore. You can refer to the following MathWorks documentations to learn more about "imageDatastore" object and "transform" function respectively.
- https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.imagedatastore.html
- https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.transform.html
I hope this helps.
0 Comments
Image Analyst
on 20 Oct 2023
What are your 3 results? I don't understand at all your code where you are using mesh() on the red channel of the image.
What I'd do is have a single for loop over all images, as per the FAQ:
then in the loop I'd have a function that generated the 3 results from that one image, like
these3Results = GetResults(thisImage); % Get the 3 results from this image.
Then somehow store and plot the results of all the images. It doesn't matter that they're done "one at a time" though you can try the parallel processing toolbox with parfor if you want to try that.
If you still have a problem, write back.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!