Wednesday, July 17, 2013

Topics I want to know

1) Imatest Master -- Testing Image Quality
such Dynamic Range Test etc.,

2) Bayer Coding, White Balance, Gamma Correction

3) Object Detection, Recognition, Tracking in low Signal to Noise Ratio Conditions

4) Pin Hole Camera, FOV, Aperture, Shutter Speed

5) OCR, Biometrics, Depth Estimation

6) Defocussed Lens

7) Textures, Video Textures

Image Processing 2- Apply Filters to Images

Convolution:

Things to remember:
a) Reverse kernel horizontally and vertically before applying
b) Output Image Size.rows = InputImageSize.rows - KernelImageSize.rows + 1
Output Image Size.rows = InputImageSize.cols- KernelImageSize.cols+ 1
c) Normalize the kernel so that overflows won't happen
d) Truncate Pixels >255 to 255 and pixels <0 (negative) to 0

def convolve(image, kernel):
  '''Convolve the given image and kernel

  Inputs:

  image - a single channel (rows, cols) image with dtype uint8

  kernel - a matrix of shape (d, d) and dtype float

  Outputs:

  output - an output array of the same dtype as image, and of shape
  (rows - d + 1, cols - d + 1)
 
  Every element of output should contain the application of the kernel to the
  corresponding location in the image.

  Output elements that result in values that are greater than 255 should be 
  cropped to 255, and output values less than 0 should be set to 0.
  '''
  oimage = None
  # Insert your code here.----------------------------------------------------
  # Get size of kernel, image and initialize output array
  kernel_row= kernel.shape[0]
  kernel_col= kernel.shape[1]
  iimage_row= image.shape[0]
  iimage_col= image.shape[1]
  print image.shape
  print kernel.shape
  
  oimage_row= iimage_row-kernel_row +1
  oimage_col= iimage_col-kernel_col +1
  #Initialize array as UINT8
  oimage = np.zeros((oimage_row,oimage_col),dtype=np.uint8)
  print oimage.shape

  # Reverse kernel; Use Special trick of -1
  rkernel = kernel[::-1,::-1]

  #Perform Convolution: Product and Sum
  for i in range(0,oimage_row):
    for j in range(0,oimage_col):
      image_buf= image[i:i+kernel_row,j:j+kernel_col]
      image_buf_prod=image_buf*rkernel
      pixelf= image_buf_prod.sum();
      if pixelf < 0:
        oimage[i,j]=0
      else:
        if pixelf > 255:
          oimage[i,j] = 255
        else:
          # convert float value as uint8
          oimage[i,j] = np.uint8(pixelf)
  #print oimage   

Tuesday, July 16, 2013

OpenCV Source Code Documentation

Matrix.cpp - has all data structure matrix related operators and functions
convert.cpp -- has all the conversion functions such as split,merge

Image Processing 1- OpenCV, C++ - Color to Greyscale Conversion

Soln 1:


#include "stdafx.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv/cv.h>

using namespace cv;
using namespace std;

int main()
{
    //Read Color Image
    Mat im_rgb = imread("C:/Users/kvemishe/Documents/Vision/images/kitten.jpg");

    //waitKey is important for image display; 0 means wait forever
    imshow("Kitten",im_rgb);
    waitKey(0);

    //Convert Color to GrayScale
    Mat img_grey;
    cvtColor(im_rgb,img_grey,CV_BGR2GRAY);

    //Write Greyscale to file location
    imwrite("C:/Users/kvemishe/Documents/Vision/images/kittengrey.jpg",img_grey);
}

Sunday, July 7, 2013

Tuesday, July 2, 2013

Vision and Image Processing Books



1. Morphological Image Analysis: Principles and Applications (Pierre Soille)

(Available in the library)

2. Image Processing Handbook (J.C.Russ)

3. Handbook of Pattern Recognition and Computer Vision (C.H.Chen)

4. Vision: A Computational Investigation into the Human Representation and Processing of Visual Information
http://www.amazon.com/Vision-Computational-Investigation-Representation-Information/dp/0262514621

Interesting Blogs on Image Processing

So, I started my journey on learning image processing....

I started looking for interesting posts on image processing

1) Steve on Image Processing
http://blogs.mathworks.com/steve/