粒子一つ一つを解析したいです
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Naoki Hashiguchi
le 24 Nov 2022
Commenté : Naoki Hashiguchi
le 27 Nov 2022
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1205103/image.bmp)
clear all,close all,clc;
%%指定領域の画像の読み込み
j = imread('10000fps_Al_0.2mm_70GLY_bottom_doublelight_S0001_S0001.bmp');
[I,rect] = imcrop(j);
figure,imshow(I)
%%2値化
BW = I < 50
%プロパティ解析
state = regionprops(BW,'Area','Centroid');
%%ラベル画像の作製
L = bwlabel(BW);
RGB = label2rgb(L);
figure,imshow(L);
使い方によるエラー bwlabel
1 番目の入力引数 BWは2 次元にする必要があります。
上記のプログラムを使用して灰色の粒子を2値化しBWを2次元にしたいのですがエラーがでますどのようにしたらいいでしょうか?
0 commentaires
Réponse acceptée
Atsushi Ueno
le 27 Nov 2022
添付の画像のサイズは 256*512*3 です。見た目は白黒ですがこれはカラー画像データです。
clear,close all; clc;
%%指定領域の画像の読み込み
%j = imread('10000fps_Al_0.2mm_70GLY_bottom_doublelight_S0001_S0001.bmp');
j = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1205103/image.bmp');
gry = imcrop(im2gray(j), [150,1,300,512]); % RGB⇒グレースケール化、指定領域を仮固定
%figure,imshow(gry)
%%コントラスト調整
adj = imadjust(gry, stretchlim(gry), []); % 追加:コントラスト調整
%figure,imshow(adj)
%%2値化
BW = imbinarize(adj); %BW = j < 50 % imbinarize関数に変更
%figure,imshow(BW)
%%プロパティ解析
state = regionprops(BW,'Area','Centroid');
%%ラベル画像の作製
L = bwlabel(BW);
RGB = label2rgb(L);
%figure,imshow(L);
他にもちょいちょい変更を入れて下記の様な結果になりました。
(左上:元画像、右上:領域指定、左下:コントラスト調整、右下:2値化)
montage({j,gry,adj,BW});
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur イメージ タイプの変換 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!