Ask Your Question

zchenkui's profile - activity

2015-12-29 20:13:46 -0600 received badge  Student (source)
2014-05-11 02:46:25 -0600 asked a question Drawing Lines At Crossover Points with OpenCV

Hello, everyone.

I am now making a program with OpenCV which should have these features: 1.Drawing lines on a white canvas;

2.The color of every line is grayscale, that is, I use CV_8UC1;

3.If a line being drawing is crossing over other lines, the grayscale at the crossover points is calculated as:

grayscaleResult = 0.5 * ( grayscaleOld + grayscaleNew)

where grayscaleOld is the color of lines which have been drawn on canvas and grayscaleNew is the color of line which has been drawing.

4.The thinness of lines may not be 1, sometimes > 1.

I want to know how to draw points at crossover points, and the most difficult for me is the thinness of lines is not the same.

Thank you very much!

2013-11-11 21:49:14 -0600 received badge  Editor (source)
2013-11-11 21:47:45 -0600 asked a question Why are the results of RNG same every time?

Hello. I have a problem about RNG class. I want to get different point randomly from a given image, so I use the RNG class which is recommanded in the OpenCV document. The code is:

struct SingleAnt
{
    int row;
    int col;
};
void initializeAnts( SingleAnt *ants, Mat *sourceImage )
{
    RNG rng( 0xFFFFFFFF );
    int imgWidth = sourceImage->cols;
    int imgHight = sourceImage->rows;

    for( int index = 0; index < ANTSNUMBER; index++ ) {
        ants[ index ].col = rng.uniform( 0, imgWidth );
        ants[ index ].row = rng.uniform( 0, imgHight );
    }
}

But whenever I run this code, I get the same result. Are there any mistakes in the code? Thanks!