Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all 2088 articles
Browse latest View live

On-screen object detection

$
0
0
Hello, I would like to ask if I can use OpenCV to detect objects on the screen not from a camera or something else. Just moving objects I see on my screen. Thank you for your time

TypeError:'NoneType' object cannot be interpreted as an integer

$
0
0
**Can any one help me in resolving this issue:** for contour, hier in zip(itertools.repeat(contours, hierarchy)): TypeError: 'NoneType' object cannot be interpreted as an integer my code snippet: _, contours, hierarchy = cv2.findContours(erosion,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE) for contour, hier in zip(itertools.repeat(contours, hierarchy)):

opencv hough trans.

$
0
0
Hi, I'm sezai. hough Trans using the opencv library in Python. I'm driving. My problem is that there are 6 coins in the image, and only I want to find these 6 circle, while other circles around it find. How do I solve this problem ?

fastNlMeansDenoising return assertion hn == 1 || hn == cn

$
0
0
Hello everyone Can you help me to understand what is wrong with my code: import numpy as np import cv2 # read a 16 bits per pixel image (CV_16U) I = cv2.imread('thermal.tiff',cv2.IMREAD_ANYDEPTH | cv2.IMREAD_ANYCOLOR) I = cv2.fastNlMeansDenoising(I,None,normType=cv2.NORM_L1) Each time I execute that code I get the folowing error: ***error: (-215) hn == 1 || hn == cn in function fastNlMeansDenoising***

fastNlMeansDenoising return assertion hn == 1 || hn == cn

$
0
0
Hello everyone Can you help me to understand what is wrong with my code: import numpy as np import cv2 # read a 16 bits per pixel image (CV_16U) I = cv2.imread('thermal.tiff',cv2.IMREAD_ANYDEPTH | cv2.IMREAD_ANYCOLOR) I = cv2.fastNlMeansDenoising(I,None,normType=cv2.NORM_L1) Each time I execute that code I get the folowing error: ***error: (-215) hn == 1 || hn == cn in function fastNlMeansDenoising***

fastNlMeansDenoising return assertion hn == 1 || hn == cn

$
0
0
Hello everyone Can you help me to understand what is wrong with my code: import numpy as np import cv2 # read a 16 bits per pixel image (CV_16U) I = cv2.imread('thermal.tiff',cv2.IMREAD_ANYDEPTH | cv2.IMREAD_ANYCOLOR) I = cv2.fastNlMeansDenoising(I,None,normType=cv2.NORM_L1) Each time I execute that code I get the folowing error: ***error: (-215) hn == 1 || hn == cn in function fastNlMeansDenoising***

fastNlMeansDenoising return assertion hn == 1 || hn == cn

$
0
0
Hello everyone Can you help me to understand what is wrong with my code: import numpy as np import cv2 # read a 16 bits per pixel image (CV_16U) I = cv2.imread('thermal.tiff',cv2.IMREAD_ANYDEPTH | cv2.IMREAD_ANYCOLOR) I = cv2.fastNlMeansDenoising(I,None,normType=cv2.NORM_L1) Each time I execute that code I get the folowing error: ***error: (-215) hn == 1 || hn == cn in function fastNlMeansDenoising***

Create a grid over image without template matching

$
0
0
Hi all, I have this image: ![image description](/upfiles/15264285162279974.jpg) I was wondering if there was an efficient way of using openCV to create a grid across the image such that the centre of each grid contains a circle, and if was possible to do this without template matching. I also would like the grid to contain the half circles at the edges. I'm trying to learn openCV and could only come up with manual calculation to perform this task without pattern matching. Any help would be appreciated! Thank you very much!

Video capture lagging to intolerant extent while working with RTSP in python. I am trying to work on facenet face recognition using opencv to capture the video

