how to do masking for multiple images in terms of {i}?

1 回表示 (過去 30 日間)
Mahmoud
Mahmoud 2015 年 3 月 22 日
コメント済み: Image Analyst 2015 年 3 月 22 日
Hello, For one image I can do the masking, which is
h1 = subplot(3, 4, 7);
imshow(RGBimage)
h2 = subplot(3,4,7);
hEllipse = imellipse(gca,[10 10 50 150]);
binaryImage = hEllipse.createMask();
but what if I have multiple images and would like to do mask for each one. I am using the for loop in this case
for i = 1 : numel(folder)
What to do ?
end

回答 (1 件)

Image Analyst
Image Analyst 2015 年 3 月 22 日
  2 件のコメント
Mahmoud
Mahmoud 2015 年 3 月 22 日
編集済み: Mahmoud 2015 年 3 月 22 日
I already defined the file and matlab is taking the images I want to process but I would like to know how to mask several images.
This is how I defined the file
folder = dir('C:\Users\Demo\WD*.png');
image = cell(1,numel(folder));
for i = 1:numel(folder);
image{i} = imread(folder(i).name);
end
I am trying to convert the ellipses I draw on each image to binary images after matlab read the rgb images I am trying to do but it didnt work
for i = 1 : numel(folder)
h1 = subplot(3, 4, i);
imshow(RGBimage{i})
h2 = subplot(3,4,i);
hEllipse{i} = imellipse(gca,[10 10 50 150]);
binaryImage{i} = hEllipse{i}.createMask();
end
but this is not working
Any help?
Image Analyst
Image Analyst 2015 年 3 月 22 日
I wouldn't call it "folder" since the variable contains filenames, not a folder name. And you should DEFINITELY not call a variable image, since that is the name of a built-in function.
I still don't know what you want to do. Why are you saving all these images instead of operating on them in the first loop? Same question for the binary images. And what do you want to do with the binary images after you create them? Do you want to write a solid or outline ellipse into the RGB image?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Translated by