Extracting text OpenCV

I used a gradient based method in the program below. Added the resulting images. Please note that I’m using a scaled down version of the image for processing. c++ version The MIT License (MIT) Copyright (c) 2014 Dhanushka Dangampola Permission is hereby granted, free of charge, to any person obtaining a copy of this software … Read more

OpenCV – Depth map from Uncalibrated Stereo System

TLDR; Use StereoSGBM (Semi Global Block Matching) for images with smoother edges and use some post filtering if you want it even smoother OP didn’t provide original images, so I’m using Tsukuba from the Middlebury data set. Result with regular StereoBM Result with StereoSGBM (tuned) Best result I could find in literature See the publication … Read more

OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection

This is a recurring subject in Stackoverflow and since I was unable to find a relevant implementation I decided to accept the challenge. I made some modifications to the squares demo present in OpenCV and the resulting C++ code below is able to detect a sheet of paper in the image: void find_squares(Mat& image, vector<vector<Point> … Read more

How to resize an image with OpenCV2.0 and Python2.6

If you wish to use CV2, you need to use the resize function. For example, this will resize both axes by half: small = cv2.resize(image, (0,0), fx=0.5, fy=0.5) and this will resize the image to have 100 cols (width) and 50 rows (height): resized_image = cv2.resize(image, (100, 50)) Another option is to use scipy module, … Read more

How to remove convexity defects in a Sudoku square?

I have a solution that works, but you’ll have to translate it to OpenCV yourself. It’s written in Mathematica. The first step is to adjust the brightness in the image, by dividing each pixel with the result of a closing operation: src = ColorConvert[Import[“http://davemark.com/images/sudoku.jpg”], “Grayscale”]; white = Closing[src, DiskMatrix[5]]; srcAdjusted = Image[ImageData[src]/ImageData[white]] The next step … Read more

Simple and fast method to compare images for similarity

Can the screenshot or icon be transformed (scaled, rotated, skewed …)? There are quite a few methods on top of my head that could possibly help you: Simple euclidean distance as mentioned by @carlosdc (doesn’t work with transformed images and you need a threshold). (Normalized) Cross Correlation – a simple metrics which you can use … Read more