How to find corners on a Image using OpenCv

First, check out /samples/c/squares.c in your OpenCV distribution. This example provides a square detector, and it should be a pretty good start on how to detect corner-like features. Then, take a look at OpenCV’s feature-oriented functions like cvCornerHarris() and cvGoodFeaturesToTrack(). The above methods can return many corner-like features – most will not be the “true … Read more

How do I load and edit a bitmap file at the pixel level in Swift for iOS?

This is how I am getting a color from an image at a touch location. I translated this answer: https://stackoverflow.com/a/12579413/359578 (This sample does no error checking for nil) func createARGBBitmapContext(inImage: CGImage) -> CGContext { var bitmapByteCount = 0 var bitmapBytesPerRow = 0 //Get image width, height let pixelsWide = CGImageGetWidth(inImage) let pixelsHigh = CGImageGetHeight(inImage) // … Read more

How to read a frame from YUV file in OpenCV?

I wrote a very simple python code to read YUV NV21 stream from binary file. import cv2 import numpy as np class VideoCaptureYUV: def __init__(self, filename, size): self.height, self.width = size self.frame_len = self.width * self.height * 3 / 2 self.f = open(filename, ‘rb’) self.shape = (int(self.height*1.5), self.width) def read_raw(self): try: raw = self.f.read(self.frame_len) yuv … Read more

Is it possible to tell the quality level of a JPEG?

You can view compress level using the identify tool in ImageMagick. Download and installation instructions can be found at the official website. After you install it, run the following command from the command line: identify -format ‘%Q’ yourimage.jpg This will return a value from 0 (low quality, small filesize) to 100 (high quality, large filesize). … Read more

Comparing two histograms

Comparing histograms is quite a subject in itself. You’ve got two big classes of comparison functions : bin-to-bin comparison and cross-bin comparison. Bin-to-bin comparison : As you stated, standard sum of differences is quite bad. There’s an improvement: the Chi-squared distance. If H1.red[0] = 0.001 and H2.red[0] = 0.011, then H2.red[0] is much more important … Read more