c#,.net,image-processing,graphics,computer-vision

Your conversion from RBG to YUV uses multiplication with floating point values. Both floating point multiplication and the formulas you use are approximative, thus it is not strange that the resulting values are not exactly 0 even if it was a greyscale image. It is probably safe to set u...

The 4th parameter of calcOpticalFlowPyrLK (here track) will contain the calculated new positions of input features in the second image (here nGmask). In the simple case, you can estimate the centroid separately of fingers and track where you can infer to the movement. Making decision can be done from the...

Gradient calculations on images are performed using a mathematical operation called convolution. The formula for convolution of two matrices f and g is given below. In pseudocode, the algorithm would be: let f be the prewitt (convolution) operator let g be the image let h be the convolution result for...

Try using flann::LshIndexParams as the distance type. This does Locality Sensitive Hashing (which is close to the Hamming distance) FlannBasedMatcher matcher2(new flann::LshIndexParams(20,10,2)); See also the discussion here...

matlab,computer-vision,matlab-cvst

You are getting this warning because you have 'Fill' set to true for greenCircle. You can use 'FillColor' and 'CustomFillColor' to set the color of a filled circle. Also, if you have MATLAB version R2014a or later you can use the insertShape function instead of vision.ShapeInserter. The function is easier...

c++,image-processing,computer-vision,point-clouds

If the point cloud data comes from a depth sensor, then you have a relatively dense sampling of your walls. One thing I found that works well with depth sensors (e.g. Kinect or DepthSense) is a robust version of the RANSAC procedure that @MartinBeckett suggested. Instead of picking 3 points...

c++,computer-vision,video-capture

