#JavaScript (ES6), <s>&nbsp;228 195&nbsp;</s> 192 bytes

Expects a matrix of characters as input.

This can be quite slow on some inputs, such as the last test case.

<!-- language: lang-javascript -->

    m=>m.map((r,Y)=>r.map((_,X)=>n+=(g=(x,y,z,q=z&2,r=m[y],v=r&&r[x])=>v?(v|=64+(v>{})+!++v)^(r[x]|=v|4<<z)?g(x+--q*~z%2,y-q*z%2,z^2)&g(x,y,z^=v&3?v&3|1:v>>3-z&4?1:3)|!(r[x]=v):1:0)(X,Y,0)),n=0)|n

[Try it online!](https://tio.run/##TZDNcoIwFIX3eYp0UcwtEfBnumAMrNoXcKNjtMMgUDoQNNiMIPbV7Y0u2kVyzr35zlnkKzFJm@rycBqrZp/dcnGrRVR7dXJgTPM1iEg/hg@@wkG5ghWCnXnHe34UvTPlWtSbbsuN0I6jN@ctUiZmZhCvc5eZ6HIF98l1DeyYfR2EGeaLRQ9xwc7ueHx8@emfp7xDY7XfTcEpHv07YZxZjGeYhCaKZuPemceTcAbD071KGAgnYQBsxdc8AOBKBDCom86O36XO2ChvR@DpLNm/l1W27FTKAvBOzfKkS1Uw8NpDVZ7YSCqpEMwb/Zakn6ylIqIXQmnaqLapMq9qCpaz9g9H2H6JtuDG8zy9BQByhZsvfUmJpJRKQtH7hPi@L6VEwR0KRUAiIdERiaRvRSKFKCb@XcSyxObIveq@tAlbTX8B "JavaScript (Node.js) – Try It Online")

##How?

###Grid encoding

We divide each cell into 4 areas as follows:

[![areas][1]][1]

The current position is encoded as \$(x,y,z)\$, where \$(x,y)\$ is the position in the matrix and \$z\$ is the ID of the area.

The characters in the original matrix are converted on the fly to 7-bit integers as they are visited:

    +---------> a marker to tell that this tile has been converted (always 1)
    |      +--> 4 bits to tell whether a given area has been visited
    |      |
    |      |      +-----> set to 1 if the cell contains an anti-slash
    |  ____|____  |  +--> set to 1 of the cell contains a slash
    | /         \ |  |
    1 z3 z2 z1 z0 AS S

The conversion is done with:

<!-- language: lang-javascript -->

    v |= 64 + (v > {}) + !++v

The expression `(v > {})` is only _true_ for `'\'` and `!++v` is _true_ for either `'/'` or `'\'`. If `v` is already an integer, it is left unchanged.

###Algorithm

Evaluating the area enclosed by slashes is equivalent to counting the number of cells from which we can't escape from the grid, starting from a given area ID. We arbitrary start from area #0, but that would work with any of them as long as it is consistent.

We iterate on all possible starting points and process some kind of flood-filling that takes the area IDs into account.

For each visited cell, we try to move to an adjacent cell (left figure) and  to another area within the same cell (right figure).

[![moves][2]][2]

The recursion stops either when we escape the grid or when we get trapped.


  [1]: https://i.sstatic.net/maPxf.png
  [2]: https://i.sstatic.net/jBPzj.png