Can anyone please give me some ideas on how to optimize my code. Right now the whole sequence takes about 3 sec for a relative small image 400px x 300px.The code is like this:1. Edge Detection using Sobel2. Hit and Miss using 5x5 structure element (is it possible to do a hit and miss with a line element instead of a square element?)3. Dilation using a 17x17 circular element 4. Erosion using 25x25 circular element5. BlobCounter to extract the regions

I think steep 3 and 4 are the most time consuming because of the large structure elements used. So fell free to give me any tips.