# Calculate the area and perimeter of a hand-drawn shape

I need to know whether my idea for my final year project could be achieved or not. If its achievable please guide me with the relevant language and other frameworks.

The idea

I have a piece of paper (A4) on which I draw a circle. Once it is drawn I need to calculate the area and perimeter. In order to calculate the area and perimeter I move the mouse pointer on the image borders. Then the area and perimeter is calculated. Input of the image could be fed into the application via scanning or capturing as an image.

• Welcome to SciComp! When you say draw a circle I am guessing you don't mean a perfect circle but rather some closed curve (possibly peanut shaped for example)? I think this could be done, for example if it is fed into your application as a pixel image of black and white then you can just store your image as an array of 1's and 0's (say 1 for black and 0 for white). From there I think it wouldn't be too hard to find the approximate area via a Riemann-like sum of rectangles. – James Nov 19 '15 at 6:43
• Please don't cross-post: stackoverflow.com/q/33794887/491171 – Kirill Nov 19 '15 at 7:17
• It is not clear how the piece of paper is going to become an image: if you scan it things get better (still you have to cope with greyscale thresholds and so on); if you want to take a photo of the A4 sheet then you will neep perspective corretion, barrel correction, lighting balancing, ... – N74 Nov 19 '15 at 11:59

Once you have this you can just loop through the two dimensional array and find the approximate area by counting the number of white pixels inside the drawn object. Obviously in with an image with much finer detail the array becomes larger but I think the same idea will work. Even an image that is $1000\times{}1000$ pixels will still only contain 1 million entries and only a fraction of them would be ones. The perimeter is even easer as you simple have to count the number of black pixels.