Below code is written in Opencv 3 c++.
class Ball {
public:
int x, y, dX, dY, radius, r, g, b, colorWeight;
clock_t ticksLast;
cv::Scalar color;
Ball() {
radius = ( rand() % (MAX_RADIUS - MIN_RADIUS)) + MIN_RADIUS;
x = rand() % (640 - 2 * radius) + radius;
y = rand() % (480 - 2 * radius) + radius;
dX = dY = 0;
colorWeight = rand() % 3;
r = (colorWeight==0) ? rand() % 105 + 140 : rand() % 50;
g = (colorWeight==1) ? rand() % 105 + 140 : rand() % 50;
b = (colorWeight==2) ? rand() % 105 + 140 : rand() % 50;
color = cv::Scalar(b,g,r);
ticksLast = clock();
}
};
Above code is generating the balls dynamically, but i need PNG images instead of balls.
Through which way i can get this result.
Thanks
Comments
Post a Comment