Minimum Binding Quadrilateral

In an image processing project (using opencv with python), I am trying to detect as precisely as possible the location of a rectangular object in a photograph. My final goal is to output the 4 corners of the object.

For example, an image could look like this: Original image

In the first stage I am able to detect an approximate boundary for the image, like so: Initial Detection

Now, I have the above red convex polygon.

Next, I would like to compute the Minimum Area Bounding Quadrilateral, and this is where I’m stuck.

My question is, given a convex polygon, what is an efficient algorithm to find a minimum area bounding quadrilateral?


Calculate minimum and maximum Ethernet (IEEE 802.3) frame size from frame format

enter image description here

According the frame format of Ethernet

Minimum Frame Size should be : $ 7 Byte + 1Byte+6Bytes+6Bytse+2Bytes+46Bytes+4Bytes=72Bytes$

Maximum Frame Size should be : $ 7 Byte + 1Byte+6Bytes+6Bytse+2Bytes+1500Bytes+4Bytes=1526Bytes$

But it is said that the minimum frame size is $ 64Bytes$ while the maximum frame size is $ 1518 Bytes$ .

How the frame sizes are calculated ?

Minimum cost max flow network problem with an alternative flow cost

Is there a standard name or a reference for the network flow problem that looks very similar to the minimum cost maximum flow problem, only the flow cost that I wish to minimize isn’t sum of edge.flow * edge.weight over edges, but rather sum of [edge.flow > 0] * edge.weight over edges, where [edge.flow > 0] equals one if the flow is greater than zero, and zero otherwise? Is it infeasible, as I suspect?

I’ll tell you about the original problem that I believe reduces to this problem. A bunch of friends have a dinner, and agree to split the bill evenly. But not everyone has enough money to cover their share at that moment, so some pay more than their share, some less, with the intent to settle later. Later on, they want to settle with a minimum number of transactions, where one transaction is money changing hands between a pair of friends.

This clearly maps to a bipartite network with edges of unlimited capacity from all the ones who underpaid going to all of those who overpaid, and edges of capacity equal to the amount underpaid going from source to the underpaid nodes, and edges of capacity equal to the amount overpaid going from overpaid nodes to the sink. To minimize the number of transactions we need to minimize the number of nonzero flow edges between the under- and overpaid.

Finding minimum spanning tree with O(|V|)

Given an undirected weighted graph $ G(V,E)$ , where the number of edges is $ |V|+10$ , how can I find the minimum spanning tree of $ G$ in $ O(|V|)$ ?

Kruskal’s algorithm is out of the question, since sorting alone is $ O(|V|\log |V|)$ , so I thought maybe using Prim’s algorithm with minimum binary heap, but still – every iteration will cost $ \log |V|$ for updating vertices keys in the heap, so altogether it’s $ |V|\log |V|$ .
I know that the key here is to use the fact that $ |E|=|V|+10$ , so I start thinking maybe removing the 11 edges with the biggest weights, as long as the graph stays connected, but that’s obviously a bad idea since it’ll – again – require sorting.
I just can’t figure it out. Any help would be greatly appreciated.

Are edges in a minimum spanning tree not heavier than respective edges in another spanning tree?

Let $ G$ be an undirected connected weighted graph, and let $ T$ be a minimum spanning tree of $ G$ with edge weights: $ w_1 \le w_2 \le … \le w_{n-1}$ .

Now let $ T’$ be some other spanning tree of $ G$ (doesn’t have to be minimum) with edge weights: $ w’_1 \le w’_2 \le … \le w’_{n-1}$ .

I need to prove\disprove the following claim: for every $ i$ : $ w_i \le w’_i$ .

I’ve tried to find a counterexample, but I wasn’t successful. So I’m quite sure the claim is correct. However, I had trouble to prove it formally.

I assume the contrary, which means there is an $ i$ that satisfies $ w’_i < w_i$ and I take the first one that does. I tried adding it to the tree $ T$ or trying to find a minimum spanning tree with this edge using Kruskal, but no luck.