<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.4.1 pre-built release</li>
<li>Tensorflow =&gt; 1.8.0 latest master</li>
<li>Operating System / Platform =&gt; Windows 10 64bit</li>
<li>Compiler =&gt; Visual Studio 2015</li>
</ul>
<p dir="auto">I have retrained an image classifier based on TFHub Mobilenet V2, using the following command:</p>
<p dir="auto"><code class="notranslate">retrain.py --image_dir .\data --output_graph output.pb --output_labels labels.txt --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/1 --saved_model_dir .\export</code></p>
<p dir="auto">The resulting output.pb works fine with TF label image:</p>
<p dir="auto"><code class="notranslate">tensorflow\examples\label_image\label_image.py --graph=.\output.pb --labels=.\labels.txt --input_layer=Placeholder --output_layer=final_result --input_height=224 --input_width=224 --image=.\111.jpg</code></p>
<p dir="auto">But when using OpenCV DNN module, it crashes at the following line:</p>
<p dir="auto"><code class="notranslate">dnn::Net net = readNetFromTensorflow(modelFile);</code></p>
<p dir="auto">with error message:</p>
<p dir="auto"><code class="notranslate">OpenCV(3.4.1) Error: Unspecified error (Unknown layer type Sub in op module_apply_default/hub_input/Sub) in cv::dnn::experimental_dnn_v4::'anonymous-namespace'::TFImporter::populateNet, file C:\build\master_winpack-build-win64-vc14\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 1582</code></p>
<p dir="auto">Running optimize_for_inference.py and transform_graph does not help.</p>
<p dir="auto">After some inspecting with tensorboard graph, it seems that one hub_input block caused this problem.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/13673628/40423491-54cb0eaa-5ec5-11e8-8053-037d32c0a8d4.png"><img src="https://user-images.githubusercontent.com/13673628/40423491-54cb0eaa-5ec5-11e8-8053-037d32c0a8d4.png" alt="hub_input" style="max-width: 100%;"></a></p>
<p dir="auto">Looks like TF Hub models have this block between Placeholder(input node) and the MobilenetV2 block, and the Sub operation is not supported by DNN.</p>
<p dir="auto">Am I missing something here?</p>

<p dir="auto">Here is my retrained model, load it with readNetFromTensorflow() to reproduce the problem<br>
<a href="https://github.com/opencv/opencv/files/2030954/output.zip">output.zip</a></p>
<p dir="auto">Any help is appreciated!</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.1</li>
<li>Operating System / Platform =&gt; OS X 10.13.6</li>
<li>Compiler =&gt; clang</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I installed opencv using homebrew and it installed fine. I edited the rb file to include ffmpeg, which was the <a href="https://github.com/opencv/opencv/issues/7474#issuecomment-281799812" data-hovercard-type="issue" data-hovercard-url="/opencv/opencv/issues/7474/hovercard">solution to this issue in ocv 3.1</a>. I was unable to install with the <code class="notranslate">--with-ffmpeg</code> flag for ver 4.1. My code works on Ubuntu 18.04 but not OS X. This is the error I get:</p>
<details>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="2019-04-22 17:40:46.985 Python[29225:130069098] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
2019-04-22 17:40:46.993 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2019-04-22 17:40:47.135 Python[29225:130069179] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff5779623b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff7ea28c76 objc_exception_throw + 48
	2   AppKit                              0x00007fff55441297 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4167
	3   libopencv_highgui.4.1.dylib         0x000000013088fb8e cvWaitKey + 352
	4   libopencv_highgui.4.1.dylib         0x000000013088b598 _ZN2cv9waitKeyExEi + 34
	5   libopencv_highgui.4.1.dylib         0x000000013088b600 _ZN2cv7waitKeyEi + 34
	6   cv2.so                              0x000000012eb96d9d _ZL19pyopencv_cv_waitKeyP7_objectS0_S0_ + 99
	7   Python                              0x0000000107938e32 PyEval_EvalFrameEx + 19200
	8   Python                              0x0000000107934118 PyEval_EvalCodeEx + 1540
	9   Python                              0x00000001078da838 function_call + 327
	10  Python                              0x00000001078bcc19 PyObject_Call + 97
	11  Python                              0x00000001079396f3 PyEval_EvalFrameEx + 21441
	12  Python                              0x000000010793d121 fast_function + 190
	13  Python                              0x0000000107938d1c PyEval_EvalFrameEx + 18922
	14  Python                              0x000000010793d121 fast_function + 190
	15  Python                              0x0000000107938d1c PyEval_EvalFrameEx + 18922
	16  Python                              0x0000000107934118 PyEval_EvalCodeEx + 1540
	17  Python                              0x00000001078da838 function_call + 327
	18  Python                              0x00000001078bcc19 PyObject_Call + 97
	19  Python                              0x00000001078c751b instancemethod_call + 163
	20  Python                              0x00000001078bcc19 PyObject_Call + 97
	21  Python                              0x000000010793cab4 PyEval_CallObjectWithKeywords + 159
	22  Python                              0x0000000107968db4 t_bootstrap + 70
	23  Python                              0x0000000107964a70 pythread_wrapper + 25
	24  libsystem_pthread.dylib             0x00007fff7f95a661 _pthread_body + 340
	25  libsystem_pthread.dylib             0x00007fff7f95a50d _pthread_body + 0
	26  libsystem_pthread.dylib             0x00007fff7f959bf9 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
