Subscribe RSS

Posts Tagged ‘image’

A minimal ImageJ Plugin in Clojure: image inversion

January 15th, 2010 by fmn | 2 Comments | Filed in Enseignement, Research

I show in this post how to write an ImageJ plugin with Clojure. This example is taken from Digital Image Processing: An Algorithmic Introduction Using Java: an image inversion (page 32).

The goal is to invert all the pixels of a 8-bit grayscale image, turning an image into its negative. As a pixel value is coded with 8 bits, the higher possible value is 255. The operation is thus to transform each pixel value v into 255-v.

I first present the plugin in Java, with a description of the essentials elements of an ImageJ plugin. Then, i give several Clojure versions. The last is as fast as the Java one, but more reusable.

(more…)

Tags: , , , , , , , ,

Clojure functions with meta-data. Image representation #3

October 20th, 2009 by fmn | No Comments | Filed in Enseignement, Research

Previously on Pixel Shaker : an image is a bounded function that can be coded as a Java-class. This Java-class involves a lots codelines, even in Clojure. Today is an exploration of this concept in a more idiomatic way.

A bounded function is a function with an additional information : its definition domain. Clojure provides an handy way to deals with extra data : the metadata. The metadata is a map of data that can be added using the with-meta function. Let’s try to add a definition domain as a metadata :

user> (defn indom? [dom pt]
        (let [[start end] dom
              [x y] pt]
          (and (>= x (first start))
               (<= x (first end))
               (>= y (second start))
               (<= y (second end)))))
#'user/indom?
user> (defn f [x y] (+ x y))
#'user/f
user> (def dom [[0 0] [4 4]])
#'user/dom
user> (def bf (with-meta f {:domain dom}))
java.lang.UnsupportedOperationException (NO_SOURCE_FILE:10)

(more…)

Tags: , , ,

Une perception grossière est suffisante pour attribuer une catégorie générale

October 15th, 2009 by fmn | 6 Comments | Filed in Research

Translate original post with Google Translate

Je m’étais rendu compte que seule la perception grossière et erronée place tout dans l’objet, quand tout est dans l’esprit – Marcel Proust.

Lorsque nous percevons les objets qui nous entourent, nous attribuons des catégories. Les psychologues cognitivistes étudient depuis longtemps les processus activés lors de cette catégorisation. Ainsi trois niveaux sont distingués :

  • Le niveau de base (basic level) est le niveau le plus abstrait où les objets considérés partagent encore un grand nombre de caractéristiques. Les catégories de ce niveau sont les catégories les plus facile à apprendre pour les enfants. Pour nommer les objets, les adultes utilisent plus spontanément des mots des ces catégories.
  • Les catégories fines spécifiques (subordinate level) correspondent à des catégories plus spécialisées.
  • Les catégories générales (superordinate level) contiennent des abstractions plus fortes.

Par exemple la catégorie “chien” pourrait se situer au niveau de base. Dans ce cas, “animal” serait une catégorie générale et “sharpeï” serait une catégorie fine spécifique. Les études montrent que le niveau des catégories peut varier avec les individus, selon leur expertise du domaine.

(more…)

Tags: , , , , ,