Quantifying how perfectly square objects are in cellprofiler?


I am identifying objects on a pice of (10cm x 9cm) photographed graph paper to quantify the degree of distortion of the camera set up we are using.
Using “identifyPrimaryObjects”. I can easily identify 100s of what look like squares. However I would like to be able to determine how perfect the squares are (90° angles at the corners) versus being somewhat rhombus / parallelogram.
From “MeasureObjectSizeShape” or another module can you suggest what measurement might most easily capture this?
I have tried to using “MeasureObjectSizeShape” and “calculateMath” to generate the ratio of AreaShape_MaxFeretDiameter to AreaShape_MinFeretDiameter. However, while the squares really do look visually like squares I do not get a ratio of 1 (which is what I think a square should have). I get 1.3-1.4.
If anybody had better ideas I would love to try them.



I don’t know cell profiler, but I want to point out that min and max feret diameters on a perfect square would be the width or height vs the diagonal.

Out of curiosity, are the squares going to be aligned with the XY axes? As in, if you got the points that made one up, could you find the point with the max XY, min XY, maxXminY and such, to make a fake square? Or if the squares are of a set size, could you use the centroid of the object, create a square there, and then find the RMSD between your object’s vertices and the ideal square’s?

Just kinda throwing out ideas since I don’t know what is possible in CP :slight_smile: