OpenCV bounding box and scale - c++

I must to put a bounding box on an object in a jpg file and scale it to a given width and length.
Is this possible?
How can I do it?

Related

changing bounding box color in object detection

Is there a way to make the bounding box color matches the detected object color.
Say I'm doing car detection using YOLO, and we want for the bounding box color to match the detected car, per say.
Thanks in advance.
I'm using YOLOv4.

How can I ignore small imperfections in, mostly rectangular, contour when creating it's bounding rectangle?

I am using this image as an example:
What I want, is to identify a bounding rectangle that's close to the original rectangle part, ignoring most of the imperfections outside of it.
What I get right now is this (contour and bounding rectangle created from that contour):
How can I, more or less, ignore that small area when creating my bounding rectangle, so that it's not included in it?
In other words: what I need is a bounding rectangle that's as close as possible to the original "rectangle part".

Opencv height/width of part of image

I've an image like this one ![enter image description here][1]. The non-black part is expanded at each iteration. So, after a certain point, I need to enlarge the final image so the non-black one can fit in. For now, what I'm doing is to find the contour of the non-black image,find the bounding box of the contours and check the width/height of the box. At a first time it works, but after some iterations my program finds a bounding box of size 1 (it seems that it doesn't find any contour). What the problem could be?
Ps: the program is a mosaic from a video file, I followed the opencv tutorial for find homography and other stuff.
EDIT
Sorry but I had to remove images
Just a suggestion:
It's easier to simply iterate through each element in the matrix and record the coordinates of the uppermost, bottommost, leftmost and rightmost non-zero elements. These will be the four corners of your up-right bounding rectangle. Of course it is not necessarily the rectangle of the minimum area enclosing the non-zero pixels (not a rotated rectangle), but further can be used as a ROI.

How to draw an AABB bounding box in simple c++/opengl?

I don't know how to draw a bounding box around my 3D object using visual C++/Opengl!
I have calculated min and max value of my obj, but now what do I do!?
Update to my above post:
Have figured out how to draw the Bounding box! How can I align it to the axes?
You have to generate a line-mesh (or whatever you want to display) for the bounding box. The vertices should be easy to find when you already have min and max value.

How to remove part of image containing text in opencv

What method can I use in opencv to remove the black section containing text at the bottom of the image?
Any help appreciated
if Blender's suggestion does not work in your case, you can:
Threshold the image so that all pixels higher than 0 will become 255.
Find contours.
Calculate a bounding rectangle for each contour.
Define the largest bounding rectangle as the region to be kept (the other ones are just the letters). You can then simply use the found rectangle as a ROI.
Good luck,