Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

error in if cicle due to grayscale images and binary images

1 visualización (últimos 30 días)
sofia cirne
sofia cirne el 20 de Jun. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Rik
Rik el 20 de Jun. de 2017
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.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by