Hello!
Been working on some code for college today and at 6+ hours of nothing, I'm hoping some folks here could point me in the right directions. The class expects us to find everything about open CV online, so I have no course materials to use at all which is the source of my struggle.
I digress. The assignment is as follows: "Use OpenCV to create an 8-bit single-channel image of size 640x480 pixels. In this image, at random locations, place a square of size 100x100 pixels, a rectangle of size 200x160 pixels, and a circle of diameter 70 pixels. Your background should be black. For each object, the center pixel of the object will be black. Other pixels will be given a grayscale value as d where d is the distance of the pixel from the object center (maximized at 255). Make sure that you crop the objects at the borders. If two objects overlap, the object being drawn late takes precedence."
Creating the image and placing the shapes has been easy enough using the built in circle and rectangle functions. From here, however, I have trouble. I know that I need to utilize the central point and then change the value of the pixels around it within a certain range the get a gradient effect I need, though I'm not sure how to separate the shapes and actually do this. I have attempted some things with contours, though tutorials or examples seem to be somewhat slim on the web. The majority of my code is a frankenstein adaptation from the examples I did and is definately no where close to what I want. I assume this is a generally basic thing to do, but any starting point would be appreciated. Thanks!
(Here is the current status of my current work)