What is wrong in this code
    9 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Poonam
 el 12 de Sept. de 2014
  
    
    
    
    
    Respondida: Pierre Benoit
      
 el 12 de Sept. de 2014
            function [jaccard_Idx,jaccardDist]=jacarrd_coefficient(imgorig,imgseg)
{
    %check for logical image
if ~islogical(imgorig)
    error('Image must be logical');
end
    if ~islogical(imgseg)
            error('Image must be logical');
    end
        %find the intersection of both the  image
        inter_image=img_orig & img_seg;
        %find the union of both the image
        union_image=img_orig./img_seg;
        jaccard_Idx=sum(inter_image(:))./sum(union_image(:));
        jaccardDist=1-jaccard_Idx;
    }
getting following error
??? Error: File: jacarrd_coefficient.m Line: 4 Column: 1 Illegal use of reserved keyword "if".
0 comentarios
Respuesta aceptada
  Pierre Benoit
      
 el 12 de Sept. de 2014
        You're not using the proper Matlab syntax for defining function, i.e. you don't need curly braces to define function. Just remove them and it should be fine.
function [jaccard_Idx,jaccardDist]=jacarrd_coefficient(imgorig,imgseg)
      %check for logical image
  if ~islogical(imgorig)
      error('Image must be logical');
  end
      if ~islogical(imgseg)
              error('Image must be logical');
      end
          %find the intersection of both the  image
          inter_image=img_orig & img_seg;
          %find the union of both the image
          union_image=img_orig./img_seg;
          jaccard_Idx=sum(inter_image(:))./sum(union_image(:));
          jaccardDist=1-jaccard_Idx;
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

