Issue 1:
System information (version)

OpenCV => 4.1.1

Operating System / Platform => Ubuntu 18.04

Compiler => gcc

Detailed description

When I load the onnx model (converted from pytorch ) using cv::dnn::readNetFromONNX from memory buffer, it will get the "error: (-210:Unsupported format or combination of formats) Failed to parse onnx model from in-memory byte array. in function 'ONNXImporter'".

Steps to reproduce

```
ifstream modelStream("../model.onnx", ios::binary);

modelStream.seekg(0, ios_base::end);
int bufferSize = modelStream.tellg(); //getting file size
char* modelData = new char[bufferSize];

modelStream.seekg(0, ios::beg);
modelStream.read(modelData, bufferSize);

cv::dnn::Net model = cv::dnn::readNetFromONNX(modelData, bufferSize);

delete [] modelData;
```

But if I use cv::dnn::readNetFromONNX from file, it work fine:

cv::dnn::Net model = cv::dnn::readNetFromONNX("../model.onnx");

Issue 2:
System information (version)

OpenCV => 2

Operating System / Platform => Windows 10

Compiler => Python

Detailed description

I am looking to process a video stream from webcam. I am using opencv to capture and display the video. My goal is to segment the video display window into 3 rectangles with specified width and height. When an object is detected in the rectangle then it should output left center or right. I have managed to calculated the center coordinate of the object and drawn the rectangles on the video stream display window. Based on the coordinate where it falls in one of the rectangles, then the output will be left, center or right.

My question is how do i make the output when the coordinate falls within one of the box. I assumed using if center_coord in box then output but it does not work.>

Steps to reproduce

from darkflow.net.build import TFNet
import numpy as np
import time
from collections import namedtuple
options = {
'model': 'cfg/yolov2.cfg',
'load': 'bin/yolov2.weights',
'threshold': 0.8,
'gpu': 0.8
}

tfnet = TFNet(options)
colors = [tuple(255 * np.random.rand(3)) for _ in range(10)]

capture = cv2.VideoCapture(0, cv2.CAP_DSHOW)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
center_coord = namedtuple("center_coord", ['x', 'y'])

while True:
stime = time.time()
ret, frame = capture.read()
box = cv2.rectangle(frame, (1, 0), (426, 720), (0, 0, 255), 2)
box2 = cv2.rectangle(frame, (426, 0), (852, 720), (0, 0, 255), 2)
box3 = cv2.rectangle(frame, (852, 0), (1279, 720), (0, 0, 255), 2)
if ret:
results = tfnet.return_predict(frame)
for color, result in zip(colors, results):
tl = (result['topleft']['x'], result['topleft']['y'])
br = (result['bottomright']['x'], result['bottomright']['y'])
center_x = ((tl[0] + br[0])/2)
center_y = ((tl[1] + br[1])/2)
center_box = center_coord(center_x, center_y)
print(center_box)
label = result['label']
confidence = result['confidence']
text = '{}: {:.0f}%'.format(label, confidence * 100)
frame = cv2.rectangle(frame, tl, br, color, 5)
frame = cv2.putText(frame, text, tl, cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 0), 2)
cv2.imshow('frame', frame)
print('FPS {:.1f}'.format(1 / (time.time() - stime)))
if cv2.waitKey(1) & 0xFF == ord('q'):
break

capture.release()
cv2.destroyAllWindows()