Algorithm to detect photo orientation

Many photographs from consumer digital cameras are of people, which could be used for orientation. Face detection is a well-studied research area. Basic face detection would give you a rectangle whose longer side should be the vertical dimension. Further, if you can detect the eyes/mouth, you should be able to pick the correct orientation of … Read more

Writing a video file using H.264 compression in OpenCV

You can certainly use the VideoWriter class, but you need to use the correct FourCC code that represents the the H264 standard. FourCC stands for Four Character Code, which is an identifier for a video codec, compression format, colour or pixel format used in media files. Specifically, when you create a VideoWriter object, you specify … Read more

Fastest available algorithm for distance transform

This paper reviews the known exact distance transform algorithms: “2D Euclidean distance transform algorithms: A comparative survey” https://rfabbri.github.io/stuff/fabbri-EDT-survey-ACMCSurvFeb2008.pdf The fastest exact distance transform is from Meijster: “A General Algorithm for Computing Distance Transforms in Linear Time.” http://fab.cba.mit.edu/classes/S62.12/docs/Meijster_distance.pdf The design of the algorithm is particularly well suited for parallel calculation. This is implemented in my open … Read more

scale and rotation Template matching

Template matching with matchTemplate is not good when your object is rotated or scaled in scene. You should try openCV function from Features2D Framework. For example SIFT or SURF descriptors, and FLANN matcher. Also, you will need findHomography method. Here is a good example of finding rotated object in scene. Update: In short, algorithm is … Read more

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

Image Processing – Implementing Sobel Filter

It’s pretty easy, you just need to convolve your image with a Sobel filter. A Sobel filter has two kernels, x-direction kernel and y-direction kernel. The x-direction kernel detects horizontal edges, and y-direction kernels detects vertical edges. x-direction kernel (the size is 3×3) float kernelx[3][3] = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}}; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)