2009-04-10 20:32:16 PAYNE Интересует задача векторизации кривых. Конкретно: Есть изображение с кривыми, которые получены из вертикальных прямых. Да, тупо сказано, но не знаю как объяснить точнее >< Как бы похожие на букву "S", или ")", или повёрнутая на 90 градусов тильда. Нужно: 1) Привести их к единичной толщине. С этим, вроде, разобрался. 2) Разделить их. Т.е. каким-то образом индексировать. Тут проблемы =( Нашёл какой-то алгоритм, но не совсем вкурил что-то <_< Прошу помочь разбраться или подсказать что-то более простое/подходяще/уже реализованное. Вот тот алгоритм: ASSIGNING IDs TO STRIPS 1. Algorithm description: The basic idea is to let the pixels to vote which ID they prefer, instead of assign ID to pixel arbitrarily. We group all the white pixels in the same strips segment. The white pixels in the same group shall be assigned a same ID. During the voting, each pixel pick two candidate IDs, one of candidate IDs is decided from its left neighbor pixel and the other comes from its right neighbor pixel. The stripe segment will pick the ID which most of pixels voted for. After the ID is elected, each pixel will propagate their ID information to their left and right neighbor pixels. To propagate ID to neighbors is to help neighbor stripes to decide ID when they are going to vote. From the image result, we will see that voting algorithm produce really good result. It is able to locate almost all the strips on the face, and assign the ID correctly. 2. Pseudo code of the Pixel ID Voting algorithm Definition of some term Dot: the block position that have already assigned a ID from previous part Pixel, White pixel: pixel on the stripe needed to assign an ID Neighbor, Neighbor pixel: The neighbor pixel of a pixel (x, y) is the white pixel that is on the left or right stripe with same x value. Input: dot(x, y, id), and the graph with Output: almost all the white pixels in graph with (x, y, id) Important Data element and their structure There is a Queue to store all pixel need to process. When the program assigns ID to a white pixel, the white pixel will also try to find its left and right neighbor pixel and store them into the Queue for processing later. The data structure storing each white pixel consists four parts, its postion on the image, its ID, its left neighbor’s ID, and its right neighbor’s ID. Giving each pixel its neighbor’s ID information can help it to vote a perfered ID for itself. Pseudo code of the voting algorithm Read all dot(x, y, id) and put all the dots into the Queue While (Queue is not Empty) { Get an element from the Queue If (this element is a dot) { 1. Move up from this dot’s position to find all the white pixels which are belong to the same stripe of the dot For each pixel found a. Assign the pixel with same ID of the dot b. Find pixel’s left and right neighbor pixels and assign them reference IDs (not real id) - 5 - c. Stored its left and right neighbor into the queue 2. Move down from this dot’s position to find all the white pixels which are belong to the same stripe of the dot For each pixel found a. Assign the pixel with same ID of the dot b. Find pixel’s left and right neighbor pixels and assign them reference IDs (not real id) c. Stored its left and right neighbor into the queue } else if (this element is a pixel and this pixel has never been assigned ID yet) { 1. Move up from this pixel’s position to locate all the pixels in the same stripe. And also collect each pixel’s vote 2. Move down from this pixel’s position to locate all the pixels in the same stripe. And also collect each pixel’s vote 3. Check all the votes, and select a ID that most of pixel prefer 4. Move up and down to visit the stripe again. For each pixel: a. Assign the elected ID to the pixel b. Find pixel’s left and right neighbor pixels and assign them reference IDs (not real id) c. Stored its left and right neighbor into the queue } } Do an extensive search to find any remaining white pixel which has not been assigned ID yet. 1. Group the remaining white pixel in same stripe 2. For each pixel vote for ID based finding its closed left and right neighbor’s IDs and the ID distance from its neighbors 3. Collect the vote and assign the ID to the remaining stripes. | ||
2009-04-10 21:31:40 PAYNE | ||
2009-04-10 21:33:10 Vladislav
https://cs1679.vkontakte.ru/u9709722/53072780/x_384c889d.jpg | ||
2009-04-10 23:13:55 Yunis Vladislav а шо он на столе у тебя делает? О.о | ||
2009-04-10 23:30:22 svert PAYNE Антикапча? | ||
2009-04-11 20:12:26 PAYNE svert Капчи анализом картинки взламывать дело неблагодарное. Задача не в сравнении и/или распознавании изображения, а в его векторизации. | ||
2009-04-11 20:14:05 PAYNE Vladislav А ещё можно смеяться над "член партии" и строчкой из Евгения Онегина, где "кончаю" написано. | ||