<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Dubna, Russia, June</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>COMPUTER VISION ALGORITHMS FOR STUDYING THE INFLUENCE OF VARIOUS FACTORS ON BIOLOGICAL OBJECTS</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>A.S. Bulatov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>A.V. Stadnik</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrey Bulatov</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Aleksey Stadnik</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dubna State University</institution>
          ,
          <addr-line>Universitetskaya 19, Dubna, Moscow Region, 141980</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Joint Institute for Nuclear Research</institution>
          ,
          <addr-line>6 Joliot-Curie Street, Dubna, Moscow Region</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2020</year>
      </pub-date>
      <volume>18</volume>
      <issue>2020</issue>
      <fpage>34</fpage>
      <lpage>38</lpage>
      <abstract>
        <p>The article discusses the possibilities of automating the analysis of behavioral parameters of laboratory animals during an experiment using computer vision algorithms. Specific algorithms that allow one to calculate the track of a laboratory animal and to automatically read out the parameters of the experiment, such as the marking of the laboratory pool and the coordinates of the test site, are presented. The relevance of the work results from the need for automatically monitored behavioral patterns (vertical stands, minks, grooming, fading, movement in place) in the "Open Field" experimental setup. At the same time, in the "Morris Water Maze" experimental setup, due to the presence of glare on the water surface, tracking an experimental animal is incorrect.</p>
      </abstract>
      <kwd-group>
        <kwd>computer vision</kwd>
        <kwd>Python</kwd>
        <kwd>OpenCV</kwd>
        <kwd>tracking</kwd>
        <kwd>image segmentation</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>The article is devoted to the development of a software component of an information
system being elaborated as part of the joint project of the Laboratory of Information
Technologies and the Laboratory of Radiation Biology of the Joint Institute for Nuclear
Research. The major task of the information system is to automate the processing and
analysis of photo and video files with experiments underway at the Radiation Physiology
Sector of the Laboratory of Radiation Biology. The software component of the information
system will make it possible to process video recordings of experiments carried out in
experimental setups, such as “Open Field”, “Morris Water Maze” and “T-Maze”, to evaluate
the track of an experimental animal, to automate the reading-out of some parameters, namely,
the marking and location of the experimental setup, the counting of sectors traversed by the
rodent in the “Open Field” experimental setup, the fixation of the fact that the rodent found a
platform on the water surface in the “Morris Water Maze” experimental setup, the fixation of
the rodent’s final position in the “T-Maze” experimental setup.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Development of the software component</title>
      <p>The software component of the information system is developed in the Python
programming language using the OpenCV computer vision algorithm library and allows one
to download, process and analyze video files obtained during experiments to study the effects
of ionizing radiation on the behavioral responses of laboratory animals in test setups (“Open
Field”, “Morris Water Maze”, “T-Maze”).</p>
      <p>The video recording with the experiment, downloaded in the software component, is
processed frame by frame. The experimental animal must be absent from the first frame of
the video recording, since the first frame is saved and marked as a background.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Image segmentation</title>
      <p>Segmentation algorithms are used to detect or count details in the image. The result of
applying these algorithms represents a set of segments covering the entire image or a set of
contours extracted from the image. All pixels in the segment are similar in some
characteristic or property (color, brightness or texture). Adjacent segments differ in the given
characteristic.</p>
      <p>
        After saving the first frame, the Watershed [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] segmentation algorithm is applied to
extract the experimental setup and its boundaries in the image (Fig. 1). It is required for
processing only the part of the image with the experimental setup.
      </p>
    </sec>
    <sec id="sec-4">
      <title>4. Detecting a platform on the water surface</title>
      <p>One of the behavioral indicators in the “Morris Water Maze” test is the detection of a
platform on the water surface by an experimental animal.</p>
      <p>Since the location of the platform can vary in different experiments, the task of
defining the location of the platform in the frame was a separate service task to automate the
experiment.</p>
      <p>The main difficulty in the given task relies on the fact that the platform has a fairly