After previousFrame = currentFrame; both previousFrame and currentFrame refer to the same array of values. You need to create a new cv::Mat object within your loop so that each captured frame does not overwrite the one before. So instead of : do { capture >> currentFrame; Try: do { currentFrame...

opencv,dataset,computer-vision,svm,training-data

Optimal size of images is that you can easily classify object by yourself. Yes, classifiers works better after normalization, there are options. Most popular ways is center dataset (subtract mean) and normalize range of values say in [-1:1] range. Other popular way of normalization is similar to previous but...

opencv,computer-vision,stereo-3d

If you use OpenCV 2.4.x you have to look at http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereobm-operator which tells you: disparity – Output disparity map. It has the same size as the input images. When disptype==CV_16S, the map is a 16-bit signed single-channel image, containing disparity values scaled by 16. To get the true disparity values...

OpenCV combined with Python is a good option. Google for PyImageSearch and you will find some valuable resources by Adrian Rosebrock.

c#,opencv,computer-vision,kinect,kinect-sdk

That line of code is used to normalize depth values, which are coded in 11 bits in the C++ API. With that command, the 11-bit representation is converted in an 8-bit one, which allows to display the depth map as a grayscale image. Anyway, you don't need to use that...

matlab,computer-vision,matlab-cvst,video-tracking

In your code, tracking_box output from blob_analyzer actually contains area of the blobs. When creating vision.BlobAnalysis you have enabled area output port in addition to centroid output. You seem to want only centroid output if you want to mark your objects. So you should only set CentroidOutputPort to true and...

You need to know the camera's intrinsic parameters, so that you can also know the distance between pixels in the same units (mm). This distance between pixels is obviously true for a certain distance from the camera (i.e. the value of the center pixel) If the camera matrix is K...

python,opencv,computer-vision,webcam,webcam-capture

There are not enough details to tell, but it seems that one of the images that you are trying to resize is empty. Do you know on which of the resize lines this error is happening? You should probably check after you grab the webcam image if it has any...

matlab,computer-vision,matlab-cvst

The problem is that after thresholding frame is a logical array. To make the text show up use im2uint8 to convert it to uint8. A few other pointers: since you are working with a single image rather than with a video you can use imread instead of vision.VideoFileReader to read...

matlab,machine-learning,computer-vision,deep-learning,conv-neural-network

These two lines net = cnnff(net, x); [~, h] = max(net.o); feed an image x through the network and then compute the index h which had the largest output activation. You can simply do the same for an arbitrary input image x and it will give you the class h....

python,opencv,computer-vision,webcam

In the code Center the hat you have: x1 = x - 15 x2 = x + w +15 where x1 and x2 seem to be the horizontal bounds of the hat. Then, a few lines later, without x1 and x2 changing values you have # Check for clipping if...

image,matlab,image-processing,computer-vision,image-registration

Not sure what you're talking about, and I'm quite confused about your statement. cpselect is image independent. You can show both of them as colour or grayscale or one or the other. The example you're probably looking at is the one that comes with MATLAB: http://www.mathworks.com/help/images/ref/cpselect.html . One image is...

image-processing,machine-learning,computer-vision

Test, Train and Validate Read this stats SE question: What is the difference between test set and validation set? This is basic machine learning, so you should probably go back and review your course literature, since it seems like you're missing some pretty important machine learning concepts. Do we...

matlab,image-processing,computer-vision,feature-detection,sift

MATLAB has SURF available as part of the Computer Vision Toolbox but not SIFT: http://www.mathworks.com/help/vision/ref/surfpoints-class.html. However, both algorithms are pretty much the same with some minor (but crucial) differences, such as using integral images and a fast Hessian detector. I won't go into those differences in any further detail, but...

machine-learning,computer-vision,neural-network,deep-learning,pylearn

moving the comment to an answer; modifying my previous answer seemed wrong The full dataset may not be properly shuffled so the examples in the test set may be easier to classify. Doing the experiment again with examples redistributed among the train / valid / test subsets would show if...

opencv,computer-vision,face-detection,face-recognition

A shape-indexed-feature is a feature who's index gives some clue about the hierarchical structure of the shape that it came from. So in face alignment, facial landmarks are extremely important, since they are the things that will be useful in successfully aligning the faces. But, just taking facial landmarks into...

image-processing,computer-vision,image-segmentation

when an image is too bright (or too dark) you could try contrast enhancement. edit looking at your example image it looks like the features are completely washed out and contrast enhancement will not help detect the white line marking the edge of the road. another alternative might be to...

python,opencv,computer-vision,gpu

Ive stumbled across a Python friendly module that contains a GLSL API with quite a bit of examples : http://pi3d.github.io/html/...

1) You have two overlapping bounding boxes. You compute the intersection of the boxes, which is the area of the overlap. You compute the uniton of the overlapping boxes, which is the some of the areas of the entrie boxes minus the area of the overlap. Then you divide the...

python,opencv,computer-vision,coordinates,stereo-3d

1) Case of no rotation, only translation parallel to the horizontal axis of the image plane, cameras with equal focal lengths. Denote with "f" the common focal length. Denote with "b" the baseline of the stereo pair, namely the distance between the cameras' optical centers. Given a 3D point P,...

computer-vision,camera-calibration,extrinsic-parameters

the solvePnP procedure calculates extrinsic pose for Chess Board (CB) in camera coordinates. openCV added a fishEye library to its 3D reconstruction module to accommodate significant distortions in cameras with a large field of view. Of course, if your intrinsic matrix or transformation is not a classical intrinsic matrix you...

matlab,computer-vision,matlab-cvst

If you google "gaussian blur Matlab" you'll get to the next page: http://uk.mathworks.com/help/images/ref/fspecial.html where you can understand how to blur: H = fspecial('gaussian',[5 5],0.5); blurred = imfilter(Image,H,'replicate'); If you just want to blur a part of the image, extract that part, blur it and then patch it again!...

c++,opencv,image-processing,computer-vision,opencv3.0

Given your simple contour, I'm not sure why you are using RETR_TREE since there are no nested contours. Have you tried using RETR_EXTERNAL instead ? From OpenCV docs: CV_RETR_TREE retrieves all of the contours and reconstructs a full hierarchy of nested contours. CV_RETR_EXTERNAL retrieves only the extreme outer contours. Also,...

python,computer-vision,camera-calibration,opencv3.0,pose-estimation

I think your camera matrix is ok. The error may be caused by objp or corners. objp must be array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. std::vector of cv::Point3f can be also passed here. corners must...

matlab,computer-vision,opticalflow

