opencv3.0

Out of memory error in opencv3.0 which is running inside docker container

烂漫一生 提交于 2019-12-09 03:45:33
OpenCV Error: Insufficient memory (Failed to allocate 995522496 bytes) in OutOfMemoryError. base_features, base_descs = detector.detectAndCompute(base_img, None) In this particular line the length("len(base_descs)") of base_desc is around 70000. base_desc is a numpy array . I am currently using 4 GB RAM but still it is showing this error. I am running this code inside a docker container , The above code is working fine when i run the python code without using the container in the system. VonC First, try and run some docker stats to see the memory usage and limit of your container during the

Python multiprocessing - How can I split workload to get speed improvement?

时光怂恿深爱的人放手 提交于 2019-12-09 03:21:34
问题 I am writing a simple code of cropping images and saving it. But the problem is that the number of images is about 150,000+ and I want to improve the speed. So, at first I wrote a code with simple for loops, like the following: import cv2 import numpy import sys textfile=sys.argv[1] file_list=open(textfile) files=file_list.read().split('\n') idx=0 for eachfile in files: image=cv2.imread(eachfile) idx+=1 if image is None: pass outName=eachfile.replace('/data','/changed_data') if image.shape[0]

How can I move mouse by detected face and Eye using OpenCV and Python

我是研究僧i 提交于 2019-12-08 18:45:27
I have managed to detect face and eyes by drawing cycles around them and it works fine with the help of Python tutorials Python tutorial & Learn Opencv . Now I would like to make the mouse (Cursor) moves when Face moves and Eyes close/open to do mouse clicking. (PYTHON & OPENCV). Please help to give me more ideas on how I can make it works. Thanks. Check the codes below: import cv2 import sys face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') video_capture = cv2.VideoCapture(0) while True: ret, img = video

OpenCV findContours are not in order

一笑奈何 提交于 2019-12-08 11:42:04
问题 When using OpenCV findContours method, how come the contours are not found in order? inputImage = cv2.imread("randomImage.jpg",0) im2, contours, hierarchy = cv2.findContours(inputImage.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE) j=1 for cnt in reversed(contours): letter = inputImage[y:y+h, x:x+w] cv2.imwrite(str(j)+"sub/"+str(k)+'.png', letter) k+=1 The input image consists of a few letters, for example "abcde". However, when the contours are saved to file they are saved in a random

Java OpenCV: How to convert a color image into black and white?

南笙酒味 提交于 2019-12-08 11:22:48
问题 I have loaded the image as gray sclae , I know I need use threshold to binarize it. But how to do it in Java? Mat imageMat = Imgcodecs.imread(picDir + "color_console.tif", Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE); //then what API? 回答1: I recommend you to read this tutorial about thresholding: http://docs.opencv.org/doc/tutorials/imgproc/threshold/threshold.html. Documentation for threshold function in Java is here. THRESH_BINARY and THRESH_BINARY_INV modes are suitable for binarization. For example

Capturing RTSP stream fails when the script is turned into a standalone executable using pyinstaller

Deadly 提交于 2019-12-08 06:45:02
问题 Code: from imutils.video import VideoStream import cv2 # Read rtsp stream rtsp = u"rtsp://admin:admin@10.64.1.31:554/1/h264major" #vs = VideoStream(src=0).start() # for capturing from webcam vs = VideoStream(src=rtsp).start() while True: frame = vs.read() # show the output frame cv2.imshow("Frame", frame) key = cv2.waitKey(1) & 0xFF # if the `q` key was pressed, break from the loop if key == ord("q"): break # do a bit of cleanup cv2.destroyAllWindows() vs.stop() I have faced the same problem

OpenCV 3.0 visual debug with CVV, crash cvv::showImage

徘徊边缘 提交于 2019-12-08 06:40:01
问题 I tried use visual debug like in this tutorial #define CVVISUAL_DEBUGMODE #include <opencv2/cvv/debug_mode.hpp> #include <opencv2/cvv/show_image.hpp> #include <opencv2/cvv/final_show.hpp> int main() { cv::Mat mat = imread("..."); imshow("img", mat); // works fine waitKey(); cvv::showImage(mat); // crash on this line cvv::finalShow(); return 0; } EXC_BAD_ACCESS (code=1, address=0x0) 来源: https://stackoverflow.com/questions/34897345/opencv-3-0-visual-debug-with-cvv-crash-cvvshowimage

ROS, opencv3 and CMake - unable to remove the library

守給你的承諾、 提交于 2019-12-08 05:22:53
问题 Working environment: Kubuntu 14.04 LTS 64bit ROS Indigo (up-to-date, full desktop install) OpenCV 2.4.8 For some unknown reason I decided to install the ros-indigo-opencv3 package which I regretted almost immediately due to the fact I also have the default version that comes with Ubuntu 14.04 - OpenCV 2.4.8. At first I noticed that QtCreator was warning me of possible incompatibility between 2.4.8 and 3.0.0 when I was building my CMake project (you can see the CMakeLists.txt at the end of

OpenCv 3.0.0 Face Recognizer with Java

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 00:38:53
问题 I'm writing this post to ask how I can use Face Recognizer in a JAVA project. I'm trying to generate with cmake the jar file of opencv3.0.0.0 with all its contribs, but the resulted generated jar contains only standard modules. I've also tried to use the 2.4.11 version but i can't realize how to make a concrete instance of the face recognizer class. 回答1: The one part that is a bit tricky to find in any documentation is about editing the CMakeLists.txt for the contrib modules. It seems that is

OpenCV 3.0 + Visual Studio Memory Leak Detector “false” positive

旧城冷巷雨未停 提交于 2019-12-07 23:56:29
问题 I would like to create project with enabled Visual Studio memory leak detector (Memory Leak Detector) It always worked fine and I could easily find memory leaks by running bunch of tests on my application and then checking the report. But after statically linking OpenCV 3.0 to my project I got some false positives. For instance the most frustrating error comes from StereoBMImpl::compute method and call: ocl::useOpenCL() After debugging I found the source of the "leak": TLSData<CoreTLSData>&