IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Images Discussion :

segmentation d'une image


Sujet :

Images

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    université
    Inscrit en
    Avril 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : université

    Informations forums :
    Inscription : Avril 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut segmentation d'une image
    Bonjour,

    je veux utiliser une fonction de segmentation qui s'appelle "slic"
    je veux avoir comme résultat de sortie une image segmentée en noire et blanc
    les lignes qui définissent les régions en noir et le fond en blanc.
    est ce que quelqu'un a une idée pour m'aider
    merci

  2. #2
    Modérateur

    Homme Profil pro
    Ingénieur en calculs scientifiques
    Inscrit en
    Août 2007
    Messages
    4 639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Ingénieur en calculs scientifiques

    Informations forums :
    Inscription : Août 2007
    Messages : 4 639
    Points : 7 614
    Points
    7 614
    Par défaut
    Bonjour,

    d'où vient cette fonction clic? et quel est le problème exactement? As-tu essayé de coder quelque chose? Peux-tu nous le montrer?
    Pour une bonne utilisation des balises code c'est ici!
    Petit guide du voyageur MATLABien : Le forum La faq Les tutoriels Les sources


    La nature est un livre écrit en langage mathématique. Galilée.

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    université
    Inscrit en
    Avril 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : université

    Informations forums :
    Inscription : Avril 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    les deux fonctions qui nous donnent le resultat de la segmentation ce sont ces deux fonctions :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
     
    % DRAWREGIONBOUNDARIES Draw boundaries of labeled regions in an image
    %
    % Usage: maskim = drawregionboundaries(l, im, col)
    %
    % Arguments:
    %            l - Labeled image of regions.
    %           im - Optional image to overlay the region boundaries on.
    %          col - Optional colour specification. Defaults to black.  Note that
    %                the colour components are specified as values 0-255.
    %                For example red is [255 0 0] and white is [255 255 255].
    %
    % Returns: 
    %       maskim - If no image has been supplied maskim is a binary mask
    %                image indicating where the region boundaries are.
    %                If an image has been supplied maskim is the image with the
    %                region boundaries overlaid 
    %
    % See also: MASKIMAGE
     
    % Copyright (c) 2013 Peter Kovesi
    % Centre for Exploration Targeting
    % School of Earth and Environment
    % The University of Western Australia
    % peter.kovesi at uwa edu au
    % 
    % Permission is hereby granted, free of charge, to any person obtaining a copy
    % of this software and associated documentation files (the "Software"), to deal
    % in the Software without restriction, subject to the following conditions:
    % 
    % The above copyright notice and this permission notice shall be included in 
    % all copies or substantial portions of the Software.
    %
    % The Software is provided "as is", without warranty of any kind.
     
    % Feb 2013
    function maskim = drawregionboundaries(l, im , col)
     
        % Form the mask by applying a sobel edge detector to the labeled image,
        % thresholding and then thinning the result.
    %    h = [1  0 -1
    %         2  0 -2
    %         1  0 -1];
        h = [-1 1];  % A simple small filter is better in this application.
                     % Small regions 1 pixel wide get missed using a Sobel
                     % operator 
        gx = filter2(h ,l);
        gy = filter2(h',l);
        maskim = (gx.^2 + gy.^2) > 0;
        maskim = bwmorph(maskim, 'thin', Inf);
     
        % Zero out any mask values that may have been set around the edge of the
        % image.
        maskim(1,:) = 0; maskim(end,:) = 0;
        maskim(:,1) = 0; maskim(:,end) = 0;
     
        % If an image has been supplied apply the mask to the image and return it 
        if exist('im', 'var') 
            if ~exist('col', 'var'), col = 0; end
            maskim = maskimage(im, maskim, col);
        end
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
     
    % MASKIMAGE Apply mask to image
    %
    % Usage: maskedim = maskimage(im, mask, col)
    %
    % Arguments:    im  - Image to be masked
    %             mask  - Binary masking image
    %              col  - Value/colour to be applied to regions where mask == 1
    %                     If im is a colour image col can be a 3-vector
    %                     specifying the colour values to be applied.
    %
    % Returns: maskedim - The masked image
    %
    % See also; DRAWREGIONBOUNDARIES
     
    % Peter Kovesi
    % Centre for Exploration Targeting
    % School of Earth and Environment
    % The University of Western Australia
    % peter.kovesi at uwa edu au
    %
    % Feb 2013
    function maskedim = maskimage(im, mask, col)
     
        [rows,cols, chan] = size(im);
     
        % Set default colour to 0 (black)
        if ~exist('col', 'var'), col = 0; end
     
        % Ensure col has same length as image depth.
        if length(col) == 1
            col = repmat(col, [chan 1]);
        else
            assert(length(col) == chan);
        end
     
        % Perform masking
        maskedim = im;
        for n = 1:chan
            tmp = maskedim(:,:,n);
            tmp(mask) = col(n);
            maskedim(:,:,n) = tmp;
        end
    ce que je dois faire c'est faire des changements a la variable im pour que l'image segmentée soit blanche

  4. #4
    Nouveau Candidat au Club
    Homme Profil pro
    université
    Inscrit en
    Avril 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : université

    Informations forums :
    Inscription : Avril 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    J'ai fais ce changement sur la boucle for de la deuxième fonction maskedim mais j'ai obtenu une image toute blanche.
    % Perform masking
    maskedim = im;

    for n = 1:chan
    tmp = maskedim(:,:,n);
    tmp(mask) = col(n);
    for i= 1:size(tmp,1)
    for j=1:size(tmp,2)
    if tmp(i,j)~= 0;
    tmp(i,j)= 255;
    end
    end
    end
    maskedim(:,:,n) = tmp;
    end
    et ce n'est pas le résultat que je veux avoir

    voila le résultat :Nom : blanc.JPG
Affichages : 208
Taille : 13,0 Ko
    et voila le résultat que je veux avoir :
    Nom : 1_IniSeg.png
Affichages : 201
Taille : 3,8 Ko

    est ce que vous pouvez m'aider ?

Discussions similaires

  1. Segmentation d'une image couleur
    Par Vanier42 dans le forum OpenCV
    Réponses: 0
    Dernier message: 09/10/2008, 00h18
  2. segment d'une image
    Par yasminsila dans le forum Images
    Réponses: 1
    Dernier message: 30/05/2008, 13h54
  3. Segmentation d'une image binaire
    Par miss_angel dans le forum Images
    Réponses: 12
    Dernier message: 27/03/2008, 22h35
  4. Segmentation d'une image
    Par djtsou dans le forum Traitement d'images
    Réponses: 5
    Dernier message: 17/02/2008, 16h57
  5. Réponses: 4
    Dernier message: 20/11/2007, 13h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo