Negative unread mails in Yahoo! %<:?
OpenCV:A Development Enviroment for Computer Vision in C/C++
General Description:
OpenCV is basically an Open source computer vision library in C/C++. It is optimized and intended for real-time applications. OpenCV is OS/hardware/window-manager independent.Generic image/video loading, saving, and acquisition. It supports both low and high level API. OpenCV also provides interface to Intel's Integrated Performance Primitives (IPP) with processor specific optimization (Intel processors). OpenCV’s official web site is
Some Features of OpenCv:
- Image data manipulation (allocation, release, copying, setting, conversion).
- Image and video I/O (file and camera based input, image/video file output).
- Matrix and vector manipulation and linear algebra routines (products, solvers, eigenvalues, SVD).
- Various dynamic data structures (lists, queues, sets, trees, graphs).
- Basic image processing (filtering, edge detection, corner detection, sampling and interpolation, color conversion, morphological operations, histograms, image pyramids).
- Structural analysis (connected components, contour processing, distance transform, various moments, template matching, Hough transform, polygonal approximation, line fitting, ellipse fitting, Delaunay triangulation).
- Camera calibration (finding and tracking calibration patterns, calibration, fundamental matrix estimation, homography estimation, stereo correspondence).
- Motion analysis (optical flow, motion segmentation, tracking).
- Object recognition (eigen-methods, HMM).
- Basic GUI (display image/video, keyboard and mouse handling, scroll-bars).
- Image labeling (line, conic, polygon, text drawing)
OpenCV naming conventions
Functions in openCv starts with the library name(ex: functions in cv.h starts with cv) prefix and then the Core functionality follows it.The function name sometimes ends with the datatype that it returns. Function naming conventions:
cvActionTargetMod(...)
Action = the core functionality (e.g. set, create)
Target = the target image area (e.g. contour, polygon)
Mod = optional modifiers (e.g. argument type)
Ex: cvFindExtrinsicCameraParams_64d(...)
Matrix data types:
CV_<bit_depth>(SUF)C<number_of_channels>
S = Signed integer
U = Unsigned integer
F = Float
Ex: CV_8UC1 means an 8-bit unsigned single-channel matrix,
CV_32FC2 means a 32-bit float matrix with two channels.
Image data types:
IPL_DEPTH_<bit_depth>(SUF)
E.g.: IPL_DEPTH_8U means an 8-bit unsigned image.
IPL_DEPTH_32F means a 32-bit float image.
Header files:
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
#include <ml.h>
#include <cxcore.h> // unnecessary - included in cv.h
Library Definitions:
cv.h: Includes the essential computer vision and image processing functions.
cvaux.h: Obsolote library and includes some experimental codes.
highgui.h: Functions for user interface and drawing
ml.h: Machine Learning tools. For exampl: SVM(Support Vector Machine), ANN, Normal Bayes Classifier...etc
cxcore.h : This library includes Data Structures and Data types needed for image processing and computer vision.
cvcam.h: CvCam has important functions and interfaces for accessing camera and image retrieval.
Fundamental Data Structures in OpenCV
Image data structure
Image data structure is used for storing image in the memory and accessing image’s properties.
IPL image:
IplImage // Number of color channels (1,2,3,4)
// IPL_DEPTH_64F -- char* imageData;// pointer to aligned image data // Note that color images are stored in BGR order // size of aligned image row in bytes // image data size in bytes = height*widthStep
// image ROI. when not NULL specifies image // pointer to the unaligned origin of image data // Alignment of image rows: 4 or 8 byte alignment -- char colorModel[4]; //Color model-ignored by OpenCV |
Matrices in OpenCv is usually used for mathematical operations for image processing and computer vision on the images caputured.Matrices:
CvMat // 2D array -- int type; //elements type //(uchar,short,int,float,double) and flags
-- union data; -- uchar* ptr; // data pointer for an unsigned char matrix // data pointer for a short matrix // data pointer for an integer matrix // data pointer for a float matrix // data pointer for a double matrix -- int type; // elements type //(uchar,short,int,float,double) and flags
-- union data; // data pointer for an unsigned char matrix // data pointer for a short matrix // data pointer for an integer matrix // data pointer for a float matrix -- double* db; // data pointer for a double matrix -- struct dim[]; // information for each dimension // number of elements in a given dimension -- step; //distance between elements in a given dimension
|
Arrays are very important data structures in programming. They can be used in many ways. Generic arrays:
CvArr* // Used only as a function parameter to specify that the |
Scalars:
CvScalar -- double val[4]; //4D vector |
Initializer function:
CvScalar s = cvScalar(double val0, double val1=0, double val2=0, double val3=0); |
CvScalar s = cvScalar(20.0); s.val[0]=10.0; |
Note that the initializer function has the same name as the data structure only starting with a lower case character. It is not a C++ constructor.
Other data structures
Point data structure is usually used for storing specific points coordinates in the memory. Points:
CvPoint p = cvPoint(int x, int y); CvPoint2D32f p = cvPoint2D32f(float x, float y); CvPoint3D32f p = cvPoint3D32f(float x, float y, float z); E.g.: p.x=5.0; p.y=5.0; |
Rectangular dimensions:
CvSize r = cvSize(int width, int height); CvSize2D32f r = cvSize2D32f(float width, float height); |
Rectangular dimensions with offset:
CvRect r = cvRect(int x, int y, int width, int height); |
Some GUI commands
Window management
Create and position a window:
cvNamedWindow("win1", CV_WINDOW_AUTOSIZE);// offset from the UL corner of the screen |
Load an image:
IplImage* img=0;
img=cvLoadImage(fileName);
if(!img) printf("Could not load image file: %s\n",fileName);
Display an image:
cvShowImage("win1",img);Can display a color or grayscale byte/float-image. A byte image is assumed to have values in the range [0..255]. A float image is assumed to have values in the range [0..1]. A color image is assumed to have data in BGR order.
Close a window:
cvDestroyWindow("win1");Resize a window:
cvResizeWindow("win1",100,100); // new width/heigh in pixelsInput handling
Handle mouse events:
Define a mouse handler:
void mouseHandler(int event, int x, int y, int flags, void* param) { switch(event){
case CV_EVENT_LBUTTONDOWN:
if(flags & CV_EVENT_FLAG_CTRLKEY)
printf("Left button down with CTRL pressed\n");
break;
case CV_EVENT_LBUTTONUP:
printf("Left button up\n");
break;
}
}
x,y: pixel coordinates with respect to the UL corner
event: CV_EVENT_LBUTTONDOWN, CV_EVENT_RBUTTONDOWN, CV_EVENT_MBUTTONDOWN,
CV_EVENT_LBUTTONUP, CV_EVENT_RBUTTONUP, CV_EVENT_MBUTTONUP,
CV_EVENT_LBUTTONDBLCLK, CV_EVENT_RBUTTONDBLCLK, CV_EVENT_MBUTTONDBLCLK,
CV_EVENT_MOUSEMOVE:
flags: CV_EVENT_FLAG_CTRLKEY, CV_EVENT_FLAG_SHIFTKEY, CV_EVENT_FLAG_ALTKEY,
CV_EVENT_FLAG_LBUTTON, CV_EVENT_FLAG_RBUTTON, CV_EVENT_FLAG_MBUTTON
Register the handler:
mouseParam=5;
cvSetMouseCallback("win1",mouseHandler,&mouseParam);
Handle keyboard events:
The keyboard does not have an event handler.
Get keyboard input without blocking:
int key;
key=cvWaitKey(10); // wait 10ms for input
Get keyboard input with blocking:
int key;
key=cvWaitKey(0); // wait indefinitely for input
The main keyboard event loop:
while(1){
key=cvWaitKey(10);
if(key==27) break;
switch(key){
case 'h':...
break;
case 'i':
...
break;
}
}
Handle trackbar events:
Define a trackbar handler:
void trackbarHandler(int pos)
{
printf("Trackbar position: %d\n",pos);
}
Register the handler:
int trackbarVal=25;
int maxVal=100;
cvCreateTrackbar("bar1", "win1", &trackbarVal ,maxVal , trackbarHandler);
Get the current trackbar position:
int pos = cvGetTrackbarPos("bar1","win1");Set the trackbar position:
cvSetTrackbarPos("bar1", "win1", 25);A sample OpenCv Program
Here is a sample OpenCv program that captures frames from camera and display it in a window.
CameraCapture.c:
#include "cv.h" #include "highgui.h" #include <stdio.h> // A Simple Camera Capture Program // Create a window in which the captured images will be presented // Show the image captured from the camera in the window and repeat cvShowImage( "capWindow", frame ); //If ESC key pressed, Key=0x10001B // Always Release the capture device and Destroy the window |
As we see above to capture images from the camera, firstly we initialized the camera device via CvCapture and with the cvCaptureFromCam(0) we choose to grab the images from the local camera connected to computer. Then we checked the capture object if the program could detect a camera or not for capturing purpose.
We created a window by the cvNamedWindow() function which takes 2 parameters. First one is the name of the window and the second one is the size of the window.
In the while(1) loop we grabbed images from the camera by the cvQueryFrame() function which takes the CvCapture object and check if the frame is null. If frame is not null then we displayed the frame in the window by cvShowImage() which takes the name of the window that the image will be shown at and the IplImage object.
At the end of the program we released the CvCapture object and destroyed the window.
Physics and Mathematics behind the Harmonics
The following links are very useful for learning string harmonics:
Harmonic string vibrations
Understanding Harmonics
Strings, standing waves and harmonics
And a video:
Natural Harmonics
Guitar Modding

