フィルターのクリア

multiple snapshots into binarised

1 回表示 (過去 30 日間)
Carlos_conde
Carlos_conde 2017 年 10 月 19 日
コメント済み: Carlos_conde 2017 年 10 月 19 日
Hello all,
I have 500 snapshots from a video (called img001, img002,...,img500) I want to creat a loop for:
-read each image
-binarise each image
at the end, I will have 500 matrices because of the binarised images.
I have tried several codes provided by other users, but they did not work out for my case,
Regards

採用された回答

Cam Salzberger
Cam Salzberger 2017 年 10 月 19 日
Hello Carlos,
It helps if you post what you tried already, and what behavior/errors you were seeing.
I can recommend that you:
  1. Use dir to get the filenames in the desired directory.
  2. Create your storage container for the image matrices. If you know that all images are the same size, you could use a 3-D array, storing each binary image in one layer. If not, you could use a cell array. If you want to store other information with the images, you could use a struct array.
  3. Loop through each filename, and use imread to get the image data.
  4. Use imbinarize to binarize the image. If you have an older version of MATLAB (R2015b or earlier), you can use im2bw, possibly with graythresh.
  5. Store the binarized image in your data structure (array, cell array, struct array).
Hope this helps to get you started.
-Cam
  1 件のコメント
Carlos_conde
Carlos_conde 2017 年 10 月 19 日
thanks for your answer. Eventually I found the mistake in the code and it is working properly. Thanks

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by