Line Analysis 12/02/2017

For the rest of the semester I will be working on blob analysis in a final push to get a preliminary aesthetic measure done by the end of the semester.

This will start with a different way of analyzing the blobs, in which we will try to see if the blobs are a line that doesn’t just consist of horizontal and vertical. I will be working to identify curved and diagonal lines.

Identification and Counting

Not working
Our blob checker currently identifies none of these as lines, which is a problem.

Now, the program should identify concave lines as lines as well as straight ones. For this I wrote a function to split the invisible box around all of our blobs into a 4×4 box, and check whether certain conditions apply.

A rough diagram is shown of this below, explaining how this can be used to find concavity without having the check every single pixel in a line.

Diagram logic

Roughly, this interprets the line as larger pixels, right now, we are splitting them into 4×4 boxes and trying to extrapolate data about their shapes, and quickly determine and see what exactly makes a line and line.

So far, my program interprets the following lines like so:


As is seen, these appear to be fairly accurate depictions of the lines. However, this is not completely satisfactory for two reasons:

  • In the second example, the program fails to find the empty spaces in the squiggle.
  • In the third example, the program fails to find the empty spaces in the corners of the circle

This may not seem to be an issue, however, here are two examples of similar shapes that will return the same output.

Shapes not line

So how do we determine which ones are shapes, and which ones are lines?

First, I will start by updating the program to be 6×6, this will be enough to find the corners of the circle as empty, and to find the empty space in the squiggle.

Observing these three different kind of lines sorted into 6×6 squares I observe the following:

  • The concave line has 14 True values and 22 False values
  • The circle line has 16 True values and 20 False values
  • The squiggle has 13 True values and 23 False values

I hypothesize that when

18 <= False <= 30

6 <= T <= 18

Then the blob should be considered a line. Implementing this on the first example, we can see that it correctly identifies the below simple lines.

Working ! Maybe

However, some instances are still not found. Namely, any lines that start to backtrack on themselves, loop around, or generally fill up space, the program will not identify. Below are some examples illustrating how lines can get more complex, and are no longer identifiable.

To help solve this issue, I will attempt to sort these lines into a percentage. Individual blobs will be labelled as having a percentage of a line.

What Percentage is a Blob a Line?

For this, we will be using what is called a chi-squared test. We already have a good idea of what are some acceptable values for a line, but from here we need to plug these values into a chi-squared test. Below is an outline of how I will run my first chi-squared test.

Chi-Squared Testing’

1) Null hypothesis : Blob b is a line

Alternative hypothesis : Blob b is not a line

2) Choose a level of significance

We know that our values for False should lay between 18 -> 30, and our values of true should be 6 -> 18. We can turn this into our level of significance.

3) Find the critical value and the degree of freedom

Our critical value is to be determined

Our degree of freedom will be 35, since there are 36 possible outcome in a 6×6 box if you do not consider the placement of our true/false values.

4) Find test statistic

The test statistic will be :

int X = (((observed value) – (expected value))^2) / (expected value)

Where, if we have multiple observed and expected value for something, we find X again for all of them and add them together.


5) Plot the value on a chi-squared graph, and figure out whether blob b is a line, or what percent it is away from the expected value.

On Monday, I will go over these precise steps with my mentor, look into how to code them in a more general case, discuss the right identification for what is a line, and also for what certain shapes are.

I should be looking into triangles, squares, and circle shaped objects in the future.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s