$
0
0
Hi, I am pretty new to FR and lately have been working on a project where, I need to use FaceNet to recognize faces. Everything works fine, except that when I try to capture the Video from an IP camera, using RTSP I get a great lag almost ~2 minutes I am using the following code: from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import pickle import time import cv2 import numpy as np import tensorflow as tf from scipy import misc from packages import facenet, detect_face input_video="rtsp://192.168.2.236/live.sdp" modeldir = './model/20170511-185253.pb' classifier_filename = '/home/iot/Downloads/my_classifier.pkl' npy='' train_img="./train_img" with tf.Graph().as_default(): gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.6) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False)) with sess.as_default(): pnet, rnet, onet = detect_face.create_mtcnn(sess, npy) minsize = 20 # minimum size of face threshold = [0.6, 0.7, 0.7] # three steps's threshold factor = 0.709 # scale factor margin = 44 frame_interval = 3 batch_size = 1000 image_size = 182 input_image_size = 160 HumanNames = os.listdir(train_img) HumanNames.sort() print('Loading Modal') facenet.load_model(modeldir) images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0") embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0") phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0") embedding_size = embeddings.get_shape()[1] classifier_filename_exp = os.path.expanduser(classifier_filename) with open(classifier_filename_exp, 'rb') as infile: (model, class_names) = pickle.load(infile) video_capture = cv2.VideoCapture(input_video) c = 0 print('Start Recognition') prevTime = 0 while True: ret, frame = video_capture.read() frame = cv2.resize(frame, (0,0), fx=0.5, fy=0.5) #resize frame (optional) curTime = time.time()+1 # calc fps timeF = frame_interval if (c % timeF == 0): find_results = [] if frame.ndim == 2: frame = facenet.to_rgb(frame) frame = frame[:, :, 0:3] bounding_boxes, _ = detect_face.detect_face(frame, minsize, pnet, rnet, onet, threshold, factor) nrof_faces = bounding_boxes.shape[0] print('Detected_FaceNum: %d' % nrof_faces) if nrof_faces > 0: det = bounding_boxes[:, 0:4] img_size = np.asarray(frame.shape)[0:2] cropped = [] scaled = [] scaled_reshape = [] bb = np.zeros((nrof_faces,4), dtype=np.int32) for i in range(nrof_faces): emb_array = np.zeros((1, embedding_size)) bb[i][0] = det[i][0] bb[i][1] = det[i][1] bb[i][2] = det[i][2] bb[i][3] = det[i][3] # inner exception if bb[i][0] <= 0 or bb[i][1] <= 0 or bb[i][2] >= len(frame[0]) or bb[i][3] >= len(frame): print('Face is very close!') continue cropped.append(frame[bb[i][1]:bb[i][3], bb[i][0]:bb[i][2], :]) cropped[i] = facenet.flip(cropped[i], False) scaled.append(misc.imresize(cropped[i], (image_size, image_size), interp='bilinear')) scaled[i] = cv2.resize(scaled[i], (input_image_size,input_image_size), interpolation=cv2.INTER_CUBIC) scaled[i] = facenet.prewhiten(scaled[i]) scaled_reshape.append(scaled[i].reshape(-1,input_image_size,input_image_size,3)) feed_dict = {images_placeholder: scaled_reshape[i], phase_train_placeholder: False} emb_array[0, :] = sess.run(embeddings, feed_dict=feed_dict) predictions = model.predict_proba(emb_array) print(predictions) best_class_indices = np.argmax(predictions, axis=1) best_class_probabilities = predictions[np.arange(len(best_class_indices)), best_class_indices] # print("predictions") print(best_class_indices,' with accuracy ',best_class_probabilities) # print(best_class_probabilities) if best_class_probabilities>0.53: cv2.rectangle(frame, (bb[i][0], bb[i][1]), (bb[i][2], bb[i][3]), (0, 255, 0), 2) #boxing face #plot result idx under box text_x = bb[i][0] text_y = bb[i][3] + 20 print('Result Indices: ', best_class_indices[0]) print(HumanNames) for H_i in HumanNames: if HumanNames[best_class_indices[0]] == H_i: result_names = HumanNames[best_class_indices[0]] cv2.putText(frame, result_names, (text_x, text_y), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), thickness=1, lineType=2) else: print('Alignment Failure') # c+=1 cv2.imshow('Video', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break video_capture.release() cv2.destroyAllWindows() Am I doing something wrong? Is there any way I could improve the performance of the video capture?

Pass Mat to Python Script ?

$
0
0
Hi, I am using OpenCV v2.4.13.6 with C++ in QT Creator. I am trying to pass an OpenCV Mat object to a Python script using Python interpreter. I need to convert the OpenCV Mat to a PyObject so that I can pass it to the Python script. Something like this: PyObject *pName, *pModule, *pFunc, *pValue, *pMat; Mat img; Py_Initialize(); pName = PyUnicode_FromString("load-mat"); //python script is named load-mat pModule = PyImport_Import(pName); pFunc = PyObject_GetAttrString(pModule, "load_mat") //python function is named load_mat() ############################################ //Need to convert Mat img to PyObject *pMat ############################################ pValue = PyObject_CallFunctionObjArgs(pFunc, pMat, NULL); Py_Finalize(); I read somewhere: PyObject* pyopencv_from(const cv::Mat& m) { if( !m.data ) Py_RETURN_NONE; cv::Mat temp, *p = (cv::Mat*)&m; if(!p->refcount || p->allocator != &g_numpyAllocator) { temp.allocator = &g_numpyAllocator; m.copyTo(temp); p = &temp; } p->addref(); return pyObjectFromRefcount(p->refcount); } pMat = pyopencv_from(img); But placing that into my C++ code straight I get the following 2 errors: error: 'g_numpyAllocator' was not declared in this scope error: 'pyObjectFromRefcount' was not declared in this scope What is the easiest method of getting this to work ? Thanks

Depth map shows everything grey! OpenCV- Python

$
0
0
Hello! My code: import cv2 import numpy as np imgL = cv2.imread('Blender_Suzanne1.jpg') img1 = cv2.cvtColor(imgL, cv2.COLOR_BGR2GRAY) imgR = cv2.imread('Blender_Suzanne2.jpg') img2 = cv2.cvtColor(imgR, cv2.COLOR_BGR2GRAY) stereo = cv2.StereoBM_create(numDisparities = 16, blockSize = 17) disparity = stereo.compute(img2, img1) cv2.imshow('DepthMap', disparity) cv2.waitKey() cv2.destroyAllWindows() When I run it, I see a window which is all grey? I think it is wrong. I used this code from the OpenCV docs website. Can anyone help?

How to check if two following frames are identical ?

$
0
0
Hi, I'm using Python 3.5 and OpenCV 3.4.1. I just want to open a .avi video file and check if two frames in a row are identical in order to get the actual framerate of the game captured. I don't want to use an mse based comparison or something like that, I just want to know if two successives frames are EXACTLY identical. I currently have the following code : def unique_frame(): video_name = 'G:/VirtualDub Capture/RAW-Uncompressed.avi' cap = cv2.VideoCapture(video_name) fps = int(math.ceil(cap.get(cv2.CAP_PROP_FPS))) fps_counter = fps unique_fps_counter = 0 previous = cap.read() while cap.isOpened(): current = cap.read() if previous != current: unique_fps_counter += 1 if fps_counter == 0: print(actual_fps_counter) unique_fps_counter = 0 fps_counter = fps else: fps_counter -= 1 Obviously the '!=' part doesn't works. I'm a total newbie with OpenCV and I can't manage to find how to properly compare two frames. Thank you in advance

Difference in same operations between Python and C++ OpenCV Code

$
0
0
I've been working on BRISQUE IQA for Python and C++ for a while now. There is a set of code in the source code for C++ : Note: In the given code, orig_bw is the input image I've read using imread function (in grayscale). > int scalenum = 2; for (int itr_scale = 1; itr_scale<=scalenum; itr_scale++) { Size dst_size(orig_bw.cols/cv::pow((double)2, itr_scale-1), orig_bw.rows/pow((double)2, itr_scale-1)); Mat imdist_scaled; resize(orig_bw, imdist_scaled, dst_size, 0, 0, INTER_CUBIC); // INTER_CUBIC imdist_scaled.convertTo(imdist_scaled, CV_64FC1, 1.0/255.0); Mat mu(imdist_scaled.size(), CV_64FC1, 1); GaussianBlur(imdist_scaled, mu, Size(7, 7), 1.166); Mat mu_sq(imdist_scaled.size(), CV_64FC1, 1); mu_sq = mu.mul(mu); //compute sigma Mat sigma(imdist_scaled.size(), CV_64FC1, 1); sigma = imdist_scaled.mul(imdist_scaled); GaussianBlur(sigma, sigma, Size(7, 7), 1.166); subtract(sigma, mu_sq, sigma); cv::pow(sigma, double(0.5), sigma); //compute structdis = (x-mu)/sigma add(sigma, Scalar(1.0/255), sigma); //cvAddS(sigma, cvScalar(1.0/255), sigma); Mat structdis(imdist_scaled.size(), CV_64FC1, 1); subtract(imdist_scaled, mu, structdis); divide(structdis, sigma, structdis); //cvDiv(structdis, sigma, structdis); //Compute AGGD fit double lsigma_best, rsigma_best, gamma_best; structdis = AGGDfit(structdis, lsigma_best, rsigma_best, gamma_best); So this is nothing major what's happening above, just gaussian blur, addition, division and multiplication operations. I tried to convert the above set to python as follows: Note: In the given code, im_ is the input image I'm taking using imread function. I'm just testing for one iteration, and there is some change in the amount of negative pixels + positive pixels in structdis. > scalenum = 2 feat = [] im_original = im_.copy() for itr_scale in range(scalenum): im = im_original.copy() im = im / 255.0 mu = np.zeros((im.shape[0], im.shape[1]), dtype="float64") mu += 255.0 mu_ = cv2.GaussianBlur(im, (7, 7), 1.166) mu = mu_.copy() mu_sq = mu * mu sigma = im * im sigma = cv2.GaussianBlur(sigma, (7, 7), 1.166) sigma = mu_sq - sigma sigma = abs(sigma) ** 0.5 sigma = sigma + 1.0/255 structdis = mu - im structdis /= sigma ''' sigma = np.sqrt(abs(cv2.GaussianBlur(im*im, (7, 7), 1.166) - mu_sq)) structdis = (mu-im)/(sigma+(1.0/255)) ''' structdis = AGGDfit(structdis) Now, the AGGDfit function has some operations where it finds the number of positive pixel points and the negative pixel points, so for both the total number of negative and positive pixel points differ by a small amount (around 300-400) [here positive means > 0 and negative means < 0, and NOT >= or <=] . Why would that be? Is there any difference possible in the outputs of GaussianBlur of C++ and Python APIs?

How do i automatically load a new image once i have closed the previous image on OpenCV

$
0
0
I have a code which allows me to open an image from a folder, lets me draw and label the images and once i close the window, it will save the labeled image and the annotations in separate folders. Now the problem is that I want to open the next image automatically after I have closed the annotated image. Is there any way to do it? Here is my code: import cv2 import numpy as np import math import os drawing = False colours = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (204, 0, 204), (0, 155, 255), (0, 223, 255), (238, 220, 130), (255, 79, 79), (161, 0, 244), (32, 178, 170), (170, 178, 32)] nn1=0 img_dir='./3/' txt_dir='./texts/' sample_dir='./samples/' def draw_circle(event, x, y, flags, param): global x1, y1, drawing, radius, num, img, img2, z, circleProps, RGB if event == cv2.EVENT_LBUTTONDOWN: drawing = True x1, y1 = x, y radius = int(math.hypot(x - x1, y - y1)) cv2.circle(img, (x1, y1), radius, (255, 0, 0), 1) elif event == cv2.EVENT_MOUSEMOVE: if drawing == True: a, b = x, y if a != x & b != y: img = img2.copy() radius = int(math.hypot(a - x1, b - y1)) cv2.circle(img, (x1, y1), radius, (255, 0, 0), 1) elif event == cv2.EVENT_LBUTTONUP: drawing = False num += 1 radius = int(math.hypot(x - x1, y - y1)) z = (z + 1) % (len(colours) - 1) circle_drawn = cv2.circle(img, (x1, y1), 10, colours[z], 1) # change radius RGB = cv2.mean(circle_drawn) circleProps += " %d " % num + "%d " % x1 + "%d " % y1 + "15 " + "{0} \n".format(RGB) cv2.line(img, (x1, y1), (x1 + 3, y1), (0, 0, 0), 1) cv2.line(img, (x1, y1), (x1 - 3, y1), (0, 0, 0), 1) cv2.line(img, (x1, y1), (x1, y1 + 3), (0, 0, 0), 1) cv2.line(img, (x1, y1), (x1, y1 - 3), (0, 0, 0), 1) font = cv2.FONT_HERSHEY_PLAIN cv2.putText(img, str(num), (x1 + radius, y1 + radius), font, 1, (200, 255, 155), 1, cv2.LINE_AA) img2 = img.copy() elif event == cv2.EVENT_RBUTTONUP: pass def handleKeyboard(): if cv2.waitKey(20) == 38: print('38') if __name__ == "__main__": num = 0 z = 0 #nn1=3 counter='%04d' %nn1 nn1 += 1 windowName = 'DepthOut_'+counter circleProps = "|No. | x1 | y1 | radius | RGB \n" fileName="DepthOut_"+counter print('filename', fileName) im_gray = cv2.imread(img_dir+fileName+".bmp", cv2.IMREAD_COLOR) # change img filename here img = cv2.applyColorMap(im_gray, cv2.COLORMAP_BONE) img2 = img.copy() cv2.namedWindow(windowName) cv2.setMouseCallback(windowName, draw_circle) noFiles=len(img_dir) print('number of files:', noFiles) while (True): cv2.imshow(windowName, img) cv2.rectangle(img, (0, 0), (50, 50), (0, 0, 255), 2) # handleKeyboard() if cv2.waitKey(20) == 27: text_file = open(txt_dir+fileName+'.txt', "w") # change txt filename here text_file.write(circleProps) cv2.imwrite(sample_dir+fileName+'.png', img) text_file.close() break nn1 += 1 print('nn1:', nn1) cv2.destroyAllWindows()

opencv, Python hough transform labeling