First, I would not advice you to work from evaluating spherical harmonics for all possible coordinates within a cube and then use isosurface to plot things (I even think that you're misinterpreting isosurface as cutting data at some constant radius (which is absolutely not the case, see documentation). Best to...

image-processing,computer-vision,sift,vlfeat

The reason why they subtract by 3 is to ensure a minimum size of the patch you're looking at to get some appreciable output. In addition, when analyzing patches and extracting out features, depending on what algorithm you're looking at, there is a minimum size patch that the feature detection...

image,matlab,image-processing,computer-vision,vision

Using rgb2ind performs a colour quantization (the default is uniform quantization directly in RGB space and we also apply dithering to the image) of your image to a certain number of colours (in your case, 256) if you don't specify an input colour map. The map output provides a colour...

25 frames per second should be good enough. Given a time difference of 40ms between frames, and given a typical fast walking pace of about 2m/s, you get motion of about 8cm between two frames. Even at relatively short distance from the camera this should be doable.

python,algorithm,opencv,computer-vision,contour

According to OpenCV documentation findContours uses "Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following" The function retrieves contours from the binary image using the algorithm [Suzuki85]. I didn't find description of boundingRect algorithm but found this file in opencv repo 7.a. Straight Bounding...

c++,opencv,computer-vision,robotics

Answers in order: 1) "r" is the pixel's radius with respect to the distortion center. That is: r = sqrt((x - x_c)^2 + (y - y_c)^2) where (x_c, y_c) is the center of the nonlinear distortion (i.e. the point in the image that has zero nonlinear distortion. This is usually...

image-processing,machine-learning,computer-vision,background-subtraction

A key feature of the circle is that every point on the circumference has the same distance from the center. If you want to explore neighborhood relationships, you usually want to include information up to a certain distance away from the center pixel. Using a square, or worse, a rectangular...

opencv,image-processing,colors,computer-vision

It's not explicitly stated in the documentation, so you're not missing anything, but OpenCV does not perform gamma correction in its RGB2XYZ/BGR2XYZ color conversions. You can confirm this by looking at the source code for cvtColor in <OpenCV_dir>/modules/imgproc/src/color.cpp If you look at the RGB <-> XYZ section you'll see that...

Let's clear up your question first. I guess You are looking for the pose of the camera relative to another camera location. This is described by Homography only for pure camera rotations. For General motion that includes translation this is described by rotation and translation matrices. If the fields of...

python,opencv,numpy,computer-vision

This may not be entirely correct, but it works better on a small test case def nonMaximalSupress1(image,NHoodSize): # dX, dY = NHoodSize M, N = image.shape for x in range(0,M-dX+1): for y in range(0,N-dY+1): window = image[x:x+dX, y:y+dY] if np.sum(window)==0: localMax=0 else: localMax = np.amax(window) maxCoord=np.unravel_index(np.argmax(window), window.shape) + np.array((x,y)) #suppress...

matlab,computer-vision,linear-interpolation

newframes=11 %number of frames you want interpolate_data=interpn(1:size(Data,1),1:size(Data,2),Data,linspace(1,size(Data,1),newframes),1:size(Data,2)) For the second dimensions, indices are untouched to have no interpolation. For the first dimension linspace is used to define a interpolation grid with newframes values. ...

matlab,opencv,computer-vision,camera-calibration,matlab-cvst

The size of the board you should use depends on the distance to the camera. Ideally, you want to place the checkerboard at the same distance from the camera at which you want to do your measurements. At the same time you want to have enough data points to cover...

c++,opencv,computer-vision,gdi,template-matching

Hi i have included my code for finding a Template image from your Desktop image. Hope this solves your problem! #include <fstream> #include <memory> #include <string> #include <iostream> #include <strstream> #include <functional> #include <Windows.h> #include <iostream> #include <string> using namespace std; using namespace cv; Mat hwnd2mat(HWND hwnd){ HDC hwindowDC,hwindowCompatibleDC; int...

image,matlab,image-processing,computer-vision,vision

Here is one solution where I make each brain tile a 32x32 image. The comments explain the code. But the basic idea is... using block proc to split the large image into a 5x8 grid, because it has 5 rows of brains and 8 columns of brains. I call each...

opencv,image-processing,computer-vision,image-segmentation

I think you might be wanting to take a look at a more complex method called active shapes. While I'm not an expert at medical image processing, I know a friend of mine has successfully used this method for the segmentation of inner and outer surface of abdominal aneurysms (ouch)...

