OpenCV

Alternative to OpenCV fastNlMeansDenoising for real time application?

混江龙づ霸主 提交于 2021-02-19 08:41:32
问题 I'm currently using the below function to remove noise from two images of size (240x720). I'm currently computing this on my computer but would like to implement this in real time. However on my computer the function results in significant delays to the program. Is there an alternative to removing noise from an image that could work in real time? Gaussian blur perhaps? fastNlMeansDenoising(ipmOfLeftLaneRobust, ipmOfLeftLaneRobust,10,7,21); 回答1: Given a function fastNlMeansDenoising(InputArray

How to find the max occurred color in the picture using EMGU CV in C#?

送分小仙女□ 提交于 2021-02-19 08:17:07
问题 I have an image of a "windows control" lets say a Text-box and I want to get background color of the text written within the text box by finding max color occurred in that picture by pixel color comparison. I searched in google and I found that every one is talking about histogram and also some code is given to find out histogram of an image but no one described the procedure after finding histogram. the code I found on some sites is like // Create a grayscale image Image<Gray, Byte> img =

Opencv fullscreen using CameraBridgeViewBase android

坚强是说给别人听的谎言 提交于 2021-02-19 07:41:22
问题 i am trying to set up Opencv on android using the given tutorials as the base. i havenot been able to control the video size on the screen, i want to enlarge it to full screen. i am using the CameraBridgeViewBase object as the VideoCapture object does not work. does anyone know how to set up the picture to be full screen? relevant code: public class Sample3Native extends Activity implements CvCameraViewListener { private static final String TAG = "OCVSample::Activity"; private Mat mRgba;

How to detect an object real time and track it automatically, instead of user having to draw a bounding box around the object to be tracked?

倾然丶 夕夏残阳落幕 提交于 2021-02-19 07:37:26
问题 I have the following code where the user can press p to pause the video, draw a bounding box around the object to be tracked, and then press Enter (carriage return) to track that object in the video feed: import cv2 import sys major_ver, minor_ver, subminor_ver = cv2.__version__.split('.') if __name__ == '__main__' : # Set up tracker. tracker_types = ['BOOSTING', 'MIL','KCF', 'TLD', 'MEDIANFLOW', 'GOTURN', 'MOSSE', 'CSRT'] tracker_type = tracker_types[1] if int(minor_ver) < 3: tracker = cv2

using gstreamer with python opencv to capture live stream?

半腔热情 提交于 2021-02-19 07:32:32
问题 First of all i have python 3 with the library Gstreamer in it. print(cv2.getBuildInformation()) it shows Gstreamer with YES next to it. Here is the transmitter code using gstreamer in rasperryPi 3: gst-launch-1.0 v4l2src device="/dev/video0" ! video/x-raw,width=320,height=240 ! videoconvert ! x264enc tune=zerolatency ! rtph264pay ! udpsink host='my ip address' port=10000 and i will be using a python code to determine shapes , recognize objects .. etc here is my python code: import numpy as np

Occlusion with camshift

自作多情 提交于 2021-02-19 07:26:50
问题 I am working on object tracking by camshift algorithm. For the time being I am using the inbuilt opencv code wherein I have trouble dealing with occlusion. hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, np.array((0., 60., 32.)), np.array((180., 255., 255.))) prob = cv2.calcBackProject([hsv], [0], self.hist, [0, 180], 1) cv2.imshow('prob_0',prob) prob &= mask cv2.imshow('prob',prob) term_crit = ( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1 ) track_box,

Occlusion with camshift

馋奶兔 提交于 2021-02-19 07:24:30
问题 I am working on object tracking by camshift algorithm. For the time being I am using the inbuilt opencv code wherein I have trouble dealing with occlusion. hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, np.array((0., 60., 32.)), np.array((180., 255., 255.))) prob = cv2.calcBackProject([hsv], [0], self.hist, [0, 180], 1) cv2.imshow('prob_0',prob) prob &= mask cv2.imshow('prob',prob) term_crit = ( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1 ) track_box,

OpenCV: How to use the convertScaleAbs() function

匆匆过客 提交于 2021-02-19 06:11:06
问题 I am trying to convert an image back to greyscale after applying Sobel filtering on it. I have the following code: import numpy as np import matplotlib.pyplot as plt import cv2 image = cv2.imread("train.jpg") img = np.array(image, dtype=np.uint8) #convert to greyscale img_grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #remove noise img_smooth = cv2.GaussianBlur(img_grey, (13,13), 0) sobely = cv2.Sobel(img_smooth,cv2.CV_64F,0,1,ksize=9) I want to convert the image sobely back to greyscale using

Error when using Decision Trees in OpenCV 3.0.0-rc1

扶醉桌前 提交于 2021-02-19 06:01:15
问题 I am doing some machine learning in OpenCV and i'm using Decision Trees . I am currently using OpenCV 3.0.0-rc1 . Whenever i attempt to train Decision Trees with my training data and labels, i get either terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc or Segmentation fault Depending on what i put into setMaxDepth(); if the number is larger than 22, it's bad_alloc, else it's seg fault. Here's my source code: //import data Mat trainData=imread("/home

cmake and tesseract, how to link using cmake

空扰寡人 提交于 2021-02-19 06:00:11
问题 I'm trying to build my application against tesseract, which i have installed through brew (working on mac os x). While i can compile my application without problem using g++ and pkg-config, i'm not sure how to do the same with cmake. I tried FIND_PACKAGE tesseract REQUIRED but it can't seem to find it. Does anyone have a sample CMakeLists.txt ? Appreciate the help. 回答1: It seems the only (or the easiest) way to use tesseract in your project with CMake is to download tesseract sources (from