OpenCV and image processing

The following code works on my Ubuntu 10.04 machine with the following caveat: the image file must be a base 2 file size. Also python-opencv is needed. The picture is the image that I used as template and whether it can be downloaded and be the same is probably true. Some of the documentation on the web is seriously out of date, but I have learned to interpolate. There is a good course with pdf's at MIT IIRC ( actually it is Vanderbilt EECE 253 Image Processing ) about image manipulation that covers Fourier, Haar, and various other methods. It is worth the time to at least browse the pdfs that are the basis of the course. I may make an attempt to do all the exercises including directional Fouriers and phase maps as well as image decomposition on hue, saturation, color... The Cornsweet effect in the image below is really weird and by placing your finger between the screen and the boundaries it can be seen that the upper and lower brightness is the same. Kind of spooky. As well as the fact that perceived brightness is such a divergent function from the actual intensity of radiation.



#!/usr/bin/python # -*- coding: utf-8 -*- from opencv.cv import * from opencv.highgui import * import sys print "A demo of opencv in Python" print "Press a key to cycle images" im=cvLoadImageM("foo.png") print type(im) Monochrome = cvCreateImage(cvGetSize(im), IPL_DEPTH_8U, 1) Boundary = cvCreateImage(cvGetSize(im), IPL_DEPTH_8U, 1) out = cvCreateImage( cvSize(im.width,im.height), im.depth, im.nChannels ) cvNamedWindow( "OpenCV examples", CV_WINDOW_AUTOSIZE ); cvCvtColor(im, Monochrome, CV_BGR2GRAY) cvCanny(Monochrome, Boundary, 0.10, 0.90,3) cvSmooth( im, out, CV_GAUSSIAN, 11, 11 ) cvShowImage("OpenCV examples", Boundary); cvWaitKey(0); cvShowImage("OpenCV examples", Monochrome); cvWaitKey(0); cvShowImage("OpenCV examples", out); cvWaitKey(0); cvReleaseImage( im ); cvReleaseImage( out ); cvReleaseImage( Monochrome ); cvReleaseImage( Boundary); cvDestroyWindow( "OpenCV examples" );

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen