Tracking white color using python opencv

Let’s take a look at HSV color space: You need white, which is close to the center and rather high. Start with sensitivity = 15 lower_white = np.array([0,0,255-sensitivity]) upper_white = np.array([255,sensitivity,255]) and then adjust the threshold to your needs. You might also consider using HSL color space, which stands for Hue, Saturation, Lightness. Then you … Read more

module’ object has no attribute ‘drawMatches’ opencv python

I am late to the party as well, but I installed OpenCV 2.4.9 for Mac OS X, and the drawMatches function doesn’t exist in my distribution. I’ve also tried the second approach with find_obj and that didn’t work for me either. With that, I decided to write my own implementation of it that mimics drawMatches … Read more

Sobel filter kernel of large size

Complete solution for arbitrary Sobel kernel sizes and angles tl;dr: skip down to section ‘Examples’ To add another solution, expanding on this document (it’s not particularly high quality, but it shows some usable graphics and matrices starting at the bottom of page 2). Goal What we’re trying to do is estimate the local gradient of … Read more

How to use SIFT algorithm to compute how similar two images are?

First, aren’t you supposed to be using vl_sift instead of sift? Second, you can use SIFT feature matching to find correspondences in the two images. Here’s some sample code: I = imread(‘p1.jpg’); J = imread(‘p2.jpg’); I = single(rgb2gray(I)); % Conversion to single is recommended J = single(rgb2gray(J)); % in the documentation [F1 D1] = vl_sift(I); … Read more

Calculating percentage of Bounding box overlap, for image detector evaluation

For axis-aligned bounding boxes it is relatively simple. “Axis-aligned” means that the bounding box isn’t rotated; or in other words that the boxes lines are parallel to the axes. Here’s how to calculate the IoU of two axis-aligned bounding boxes. def get_iou(bb1, bb2): “”” Calculate the Intersection over Union (IoU) of two bounding boxes. Parameters … Read more

How to recognize vehicle license / number plate (ANPR) from an image? [closed]

EDIT: I wrote a Python script for this. As your objective is blurring (for privacy protection), you basically need a high recall detector as a first step. Here’s how to go about doing this. The included code hints use OpenCV with Python. Convert to Grayscale. Apply Gaussian Blur. img = cv2.imread(‘input.jpg’,1) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) … Read more

Fit Quadrilateral (Tetragon) to a blob

I recommend the following steps: threshold() the image dilate() the image – this will remove the black line splitting the top and bottom section and also darker artifacts on the lower part findContours() using setting to retrieve only external contours(RETR_EXTERNAL) and simplify the output(CHAIN_APPROX_SIMPLE) process the contours further Step 1:threshold # threshold image ret,thresh = … Read more