please can you help me with writing script for viewshed that evaluate a count of visible cells from every pixel? Or is there any plugin that can do it?
This is exactly what the Visibility index is. For further details see my reply to this post and my blog at this site, which describes the index and some of the complications for calculating it. The site also provides a link to the open-source software that can be used to perform the analysis. Importantly, since a cumulative viewshed area is an extremely computationally intensive thing to calculate, the algorithm uses several approaches to make it more feasible.
I would use ArcGIS for this, but the approach can be used in any GIS package which is capable of making a cumulative raster.
This is going to take a long time to run -- possibly days, depending on the size of your input raster. I suggest testing on a small subset area for, to make sure the results are what you want. But you don't need a script.
Convert the raster to a point feature.
Run Viewshed on the point feature, with the original raster as the elevation surface.
This produces a cumulative viewshed, instead of the traditional binary viewshed. Instead of a simple "visible/not visible" raster result, it is a count of how many of the input features are able to see a specific pixel. (Useful theoretical paper on the subject if you're interested.)
Typically, this is used with a small number of observation points -- so if 10 points are used as the input, the output raster has values from 0 to 10 depending on how many points can see a given cell. But we can assume intervisibility: if an observer can see a target point, then the target point can also see the observer point.
Therefore, if you use the entire raster as input observation points, the resulting cumulative raster tells you how many other cells each cell can see.