开发者

Selecting points on image parts by color weight

There is a need for selecting specified number of points on the image (actually on the part of that image). Darker parts of the image are more important.

The easiest way of doing this is by selecting them randomly. But even dropping used points usually finished with some points being located too close to others especially when respecting weights.

Maybe after selecting the point the weight should be decreased dynamically? Haven't tried.

I've noticed that original image has too many different colors so I wanted to smooth it to cut off similar colors. However converting to grayscale was not enough.

I used Emgu CV (OpenCV wrapper) functions to binarize image. Than I tried to calculate watershed but calculated areas are not so easy to separate. Generally watershed is pretty 'non-intuitive' approach to det开发者_如何学编程ect darker places.

Simply: I would like to mark points on the image starting from darker parts - that parts should be marked more frequently than lighter. Points should be scattered over group of colors that are similar to avoid being piled-up in nearby places.

The algorithm doesn't have to be accurate. It can give different results in next iterations. Number of points would not be very big from 10 to 150-200.

How to calculate specified number of points scattered on the image starting from the darker regions?

To visualize what I mean see the picture below. It contains selected points (qty. ~20). Mostly darker parts are selected. The points don't have to appear on the same locations after next iteration. But what I want is to select points on lighter regions when number of them would be higher.

Of course for different images the numbers of points needed to jump out of darkness would differ.

Selecting points on image parts by color weight


If I understand your question correctly, you need a list of points on an image. The list must contain several points from the black regions and a few points from the white regions.

A simple approach - Iterate through each pixel. Store the value of the current pixel in a variable 's', then:

if(s < 64) // Darker
    if(rand() % 5 == 1)
        // Add to list
else      // White
    if(rand() % 25 == 1)
        // Add to list
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