data / picture manipulation

I have black and white picture which looks something like that.


0000000
0111111
0011111
0001111
0000000

I am looking for a method such that i can frame the element 1.
I've spend a lot time trying to figure a smart way to do so, but all them seem too complex..

It has to end up looking like this
*******
*111111
**11111
0**1111
00*****
Last edited on
For every black pixel, add the surrounding pixels that are not black if they are not already added.

What have you tried?

Edit: You put this question on StackOverflow too?
Last edited on
How would you check around it, It seem stupid to have 10 if - statement checking wheather or not the surrounding pixel are black or white.
Topic archived. No new replies allowed.