# How can you get the area of a region from an image?

Suppose we have a square of side "L" m,

How can I calculate the hatched area, if the corners of the square are centers of circles.

It can be generalized to any region?

edit: This is the result I get, as I remove the "i" in response Rahul

ConditionalExpression[
1/64 l^2 (-16 Sqrt[7] + 5 Sqrt[2 (16 - 5 Sqrt[7])] + Sqrt[
14 (16 - 5 Sqrt[7])] - 5 Sqrt[2 (16 + 5 Sqrt[7])] + Sqrt[
14 (16 + 5 Sqrt[7])] + 32 ArcCot[Sqrt[7]] -
32 ArcSin[5/8 - Sqrt[7]/8] + 32 ArcSin[1/8 (5 + Sqrt[7])] +
64 I Log[I Sqrt[13 - Sqrt[7]] + Sqrt[3 + Sqrt[7]]] -
64 I Log[Sqrt[3 - Sqrt[7]] + I Sqrt[13 + Sqrt[7]]]), l > 0]

• Area[RegionIntersection[Disk[{l, 0}, l], Disk[{0, l}, l], Disk[{l/2, l/2}, l/2]]]
– user484
Jul 16 '15 at 1:59
• @Rahul Why not post that as an answer? Jul 16 '15 at 2:12
• Rahul Thank you, could you comment your code and modify something out imaginary parts Jul 16 '15 at 4:00
• @Mr.Wizard: Because I wasn't sure whether I was answering the intended question. Going by the title it's conceivable the OP wants to count the area of the shaded region in the actual raster image rather than in the geometric shape it depicts. Fernando: Can you clarify? Also, what do you mean by "modify something out imaginary parts"?
– user484
Jul 16 '15 at 4:24
• I need you to tell me the line of code you put further up the issue put the result gives me, this goes with "i" Jul 16 '15 at 17:42

To be honest, I was quite surprised that Mathematica finds an analytical solution when you just enter the problem in naively:

Area[RegionIntersection[Disk[{l, 0}, l], Disk[{0, l}, l], Disk[{l/2, l/2}, l/2]]]


On Mathematica 10.1 I don't get the expression with complex terms that Fernando got above, I get the purely real

ConditionalExpression[-(1/4)
l^2 (Sqrt[7] - 2 ArcCot[Sqrt[7]] +
4 ArcCot[3/Sqrt[31 + 8 Sqrt[7]]] - 4 ArcTan[4 + Sqrt[7]] -
4 ArcTan[1/8 (5 + Sqrt[7] - Sqrt[48 - 6 Sqrt[7]])] -
2 ArcTan[1/6 (-12 + 3 Sqrt[7] + Sqrt[31 + 8 Sqrt[7]])] +
2 ArcTan[1/48 (9 + 9 Sqrt[7] - Sqrt[1704 + 642 Sqrt[7]])]), l > 0]


However, one can fix Fernando's result by applying FullSimplify on it, giving the much nicer

ConditionalExpression[
1/4 l^2 (-Sqrt[7] + \[Pi] + ArcTan[(1541 Sqrt[7])/393]), l > 0]


i.e. $$\frac14 \left(\pi +\tan^{-1}\frac{1541 \sqrt{7}}{393}-\sqrt{7}\right)l^2.$$ The two expressions seem to be equal to machine precision, but I can't get Mathematica to verify that they are identical.