small size comparable to the size of the experimental animal, and in the video it also poorly
contrasts with the background, i.e. the pool water, which is a relatively calm, but still
dynamic environment with a fairly active noise component.</p>
      <p>The proposed solution comprises several classical stages of image analysis, which is
used for one first or several initial frames of the video recording of the experiment. The
selected frames are processed by a specially selected filter, which is a MexicanHat wavelet
function with radial symmetry with a peak in the center of a 32х32 square image. The image
is converted to the HSV color space, where the Value channel is filtered. Such simple
transformations enable the grading of the invisibility of the platform in the water. The filter is
selected so that its average is close to zero, therefore it works similarly to some conditional
segmentation, aligning homogeneous image segments despite small noise. The adaptive
threshold filtering from the OpenCV Adaptive Threshold computer vision algorithm library
returns a binary mask where in the pool area there is only a segment almost completely
corresponding to the platform pixels. To automate the reading-out of the platform location,
the contour detection algorithm is used (Fig. 2).</p>
    </sec>
    <sec id="sec-5">
      <title>5. Searching for a rodent in the frame</title>
      <p>To search for a rodent in the frame correctly, without false positives, reactions to glare
and noise, Gaussian smoothing is applied, after which the Threshold function built into
OpenCV is used; with its help the absolute difference between the current frame and the
background is calculated (Fig. 3).</p>
      <p>At the end, the function to search for the object’s contour is used, the coordinates of
the contour are written to a text file, and after processing the video file, a track is built using
the coordinates (Fig. 4).</p>
    </sec>
    <sec id="sec-6">
      <title>6. Counting traversed sectors</title>
      <p>To automate the counting of sectors traversed by the rodent in the “Open Field”
experimental setup, it is required to detect and write the coordinates of the marking of the
experimental setup. To search for circles and lines of the marking, the Hough Transform
algorithm is used (Fig. 5). The coordinates of the lines of the marking are written, and sectors
traversed by the rodent are counted on their basis.</p>
    </sec>
    <sec id="sec-7">
      <title>Conclusion</title>
      <p>The first results of the development of the software component to analyze video
recordings with experiments are considered, computer vision algorithms for image
segmentation to detect the experimental setup in the frame and algorithms to define the
marking in the “Open Field” experimental setup and to search for a platform on the water
surface in the “Morris Water Maze” experimental setup, as well as algorithms to search for a
moving object in the frame and to build the trajectory of its movement, are presented.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>[1] Watershed algorithm</article-title>
          . Electronic resource: https://www.pyimagesearch.com/
          <year>2015</year>
          /11/02/watershed-opencv/
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <article-title>Wavelet function MexicanHat</article-title>
          . Electronic resource: https://academic.oup.com/mnras/article/369/4/1603/1087163
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>OpenCV</given-names>
            <surname>Adaptive</surname>
          </string-name>
          <article-title>Threshold</article-title>
          . Electronic resource: https://docs.opencv.
          <source>org/3</source>
          .4/d7/d4d/tutorial_py_thresholding.html
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>OpenCV</given-names>
            <surname>Hough</surname>
          </string-name>
          <article-title>Transform</article-title>
          . Electronic resource: https://docs.opencv.
          <source>org/3</source>
          .4/d9/db0/tutorial_hough_lines.html
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5] “Open Field”
          <article-title>experimental setup</article-title>
          . Electronic resource: http://www.openscience.ru/index.php?page=ts&amp;item=
          <fpage>001</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>[6] “Morris Water Maze” experimental setup</article-title>
          . Electronic resource: http://www.openscience.ru/index.php?page=ts&amp;item=
          <fpage>021</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>“</surname>
            <given-names>T-</given-names>
          </string-name>
          <article-title>Maze” experimental setup</article-title>
          . Electronic resource: http://www.openscience.ru/index.php?page=ts&amp;item=
          <fpage>006</fpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>