"><pre class="notranslate">2019-04-22 17:40:46.985 Python[29225:130069098] <span class="pl-k">!!!</span> BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called <span class="pl-k">for</span> the first <span class="pl-k">time</span> off the main thread.
2019-04-22 17:40:46.993 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.004 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.006 Python[29225:130069098] pid(29225)/euid(504) is calling TIS/TSM <span class="pl-k">in</span> non-main thread environment, ERROR <span class="pl-c1">:</span> This is NOT allowed. Please call TIS/TSM <span class="pl-k">in</span> main thread<span class="pl-k">!!!</span>
2019-04-22 17:40:47.135 Python[29225:130069179] <span class="pl-k">***</span> Terminating app due to uncaught exception <span class="pl-s"><span class="pl-pds">'</span>NSInternalInconsistencyException<span class="pl-pds">'</span></span>, reason: <span class="pl-s"><span class="pl-pds">'</span>nextEventMatchingMask should only be called from the Main Thread!<span class="pl-pds">'</span></span>
<span class="pl-k">***</span> First throw call stack:
(
	0   CoreFoundation                      0x00007fff5779623b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff7ea28c76 objc_exception_throw + 48
	2   AppKit                              0x00007fff55441297 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4167
	3   libopencv_highgui.4.1.dylib         0x000000013088fb8e cvWaitKey + 352
	4   libopencv_highgui.4.1.dylib         0x000000013088b598 _ZN2cv9waitKeyExEi + 34
	5   libopencv_highgui.4.1.dylib         0x000000013088b600 _ZN2cv7waitKeyEi + 34
	6   cv2.so                              0x000000012eb96d9d _ZL19pyopencv_cv_waitKeyP7_objectS0_S0_ + 99
	7   Python                              0x0000000107938e32 PyEval_EvalFrameEx + 19200
	8   Python                              0x0000000107934118 PyEval_EvalCodeEx + 1540
	9   Python                              0x00000001078da838 function_call + 327
	10  Python                              0x00000001078bcc19 PyObject_Call + 97
	11  Python                              0x00000001079396f3 PyEval_EvalFrameEx + 21441
	12  Python                              0x000000010793d121 fast_function + 190
	13  Python                              0x0000000107938d1c PyEval_EvalFrameEx + 18922
	14  Python                              0x000000010793d121 fast_function + 190
	15  Python                              0x0000000107938d1c PyEval_EvalFrameEx + 18922
	16  Python                              0x0000000107934118 PyEval_EvalCodeEx + 1540
	17  Python                              0x00000001078da838 function_call + 327
	18  Python                              0x00000001078bcc19 PyObject_Call + 97
	19  Python                              0x00000001078c751b instancemethod_call + 163
	20  Python                              0x00000001078bcc19 PyObject_Call + 97
	21  Python                              0x000000010793cab4 PyEval_CallObjectWithKeywords + 159
	22  Python                              0x0000000107968db4 t_bootstrap + 70
	23  Python                              0x0000000107964a70 pythread_wrapper + 25
	24  libsystem_pthread.dylib             0x00007fff7f95a661 _pthread_body + 340
	25  libsystem_pthread.dylib             0x00007fff7f95a50d _pthread_body + 0
	26  libsystem_pthread.dylib             0x00007fff7f959bf9 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of <span class="pl-c1">type</span> NSException
Abort trap: 6
</pre></div>
</details>
<h5 dir="auto">Steps to reproduce</h5>
<details>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
import sys, cv2, time,cmapy
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

from threading import Thread, RLock
from Queue import Queue
import imutils
from cv2 import *

ip = '192.168.122.1'

class VideoGet:
	def __init__(self,url):
		self.stream=cv2.VideoCapture(url)
		self.stream.set(cv2.CAP_PROP_BUFFERSIZE, 0)
		(self.grabbed,self.frame)=self.stream.read()
		self.frame = self.frame[:,:,0]
		#self.frame = cv2.resize(self.frame, (1920,1080))
		self.stopped = False
	def start(self):    
		Thread(target=self.get, args=()).start()
		return self
	def get(self):
		while not self.stopped:
			if not self.grabbed:
				self.stop()
			else:
				(self.grabbed, self.frame) = self.stream.read()
				self.frame = self.frame[:,:,0]
	def stop(self):
		self.stopped = True


class VideoGetAll:
	def __init__(self,url1,url2,url3,url4,url5,url6,url7):
		self.cap1=cv2.VideoCapture(url1)
		(self.grabbed1,self.frame1)=self.stream1.read()
		self.cap2=cv2.VideoCapture(url2)
		(self.grabbed2,self.frame2)=self.stream2.read()
		self.cap3=cv2.VideoCapture(url3)
		(self.grabbed3,self.frame3)=self.stream3.read()
		self.cap4=cv2.VideoCapture(url4)
		(self.grabbed4,self.frame4)=self.stream4.read()
		self.cap5=cv2.VideoCapture(url5)
		(self.grabbed5,self.frame5)=self.stream5.read()
		self.cap6=cv2.VideoCapture(url6)
		(self.grabbed6,self.frame6)=self.stream6.read()
		self.cap7=cv2.VideoCapture(url7)
		(self.grabbed7,self.frame7)=self.stream7.read()
		self.grabbed = self.grabbed1&amp;self.grabbed2&amp;self.grabbed3&amp;self.grabbed4&amp;self.grabbed5&amp;self.grabbed6&amp;self.grabbed7
		self.frame = concat(self.frame1[0:1080,:],self.frame2[0:1080,:],self.frame3[0:1080,:],self.frame4[0:1080,:],self.frame5[0:1080,:],self.frame6[0:1080,:])
        #self.frame = cv2.resize(self.frame, (1920,1080))
		self.stopped = False
	def start(self):    
		Thread(target=self.get, args=()).start()
		return self
	def get(self):
		while not self.stopped:
			if not self.grabbed:
				self.stop()
			else:
				(self.grabbed1, self.frame1) = self.stream1.read()
				(self.grabbed2, self.frame2) = self.stream2.read()
				(self.grabbed3, self.frame3) = self.stream3.read()
				(self.grabbed4, self.frame4) = self.stream4.read()
				(self.grabbed5, self.frame5) = self.stream5.read()
				(self.grabbed6, self.frame6) = self.stream6.read()
				(self.grabbed7, self.frame7) = self.stream7.read()
				self.frame0 = concat(self.frame1[0:1080,:],self.frame2[0:1080,:],self.frame3[0:1080,:],self.frame4[0:1080,:],self.frame5[0:1080,:],self.frame5[0:1080,:],self.frame6[0:1080,:])
				self.frame = cv2.resize(self.frame0, (1280,720))
	def stop(self):
		self.stopped = True

class VideoShow:
	def __init__(self, frame1=None,frame2=None,frame3=None):
		self.frame1 = frame1
		self.frame2 = frame2
		self.frame3 = frame3
		self.stopped = False
		self.xoff1 = 0
		self.yoff1 = 0
		self.angle1 = 0
		self.xoff2 = 0
		self.yoff2 = 0
		self.angle2 = 0
		self.rchan = 5
		self.gchan = 4
		self.bchan = 3
	def start(self):
		Thread(target=self.show, args=()).start()
		return self
	def show(self):
		cv2.namedWindow('Frame',cv2.WINDOW_NORMAL)
		cv2.resizeWindow('Frame',1280,720)
		cv2.namedWindow(&quot;Transform&quot;)
		cv2.createTrackbar(&quot;X1&quot;,&quot;Transform&quot;,91,300,nothing)
		cv2.createTrackbar(&quot;Y1&quot;,&quot;Transform&quot;,-85,300,nothing)
		cv2.createTrackbar(&quot;Angle1&quot;,&quot;Transform&quot;,0,180,nothing)
		cv2.setTrackbarMin(&quot;X1&quot;,&quot;Transform&quot;,-300)
		cv2.setTrackbarMin(&quot;Y1&quot;,&quot;Transform&quot;,-300)
		cv2.setTrackbarMin(&quot;Angle1&quot;,&quot;Transform&quot;,-180)
		cv2.createTrackbar(&quot;X2&quot;,&quot;Transform&quot;,-87,300,nothing)
		cv2.createTrackbar(&quot;Y2&quot;,&quot;Transform&quot;,-1,300,nothing)
		cv2.createTrackbar(&quot;Angle2&quot;,&quot;Transform&quot;,-2,180,nothing)
		cv2.setTrackbarMin(&quot;X2&quot;,&quot;Transform&quot;,-300)
		cv2.setTrackbarMin(&quot;Y2&quot;,&quot;Transform&quot;,-300)
		cv2.setTrackbarMin(&quot;Angle2&quot;,&quot;Transform&quot;,-180)
		cv2.createTrackbar('Red',&quot;Transform&quot;,5,5,nothing)
		cv2.createTrackbar('Green',&quot;Transform&quot;,4,5,nothing)
		cv2.createTrackbar('Blue',&quot;Transform&quot;,3,5,nothing)
		while not self.stopped:
			cv2.imshow('Frame', cv2.merge((self.frame1,self.frame2,self.frame3)))
			self.xoff1 = cv2.getTrackbarPos(&quot;X1&quot;,&quot;Transform&quot;)
			self.yoff1 = cv2.getTrackbarPos(&quot;Y1&quot;,&quot;Transform&quot;)
			self.angle1 = cv2.getTrackbarPos(&quot;Angle1&quot;,&quot;Transform&quot;)
			self.xoff2 = cv2.getTrackbarPos(&quot;X2&quot;,&quot;Transform&quot;)
			self.yoff2 = cv2.getTrackbarPos(&quot;Y2&quot;,&quot;Transform&quot;)
			self.angle2 = cv2.getTrackbarPos(&quot;Angle2&quot;,&quot;Transform&quot;)
			self.rchan = cv2.getTrackbarPos(&quot;Red&quot;,&quot;Transform&quot;)
			self.gchan = cv2.getTrackbarPos(&quot;Green&quot;,&quot;Transform&quot;)
			self.bchan = cv2.getTrackbarPos(&quot;Blue&quot;,&quot;Transform&quot;)
			if cv2.waitKey(1) == 27:
				self.stopped = True
	def stop(self):
		self.stopped = True
		cv2.destroyAllWindows()
		
def concat(f1,f2,f3,f4,f5,f6):
	return np.concatenate((np.concatenate((f1,f2,f3),axis=1),np.concatenate((f4,f5,f6),axis=1)),axis=0)

def shift(img,x,y,theta):
	return imutils.rotate(cv2.warpAffine(img,np.float32([[1,0,x],[0,1,y]]), (640, 512)),theta)


get1 = VideoGet('http://'+ip+':8081/?action=stream').start()
get2 = VideoGet('http://'+ip+':8082/?action=stream').start()
get3 = VideoGet('http://'+ip+':8083/?action=stream').start()
get4 = VideoGet('http://'+ip+':8084/?action=stream').start()
get5 = VideoGet('http://'+ip+':8080/?action=stream').start()
get6 = VideoGet('http://'+ip+':8085/?action=stream').start()
get7 = VideoGet('http://'+ip+':8086/?action=stream').start()

show = VideoShow(cv2.merge((get3.frame,get4.frame, get5.frame))).start()

while True:
	if show.stopped:
		show.stop()
		get1.stop()
		get2.stop()
		get3.stop()
		get4.stop()
		get5.stop()
		get6.stop()
		get7.stop()
		break
	if show.rchan&gt;=0 and show.rchan&lt;1:
		show.frame3=shift(get1.frame,show.xoff2,show.yoff2,show.angle2)
	elif show.rchan&gt;=1 and show.rchan&lt;2:
		show.frame3=shift(get2.frame,show.xoff2,show.yoff2,show.angle2)
	elif show.rchan&gt;=2 and show.rchan&lt;3:
		show.frame3=shift(get3.frame,show.xoff2,show.yoff2,show.angle2)
	elif show.rchan&gt;=3 and show.rchan&lt;4:
		show.frame3=shift(get4.frame,show.xoff2,show.yoff2,show.angle2)
	elif show.rchan&gt;=4 and show.rchan&lt;5:
		show.frame3=shift(get5.frame,show.xoff2,show.yoff2,show.angle2)
	elif show.rchan&gt;=5 and show.rchan&lt;=6:
		show.frame3=shift(get6.frame,show.xoff2,show.yoff2,show.angle2)
	if show.gchan&gt;=0 and show.gchan&lt;1:
		show.frame2=shift(get1.frame,show.xoff1,show.yoff1,show.angle1)
	elif show.gchan&gt;=1 and show.gchan&lt;2:
		show.frame2=shift(get2.frame,show.xoff1,show.yoff1,show.angle1)
	elif show.gchan&gt;=2 and show.gchan&lt;3:
		show.frame2=shift(get3.frame,show.xoff1,show.yoff1,show.angle1)
	elif show.gchan&gt;=3 and show.gchan&lt;4:
		show.frame2=shift(get4.frame,show.xoff1,show.yoff1,show.angle1)
	elif show.gchan&gt;=4 and show.gchan&lt;5:
		show.frame2=shift(get5.frame,show.xoff1,show.yoff1,show.angle1)
	elif show.gchan&gt;=5 and show.gchan&lt;=6:
		show.frame2=shift(get6.frame,show.xoff1,show.yoff1,show.angle1)
	if show.bchan&gt;=0 and show.bchan&lt;1:
		show.frame1=get1.frame
	elif show.bchan&gt;=1 and show.bchan&lt;2:
		show.frame1=get2.frame
	elif show.bchan&gt;=2 and show.bchan&lt;3:
		show.frame1=get3.frame
	elif show.bchan&gt;=3 and show.bchan&lt;4:
		show.frame1=get4.frame
	elif show.bchan&gt;=4 and show.bchan&lt;5:
		show.frame1=get5.frame
	elif show.bchan&gt;=5 and show.bchan&lt;=6:
		show.frame1=get6.frame

	if cv2.waitKey(1) == 27:
		break"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">sys</span>, <span class="pl-s1">cv2</span>, <span class="pl-s1">time</span>,<span class="pl-s1">cmapy</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-s1">matplotlib</span>.<span class="pl-en">use</span>(<span class="pl-s">'TkAgg'</span>)
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-k">from</span> <span class="pl-s1">threading</span> <span class="pl-k">import</span> <span class="pl-v">Thread</span>, <span class="pl-v">RLock</span>
<span class="pl-k">from</span> <span class="pl-v">Queue</span> <span class="pl-k">import</span> <span class="pl-v">Queue</span>
<span class="pl-k">import</span> <span class="pl-s1">imutils</span>
<span class="pl-k">from</span> <span class="pl-s1">cv2</span> <span class="pl-k">import</span> <span class="pl-c1">*</span>

<span class="pl-s1">ip</span> <span class="pl-c1">=</span> <span class="pl-s">'192.168.122.1'</span>

<span class="pl-k">class</span> <span class="pl-v">VideoGet</span>:
	<span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>,<span class="pl-s1">url</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">stream</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url</span>)
		<span class="pl-s1">self</span>.<span class="pl-s1">stream</span>.<span class="pl-en">set</span>(<span class="pl-s1">cv2</span>.<span class="pl-v">CAP_PROP_BUFFERSIZE</span>, <span class="pl-c1">0</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">frame</span>[:,:,<span class="pl-c1">0</span>]
		<span class="pl-c">#self.frame = cv2.resize(self.frame, (1920,1080))</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>
	<span class="pl-k">def</span> <span class="pl-en">start</span>(<span class="pl-s1">self</span>):    
		<span class="pl-v">Thread</span>(<span class="pl-s1">target</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">get</span>, <span class="pl-s1">args</span><span class="pl-c1">=</span>()).<span class="pl-en">start</span>()
		<span class="pl-k">return</span> <span class="pl-s1">self</span>
	<span class="pl-k">def</span> <span class="pl-en">get</span>(<span class="pl-s1">self</span>):
		<span class="pl-k">while</span> <span class="pl-c1">not</span> <span class="pl-s1">self</span>.<span class="pl-s1">stopped</span>:
			<span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">self</span>.<span class="pl-s1">grabbed</span>:
				<span class="pl-s1">self</span>.<span class="pl-en">stop</span>()
			<span class="pl-k">else</span>:
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream</span>.<span class="pl-en">read</span>()
				<span class="pl-s1">self</span>.<span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">frame</span>[:,:,<span class="pl-c1">0</span>]
	<span class="pl-k">def</span> <span class="pl-en">stop</span>(<span class="pl-s1">self</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>


<span class="pl-k">class</span> <span class="pl-v">VideoGetAll</span>:
	<span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>,<span class="pl-s1">url1</span>,<span class="pl-s1">url2</span>,<span class="pl-s1">url3</span>,<span class="pl-s1">url4</span>,<span class="pl-s1">url5</span>,<span class="pl-s1">url6</span>,<span class="pl-s1">url7</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">cap1</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url1</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed1</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame1</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream1</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap2</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url2</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed2</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame2</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream2</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap3</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url3</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed3</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame3</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream3</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap4</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url4</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed4</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame4</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream4</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap5</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url5</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed5</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame5</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream5</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap6</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url6</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed6</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame6</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream6</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">cap7</span><span class="pl-c1">=</span><span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-s1">url7</span>)
		(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed7</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame7</span>)<span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">stream7</span>.<span class="pl-en">read</span>()
		<span class="pl-s1">self</span>.<span class="pl-s1">grabbed</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">grabbed1</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed2</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed3</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed4</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed5</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed6</span><span class="pl-c1">&amp;</span><span class="pl-s1">self</span>.<span class="pl-s1">grabbed7</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-en">concat</span>(<span class="pl-s1">self</span>.<span class="pl-s1">frame1</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame2</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame3</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame4</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame5</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame6</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:])
        <span class="pl-c">#self.frame = cv2.resize(self.frame, (1920,1080))</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>
	<span class="pl-k">def</span> <span class="pl-en">start</span>(<span class="pl-s1">self</span>):    
		<span class="pl-v">Thread</span>(<span class="pl-s1">target</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">get</span>, <span class="pl-s1">args</span><span class="pl-c1">=</span>()).<span class="pl-en">start</span>()
		<span class="pl-k">return</span> <span class="pl-s1">self</span>
	<span class="pl-k">def</span> <span class="pl-en">get</span>(<span class="pl-s1">self</span>):
		<span class="pl-k">while</span> <span class="pl-c1">not</span> <span class="pl-s1">self</span>.<span class="pl-s1">stopped</span>:
			<span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">self</span>.<span class="pl-s1">grabbed</span>:
				<span class="pl-s1">self</span>.<span class="pl-en">stop</span>()
			<span class="pl-k">else</span>:
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed1</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame1</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream1</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed2</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame2</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream2</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed3</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame3</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream3</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed4</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame4</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream4</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed5</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame5</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream5</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed6</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame6</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream6</span>.<span class="pl-en">read</span>()
				(<span class="pl-s1">self</span>.<span class="pl-s1">grabbed7</span>, <span class="pl-s1">self</span>.<span class="pl-s1">frame7</span>) <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">stream7</span>.<span class="pl-en">read</span>()
				<span class="pl-s1">self</span>.<span class="pl-s1">frame0</span> <span class="pl-c1">=</span> <span class="pl-en">concat</span>(<span class="pl-s1">self</span>.<span class="pl-s1">frame1</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame2</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame3</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame4</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame5</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame5</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:],<span class="pl-s1">self</span>.<span class="pl-s1">frame6</span>[<span class="pl-c1">0</span>:<span class="pl-c1">1080</span>,:])
				<span class="pl-s1">self</span>.<span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">resize</span>(<span class="pl-s1">self</span>.<span class="pl-s1">frame0</span>, (<span class="pl-c1">1280</span>,<span class="pl-c1">720</span>))
	<span class="pl-k">def</span> <span class="pl-en">stop</span>(<span class="pl-s1">self</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>

<span class="pl-k">class</span> <span class="pl-v">VideoShow</span>:
	<span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">frame1</span> <span class="pl-c1">=</span> <span class="pl-s1">frame1</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">frame2</span> <span class="pl-c1">=</span> <span class="pl-s1">frame2</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">frame3</span> <span class="pl-c1">=</span> <span class="pl-s1">frame3</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">xoff1</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">yoff1</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">angle1</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">xoff2</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">yoff2</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">angle2</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">rchan</span> <span class="pl-c1">=</span> <span class="pl-c1">5</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">gchan</span> <span class="pl-c1">=</span> <span class="pl-c1">4</span>
		<span class="pl-s1">self</span>.<span class="pl-s1">bchan</span> <span class="pl-c1">=</span> <span class="pl-c1">3</span>
	<span class="pl-k">def</span> <span class="pl-en">start</span>(<span class="pl-s1">self</span>):
		<span class="pl-v">Thread</span>(<span class="pl-s1">target</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">show</span>, <span class="pl-s1">args</span><span class="pl-c1">=</span>()).<span class="pl-en">start</span>()
		<span class="pl-k">return</span> <span class="pl-s1">self</span>
	<span class="pl-k">def</span> <span class="pl-en">show</span>(<span class="pl-s1">self</span>):
		<span class="pl-s1">cv2</span>.<span class="pl-en">namedWindow</span>(<span class="pl-s">'Frame'</span>,<span class="pl-s1">cv2</span>.<span class="pl-v">WINDOW_NORMAL</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">resizeWindow</span>(<span class="pl-s">'Frame'</span>,<span class="pl-c1">1280</span>,<span class="pl-c1">720</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">namedWindow</span>(<span class="pl-s">"Transform"</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"X1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">91</span>,<span class="pl-c1">300</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"Y1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">85</span>,<span class="pl-c1">300</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"Angle1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">0</span>,<span class="pl-c1">180</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"X1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">300</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"Y1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">300</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"Angle1"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">180</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"X2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">87</span>,<span class="pl-c1">300</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"Y2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">1</span>,<span class="pl-c1">300</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">"Angle2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">2</span>,<span class="pl-c1">180</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"X2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">300</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"Y2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">300</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">setTrackbarMin</span>(<span class="pl-s">"Angle2"</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">-</span><span class="pl-c1">180</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">'Red'</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">5</span>,<span class="pl-c1">5</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">'Green'</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">4</span>,<span class="pl-c1">5</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-s1">cv2</span>.<span class="pl-en">createTrackbar</span>(<span class="pl-s">'Blue'</span>,<span class="pl-s">"Transform"</span>,<span class="pl-c1">3</span>,<span class="pl-c1">5</span>,<span class="pl-s1">nothing</span>)
		<span class="pl-k">while</span> <span class="pl-c1">not</span> <span class="pl-s1">self</span>.<span class="pl-s1">stopped</span>:
			<span class="pl-s1">cv2</span>.<span class="pl-en">imshow</span>(<span class="pl-s">'Frame'</span>, <span class="pl-s1">cv2</span>.<span class="pl-en">merge</span>((<span class="pl-s1">self</span>.<span class="pl-s1">frame1</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame2</span>,<span class="pl-s1">self</span>.<span class="pl-s1">frame3</span>)))
			<span class="pl-s1">self</span>.<span class="pl-s1">xoff1</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"X1"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">yoff1</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Y1"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">angle1</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Angle1"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">xoff2</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"X2"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">yoff2</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Y2"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">angle2</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Angle2"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">rchan</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Red"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">gchan</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Green"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-s1">self</span>.<span class="pl-s1">bchan</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">getTrackbarPos</span>(<span class="pl-s">"Blue"</span>,<span class="pl-s">"Transform"</span>)
			<span class="pl-k">if</span> <span class="pl-s1">cv2</span>.<span class="pl-en">waitKey</span>(<span class="pl-c1">1</span>) <span class="pl-c1">==</span> <span class="pl-c1">27</span>:
				<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
	<span class="pl-k">def</span> <span class="pl-en">stop</span>(<span class="pl-s1">self</span>):
		<span class="pl-s1">self</span>.<span class="pl-s1">stopped</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
		<span class="pl-s1">cv2</span>.<span class="pl-en">destroyAllWindows</span>()
		
<span class="pl-k">def</span> <span class="pl-en">concat</span>(<span class="pl-s1">f1</span>,<span class="pl-s1">f2</span>,<span class="pl-s1">f3</span>,<span class="pl-s1">f4</span>,<span class="pl-s1">f5</span>,<span class="pl-s1">f6</span>):
	<span class="pl-k">return</span> <span class="pl-s1">np</span>.<span class="pl-en">concatenate</span>((<span class="pl-s1">np</span>.<span class="pl-en">concatenate</span>((<span class="pl-s1">f1</span>,<span class="pl-s1">f2</span>,<span class="pl-s1">f3</span>),<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>),<span class="pl-s1">np</span>.<span class="pl-en">concatenate</span>((<span class="pl-s1">f4</span>,<span class="pl-s1">f5</span>,<span class="pl-s1">f6</span>),<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)),<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)

<span class="pl-k">def</span> <span class="pl-en">shift</span>(<span class="pl-s1">img</span>,<span class="pl-s1">x</span>,<span class="pl-s1">y</span>,<span class="pl-s1">theta</span>):
	<span class="pl-k">return</span> <span class="pl-s1">imutils</span>.<span class="pl-en">rotate</span>(<span class="pl-s1">cv2</span>.<span class="pl-en">warpAffine</span>(<span class="pl-s1">img</span>,<span class="pl-s1">np</span>.<span class="pl-en">float32</span>([[<span class="pl-c1">1</span>,<span class="pl-c1">0</span>,<span class="pl-s1">x</span>],[<span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-s1">y</span>]]), (<span class="pl-c1">640</span>, <span class="pl-c1">512</span>)),<span class="pl-s1">theta</span>)


<span class="pl-s1">get1</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8081/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get2</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8082/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get3</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8083/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get4</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8084/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get5</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8080/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get6</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8085/?action=stream'</span>).<span class="pl-en">start</span>()
<span class="pl-s1">get7</span> <span class="pl-c1">=</span> <span class="pl-v">VideoGet</span>(<span class="pl-s">'http://'</span><span class="pl-c1">+</span><span class="pl-s1">ip</span><span class="pl-c1">+</span><span class="pl-s">':8086/?action=stream'</span>).<span class="pl-en">start</span>()

<span class="pl-s1">show</span> <span class="pl-c1">=</span> <span class="pl-v">VideoShow</span>(<span class="pl-s1">cv2</span>.<span class="pl-en">merge</span>((<span class="pl-s1">get3</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">get4</span>.<span class="pl-s1">frame</span>, <span class="pl-s1">get5</span>.<span class="pl-s1">frame</span>))).<span class="pl-en">start</span>()

<span class="pl-k">while</span> <span class="pl-c1">True</span>:
	<span class="pl-k">if</span> <span class="pl-s1">show</span>.<span class="pl-s1">stopped</span>:
		<span class="pl-s1">show</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get1</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get2</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get3</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get4</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get5</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get6</span>.<span class="pl-en">stop</span>()
		<span class="pl-s1">get7</span>.<span class="pl-en">stop</span>()
		<span class="pl-k">break</span>
	<span class="pl-k">if</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">0</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">1</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get1</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">1</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">2</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get2</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">2</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">3</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get3</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">3</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">4</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get4</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">4</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">5</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get5</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">5</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">rchan</span><span class="pl-c1">&lt;=</span><span class="pl-c1">6</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame3</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get6</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff2</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle2</span>)
	<span class="pl-k">if</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">0</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">1</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get1</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">1</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">2</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get2</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">2</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">3</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get3</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">3</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">4</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get4</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">4</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">5</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get5</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">5</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">gchan</span><span class="pl-c1">&lt;=</span><span class="pl-c1">6</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame2</span><span class="pl-c1">=</span><span class="pl-en">shift</span>(<span class="pl-s1">get6</span>.<span class="pl-s1">frame</span>,<span class="pl-s1">show</span>.<span class="pl-s1">xoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">yoff1</span>,<span class="pl-s1">show</span>.<span class="pl-s1">angle1</span>)
	<span class="pl-k">if</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">0</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">1</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get1</span>.<span class="pl-s1">frame</span>
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">1</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">2</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get2</span>.<span class="pl-s1">frame</span>
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">2</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">3</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get3</span>.<span class="pl-s1">frame</span>
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">3</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">4</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get4</span>.<span class="pl-s1">frame</span>
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">4</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;</span><span class="pl-c1">5</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get5</span>.<span class="pl-s1">frame</span>
	<span class="pl-k">elif</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&gt;=</span><span class="pl-c1">5</span> <span class="pl-c1">and</span> <span class="pl-s1">show</span>.<span class="pl-s1">bchan</span><span class="pl-c1">&lt;=</span><span class="pl-c1">6</span>:
		<span class="pl-s1">show</span>.<span class="pl-s1">frame1</span><span class="pl-c1">=</span><span class="pl-s1">get6</span>.<span class="pl-s1">frame</span>

	<span class="pl-k">if</span> <span class="pl-s1">cv2</span>.<span class="pl-en">waitKey</span>(<span class="pl-c1">1</span>) <span class="pl-c1">==</span> <span class="pl-c1">27</span>:
		<span class="pl-k">break</span></pre></div>
</details>