image,matlab,image-processing,computer-vision

You are basically trying to deblur a colour image but the process you speak of (deconvolution) assumes a grayscale image. You are getting a dimensions mismatch because doing ./ assumes that the matrices you are dividing with are the same dimensions because this is an element-wise operator. BTW, your beginning...

matlab,machine-learning,computer-vision,classification,matlab-cvst

Look at Database Toolbox in Matlab. You could just save the classifier variable in a file: save('classifier.mat','classifier') And then load it before executing predict: load('classifier.mat') predictedLabels = predict(classifier, testFeatures); ...

OpenCV provides a simple cross-platform video input API. It does not attempt to provide a comprehensive feature list, and even (some of) the properties it does provide, do not alwyas work with all hardware and platforms. The whole highgui module is mostly aim at rapid prototyping and not for bulletproof...

opencv,computer-vision,object-detection

Number of scales used in CascadeClassifier::detectMultiScale depends on image size, original trained window size, minObjectSize, maxObjectSize and scaleFactor parameters. It loops through all the scales starting with 1 in increments of scaleFactor until one of the conditions: current window size is larger image size current window size is larger maxObjectSize...

You have got few options: use some filtering/thresholding method on your result image to split objects from each other. Otsu binarization should be enough in this case, alternatively you can try to use dilate operation. inverse your result image and than use distance transform and Otsu binarization (or some other...

python,opencv,video,image-processing,computer-vision

I tried your code. Three things I had to change: The codec of the output video. I changed it to mp4 and it works. The indentation of the line out.write(frame). Resize the input frame, just to make sure it has the right size. Here is what works for me: import...

c++,opencv,c++11,computer-vision

The camera calibration process estimates the intrinsic camera parameters: the camera matrix, usually denoted K, and the lens distortion coefficients, D. (NB: the rotation translation matrices of the camera with respect to the pattern are also computed for each image used for the calibration, see "Extrinsic_Parameters", but they are generally...

c++,opencv,image-processing,computer-vision

Given the shape is a fairly regular polygon, have you tried running Hough Lines and computing intersections to find the vertices ? Even if you can't get all the vertices, you should be able to reconstruct the missing ones if you get 4 of 6. The following uses Hough Probabilistic...

c++,opencv,computer-vision,filtering

Here are the meaning of parameters: ksize Size of the filter returned. sigma Standard deviation of the gaussian envelope. theta Orientation of the normal to the parallel stripes of a Gabor function. lambda Wavelength of the sinusoidal factor. gamma Spatial aspect ratio. psi Phase offset. ktype Type of filter coefficients....

opencv,camera,computer-vision,object-recognition,orb

As you've recognized yourself, the object sizes are very similar in both images, so the algorithm seems to stop for a certain object resolution. The difference in distance between both cameras (for the same object size) comes from camera intrinsic parameters like focal length (coming from the lens objective) and...

image,matlab,image-processing,computer-vision,vision

If I understood right you can store the image data as a 2D array and use a colormap to assign it colors, displaying it as a "colorful" image. In this case the colormap will be a Nx3 array where each row corresponds to an index present (or not) in the...

matlab,computer-vision,coordinate-systems,camera-calibration,matlab-cvst

RotationOfCamera2 and TranslationOfCamera2 describe the transformation from camera1's coordinates into camera2's coordinates. A camera's coordinate system has its origin at the camera's optical center. Its X and Y-axes are in the image plane, and its Z-axis points out along the optical axis. Equivalently, the extrinsics of camera 1 are identity...

image,matlab,image-processing,computer-vision,vision

Assuming your large image is stored in A, then ind = arrayfun(@(ii) [ceil(ii/8) ,mod(ii-1, 8)+1], 1:40, 'uniformoutput',0); Acell = cellfun(@(rc) A((1:64)+64*(rc(1)-1), (1:64)+64*(rc(2)-1)), ind, 'UniformOutput', 0); should return a cell array Acell containing the individual images. The idea is to generate a vector of indices first, determining the order in which...

matlab,image-processing,computer-vision

The range of the RGB colormap must be [0,1] (double) for rgb2hsv to work; your problem is the pixels matrix color range goes from 0 to 255 (int). You have to find a way to fix this. im2double might help. See the rgb2hsv documentation for details. Also, I would recommend...

c++,vector,global-variables,computer-vision,local-variables

I am assuming you have access to the parameters being passed to this function void LKTracker::processFrame(const Matrix& curImage, std::vector<ObjectBox>& bbox, std::vector<bool>& isDefined) I think your two best options are: Calculate the center from the bbox (ObjectBox) x, width and y, height values. You can create functions to make it cleaner:...

python,opencv,image-processing,computer-vision,variance

Let's take for example, the second row of variance. Since the color values are in range 0-255 per channel, we can try wrapping your values to fit into that range: >>> row = [46.664, 121.162, 326.59, 809.223, 1021.599, 5330.989] >>> wrapped = [x % 256 for x in row] >>>...

matlab,image-processing,computer-vision

Color histogram similarity may be used as a good clue for tracking by detection, but don't count on it to disambiguate all possible matches between people-people and people-non-people. According to your code, there is one thing you can do to improve the comparison: currently, you are working with per-channel histograms....

image,matlab,image-processing,computer-vision,matlab-cvst

The error is a bit hard to understand, but I can explain what exactly it means. When you use the CVST Connected Components Labeller, it assumes that all of your images that you're going to use with the function are all the same size. That error happens because it looks...

Are the spikes actually different sizes and irregularly spaced in real life? In your image they are regularly spaced and identically sized and so once you know the coordinates of one point, you can calculate all of the rest by simply adding a fixed increment to the X coordinate. If...

matlab,image-processing,machine-learning,computer-vision,image-segmentation

The bag of words approach provides a concise representation of an image or a part of an image. That representation is typically used as an input to a classification algorithm which is used to estimate the class to which the image data belongs. Typically, the classifier is a supervised learning...

ios,objective-c,iphone,opencv,computer-vision

As can be seen in the function prototype, the third argument has a default value of false: ... bool alphaExist = false. Hence, in use cases when there is no alpha, there is no need to explicitly specify the last argument.

python,opencv,image-processing,computer-vision

First off, that example only shows you how to draw contours with the simple approximation. If you were to show that image now, you will only get what you see on the right hand side of that figure. If you want to get the image on the left hand side,...

matlab,geometry,computer-vision,matlab-cvst,projection-matrix

If the intrinsics are not known, the result is ambiguous up to a projective transformation. In other words, if you use estimateUncalibratedRectification to rectify a pair of images, and then compute disparity and do the 3D reconstruction, then you will reconstruct the 3D scene up to a projective transformation. Straight...

c++,opencv,matrix,computer-vision,transform

Reading the (excellent) OpenCV documentation for solvePnP might help: "rvec – Output rotation vector (see Rodrigues() ) that, together with tvec , brings points from the model coordinate system to the camera coordinate system." And following the link to Rodrigues(): src – Input rotation vector (3x1 or 1x3) or rotation...

python,opencv,image-processing,computer-vision

cv2.boxPoints should return only 4 coordinates which contain the minimum spanning bounding box for the contour. In your code, what is returned is a numpy array of size 4 x 2 where each row is a rectangle coordinate of the minimum spanning bounding box. The fact that you get repeated...

This paper tackles the tracking problem using a background model, as most CCTV tracking methods do. The BG model produces a foreground mask, and the aforementioned p_ij relates to this mask after some morphology. Specifically, they try to separate foreground blobs into components, based on thresholds on allowed 'gaps' in...

matlab,computer-vision,bounding-box,matlab-cvst

You can use the insertMarker function in the Computer Vision System Toolbox to mark the centers of the bounding boxes.

matlab,computer-vision,camera-calibration,matlab-cvst

Here are the steps you need to do: Estimate the intrinsic parameters of the camera using a calibration target. You can user Matlab camera calibration toolbox, or http://www.vision.caltech.edu/bouguetj/calib_doc/ Take your time performing this step and make sure the calibration is correct. Calibration toolboxes will give you statistics on how good...

python,matlab,video,annotations,computer-vision

One way to solve your task is using the opencv library with python, as described in this tutorial. import numpy as np import cv2 cap = cv2.VideoCapture('video.avi') current_state = False annotation_list = [] while(True): # Read one frame. ret, frame = cap.read() if not ret: break # Show one frame....

This is mainly due to the high brightness of the face, and the lack of sharp features on kids' faces (mainly around the nose bridge). Histogram equalisation before face detection can improve detection accuracy for images like this. If your detector needs to work well on such images, one possibility...

python,opencv,numpy,computer-vision,image-recognition

The bottleneck here is that you are converting the numpy array frame returned by camera.read() (i.e. the snapshot made by the camera) into an ordinary Python list. You're then iterating over the elements using ordinary for-loops, which are relatively slow by comparison. What you should do is use numpy's vectorized...

python,opencv,image-processing,numpy,computer-vision

Here's my attempt at recreating this using OpenCV Python. It's a rather hack-ish solution that is a bit computationally intensive, but it certainly gets the job done. First, create a mask where pixels that are zero correspond to those pixels you want to keep at high resolution and pixels that...

machine-learning,computer-vision,vision

I don't know of any programs that can do specifically this, but I think it is an easy problem and you can code it yourself in no time. As you are in the computer vision field you must be used to OpenCV. You can use it to extract the frames...

matlab,opencv,image-processing,computer-vision,emgucv

What you are describing sounds pretty much like the C-HOG (circular HOG) features in the original HOG paper. The only difference wrt typical hog is the shape of the bins. I think it would be best to: iterate over the pixels calculate the circular bin number for each pixel add...

matlab,computer-vision,feature-descriptor

Usually you can use atan2 to generate angles that are between -180 and 180 given your horizontal and vertical gradient components, and hence signed angles. However, if you want angles from 0 to 360 or unsigned angles, all you have to do is search for any angles that are generated...

python,image,opencv,computer-vision

My quick suggestion would be to: 1) Filter by color since the rectangle is green. Green might also exist in the image itself, but this will reduce the false positives. 2) Detect lines that form the rectangle. Now this might be done in various ways. A more general way to...

