Make one result for multiple images

2 次查看(过去 30 天)
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 个评论
yanqi liu
yanqi liu 2022-2-21
yes,sir,may be use Parallel Computing Toolbox to get parallel for loop process

请先登录,再进行评论。

回答(2 个)

Udit06
Udit06 2023-10-20
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.
  1. https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.imagedatastore.html
  2. https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.transform.html
I hope this helps.

Image Analyst
Image Analyst 2023-10-20
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.

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by