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

What is the algorithm that opencv uses for finding contours?

If you read the documentation it is mentioned this function implements the algorithm of: Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following. CVGIP 30 1, pp 32-46 (1985) OpenCV is open source if you want to see how this is implemented just need to read the code: https://github.com/opencv/opencv/blob/master/modules/imgproc/src/contours.cpp#L1655 … Read more

How to detect ellipses in image without using fitEllipse() in opencv?

As you already got, you don’t need ellipse fitting, but ellipse detection. You can find in my other answer two papers with C++ code available. I’ll report here for completeness: L. Libuda, I. Grothues, K.-F. Kraiss, Ellipse detection in digital image data using geometric features, in: J. Braz, A. Ranchordas, H. Arajo, J. Jorge (Eds.), … Read more

How do I use OpenCV MatchTemplate?

This might work for you! 🙂 def FindSubImage(im1, im2): needle = cv2.imread(im1) haystack = cv2.imread(im2) result = cv2.matchTemplate(needle,haystack,cv2.TM_CCOEFF_NORMED) y,x = np.unravel_index(result.argmax(), result.shape) return x,y CCOEFF_NORMED is just one of many comparison methoeds. See: http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html for full list. Not sure if this is the best method, but is fast, and works just fine for me! 🙂

Square detection in image

Sharpen square edges. Load the image, convert to grayscale, median blur to smooth, and sharpen to enhance edges. Obtain binary image and remove noise. We threshold to obtain a black/white binary image. Depending on the image, Otsu’s thresholding or adaptive thresholding would work. From here we create a rectangular kernel and perform morphological transformations to … Read more

Are there any fast alternatives to SURF and SIFT for scale-invariant feature extraction?

Although you already choose BRISK, you might find FREAK interesting. Author claims to have better results than BRISK and ORB. I should also add that ORB is scale-invariant but has some problems in that area. So I would still recommend it for someone to try it. The FREAK source code is compatible with OpenCV (how … Read more

How to construct a network with two inputs in PyTorch

By “combine them” I assume you mean to concatenate the two inputs. Assuming you concat along the second dimension: import torch from torch import nn class TwoInputsNet(nn.Module): def __init__(self): super(TwoInputsNet, self).__init__() self.conv = nn.Conv2d( … ) # set up your layer here self.fc1 = nn.Linear( … ) # set up first FC layer self.fc2 = … Read more