$
0
0
Hi, I have detected circular areas using hough transform. I want to print labels to each detected apartment using cv2.putText. ![image description](/upfiles/1528421692717326.jpg)

CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266

$
0
0
Hello, i am trying to build OpenCV with the OpenCV-contrib modul. I am using a Mac (10.13.4) and my Cmake command is: I am using Clang 8.1 : > Apple LLVM version 8.1.0> (clang-802.0.42) Target:> x86_64-apple-darwin17.5.0 Thread> model: posix InstalledDir:> /Library/Developer/CommandLineTools/usr/bin> cmake -D CMAKE_BUILD_TYPE=RELEASE > -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES=ON -D> WITH_OPENGL=ON -D> INSTALL_C_EXAMPLES=OFF -D> OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules> .. Which worked fine, but the make command doesn't work. Thanks Marvin > -- Looking for ccache - not found> -- Checking for module 'gstreamer-base-1.0'> -- No package 'gstreamer-base-1.0' found> -- Checking for module 'gstreamer-video-1.0'> -- No package 'gstreamer-video-1.0' found> -- Checking for module 'gstreamer-app-1.0'> -- No package 'gstreamer-app-1.0' found> -- Checking for module 'gstreamer-riff-1.0'> -- No package 'gstreamer-riff-1.0' found> -- Checking for module 'gstreamer-pbutils-1.0'> -- No package 'gstreamer-pbutils-1.0' found> -- Checking for module 'gstreamer-base-0.10'> -- No package 'gstreamer-base-0.10' found> -- Checking for module 'gstreamer-video-0.10'> -- No package 'gstreamer-video-0.10' found> -- Checking for module 'gstreamer-app-0.10'> -- No package 'gstreamer-app-0.10' found> -- Checking for module 'gstreamer-riff-0.10'> -- No package 'gstreamer-riff-0.10' found> -- Checking for module 'gstreamer-pbutils-0.10'> -- No package 'gstreamer-pbutils-0.10' found> -- Checking for module 'libdc1394-2'> -- No package 'libdc1394-2' found> -- Checking for module 'libdc1394'> -- No package 'libdc1394' found> -- found Intel IPP (ICV version): 2017.0.3 [2017.0.3]> -- at: /Users/Marvin/Documents/OpenCV3/opencv/build/3rdparty/ippicv/ippicv_mac> -- found Intel IPP IW sources: 2017.0.3> -- at: /Users/Marvin/Documents/OpenCV3/opencv/build/3rdparty/ippicv/ippiw_mac> -- CUDA detected: 9.1> -- CUDA NVCC target flags: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-D_FORCE_INLINES> -- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off> -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off> -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR> Atlas_BLAS_LIBRARY) > -- A library with LAPACK API found.> -- LAPACK(LAPACK/Apple): LAPACK_LIBRARIES:> /System/Library/Frameworks/Accelerate.framework;/System/Library/Frameworks/Accelerate.framework> CMake Warning at> cmake/OpenCVFindLAPACK.cmake:29> (message): LAPACK(LAPACK/Apple):> CBLAS/LAPACK headers are not found in> '' Call Stack (most recent call> first): > cmake/OpenCVFindLAPACK.cmake:143> (ocv_lapack_check) > CMakeLists.txt:605 (include)>>> -- LAPACK(Apple): LAPACK_LIBRARIES: -framework Accelerate CMake Warning at cmake/OpenCVFindLAPACK.cmake:29> (message): LAPACK(Apple):> CBLAS/LAPACK headers are not found in> '' Call Stack (most recent call> first): > cmake/OpenCVFindLAPACK.cmake:159> (ocv_lapack_check) > CMakeLists.txt:605 (include)>>> -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) > -- Could NOT find Pylint (missing: PYLINT_EXECUTABLE) > -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS> MATLAB_ROOT_DIR MATLAB_LIBRARIES> MATLAB_LIBRARY_DIRS MATLAB_MEXEXT> MATLAB_ARCH MATLAB_BIN) > -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install> subdirectory with VTKConfig.cmake file> -- Caffe: NO> -- Protobuf: NO> -- Glog: YES> -- Looking for tiny_dnn.h> -- Looking for tiny_dnn.h - found> -- Found tiny-dnn in: /Users/Marvin/Documents/OpenCV3/opencv/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3> -- The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='')> -- Checking for one of the modules 'harfbuzz'> -- freetype2: YES> -- harfbuzz: NO> -- HDF5: Using hdf5 compiler wrapper to determine C configuration> -- Module opencv_ovis disabled because OGRE3D was not found> -- No preference for use of exported gflags CMake configuration set, and no> hints for include/library directories> provided. Defaulting to preferring an> installed/exported gflags CMake> configuration if available.> -- Found installed version of gflags: /usr/local/lib/cmake/gflags> -- Detected gflags version: 2.2.1> -- Checking SFM deps... TRUE> -- CERES support is disabled. Ceres Solver for reconstruction API is> required.> -- HDF5: Using hdf5 compiler wrapper to determine C configuration> -- Excluding from source files list: /Users/Marvin/Documents/OpenCV3/opencv/build/modules/imgproc/accum.neon.cpp> -- Checking for modules 'tesseract;lept'> -- No package 'tesseract' found> -- No package 'lept' found> -- Tesseract: NO> -- No preference for use of exported gflags CMake configuration set, and no> hints for include/library directories> provided. Defaulting to preferring an> installed/exported gflags CMake> configuration if available.> -- Found installed version of gflags: /usr/local/lib/cmake/gflags> -- Detected gflags version: 2.2.1> -- Checking SFM deps... TRUE> -- CERES support is disabled. Ceres Solver for reconstruction API is> required.> -- > -- General configuration for OpenCV 3.4.0 =====================================> -- Version control: 3.4.0-dirty> -- > -- Extra modules:> -- Location (extra): /Users/Marvin/Documents/OpenCV3/opencv_contrib/modules> -- Version control (extra): 3.4.0> -- > -- Platform:> -- Timestamp: 2018-06-08T21:57:14Z> -- Host: Darwin 17.5.0 x86_64> -- CMake: 3.11.3> -- CMake generator: Unix Makefiles> -- CMake build tool: /usr/bin/make> -- Configuration: RELEASE> -- > -- CPU/HW features:> -- Baseline: SSE SSE2 SSE3> -- requested: SSE3> -- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2> -- requested: SSE4_1 SSE4_2 AVX FP16 AVX2> -- SSE4_1 (3 files): + SSSE3 SSE4_1> -- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2> -- FP16 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX> -- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX> -- AVX2 (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3> AVX AVX2> -- > -- C/C++:> -- Built as dynamic libs?: YES> -- C++11: YES> -- C++ Compiler: /Library/Developer/CommandLineTools/usr/bin/c++> (ver 8.1.0.8020042)> -- C++ flags (Release): -std=c++11 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG> -- C++ flags (Debug): -std=c++11 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG> -- C Compiler: /Library/Developer/CommandLineTools/usr/bin/cc> -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG> -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG> -- Linker flags (Release):> -- Linker flags (Debug):> -- ccache: NO> -- Precompiled headers: NO> -- Extra dependencies: cudart nppc nppial nppicc nppicom> nppidei nppif nppig nppim nppist> nppisu nppitc npps cublas cufft> -L/Developer/NVIDIA/CUDA-9.1/lib> -- 3rdparty dependencies:> -- > -- OpenCV modules:> -- To be built: aruco bgsegm bioinspired calib3d> ccalib core cudaarithm cudabgsegm> cudafeatures2d cudafilters cudaimgproc> cudalegacy cudaobjdetect cudaoptflow> cudastereo cudawarping cudev datasets> dnn dpm face features2d flann fuzzy> hdf highgui img_hash imgcodecs imgproc> line_descriptor ml objdetect optflow> phase_unwrapping photo plot> python_bindings_generator reg rgbd> saliency sfm shape stereo stitching> structured_light superres> surface_matching text tracking ts> video videoio videostab xfeatures2d> ximgproc xobjdetect xphoto> -- Disabled: js world> -- Disabled by dependency: -> -- Unavailable: cnn_3dobj cudacodec cvv dnn_modern> freetype java matlab ovis python2> python3 viz> -- Applications: tests perf_tests apps> -- Documentation: NO> -- Non-free algorithms: NO> -- > -- GUI: > -- Cocoa: YES> -- OpenGL support: NO> -- VTK support: NO> -- > -- Media I/O: > -- ZLib: build (ver 1.2.11)> -- JPEG: build (ver 90)> -- WEBP: /usr/local/lib/libwebp.dylib (ver> encoder: 0x020e)> -- PNG: build (ver 1.6.34)> -- TIFF: build (ver 42 - 4.0.9)> -- JPEG 2000: build (ver 1.900.1)> -- OpenEXR: build (ver 1.7.1)> -- > -- Video I/O:> -- DC1394: NO> -- FFMPEG: YES> -- avcodec: YES (ver 58.18.100)> -- avformat: YES (ver 58.12.100)> -- avutil: YES (ver 56.14.100)> -- swscale: YES (ver 5.1.100)> -- avresample: YES (ver 4.0.0)> -- GStreamer: NO> -- AVFoundation: YES> -- gPhoto2: YES> -- > -- Parallel framework: GCD> -- > -- Trace: YES (with Intel ITT)> -- > -- Other third-party libraries:> -- Intel IPP: 2017.0.3 [2017.0.3]> -- at: /Users/Marvin/Documents/OpenCV3/opencv/build/3rdparty/ippicv/ippicv_mac> -- Intel IPP IW: sources (2017.0.3)> -- at: /Users/Marvin/Documents/OpenCV3/opencv/build/3rdparty/ippicv/ippiw_mac> -- Lapack: NO> -- Eigen: YES (ver 3.3.4)> -- Custom HAL: NO> -- > -- NVIDIA CUDA: YES (ver 9.1, CUFFT CUBLAS)> -- NVIDIA GPU arch: 30 35 37 50 52 60 61 70> -- NVIDIA PTX archs:> -- > -- OpenCL: YES (no extra features)> -- Include path: NO> -- Link libraries: -framework OpenCL> -- > -- Python (for build): /usr/local/bin/python2.7> -- > -- Java:> -- ant: NO> -- JNI: /System/Library/Frameworks/JavaVM.framework/Headers> /System/Library/Frameworks/JavaVM.framework/Headers> /System/Library/Frameworks/JavaVM.framework/Headers> -- Java wrappers: NO> -- Java tests: NO> -- > -- Matlab: NO> -- > -- Install to: /usr/local> -- -----------------------------------------------------------------> -- > -- Configuring done> -- Generating done> -- Build files have been written to: /Users/Marvin/Documents/OpenCV3/opencv/build> [ 0%] Built target gen-pkgconfig [ > 1%] Built target zlib [ 4%] Built> target libjpeg [ 6%] Built target> libtiff [ 7%] Built target libjasper> [ 8%] Built target libpng [ 12%]> Built target IlmImf [ 13%] Built> target ippiw [ 14%] Built target> ittnotify [ 18%] Built target> libprotobuf [ 18%] Built target> opencv_cudev [ 18%] Building NVCC> (Device) object> modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstddef(97):> error: identifier "nullptr" is> undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstddef(97):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(257):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(261):> error: member> "std::__1::integral_constant<_Tp,> __v>::constexpr" is not a type name>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(261):> error: return type may not be> specified on a conversion function>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(261):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(269):> error: "constexpr" is not a function> or static data member>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(327):> error: identifier "nullptr_t" is> undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(346):> error: identifier "char16_t" is> undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(347):> error: identifier "char32_t" is> undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(347):> error: class> "std::__1::__libcpp_is_integral<>"> has already been defined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(554):> error: identifier "nullptr_t" is> undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(655):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1162):> error: expected a type specifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1162):> error: expected a type specifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1185):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1185):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1186):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1186):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1187):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1187):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1188):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1188):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1189):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1189):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1190):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1190):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1191):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1191):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1192):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1192):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1193):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1193):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1194):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1194):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1195):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1195):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1196):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1196):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1197):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1197):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1198):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1198):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1201):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1201):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1257):> error: function template> "std::__1::declval" is not a type name>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1257):> error: function returning function is> not allowed>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1257):> error: "__test" has already been> declared in the current scope>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1257):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1258):> error: identifier "type" is undefined>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1287):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1287):> error: function returning function is> not allowed>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1287):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1298):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1298):> error: function returning function is> not allowed>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1298):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1535):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1535):> error: expected a ">">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1535):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1555):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1555):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1555):> error: too few arguments for class> template "std::__1::__select_2nd">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1555):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1574):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1619):> error: expected a ")">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1668):> error: expected a ";">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1825):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1825):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1833):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1833):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1841):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1841):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1849):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1849):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1857):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1857):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1865):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1865):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1873):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1873):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1881):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1881):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1889):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1889):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1897):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1897):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1905):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1905):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1913):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1913):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1921):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1921):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1929):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1929):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1937):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1937):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1945):> error: too few arguments for class> template> "std::__1::__member_pointer_traits_imp">> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(1945):> error: expected an identifier>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(2964):> error: function call is not allowed in> a constant expression>> /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits(2964):> error: function call is not allowed in> a constant expression>> Error limit reached. 100 errors> detected in the compilation of> "/var/folders/yz/49kbdr4n0fv_zz022xkfs_p40000gn/T//tmpxft_00007536_00000000-13_gpu_mat.compute_70.cpp1.ii".> Compilation terminated. CMake Error at> cuda_compile_generated_gpu_mat.cu.o.cmake:266> (message): Error generating file > /Users/Marvin/Documents/OpenCV3/opencv/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o>>> make[2]: ***> [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o]> Error 1 make[1]: ***> [modules/core/CMakeFiles/opencv_core.dir/all]> Error 2 make: *** [all] Error 2

