フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

error in if cicle due to grayscale images and binary images

1 回表示 (過去 30 日間)
sofia cirne
sofia cirne 2017 年 6 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
im trying to calculate porosity throgh a funtion (bellow), either from a binary image or a grayscale image in one pusch button, but the grayscale image is not able to calculate, it just give another value, incorrect. the binary works fine. a = handles.grey; b = handles.imgData; B = im2double(b); A = im2double(a); I = handles.binaria;
[r c d]=size(a)
if d == 0 % black pixels c = sum(sum(A == 0));
textLabel2 = sprintf('%d', c); set(handles.areaporos, 'String', textLabel2);
% total pixels numPixels = numel(B); textLabel = sprintf('%d', numPixels); set(handles.areatotal, 'String', textLabel);
%porosidade P = ((c/numPixels)*100); textLabe4 = sprintf('%d', P); set(handles.porosidade, 'String', textLabe4);
else
h = sum(sum(I == 0)); textLabel5 = sprintf('%d', h); set(handles.areaporos, 'String', textLabel5);
numPixels = numel(B); textLabel = sprintf('%d', numPixels); set(handles.areatotal, 'String', textLabel);
H = ((h/numPixels)*100); textLabe6 = sprintf('%d', H); set(handles.porosidade, 'String', textLabe6); end end
  1 件のコメント
Rik
Rik 2017 年 6 月 20 日
Your code is unreadable, you give no example data, you don't say what the output should be. Have a read here and here. It will greatly improve your chances of getting an answer.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by