matlab,image-processing,computer-vision,bounding-box

Here is something to get you going with the image you posted. I used a line structuring element with an angle to dilate the image and amplify the signal from the small white chunks at the left of the silhouette. Then using regionprops its easier to identify objects individually and...

image,matlab,image-processing,computer-vision

You can use the bitdepth parameter to set that. imwrite(img,'myimg.png','bitdepth',16) Of course, not all image formats support all bitdepths, so make sure you are choosing the the right format for your data....

image,opencv,image-processing,computer-vision,artificial-intelligence

Algo: create/clear mask for image binarize image (to black and white by some intensity treshold) process all pixels count how many pixels of the same color are there in x,y directions call it wx,wy detect circle,shot and mid section circles are thin so wx or wy should be less then...

opencv,image-processing,3d,computer-vision,camera-calibration

This can be done in pure OpenCV as long as you have your camera parameters. You should be able to create three vectors corresponding to axis x, y, z (basically points [0,0,0] [1, 0, 0], [0, 1, 0], [0, 0, 1] which you will later project into the image plane....

It seems imrect can take a position-constraining function as an input argument. This function is specified as follows: Whenever the object is moved because of a mouse drag, the constraint function is called using the syntax: constrained_position = fcn(new_position) Position is a vector of the form [xleft ybottom width height]....

image,matlab,image-processing,computer-vision

One simple method would be to threshold the image by some known value once you convert the image to grayscale. The problem with that approach is that we are applying a global threshold and so some of the paper at the bottom of the image will be lost if you...

image,opencv,computer-vision,subtract

To remove unsharpness artifacts and slightly imperfect alignment issues, you can try to just dilate the template image. You'll lose some input information though. If you want to do it "better", I would suggest you to to try find each contour of the template image in the input image (e.g....

camera,computer-vision,autofocus

Short answer: it cannot. The pinhole camera model has no notion of 'focus'. A more interesting question is, I think, the effect of changing the focusing distance on a pinhole approximation of the lens+camera combination, the approximation itself being estimated, for example, through a camera calibration procedure. With "ordinary" consumer-type...

matlab,image-processing,computer-vision,detection,matlab-cvst

Just to clarify, are you working with a video? Is your camera stationary? In that case, you should be able to use vision.ForegroundDetector to detect anything that moves, and then use regionprops to select the blobs of the right size. If regionprops does not work for you, you may want...