unknown noise during capture for vein detection

$
0
0
Hello, I'm currently working in a project in that I have to do a vein detector using IR images, currently we have a problem with an unknown noise that appears in the images during the capture. I'm using a webcam Genius Facecam 1000HD without IR Filter (I remove it), and 6 3W LEDs with 850nm. Heres is an example about the noise ![EXAMPLE 1](/upfiles/15284965927807205.png) ![EXAMPLE 2](/upfiles/15284966642180846.png) ![EXAMPLE 3](/upfiles/15284966293824932.png) we think that it can be the webcam, probably when I removed the IR filter, that process altered the image. But I'm not completly sure about it. Other thing thant can be it could that the illumination its not completly homogeneous around the arm. Or possibly the code, but I think this is the less possible. I dont know if anyone here has an idea that what could possibly cause that noise, because it altered the final result. Here is the code if anyone can try. import matplotlib.pyplot as plt import matplotlib.image as img import numpy as np import cv2 kernel = np.ones((3,3),np.uint8) kernel[0,0]=0 kernel[0,2]=0 kernel[2,0]=0 kernel[2,2]=0 print(kernel) #-----Reading the image----------------------------------------------------- camera = cv2.VideoCapture(1) while cv2.waitKey(1)==-1: retval, img = camera.read() final = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) retval,mask = cv2.threshold(final,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) gray = cv2.bitwise_and(final,final,mask = mask) ##-----PROCESAMIENTO----------------------------------- #Def. ROI nf,nc=gray.shape nf3=round(nf/3) gray = gray[nf3:2*nf3,:] CAP1 = gray.copy() #con ROI #Ecualización # gray = cv2.medianBlur(gray,3) clahe = cv2.createCLAHE(clipLimit=20.0, tileGridSize=(8,8)) gray= clahe.apply(gray) CAP2 = gray.copy() gray = cv2.medianBlur(gray,3) #Filtro Mediana CAP3 = gray.copy() retval,CAP4 = cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) mask1=(CAP4>0)*gray #pixeles grises mask2=(CAP4==0)*int(CAP3.mean()) #Fondo Promedio gray=np.uint8(mask1+mask2) #conviente a formato int CAP5 = gray.copy() retval,gray = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU) gray = (CAP1>0)*gray CAP6 = gray.copy() gray = cv2.erode(gray,kernel,iterations = 2) gray = cv2.morphologyEx(gray, cv2.MORPH_CLOSE, kernel) # gray = cv2.dilate(gray,kernel,iterations = 1) CAP7 = gray.copy() # gray = cv2.morphologyEx(gray, cv2.MORPH_CLOSE, kernel) # gray = cv2.dilate(gray,kernel,iterations = 1) cv2.imshow('1:Original, 2:CLAHE, 3:Mediana, 4:OTSU', np.concatenate((CAP1,CAP2,CAP3,CAP4),axis=0)) cv2.imshow('5:Mediana+FondoProm 6:OTSU, 7:Erode',np.concatenate((CAP5,CAP6,CAP7),axis=0)) original=img[nf3:2*nf3,:,:] original[:,:,2]=CAP7; cv2.imshow('Original',original) cv2.destroyAllWindows() camera.release() #_____END_____#

