Negative unread mails in Yahoo! %<:?

Today while I was trying to access my Yahoo webmail account, suprisingly after reading some mails, I met this strange behaviour from Yahoo Mail:


Then I suddenly recognized another unread mail and when I click on it, I came upon with this screen :This is a both scary and funny ; but probably occured because of a bug in yahoo. Oh my god -2 unread mail is this an Illusion? :D



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

http://www.intel.com/technology/computing/opencv/ and can be downloaded from the Sourceforge Page: http://sourceforge.net/projects/opencvlibrary/

Some Features of OpenCv:


  1. Image data manipulation (allocation, release, copying, setting, conversion).

  2. Image and video I/O (file and camera based input, image/video file output).

  3. Matrix and vector manipulation and linear algebra routines (products, solvers, eigenvalues, SVD).

  4. Various dynamic data structures (lists, queues, sets, trees, graphs).

  5. Basic image processing (filtering, edge detection, corner detection, sampling and interpolation, color conversion, morphological operations, histograms, image pyramids).

  6. Structural analysis (connected components, contour processing, distance transform, various moments, template matching, Hough transform, polygonal approximation, line fitting, ellipse fitting, Delaunay triangulation).

  7. Camera calibration (finding and tracking calibration patterns, calibration, fundamental matrix estimation, homography estimation, stereo correspondence).

  8. Motion analysis (optical flow, motion segmentation, tracking).

  9. Object recognition (eigen-methods, HMM).

  10. Basic GUI (display image/video, keyboard and mouse handling, scroll-bars).

  11. 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
-- int nChannels;
// Number of color channels (1,2,3,4)

-- int depth; // Pixel depth in bits:
// IPL_DEPTH_8U, IPL_DEPTH_8S,
// IPL_DEPTH_16U,IPL_DEPTH_16S,
// IPL_DEPTH_32S,IPL_DEPTH_32F,
                    //   IPL_DEPTH_64F
-- int width; // image width in pixels
-- int height; // image height in pixels
  -- char* imageData;// pointer to aligned image data
   // Note that color images are stored in BGR order
-- int dataOrder;// 0 - interleaved color channels,
// 1 - separate color channels
// cvCreateImage can only create interleaved images
-- int origin; // 0 - top-left origin,
// 1 - bottom-left origin (Windows bitmaps style)
-- int widthStep;
// size of aligned image row in bytes
-- int imageSize;
// image data size in bytes = height*widthStep

-- struct _IplROI *roi;
 // image ROI. when not NULL specifies image
// region to be processed.
-- char *imageDataOrigin;
// pointer to the unaligned origin of image data
// (needed for correct image deallocation)

-- int align;
// Alignment of image rows: 4 or 8 byte alignment
// OpenCV ignores this and uses widthStep instead
  -- char colorModel[4];
//Color model-ignored by OpenCV

Matrices and vectors

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

-- int step; // full row length in bytes


-- int rows, cols; // dimensions
-- int height, width;
// alternative dimensions reference

-- union data;

      -- uchar*  ptr;    
 // data pointer for an unsigned char matrix
-- short* s;
// data pointer for a short matrix
-- int* i;
// data pointer for an integer matrix
-- float* fl;
// data pointer for a float matrix
-- double* db;
// data pointer for a double matrix
CvMatND // N-dimensional array
  -- int   type;          
// elements type 
//(uchar,short,int,float,double) and flags

-- int dims;// number of array dimensions
  -- union data;
-- uchar* ptr;
// data pointer for an unsigned char matrix
-- short* s;
// data pointer for a short matrix
-- int* i;
// data pointer for an integer matrix
-- float* fl;
// data pointer for a float matrix
     -- double* db;      
// data pointer for a double matrix
  
  -- struct dim[];       
// information for each dimension
-- size;
// number of elements in a given dimension
      -- step;           
//distance between elements in a given dimension

CvSparseMat // SPARSE N-dimensional array

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
// function accepts arrays of more than a single type,
//such as: IplImage*, CvMat* or even CvSeq*. The
// particular array type is determined at
// runtime by analyzing the first 4 bytes of the
//header of the actual array.

Scalars:

CvScalar
  -- double val[4]; //4D vector



Initializer function:

CvScalar s = cvScalar(double val0, double val1=0, double val2=0, double val3=0);
Example:

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);
cvMoveWindow("win1", 100, 100);
// 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 pixels



Input 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

int main() {

//Initializing the capture from camera

CvCapture* capture = cvCaptureFromCAM(0); // capture from video device #0

if( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();

return -1;

}

// Create a window in which the captured images will be presented

cvNamedWindow( "capWindow", CV_WINDOW_AUTOSIZE );

// Show the image captured from the camera in the window and repeat

while( 1 ) {

// Get one frame
IplImage* frame = cvQueryFrame( capture );
//Check that if we captured the frame if we could not capture any frame display error!
if( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;

}

cvShowImage( "capWindow", frame );

// Do not release the frame!

//If ESC key pressed, Key=0x10001B

//remove higher bits using AND operator

if( (cvWaitKey(10) & 255) == 27 ) break;

}

// Always Release the capture device and Destroy the window

cvReleaseCapture( &capture );

cvDestroyWindow( "capWindow" );

return 0;

}




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

Harmonics are the one of the hardest thing that the most of the musicians experiences diffuculties to master at. But I think, if you want to play and use harmonics easily, knowing the both physics and mathematics lie behind them will make you learn those faster.

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

Here is my Ibanez guitar with its stock pickups on it:







Here is my Ibanez guitar with the Emg Zakk Wylde series active pickups and Artec Vintage in the middle:

Emg 81 and 85 have very heavy tones in the distortion mode and I use Artec Vintage to get softer overdrive tones.

Let's look closer to the pickups:



Emg 81 at the bridge and Emg 85 is at the head position.

The next thing that I will add to my gears is the following pickguard.


And I will paint some figures on the keyboard of the guitar.

Where do the Tech company's names come from

Here are some tech companies and the short stories lie behind their names:

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

Today I bought a 300 Seagate Ide HDD with 16 mb cache and a USB 2.0 External Box. I placed the HDD into the Box (But before of that I configured the jumpers and set the HDD to Master.Don't forget to do that.) When i connected the ext. hdd to the pc computer recognized the hdd(I can see the it in the device manager) but i can not see the it in the my computer. Then suddenly thunders sparkled in my mind and i remembered that i did not formatted the disk.It was a brand new disc and was in a raw format so it has no drive letter ;but i was disappointed that i will have to reopen the HDD Case and connect the HDD inside the Pc with the IDE cable.When I do the following: 'Right click My Computer>Manage>Disk Management' i can not see the drive letter ;but i can see the disk is listed in the Graph chart and right click on my ext hdd , format it from there.I was really satisfied of the result.Because i was saved from very troublesome job(For a lazy people like me.May be there are some people who can enjoy to reopen the case and connect to the PC and find it easier. :) All the generalizations are wrong.)

A hungry mind

Now I am working on a web site.Where i will put my projects and etc. It will be on air soon.Sorry may be it has a bad design and a bit slow ;but i could not spend much time for those stuffs;but in time it will have a better design.There will also be articles about art and science.
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

Accessibility shortcuts


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

I've read the Norvig's article again and relearned that there is a very long road to pass for me .

Link:
www.norvig.com/21-days.html

Models Of Software Acceptance

Here is a very good whitepaper by Richard P. Gabriel about software acceptance by users in the market :
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