Emg 81 and 85 have very heavy tones in the distortion mode and I use Artec Vintage to get softer overdrive tones.
And I will paint some figures on the keyboard of the guitar.
Where do the Tech company's names come from
Adobe - Came from name of the river Adobe Creek that ran behind the house of founder John Warnock.
Apache - It got its name because its founders got started by applying patches to code written for NCSA’s httpd daemon. The result was ‘A PAtCHy’ server -– thus, the name Apache.
Apple Computers - Steve Jobs was three months late in filing a name for the business because he didn’t get any better name for his new company. So one day he told to the staff: “If I’ll not get better name by 5 o’clock today, our company’s name will be anything he likes…” So at 5 o’clcok nobody come up with better name, and he was eating Apple that time… so he keep the name of the company ‘Apple Computers’.
CISCO - Its not an acronym but the short for San Francisco.
Computer could not recognized the Ext Hdd problem
A hungry mind
Site url: A Hungry mind
Some Important Keyboard Shortcuts
Here are some important keyboard shortcuts which may increase your speed while you are using Windows XP:
Windows system key combinations
| • | F1: Help |
| • | CTRL+ESC: Open Start menu |
| • | ALT+TAB: Switch between open programs |
| • | ALT+F4: Quit program |
| • | SHIFT+DELETE: Delete item permanently |
Windows program key combinations
| • | CTRL+C: Copy |
| • | CTRL+X: Cut |
| • | CTRL+V: Paste |
| • | CTRL+Z: Undo |
| • | CTRL+B: Bold |
| • | CTRL+U: Underline |
| • | CTRL+I: Italic |
Mouse click/keyboard modifier combinations for shell objects
| • | SHIFT+right click: Displays a shortcut menu containing alternative commands |
| • | SHIFT+double click: Runs the alternate default command (the second item on the menu) |
| • | ALT+double click: Displays properties |
| • | SHIFT+DELETE: Deletes an item immediately without placing it in the Recycle Bin |
General keyboard-only commands
| • | F1: Starts Windows Help |
| • | F10: Activates menu bar options |
| • | SHIFT+F10 Opens a shortcut menu for the selected item (this is the same as right-clicking an object |
| • | CTRL+ESC: Opens the Start menu (use the ARROW keys to select an item) |
| • | CTRL+ESC or ESC: Selects the Start button (press TAB to select the taskbar, or press SHIFT+F10 for a context menu) |
| • | ALT+DOWN ARROW: Opens a drop-down list box |
| • | ALT+TAB: Switch to another running program (hold down the ALT key and then press the TAB key to view the task-switching window) |
| • | SHIFT: Press and hold down the SHIFT key while you insert a CD-ROM to bypass the automatic-run feature |
| • | ALT+SPACE: Displays the main window's System menu (from the System menu, you can restore, move, resize, minimize, maximize, or close the window) |
| • | ALT+- (ALT+hyphen): Displays the Multiple Document Interface (MDI) child window's System menu (from the MDI child window's System menu, you can restore, move, resize, minimize, maximize, or close the child window) |
| • | CTRL+TAB: Switch to the next child window of a Multiple Document Interface (MDI) program |
| • | ALT+underlined letter in menu: Opens the menu |
| • | ALT+F4: Closes the current window |
| • | CTRL+F4: Closes the current Multiple Document Interface (MDI) window |
| • | ALT+F6: Switch between multiple windows in the same program (for example, when the Notepad Find dialog box is displayed, ALT+F6 switches between the Find dialog box and the main Notepad window) |
Shell objects and general folder/Windows Explorer shortcuts
For a selected object:| • | F2: Rename object |
| • | F3: Find all files |
| • | CTRL+X: Cut |
| • | CTRL+C: Copy |
| • | CTRL+V: Paste |
| • | SHIFT+DELETE: Delete selection immediately, without moving the item to the Recycle Bin |
| • | ALT+ENTER: Open the properties for the selected object |
To copy a file
Press and hold down the CTRL key while you drag the file to another folder.To create a shortcut
Press and hold down CTRL+SHIFT while you drag a file to the desktop or a folder.General folder/shortcut control
| • | F4: Selects the Go To A Different Folder box and moves down the entries in the box (if the toolbar is active in Windows Explorer) |
| • | F5: Refreshes the current window. |
| • | F6: Moves among panes in Windows Explorer |
| • | CTRL+G: Opens the Go To Folder tool (in Windows 95 Windows Explorer only) |
| • | CTRL+Z: Undo the last command |
| • | CTRL+A: Select all the items in the current window |
| • | BACKSPACE: Switch to the parent folder |
| • | SHIFT+click+Close button: For folders, close the current folder plus all parent folders |
Windows Explorer tree control
| • | Numeric Keypad *: Expands everything under the current selection |
| • | Numeric Keypad +: Expands the current selection |
| • | Numeric Keypad -: Collapses the current selection. |
| • | RIGHT ARROW: Expands the current selection if it is not expanded, otherwise goes to the first child |
| • | LEFT ARROW: Collapses the current selection if it is expanded, otherwise goes to the parent |
Properties control
| • | CTRL+TAB/CTRL+SHIFT+TAB: Move through the property tabs |
| • | Press SHIFT five times: Toggles StickyKeys on and off |
| • | Press down and hold the right SHIFT key for eight seconds: Toggles FilterKeys on and off |
| • | Press down and hold the NUM LOCK key for five seconds: Toggles ToggleKeys on and off |
| • | Left ALT+left SHIFT+NUM LOCK: Toggles MouseKeys on and off |
| • | Left ALT+left SHIFT+PRINT SCREEN: Toggles high contrast on and off |
Microsoft Natural Keyboard keys
| • | Windows Logo: Start menu |
| • | Windows Logo+R: Run dialog box |
| • | Windows Logo+M: Minimize all |
| • | SHIFT+Windows Logo+M: Undo minimize all |
| • | Windows Logo+F1: Help |
| • | Windows Logo+E: Windows Explorer |
| • | Windows Logo+F: Find files or folders |
| • | Windows Logo+D: Minimizes all open windows and displays the desktop |
| • | CTRL+Windows Logo+F: Find computer |
| • | CTRL+Windows Logo+TAB: Moves focus from Start, to the Quick Launch toolbar, to the system tray (use RIGHT ARROW or LEFT ARROW to move focus to items on the Quick Launch toolbar and the system tray) |
| • | Windows Logo+TAB: Cycle through taskbar buttons |
| • | Windows Logo+Break: System Properties dialog box |
| • | Application key: Displays a shortcut menu for the selected item |
Microsoft Natural Keyboard with IntelliType software installed
| • | Windows Logo+L: Log off Windows |
| • | Windows Logo+P: Starts Print Manager |
| • | Windows Logo+C: Opens Control Panel |
| • | Windows Logo+V: Starts Clipboard |
| • | Windows Logo+K: Opens Keyboard Properties dialog box |
| • | Windows Logo+I: Opens Mouse Properties dialog box |
| • | Windows Logo+A: Starts Accessibility Options (if installed) |
| • | Windows Logo+SPACEBAR: Displays the list of Microsoft IntelliType shortcut keys |
| • | Windows Logo+S: Toggles CAPS LOCK on and off |
Dialog box keyboard commands
| • | TAB: Move to the next control in the dialog box |
| • | SHIFT+TAB: Move to the previous control in the dialog box |
| • | SPACEBAR: If the current control is a button, this clicks the button. If the current control is a check box, this toggles the check box. If the current control is an option, this selects the option. |
| • | ENTER: Equivalent to clicking the selected button (the button with the outline) |
| • | ESC: Equivalent to clicking the Cancel button |
| • | ALT+underlined letter in dialog box item: Move to the corresponding item |
An old article remind me some important points
Link:
www.norvig.com/21-days.html
Models Of Software Acceptance
www.dreamsongs.com/NewFiles/AcceptanceModels.pdf
There is also an ebook about patterns in software by the same author:
www.dreamsongs.com/NewFiles/PatternsOfSoftware.pdf
