The invention relates to a method and an electronic apparatus (10) for enabling or inhibiting the access to a resource by one or more animals. Such an electronic apparatus includes a portion (11) for accessing the resource and a portion for controlling (12) the access. The method comprises the steps of: acquiring (101) at least one digital image of a volume proximal to the portion for accessing the resource and outside the electronic apparatus containing the animal; processing (102), the at least one digital image acquired, said step of processing comprising a step of performing at least one convolution operation on the at least one digital image by means of a trained convolutional neural network; controlling (103) the means (13) for actuating a barrier element (14) of the electronic apparatus on the basis of a processing of said at least one digital image acquired to move the barrier element between a first position, in which the access to the resource is inhibited, to a second position, in which the access to the resource is enabled, or to block the movement of the barrier element. The step of controlling the means for actuating the barrier element comprises the steps of: obtaining (104) at least one descriptive class of the at least one image of a volume proximal to the portion for accessing the resource and outside the electronic apparatus on the basis of said processing; generating (105) at least one signal for controlling the means for actuating the barrier element on the basis of said at least one descriptive class of the image.L'invention concerne un procédé et un appareil électronique (10) pour permettre ou inhiber l'accès à une ressource à un ou plusieurs animaux. Un tel appareil électronique comprend une partie (11) pour accéder à la ressource et une partie pour en contrôler (12) l'accès. Le procédé comprend les étapes consistant à : acquérir (101) au moins une image numérique d'un volume à proximité de la partie pour accéder à la ressource et à l'extérie