I am right now dealing with some image processing in Python via PIL (Python Image Library). My main aim is counting the number of colored cells in an immunohistochemistry image. I know that there are relevant programs, libraries, functions and tutorials about it, and I checked almost all of them. My major aim is writing the code manually from scratch, as much as possible. Hence I am trying to avoid using lots of exterior libraries and functions. I have written the most of the program. So here is what's going on step by step:
Program takes in the image file:
And processes it for the red cells (basically, it turns off the RGB values below a certain threshold for red):
And creates the boolean map of it, (gonna paste a part of it since it is big) which basically just puts 1 wherever it encounters with a red pixel in the processed second image above.
22222222222222222222222222222222222222222 20000000111111110000000000000000000000002 20000000111111110000000000000000000000002 20000000111111110000000000000000000000002 20000000011111100000000000000000001100002 20000000001111100000000000000000011111002 20000000000110000000000000000000011111002 20000000000000000000000000000000111111002 20000000000000000000000000000000111111102 20000000000000000000000000000001111111102 20000000000000000000000000000001111111102 20000000000000000000000000000000111111002 20000000000000000000000000000000010000002 20000000000000000000000000000000000000002 22222222222222222222222222222222222222222
I intentionally generated that frame like thing on the borders with 2s to help me with counting the number of groups of 1s in that boolean map.
My question to you guys is, how come I can efficiently count the number of cells (groups of 1s) in that kind of boolean map? I have found http://en.wikipedia.org/wiki/Connected-component_labeling which look extremely related and similar, but as far as I see, it is at the pixel level. Mine is at the boolean level. Just 1s and 0s.
Thanks a lot.