My first algorithm for blob detection was to read through all the pixels and find the bright spots. This was slow and no matter how I optimised my code, I was unable to go above 60fps. The bottle neck was the for loop that reads all the pixels.
As a result I changed it to use cvFindContours. This is much faster and after making some changes, I was able to go up to 120fps!
Then came a problem. I was detecting the same coordinates for 2-3 frames before the blob was detected in its new position. This effectively gave me many problems with new blobs and old blobs being generated instead of 1 blob moving across the screen.
A colleague of mine told me that he saw no problem with my code and he encountered this problem before. It is due to the motion compensation process in the video decoder and not opencv.
He worked around this by detecting and ignoring duplicate frames. Does anyone have any other ideas ?
Thursday, February 26, 2009
Use your mobile phone as a modem for your laptop
Recently I saw the advertisement on M1 that allows 50GB free of data on your mobile plan with a monthly subscription of S$22.42. It is slightly better than Singtel's plan which offers 30GB free for the same price. With 50GB, I figured I should use this plan to surf on the go on my laptop as well. I'm planning to buy the Sony Vaio P. :)
After subscribing, I need to set up my HTC Touch Diamond to be a modem to surf with my laptop through my phone. Below are the steps to connect via your mobile phone. :)
Make sure you have ActiveSync installed on your PC if you are using Windows XP or earlier. Windows Vista requires the Windows Mobile Device Center.
Open the Internet Sharing program and change the “Network Connection” to “Sunsurf Internet” using the drop down menu.
Finally, select “Connect” and you should see your laptop doing a device driver installation.
You’re now ready to browse the internet using your Windows mobile phone as a modem.
If your phone does not have the Internet sharing program, try the following:
First, use a registry editor such as PHM Regedit to delete the value \HKEY_LOCAL_MACHINE\Comm\InternetSharing\Settings\ForceCellConnection
Soft reset your device and you should see the internet sharing program have the option: "Network Connection"
After subscribing, I need to set up my HTC Touch Diamond to be a modem to surf with my laptop through my phone. Below are the steps to connect via your mobile phone. :)
Make sure you have ActiveSync installed on your PC if you are using Windows XP or earlier. Windows Vista requires the Windows Mobile Device Center.
Open the Internet Sharing program and change the “Network Connection” to “Sunsurf Internet” using the drop down menu.
Finally, select “Connect” and you should see your laptop doing a device driver installation.
You’re now ready to browse the internet using your Windows mobile phone as a modem.
If your phone does not have the Internet sharing program, try the following:
First, use a registry editor such as PHM Regedit to delete the value \HKEY_LOCAL_MACHINE\Comm\InternetSharing\Settings\ForceCellConnection
Soft reset your device and you should see the internet sharing program have the option: "Network Connection"
Thursday, January 22, 2009
Accept the person for who they are but recognise the need for change
The paradox of being in a relationship. Women often want their other half to accept them for who they are. However, it is the other half's responsibility to see that they continue to grow and be happy. This would include correcting and improving. In other words, trying to change them from what they are to what they should be. This creates a paradox, how can you accept your girlfriend or wife yet cause them to be a better person?
Love, Acceptance. Someone to support them, encourage them, be there for them regardless of success or failure.
Love, Acceptance. Someone to support them, encourage them, be there for them regardless of success or failure.
Friday, December 26, 2008
OpenCV read coordinates from cvFindContours
CvSeq* contour1 = 0;
cvThreshold( src, src, threshold, 255, CV_THRESH_BINARY );//convert to black and white
cvFindContours( src, storage, &contour, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
cvZero( dst );
contour1 = contour;
for( ; contour != 0; contour = contour->h_next )
{
cvDrawContours( dst, contour, CV_RGB(0,255,0), CV_RGB(255,255,0), -1, 1, 8 );
}
int maxLevel = 3;
CvTreeNodeIterator iterator;
CvPoint pt,pt1,pt2;
if(contour1 != 0)
cvInitTreeNodeIterator( &iterator, contour1, maxLevel );
int i = 0;
while( (contour1 = (CvSeq*)cvNextTreeNode( &iterator )) != 0 )
{
CvSeqReader reader;
int count = contour1->total;
cvStartReadSeq( contour1, &reader, 0 );
count -= !CV_IS_SEQ_CLOSED ( contour1 );
CV_READ_SEQ_ELEM ( pt, reader );
i++;
ptArray[i] = pt;
printf("coordinates%d: %d %d \n",i ,pt.x, pt.y);
cvRectangle( dst, pt, cvPoint(pt.x+2,pt.y+2) , CV_RGB(0,0,255), 1, 8, 0 );
}
// replace CV_FILLED with 1 to see the outlines
Taken from http://cv-kolaric.blogspot.com/ thanks SINISA KOLARIC :)
cvThreshold( src, src, threshold, 255, CV_THRESH_BINARY );//convert to black and white
cvFindContours( src, storage, &contour, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
cvZero( dst );
contour1 = contour;
for( ; contour != 0; contour = contour->h_next )
{
cvDrawContours( dst, contour, CV_RGB(0,255,0), CV_RGB(255,255,0), -1, 1, 8 );
}
int maxLevel = 3;
CvTreeNodeIterator iterator;
CvPoint pt,pt1,pt2;
if(contour1 != 0)
cvInitTreeNodeIterator( &iterator, contour1, maxLevel );
int i = 0;
while( (contour1 = (CvSeq*)cvNextTreeNode( &iterator )) != 0 )
{
CvSeqReader reader;
int count = contour1->total;
cvStartReadSeq( contour1, &reader, 0 );
count -= !CV_IS_SEQ_CLOSED ( contour1 );
CV_READ_SEQ_ELEM ( pt, reader );
i++;
ptArray[i] = pt;
printf("coordinates%d: %d %d \n",i ,pt.x, pt.y);
cvRectangle( dst, pt, cvPoint(pt.x+2,pt.y+2) , CV_RGB(0,0,255), 1, 8, 0 );
}
// replace CV_FILLED with 1 to see the outlines
Taken from http://cv-kolaric.blogspot.com/ thanks SINISA KOLARIC :)
Monday, December 22, 2008
Borderline personality disorder
Borderline personality disorder (BPD) is a psychiatric diagnosis in the Diagnostic and Statistical Manual of Mental Disorders (DSM-IV Personality Disorders 301.83) that describes a prolonged disturbance of personality function characterized by depth and variability of moods. The disorder typically involves unusual levels of instability in mood; "black and white" thinking, or "splitting"; chaotic and unstable interpersonal relationships, self-image, identity, and behavior; as well as a disturbance in the individual's sense of self. In extreme cases, this disturbance in the sense of self can lead to periods of dissociation. These disturbances can have a pervasive negative impact on many or all of the psychosocial facets of life. This includes difficulties maintaining relationships in work, home, and social settings. Attempted suicide and completed suicide are possible outcomes, especially without proper care and effective therapy. Onset of symptoms typically occurs during adolescence or young adulthood. Symptoms may persist for several years, but the majority of symptoms lessen in severity over time,with some individuals fully recovering. The mainstay of treatment is various forms of psychotherapy, although medication and other approaches may also improve symptoms.
Friday, December 5, 2008
Self Handicapping
Self-handicapping occurs when individuals anticipate failure on a self-relevant task and create impediments to success. Thus doing things that would increase the self-handicapper's risk of failure.
Why do people, given the availability of alternative self-protective strategies such as self-affirmation and self-evaluation maintenance that do not entail self-sabotage?
A hypothesis is that self-handicapping might serve a secondary purpose: to preserve a pleasant affective state.
1) Self-handicappers re protected from failure by ascribing poor performance to factors other than lack of ability.
2) People who succeed despite their handicaps earn extra credit for their success.
Therefore, self-handicappers discount ability attributions for failure but augment ability attributions following success.
Self-handicapping may lead to more positive mood.
Is mood an antecedent influence on self-handicapping?
Mood states play an important role in how people attribute success and failure.
Happy persons tend to take credit when doing well, but avoid self-blame when experiencing failure.
Sad persons took little credit for success, but blamed themselves when they did poorly.
Real-life relationships showed similar mood-induced bias.
Happy people rely on positive moods as a resource to help them deal with aversive but potentially useful negative feedback. However, when negative feedback is uninformative or unreliable, happy mood produces the opposite reaction, as people become protective of their positive moods.
Self-handicapping occurs when people doubt their ability and value of receiving further feedback is low.
Results show that non-contingent feedback induces greater self-handicapping than contingent positive feedback, as people who receive non-contingent feedback doubt that they can perform well again.
Happy participants did not self-handicap merely because they wanted to avoid effrt to maintain good mood, or experienced elevated tates of imulsiveness, situational self-esteem, or arousal. Therefore mood should directly influence the motivation to self-handicap.
Most people self-handicap defensively, to discount distressing self-attributions of failure, but not to improve existing aversive states.
Lifted from www.sciencedirect.com On being happy but fearing failure: The effects of mood on self-handicapping strategies
Why do people, given the availability of alternative self-protective strategies such as self-affirmation and self-evaluation maintenance that do not entail self-sabotage?
A hypothesis is that self-handicapping might serve a secondary purpose: to preserve a pleasant affective state.
1) Self-handicappers re protected from failure by ascribing poor performance to factors other than lack of ability.
2) People who succeed despite their handicaps earn extra credit for their success.
Therefore, self-handicappers discount ability attributions for failure but augment ability attributions following success.
Self-handicapping may lead to more positive mood.
Is mood an antecedent influence on self-handicapping?
Mood states play an important role in how people attribute success and failure.
Happy persons tend to take credit when doing well, but avoid self-blame when experiencing failure.
Sad persons took little credit for success, but blamed themselves when they did poorly.
Real-life relationships showed similar mood-induced bias.
Happy people rely on positive moods as a resource to help them deal with aversive but potentially useful negative feedback. However, when negative feedback is uninformative or unreliable, happy mood produces the opposite reaction, as people become protective of their positive moods.
Self-handicapping occurs when people doubt their ability and value of receiving further feedback is low.
Results show that non-contingent feedback induces greater self-handicapping than contingent positive feedback, as people who receive non-contingent feedback doubt that they can perform well again.
Happy participants did not self-handicap merely because they wanted to avoid effrt to maintain good mood, or experienced elevated tates of imulsiveness, situational self-esteem, or arousal. Therefore mood should directly influence the motivation to self-handicap.
Most people self-handicap defensively, to discount distressing self-attributions of failure, but not to improve existing aversive states.
Lifted from www.sciencedirect.com On being happy but fearing failure: The effects of mood on self-handicapping strategies
Thursday, November 27, 2008
Subscribe to:
Posts (Atom)
