opencv3.3

openCV3: Not getting the expected output on morphologically transforming an image in opencv

。_饼干妹妹 提交于 2020-02-08 06:45:18
问题 I am trying to do top hat morphological transformation to an image but not getting the expected output for some reason. # Top Hat: difference between input image and opening kernel = np.ones((5,5),np.float32)/25 tophat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel) plt.subplot(121),plt.imshow(img, cmap='gray'),plt.title('Original') plt.xticks([]), plt.yticks([]) plt.subplot(122),plt.imshow(tophat, cmap='gray'),plt.title('Top Hat') plt.xticks([]), plt.yticks([]) plt.show() What is expected

OpenCV3.3.0 findContours error

℡╲_俬逩灬. 提交于 2020-01-16 09:05:07
问题 I reinstall opencv today, and run my code I've written before. I got the error: OpenCV Error: Assertion failed (_contours.empty() || (_contours.channels() == 2 && _contours.depth() == CV_32S)) in findContours, file /tmp/opencv-20170916-87764-1y5vj25/opencv-3.3.0/modules/imgproc/src/contours.cpp, line 1894 Traceback (most recent call last): File "pokedex.py", line 12, in (cnts, _) = cv2.findContours(gray, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE, (2,2)) cv2.error: /tmp/opencv-20170916-87764

OpenCV3.3 dnn.readNetFromTensorflow() cannot load the module

扶醉桌前 提交于 2020-01-01 03:56:06
问题 First,I use the OpenCV3.3 and the Python3.6. When I use net=cv2.dnn.readNetFromCaffe('MobileNetSSD.prototxt.txt','MobileNetSSD_deploy.caffemodel') .It works The question is when I load the tensorflow module,there is an error: My code is net = cv2.dnn.readNetFromTensorflow('frozen_inference_graph_face.pb') The wrong message is Traceback (most recent call last): File "F:/real-time-object-detection/real_time_object_detection.py", line 34, in <module> net = cv2.dnn.readNetFromTensorflow('frozen

OpenCV, How to pass parameters into cv2.TrackerMedianFlow_create function?

冷暖自知 提交于 2019-12-02 11:32:34
问题 I'm trying to create MEDIANFLOW tracker with OpenCV3.3 using opencv-python with Python3.6. I need to pass some arguments into the constructor according to this page of OpenCV docs. The problem is I don't know how to pass available arguments into this function correctly? I wasn't able to find any information about it. What I do (and it works): tracker = cv2.TrackerMedianFlow_create() What I want to do: tracker = cv2.TrackerMedianFlow_create(maxLevel=3) But it doesn't work and gives me an error