Blob Analysis Continued 12/09/2017

After talking to my mentor, I have decided to rethink some things. Before I even start, I needed to sit down and re-evaluate some goals and how my code is built, as well as how the chi-square will fit into it.

Right now I have an excellent blob to matrix function, splitting the blob into a 6×6 square.

Analyzing these now needs to happen using a simplified chi-squared metric.

My plan for tackling this is as follows:

Here is the plan stan

Program – Explained

For every blob in the image (except for blobs considered tiny!! Which is not yet implemented!!!) the program will go through and give them a “score” using a simplified version of the chi-squared statistic.

The program comes up with this score by comparing two graphs of a shape, and counting every pixel off in the 6*6 grid.  The score is then given as 1/((pixels off) + 1). Where 1/1 or 1 would be considered a “perfect” score. For every pixel off, the score goes down.yes you did do this

The program will test the blobs against the shapes presented to it, currently stored as enums as LINE, SQUARE, CIRCLE, and TRIANGLE.

square 100%

For example, when given a obviously perfect square, the program will rate it as follows:

square : 1.0

line: 0.0322

circle: 0.2

triangle: 0.0588

Where the closest shape this this shape is clearly a square, since it is a “perfect” fit for it.

The program is supposed to take the highest value out of these, and count the blob as a “square” because of it.

However, the problem I am running into is as follows:

The program is marking all of these as squares, potentially because they take up an odd amount of room or are otherwise imperfect. Similarly, when a piece of code is commented out for counting them as square, the program will still decide they are all circles. This is clearly not the case.

Obviously I need to address this problem. Similarly, to not lag the entire thing down, I need to make sure that the program will not do any of this on “tiny” blobs.

Bug Fixes and Perfecting the program

Thanks to my adviser, we now have a program that can fairly accurately identify squares, circles, and lines. However, it still struggles with triangles.

more functionality
Here, it correctly identifies three lines and three “circles”. However, it counts triangles, as squares, throwing off both counters.

As I have discovered, this is because I put the “expected” grid of the triangle in sideways. After an easy fix, it now counts 4 triangles, the arrow and three actual triangles.Working except on lines!

After some more testing I have figured out that it is labeling all the shapes mildly incorrectly. Here is an illustration below of the programs true functionality.

What it is doing

I theorize that to make this work better, it needs the old implementation of the definition of lines in place: where it count empty spaces, and more stringent definition of squares: where they have to have corners filled in, to obtain better functionality.

After playing with line analysis it now works much better, however, incorrectly identifying way to many object as squares is still a problem.

However, hopefully “twisting” shapes will allow them to fit into other categories of shapes without them being considered squares.

Rotating Shapes

Rotating shapes appears to be a struggle, as the shapes rotation appears imperfect at best.

Testing the implementation on a triangle yields the following results:

wrong outputs


Everyone is going home for the Winter Break and our college is closing the dorms etc. Since we have not met our goals before the end of the semester we will be working on a whatever-we-can basis over break.

Ultimately my goal is still to fix this analysis, and get a crude aesthetic metric done. I feel like I am incredibly close, and will continue this into next week.

The blog as such will update as usual, but a formal winter break notice will be added in the future when goals have been met and work ceases.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s