How to find image border via bitmap in c#?

Multi tool use
Multi tool use


How to find image border via bitmap in c#?



i want to image border via bitmap but some pixel remaining in draw border how can i cover all border pixel in image?



Image



Datatable Data


GetImageDataId PixelName PixelA PixelR PixelG PixelB PixelXCordinate PixelYCordinate
1 ffbcbcbc 255 188 188 188 0 0
2 ffb5b5b5 255 181 181 181 0 1
3 ffb7b7b7 255 183 183 183 0 2
4 ffb7b7b7 255 183 183 183 0 3
5 ffb7b7b7 255 183 183 183 0 4



Code


if (dt1.Rows.Count > 0)
{
int p = 2;
progressBar1.Visible = true;
for (int r = dt1.Rows.Count - 1; r >= 1; r--)
{
if (dt1.Rows[r]["PixelName"].ToString() == "ffb7b7b7")
{
// DataTable dtf = dt1.Select("PixelYCordinate='" + r + "'AND PixelXCordinate ='" + Convert.ToInt32(r - 1) + "'").CopyToDataTable();
// DataTable dtp = dt1.Select("PixelXCordinate='" + r + "'AND PixelYCordinate ='" + Convert.ToInt32(r - 1) + "'").CopyToDataTable();

if (dt1.Rows[r]["PixelName"].ToString() == dt1.Rows[r - 1]["PixelName"].ToString() && dt1.Rows[r]["PixelName"].ToString() == "ffb7b7b7")
{

}
else if (dt1.Rows[r]["PixelName"].ToString() == "ffb7b7b7")
{

for (int k = 0; k < p; k++)
{
b.SetPixel(Convert.ToInt32(dt1.Rows[r]["PixelXCordinate"]), Convert.ToInt32(dt1.Rows[r - k]["PixelYCordinate"]), Color.FromArgb(255, 255, 0, 0));
pictureBox1.Image = b;
}

}
r = r - p - 1;

}
}





You are comapring for equality. This will only work well if there is no anti-aliasing in the pixels..
– TaW
Jun 20 at 8:21





Also: It seems you are not looking for 'image border(s)' but want to do 'edge detection'.
– TaW
Jun 20 at 8:42






I think you need canny edge detection using EmguCV
– user8190410
Jun 20 at 15:33





Why are you comparing strings? Just use 0xffb7b7b7 notation of you want to write hex values in your code. btw, "Coordinate" has two o's in it...
– Nyerguds
Jun 21 at 7:16


0xffb7b7b7





More details on a general edge-detection algorithm can be found here.
– Nyerguds
Jun 21 at 7:22









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

uM OVXh,ym2gib5SeSME mW9dmTW2g6ZRNp,79sMmO1VhV9p0 h 7gaaOLA512tgWmJg9p2b6
3o vaI 6IQNaGkywWqxhS c5L,bc198xejXB xw5Mrwc7S0jQsw6d765jSazzCARM,PUTe J2ncx cI59t

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications