Grouping bounding boxes and Separating them - PYTHON - python-3.x

So I have this output image of an arabic text, I want to group the small bounding boxes to the bigger ones, then I want to separate overlapping boxes
I have no clue how to start
This is an example of what I want to do

Related

Word Bounding Boxes of Azure OCR results are shifted to the left?

I am using the Azure OCR form recognizer to perform OCR. When I draw the line bounding boxes, it works great, but when I use the word bounding boxes, they are slightly shifted to the left.
For example, the line bounding boxes (ignore the red box) would look like this:lineocr
But when I draw the word bounding boxes from the same OCR results the result is shifted as follows:wordocr
Would anyone happen to know a solution for this problem, or maybe a nice workaround?
I have tried shifting the box by a certain percentage of the width of the bounding box but I would prefer to get the correct bounding box. The line bounding boxes have correct edges and I would expect the words to have them as well.

Rectangular connected component extraction in python

There are multiple rectangular areas in the 2d-numpy array. All the rectangular areas have value 1, other areas are zero. I want to extract a minimum number of rectangular connected components from the numpy array. These connected components can touch each other in any direction.
I tried extracting connected components using label function from scipy.ndimage.measurements but it assigns the same label to rectangles which touch each other.
I also tried, morphological opening but I do not want to lose the original shape of the rectangle.
The image shows the expected output for a better understanding of the problem.
Is there a better way to extract a minimum number of perfectly rectangular regions?

Bounding box for multiple SVG paths

I have some SVG paths which represent equations. There will be multiple on the canvas. I would like to pass all of these paths and get back grouped paths where each group represents a single equation.
Assumptions there is no overlap between the equations bounding boxes
After processing I should then be able to apply a bounding box to check the success the end result should be;
I already know how to apply a bounding box to a set of points. I am specifically struggling with how to determine which set of points or paths should go into a single group.
For example I would not want it to give me a bounding box for the "y", "=", "m" e.t.c separately that would be of little use.

Is it possible to replace the bar of the chart with png images and make them expand based on the value given?

I want to build a single stacked clustered column chart to simulate earth's substances with their respective image legend. (e.g. https://ibb.co/cqUvv9)
For example, I want from 0 meters to -10 to show sand, right beneath from -10 to -25 rock, etc. and expand their respective png images based on their values.
So far I managed to build the clustered column with matplotlib, I just want to know if there's a way of showing images instead of bars.

Box plot with labels and axes, fitted to a div with fixed dimensions

Following the provided example I built a function that draws a box plot to a jQuery accordion tab, which has a certain fixed height & width. The amount of distinct categories varies greatly depending on the incoming data. Currently I'd like to achieve the following in the plotting:
1) Add axes and display labels, like in this picture
2) Always fit the boxes to container width and height. Currently I see that if there are too many categories, some of them end on the second row, ensuring they're not fully seen. In the picture, the div contains 7 boxes but only 4 fit on one row:
The question is how can these two be implemented? I couldn't even figure out a way to reliably reduce the padding between the boxes without eating into the side numbers on the boxes.
I adopted the original d3.js example to include axes:
http://bl.ocks.org/jensgrubert/7789216
Instead of using individual svg elements as in Mike's implementation, here all boxplots are rendered with in one root element. This makes it easy to add axes.
Best,
Jens
For the time being I'm using a hack found at Highcharts forum (jsfiddle here). There's also a box plot implementation made with Raphael.js that looks cool (github, example)

Resources