How to detect blob in noisy image?

$
0
0
Hello everybody, I need help in the detection of blobs in images like these: ![image description](/upfiles/15284942152703104.jpg) ![image description](/upfiles/15284942307391709.jpg) ![image description](/upfiles/1528494239419177.jpg) The blob is exactly at the center of the image. I don't have enough images to train a classifier, so my solution is to apply several morphological operators and then use the SimpleBlobDetector classb but it doesn't work very well. Do you have any suggestion? Thanks for your help.

Gaussian Fitting an image in OpenCV

$
0
0
Hey! So the thing is, I am trying to plot a gaussian fit of an image in OpenCV using any existing functions if available. The sample inputs and outputs are: ![Gaussianity of Natural Images](/upfiles/1528545896259892.png) Source: https://ieeexplore.ieee.org/document/6272356/ I've been able to generate the MSCN Image, but what's the way to get the plots as mentioned in the above figure? If someone can hint to the right solution, please.

Opencv LBPHFaceRecognizer Train data in Python

$
0
0
I am working on face recognition with LBPH algorithm and i need to save train data to database. recognizer = cv2.createLBPHFaceRecognizer() recognizer.train(images, np.array(labels)) i need to see this train data for each image. How can I make this ?
Viewing all 2088 articles
Browse latest View live