| |

VerySource

 Forgot password?
 Register
Search
View: 2752|Reply: 10

Find the edge of one of the colors in the 256-color BMP,

[Copy link]

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2021-3-9 17:00:02
| Show all posts |Read mode
As mentioned in the title, is there a good algorithm?
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2021-3-9 18:30:01
| Show all posts
Scan each pixel with that color on this picture. If the 8 neighboring pixels around this pixel have different colors, then mark this pixel as an edge pixel.
Reply

Use magic Report

0

Threads

30

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2021-3-9 18:45:01
| Show all posts
Right upstairs.
However, this tolerance range, lz can be customized.
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2021-3-9 19:00:01
| Show all posts
Just scan it
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2021-3-9 19:15:01
| Show all posts
Scan the pixels on the entire picture, if some pixels are the ones you want, take out the edges,
The boundary pixels do not necessarily have eight directions
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2021-3-9 20:00:01
| Show all posts
That is a preliminary method

1. I want to scan as few pixels as possible
2. I hope that after finding the edge pixels, use the pixels closest to the primary color pixels and the pixels with the shortest spacing between multiple points to form a circle

3. Use the fastest algorithm possible
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2021-3-9 20:15:02
| Show all posts
Can I use the involute circular scanning method instead of scanning the image, starting from the primary color pixels?
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2021-3-9 20:30:01
| Show all posts
You can first transform the image into a grayscale image (Y=1.0000R+4.5907G+0.0601B), and then obtain the edge gray value of the entire image (not the object), and then from the four sides of the image (assuming your image is a Standard rectangle) approach the center row by row to determine whether the gray value of the pixel in this row and the average gray value of the previous row or the previous row or the previous few columns is sufficient to judge the next row and the next column Is the edge, and then mark the pixels larger than this difference, and stop the approximation of this pixel to the center (but other unmarked pixels still have to approach the direction of the center, until a certain pixel in this direction is marked ), in this case, no matter whether the object has holes or not, the edges are still extracted.
In the above algorithmic ideas, approaching from the four sides to the center is a skill, the selection of the difference is a key, and marking the judged pixels and stopping the approximation is a skill.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Invalid IP Address

Post time: 2021-3-9 20:45:01
| Show all posts
I don't understand what the problem means, and I don't know what is wrong with the picture frame. . .
But converting the image into an array is definitely n times faster than the direct GetPixel
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-9 21:00:01
| Show all posts
Is it an algorithm like a magic wand? The seed filling algorithm is the same, whether it can be understood as a positive solution. If so, it will be very fast to convert the image to an array.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list