Outils pour utilisateurs

Outils du site


fr:code:core:image

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
fr:code:core:image [2011/09/21 02:46] – créée fredy123fr:code:core:image [2021/02/13 11:23] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 ====== Image ====== ====== Image ======
 Cet objet représente une image.  Cet objet représente une image. 
 +
 +**Attention, cette page n'est pas complètement traduite. Voir la version originale : [[en:code:core:image]]**
  
 ===== Fonctions ===== ===== Fonctions =====
Ligne 9: Ligne 11:
 === Syntaxe === === Syntaxe ===
 <code javascript> <code javascript>
-var myObject = new Image();+var monObjet = new Image();
 </code> </code>
 <code javascript> <code javascript>
Ligne 26: Ligne 28:
  
 === Exemple === === Exemple ===
-Create a empty Image.+Créer une nouvelle image vide.
 <code javascript> <code javascript>
 var monObjet = new Image(); var monObjet = new Image();
 </code> </code>
-Créez une Image représentant une copie de ** autreImage **. +Créer une Image représentant une copie de ** autreImage **. 
 <code javascript> <code javascript>
 var monObjet = new Image(autreImage); var monObjet = new Image(autreImage);
Ligne 36: Ligne 38:
  
 ==== takeScreenshot ==== ==== takeScreenshot ====
-Prend un screenshot de l'écran entier ou seulement de la ** fenêtre ** et conserve le résultat dans une nouvelle Image. +Prend une capture d'écran de l'écran entier ou seulement de la ** fenêtre ** et conserve le résultat dans une nouvelle Image. 
  
  
Ligne 48: Ligne 50:
  
 === Arguments === === Arguments ===
-  - fenêtre - ([[en:code:core:window|Window]]) la fenêtre à screenshot +  - fenêtre - ([[en:code:core:window|Window]]) la fenêtre dont vous voulez capturer une image 
  
 === Exceptions === === Exceptions ===
   * (InvalidWindowError) fenêtre invalide   * (InvalidWindowError) fenêtre invalide
  
 +  [TODO:Translate]
 +
 +==== takeScreenshotUsingScreenIndex ====
 +Take a screenshot of one screen and store the result in a new Image. [//Added in Actionaz 3.7.0.//]
 +
 +=== Syntax ===
 +<code javascript>
 +var myObject = Image.takeScreenshotUsingScreenIndex(0);
 +</code>
 +
 +=== Arguments ===
 +  - screenIndex - (integer) the index of the screen to screenshot
 +
 +=== Exceptions ===
 +  * (InvalidScreenIndexError) invalid screen index
 +  
 +  
 ===== Méthodes ===== ===== Méthodes =====
  
Ligne 72: Ligne 91:
  
 ==== equals ==== ==== equals ====
-Retourne vrai si cette Image et un autre se réfèrent à la même image. +Renvoie vrai si cette Image et un autre se réfèrent à la même image. 
  
 === Syntaxe === === Syntaxe ===
Ligne 120: Ligne 139:
 === Arguments === === Arguments ===
   - data - ([[en:code:core:rawdata|RawData]]) RawData de l'image   - data - ([[en:code:core:rawdata|RawData]]) RawData de l'image
-  - + 
 === Renvoie === === Renvoie ===
   * (Image) cette image   * (Image) cette image
Ligne 130: Ligne 149:
 Les formats d'image soutenus sont BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, TIFF, XBM et XPM. Les formats d'image soutenus sont BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, TIFF, XBM et XPM.
  
 +==== data ====
 +Rend les données de cette Image comme [[en:code:core:rawdata|RawData]] dans le format de BMP. 
 +
 +=== Syntaxe ===
 +<code javascript>
 +monObjet.data();
 +</code>
 +
 +=== Renvoie ===
 +  * ([[en:code:core:rawdata|RawData]]) cette Image comme RawData 
 +
 +=== Exceptions ===
 +  * (ImageDataError) incapable de recevoir les données d'image 
 +
 +==== loadFromFile ====
 +Charge l'Image d'un dossier. 
 +
 +=== Syntaxe ===
 +<code javascript>
 +monObjet.loadFromFile(nomDeFichier );
 +</code>
 +
 +=== Arguments ===
 +  - nomDeFichier - (string) le nom du fichier à charger 
 +
 +=== Renvoie ===
 +  * (Image) cette image
 +
 +=== Exceptions ===
 +  * (LoadImageError) incapable de charger l'image 
 +
 +=== Notes ===
 +Les formats d'image soutenus sont BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, TIFF, XBM et XPM.
 +
 +==== saveToFile ====
 +Enregistre l'image dans un fichier.
 +
 +=== Syntaxe ===
 +<code javascript>
 +monObjet.saveToFile(nomDeFichier);
 +</code>
 +
 +=== Arguments ===
 +  - nomDeFichier - (string) nom de fichier à enregistrer dans
 +
 +=== Renvoie ===
 +  * (Image) cette image
 +
 +=== Exceptions ===
 +  * (SaveImageError) incapable de sauver l'image 
 +
 +=== Notes ===
 +Les formats d'image soutenus sont BMP, JPG, JPEG, PNG, PPM, TIFF, XBM et XPM.
 +
 +==== applyFilter ====
 +Applique un filtre sur cette Image. 
 +
 +=== Syntaxe ===
 +<code javascript>
 +monObjet.applyFilter(filtre);
 +</code>
 +<code javascript>
 +monObject.applyFilter(filtre, options);
 +</code>
 +
 +=== Arguments ===
 +  - filtre - ([[#filter|Filtre]]) le filtre à utiliser
 +  - options - (objet) option de filtre
 +    * filterChannels - (chaîne) la couleur sur laquelle sera appliquée le filtre. Une chaîne de caractères constituée de zéro ou une occurence des caractères r,g,b,a
 +    * filterBorderPolicy - (string) utilisé avec le filtre de convolution. Les valeurs sont "mirror", "extend" ou "wrap"
 +    * convolutionDivisor - (integer) le diviseur de convolution
 +    * convolutionBias - (integer) le biais de convolution
 +    * radius - (number) le radius
 +    * force - (number) la force (Utilise la, Luc!)
 +    * center - (object) le centre
 +      * x - (integer) la coordonnée x 
 +      * y - (integer) la coordonnée y
 +
 +=== Renvoie ===
 +  * (Image) cette image
 +
 +=== Exceptions ===
 +  * (ApplyFilterError) incapable d'appliquer le filtre 
 +
 + [TODO:Translate] 
 +==== pixel ====
 +Returns a pixel from this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.pixel(x, y);
 +</code>
 +
 +=== Arguments ===
 +  - x - (integer) x coordinate of the pixel to return
 +  - y - (integer) y coordinate of the pixel to return
 +
 +=== Returns ===
 +  * ([[en:code:core:color|Color]]) the pixel
 +
 +==== setPixel ====
 +Sets a pixel from this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.pixel(x, y, color);
 +</code>
 +<code javascript>
 +myObject.pixel(x, y, colorString);
 +</code>
 +<code javascript>
 +myObject.pixel(x, y, red, green, blue);
 +</code>
 +
 +=== Arguments ===
 +  - x - (integer) x coordinate of the pixel to set
 +  - y - (integer) y coordinate of the pixel to set
 +  - color - ([[en:code:core:color|Color]]) color of the pixel to set
 +  - red - (integer) red value of the color to set
 +  - green - (integer) green value of the color to set
 +  - blue - (integer) blue value of the color to set
 +
 +=== Returns ===
 +  * (Image) this Image
 +
 +==== mirror ====
 +Mirror this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.mirror(mirrorOrientation);
 +</code>
 +
 +=== Arguments ===
 +  - mirrorOrientation - ([[#mirrororientation|MirrorOrientation]]) mirror orientation
 +
 +=== Returns ===
 +  * (Image) this Image
 +
 +==== setSize ====
 +Resizes this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.setSize(size);
 +</code>
 +<code javascript>
 +myObject.setSize(width, height);
 +</code>
 +
 +=== Arguments ===
 +  - size - ([[en:code:core:size|Size]]) the new Image size
 +  - width - (integer) the new width of this Image
 +  - height - (integer) the new height of this Image
 +
 +=== Returns ===
 +  * (Image) this Image
 +
 +==== size ====
 +Returns the size of this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.size();
 +</code>
 +
 +=== Returns ===
 +  * ([[en:code:core:size|Size]]) the size of this Image
 +
 +==== width ====
 +Returns the width of this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.width();
 +</code>
 +
 +=== Returns ===
 +  * (integer) the width of this Image
 +
 +==== height ====
 +Returns the height of this Image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.height();
 +</code>
 +
 +=== Returns ===
 +  * (integer) the height of this Image
 +
 +==== copy ====
 +Returns a copy of this Image or only a part of it.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.copy();
 +</code>
 +<code javascript>
 +myObject.copy(rect);
 +</code>
 +
 +=== Arguments ===
 +  - rect - ([[en:code:core:rect|Rect]]) the section of this Image to copy
 +
 +=== Returns ===
 +  * (Image) a new copy of this Image
 +
 +==== findSubImage ====
 +Searches for another image contained in this one.
 +
 +//Added in Actionaz 3.0.1.//
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.findSubImage(otherImage);
 +</code>
 +<code javascript>
 +myObject.findSubImage(otherImage, options);
 +</code>
 +
 +=== Arguments ===
 +  - otherImage - (Image) the Image to find
 +  - options - (object) search options
 +    * confidenceMinimum - (integer) the minimum confidence percentage, 100 means perfect match (default: 70)
 +    * downPyramidCount - (integer) the number of pyramids to use. A pyramid is a subdivision of the image used to accelerate the search. Choose 1 here if the searched image is not very different from this image. (default: 2)
 +    * method - ([[#method|Method]]) the search method to use (default: CorrelationCoefficient) [//Added in Actionaz 3.7.0.//]
 +
 +=== Returns ===
 +  * (object) the matching point, or null if no matching point can be found
 +    * position - ([[en:code:core:point|Point]]) the matching image center
 +    * confidence - (integer) the confidence percentage
 +
 +=== Exceptions ===
 +  * (FindSubImageError) an error occured while searching for a sub-image
 +  * (ParameterTypeError) incorrect parameter type
 +
 +=== Example ===
 +<code javascript>
 +//Searches for an object on the screen
 +var screenShot = Image.takeScreenshot();
 +var imageToFind = new Image("object.png");
 +
 +var searchResult = screenShot.findSubImage(imageToFind);
 +if(searchResult)
 +    Console.print("Matching image found, position: " + searchResult.position + ", confidence: " + searchResult.confidence);
 +else
 +    Console.print("No matching image found.");
 +</code>
 +
 +==== findSubImages ====
 +Searches for images contained in this one.
 +
 +//Added in Actionaz 3.0.1.//
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.findSubImages(otherImage);
 +</code>
 +<code javascript>
 +myObject.findSubImages(otherImage, options);
 +</code>
 +
 +=== Arguments ===
 +  - otherImage - (Image) the Image to find
 +  - options - (object) search options
 +    * confidenceMinimum - (integer) the minimum confidence percentage, 100 means perfect match (default: 70)
 +    * downPyramidCount - (integer) the number of pyramids to use. A pyramid is a subdivision of the image used to accelerate the search. Choose 1 here if the searched image is not very different from this image. (default: 2)
 +    * searchExpansion - (integer) the number of pixels to shift when searching for another matching image (default: 15)
 +    * maximumMatches - (integer) the maximal number of matches (default: 10)
 +    * method - ([[#method|Method]]) the search method to use (default: CorrelationCoefficient) [//Added in Actionaz 3.7.0.//]
 +
 +=== Returns ===
 +  * (array of objects) the matching points, or null if no matching point can be found
 +    * position - ([[en:code:core:point|Point]]) the matching image center
 +    * confidence - (integer) the confidence percentage
 +
 +=== Exceptions ===
 +  * (FindSubImageError) an error occured while searching for a sub-image
 +  * (ParameterTypeError) incorrect parameter type
 +
 +=== Example ===
 +<code javascript>
 +//Searches for objects on the screen
 +var screenShot = Image.takeScreenshot();
 +var imageToFind = new Image("object.png");
 +
 +var searchResult = screenShot.findSubImages(imageToFind);
 +if(searchResult)
 +{
 +    Console.print("Matching images found\n");
 +    
 +    for(var i = 0; i < searchResult.length; ++i)
 +    {
 +        Console.print("position: " + searchResult[i].position + ", confidence: " + searchResult[i].confidence + "\n");
 +    }
 +}
 +else
 +    Console.print("No matching images found.");
 +</code>
 +==== findSubImageAsync ====
 +Searches for another image contained in this one in asynchronous mode.
 +
 +//Added in Actionaz 3.0.1.//
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.findSubImageAsync(otherImage, callback);
 +</code>
 +<code javascript>
 +myObject.findSubImageAsync(otherImage, callback, options);
 +</code>
 +
 +=== Arguments ===
 +  - otherImage - (Image) the Image to find
 +  - callback(object) - (function) the function that will be called when the search ends
 +    * position - ([[en:code:core:point|Point]]) the matching image center
 +    * confidence - (integer) the confidence percentage
 +  - options - (object) search options
 +    * confidenceMinimum - (integer) the minimum confidence percentage, 100 means perfect match (default: 70)
 +    * downPyramidCount - (integer) the number of pyramids to use. A pyramid is a subdivision of the image used to accelerate the search. Choose 1 here if the searched image is not very different from this image. (default: 2)
 +    * searchExpansion - (integer) the number of pixels to shift when searching for another matching image (default: 15)
 +    * method - ([[#method|Method]]) the search method to use (default: CorrelationCoefficient) [//Added in Actionaz 3.7.0.//]
 +
 +=== Returns ===
 +  * (Image) this Image
 +
 +=== Exceptions ===
 +  * (FindSubImageError) an error occured while searching for a sub-image
 +  * (ParameterTypeError) incorrect parameter type
 +
 +=== Example ===
 +<code javascript>
 +//Searches for an object on the screen
 +var screenShot = Image.takeScreenshot();
 +var imageToFind = new Image("object.png");
 +
 +screenShot.findSubImageAsync(imageToFind, function(searchResult)
 +{
 +    if(searchResult)
 +        Console.print("Matching image found, position: " + searchResult.position + ", confidence: " + searchResult.confidence);
 +    else
 +        Console.print("No matching image found.");
 +});
 +</code>
 +==== findSubImagesAsync ====
 +Searches for images contained in this one in asynchronous mode.
 +
 +//Added in Actionaz 3.0.1.//
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.findSubImagesAsync(otherImage, callback);
 +</code>
 +<code javascript>
 +myObject.findSubImagesAsync(otherImage, callback, options);
 +</code>
 +
 +=== Arguments ===
 +  - otherImage - (Image) the Image to find
 +  - callback(object) - (function) the function that will be called when the search ends
 +    * position - ([[en:code:core:point|Point]]) the matching image center
 +    * confidence - (integer) the confidence percentage
 +  - options - (object) search options
 +    * confidenceMinimum - (integer) the minimum confidence percentage, 100 means perfect match (default: 70)
 +    * downPyramidCount - (integer) the number of pyramids to use. A pyramid is a subdivision of the image used to accelerate the search. Choose 1 here if the searched image is not very different from this image. (default: 2)
 +    * searchExpansion - (integer) the number of pixels to shift when searching for another matching image (default: 15)
 +    * maximumMatches - (integer) the maximal number of matches (default: 10)
 +    * method - ([[#method|Method]]) the search method to use (default: CorrelationCoefficient) [//Added in Actionaz 3.7.0.//]
 +
 +=== Returns ===
 +  * (Image) this Image
 +
 +=== Exceptions ===
 +  * (FindSubImageError) an error occured while searching for a sub-image
 +  * (ParameterTypeError) incorrect parameter type
 +
 +=== Example ===
 +<code javascript>
 +//Searches for objects on the screen
 +var screenShot = Image.takeScreenshot();
 +var imageToFind = new Image("object.png");
 +
 +screenShot.findSubImagesAsync(imageToFind, function(searchResult)
 +{
 +    if(searchResult)
 +    {
 +        Console.print("Matching images found\n");
 +    
 +        for(var i = 0; i < searchResult.length; ++i)
 +        {
 +            Console.print("position: " + searchResult[i].position + ", confidence: " + searchResult[i].confidence + "\n");
 +        }
 +    }
 +    else
 +        Console.print("No matching images found.");
 +});
 +</code>
 +===== Enumerations =====
 +
 +==== Filter ====
 +Image filters.
 +
 +=== Values ===
 +  - ConvolutionFilter: the convolution filter
 +  - GaussianBlur: a gaussian blur
 +  - Defocus: blurs the image
 +  - Highlight: highlight the image
 +  - Sharpen: sharpens the image
 +  - SharpenMore: sharpens the image
 +  - SharpenEvenMore: sharpens the image
 +  - EdgeDetect: edge detection filter
 +  - BigEdge: edge detection filter (thicker edges)
 +  - Emboss: embosses the image (no color preservation)
 +  - EmbossColor: embosses the image (color preservation)
 +  - Negative: negates a color channel
 +  - RemoveChannel: remove a color channel
 +  - Punch: distorts the image
 +
 +==== MirrorOrientation ====
 +Mirror orientation.
 +
 +=== Values ===
 +  - Vertical: a vertical mirror
 +  - Horizontal: an horizontal mirror
 +
 +==== Method ====
 +Search method. [//Added in Actionaz 3.7.0.//]
 +
 +=== Values ===
 +  - CorrelationCoefficient: correlation coefficient, best for most use cases
 +  - CrossCorrelation: cross correlation
 +  - SquaredDifference: squared difference 
fr/code/core/image.1316573197.txt.gz · Dernière modification : 2021/02/13 11:23 (modification externe)