Tuesday, July 22, 2008
Nsotalgic Dreams
Lately there has been a strange feeling lurking inside me. Usually I am not the type of person who will feel giddy about the past and want a return to the glory days. I am a firm believer of the "let by gones be bygones" phrase. But lately i have been getting this deja vu feeling so strongly in my mind. It is neither apparent nor obvious. But it has been lurking beneath the already murky waters of my mind for quite some time now. And recently and idea has been taking form inside my head. That something from the past, some feeling relationship, some colleague or some connecction is gonna come back and show me the past in a glorified state. And to add to all of this, it is the autumn now. That time of the year that winds start to get cooler. The times when the trees turn from green to gold and times when the twilight streams through the falling leaves and casts the long shadows of the past. I dont know where this is leading us nor do I knnow what will be there at the end of the road. But I smell adventure and feel the smell of the ripe fruit in the air. I know that it is coming though unseen yet. The world is young still, so lets just wait and see how things turn out. Viva La Vida.
Thursday, July 10, 2008
What we lost in the Fire
Molder said we could stay clam. Well we didnt loose anything important after all. It was just stuff. Yeah it was just stuff. Only it was not just stuff. We are fire-flies. On that island. We wreck our own plane and get ourselves stranded here. We wield the sticks and shout out now. The fireflies. The sinking hearts. Across the times we sail back to the lost generation. The breakers of the beam rise once again as the beast stands up to fight. What we lost in the fire may be nothing but it may eventually cost us everything. Sounds crytpic ? Well it was supposed to.
Finishing a Project
Guys we have been at work. Literally. The last 5 to 6 days have been very busy for me. It's been long and hard march but finally we have seen water and grass. I mean I had not touched VS2008 before this and have not seen any WPF app in action, only momentarily glanced at Expression (Blend for some of you) and didnt know a darn thing about battery testers. But the worst part of it was the architecture of the existing application. If I have ever seen an over-architected application worse than this, it is Word 2007. I mean the event handling was so complex that one perticular event cascaded in to 4 different events and went through 6 classes and 11 different methods. And yes I really did trace the whole execution as it was an event that i had to trigger and wanted to do some modifications on it. Thus I did try and trace it through. It was a NIGHTMARE. sorry for shouting but I had to. Anyways the good thing is that I have decided to put out the things that i see as the good practises in writing applications for testers. I guess this is going to be a kind of a "Applications for Driver Developers" kinda thing. See ya.
Wednesday, July 2, 2008
Two little gems
Hi guys, So been quiet for some time now and I have returned with some goodies for you. First of all I have been munching away at two problems now and have come up some interesting stuff
First of all a video saga. I have been wanting to extract frames out of an avi file and save any frame that I was interested in. For this we need to be able to see the movie entirely and select a a frame to save as a jpg or bmp. I created a simple solution for this I created a window with a trackbar in it and then set the trackbar maximum value to the no of frames encountered. And then the user is able to select the frame he want using the slider. When he selects a frame he has the option of selecting between saving it and exiting the programme. If you press space at anypoint then the image is saved with the frame number as the image name. Or if you press enter the program exits.
I will post the code in here. Please note that there is some borrowed code in here for calculating the no frames in here. I have since forgotten where the code was, but all the credit to the original writer for that.
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include
#include
int frameNumber;
IplImage *capFrame;
CvCapture *myCap;
int nFrames;
void CV_CDECL mainTrackCallBack(int pos){
if((pos > 0) && (pos <>
cvSetCaptureProperty(myCap, CV_CAP_PROP_POS_FRAMES, pos);
capFrame = cvQueryFrame(myCap);
cvShowImage("CaptureFrames", capFrame);
frameNumber = pos;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
char tempSize[4];
std::ifstream videoFile(L"C:\\car.avi", ios::in|ios::binary);
videoFile.seekg( 0x30 , ios::beg );
videoFile.read( tempSize , 4 );
nFrames = (unsigned char ) tempSize[0] + 0x100*(unsigned char ) tempSize[1] + 0x10000*(unsigned char ) tempSize[2] + 0x1000000*(unsigned char ) tempSize[3];
videoFile.close();
myCap = cvCaptureFromAVI("C:\\car.avi");
cvNamedWindow("CaptureFrames");
cvCreateTrackbar("FrameNumber", "CaptureFrames", &frameNumber, nFrames, mainTrackCallBack);
capFrame = cvQueryFrame(myCap);
cvShowImage("CaptureFrames", capFrame);
char fileName[100];
int keyPress;
frameNumber = 0;
while(1){
keyPress = cvWaitKey(500);
if(keyPress == 32){
_itoa_s(frameNumber, fileName, 200, 10);
int tempLen = strlen(fileName);
strcpy( fileName + tempLen, "Image.jpg");
cvSaveImage(fileName, capFrame);
}else if(keyPress == 13){
break;
}
}
return 0;
}
First of all a video saga. I have been wanting to extract frames out of an avi file and save any frame that I was interested in. For this we need to be able to see the movie entirely and select a a frame to save as a jpg or bmp. I created a simple solution for this I created a window with a trackbar in it and then set the trackbar maximum value to the no of frames encountered. And then the user is able to select the frame he want using the slider. When he selects a frame he has the option of selecting between saving it and exiting the programme. If you press space at anypoint then the image is saved with the frame number as the image name. Or if you press enter the program exits.
I will post the code in here. Please note that there is some borrowed code in here for calculating the no frames in here. I have since forgotten where the code was, but all the credit to the original writer for that.
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include
#include
int frameNumber;
IplImage *capFrame;
CvCapture *myCap;
int nFrames;
void CV_CDECL mainTrackCallBack(int pos){
if((pos > 0) && (pos <>
cvSetCaptureProperty(myCap, CV_CAP_PROP_POS_FRAMES, pos);
capFrame = cvQueryFrame(myCap);
cvShowImage("CaptureFrames", capFrame);
frameNumber = pos;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
char tempSize[4];
std::ifstream videoFile(L"C:\\car.avi", ios::in|ios::binary);
videoFile.seekg( 0x30 , ios::beg );
videoFile.read( tempSize , 4 );
nFrames = (unsigned char ) tempSize[0] + 0x100*(unsigned char ) tempSize[1] + 0x10000*(unsigned char ) tempSize[2] + 0x1000000*(unsigned char ) tempSize[3];
videoFile.close();
myCap = cvCaptureFromAVI("C:\\car.avi");
cvNamedWindow("CaptureFrames");
cvCreateTrackbar("FrameNumber", "CaptureFrames", &frameNumber, nFrames, mainTrackCallBack);
capFrame = cvQueryFrame(myCap);
cvShowImage("CaptureFrames", capFrame);
char fileName[100];
int keyPress;
frameNumber = 0;
while(1){
keyPress = cvWaitKey(500);
if(keyPress == 32){
_itoa_s(frameNumber, fileName, 200, 10);
int tempLen = strlen(fileName);
strcpy( fileName + tempLen, "Image.jpg");
cvSaveImage(fileName, capFrame);
}else if(keyPress == 13){
break;
}
}
return 0;
}
Subscribe to:
Comments (Atom)