So far I have been able to extract only green channel (step 2) from the following algorithm. I tried to use extract largest blob with AForge.NET and it dint give me an rectangle.

How can I achieve this ?

Image

Original: i.stack.imgur.com/BGbTa.jpg

What I would like to get:

Algorithm

- 1. Import original image.

2. Extract channel Green from the RGB image.

3.Crop the image based on uniform background color and give the smallest rectangular fit of the slit.

4. Rotate the image with a certain angle.

5. Reflect the rotated image.

6. Multiply Rotated image and reflection of rotated image.

7. Get the Total of all the pixel values from the previous step.

8. Repeat steps 4,5,6,7 for a range of angles [-0.01 to 0.01] degrees.

9. Tabulate all the Total pixel values corresponding to their rotation angles and find the angle which provides the max Total value.

10. Rotate image from step 3 with the angle value found from step 9.

11. Binarize the image and Plot a graph based on the intensity variation along the length (every column).

12. Calculate the standard deviation and mean based on image in step 10.