working with fastHOG; moving towards fast object detection

July 9, 2013 Leave a comment

Although HOG calculations don’t take much portion of time when running object detectors, but the dot products do. Sending HOG pyramid to the GPU steals away all the benefits of calculating dot product on GPU, only way is to calculate HOG also on GPU for different scales of pyramid.

Therefore I am trying to fastHOG. It requires quite a bit of libraries.

one of the libray is FLTK

if you don’t want to put it in the default location (which might be restricted) the following will help make install prefix=New_Dictionary_location

or you can set up through configure file

./configure –bindir=/location/fltk/bin –libdir=/location/fltk/lib –includedir=/location/fltk/include/ –prefix=/location/fltk

Categories: Uncategorized Tags: , ,

C++ Using template type to make decision about how to extend class

June 4, 2013 Leave a comment

so the problem was a follow, I had a parent template class and as usual template child class extended from the parent class. Objective was depending upon what type of the Child class to select the type of the parent template.

Therefore went looking for how to pick up the  type of the variable depending upon the template. Found this really nice post. http://stackoverflow.com/questions/8243134/c-templates-select-different-type-based-on-value-of-template-parameter

Using information in it and little experimentation following code shows how to do it.

//============================================================================
// Name        : forTestingAndTrying.cpp
// Author      : Mohsen Ali
// Version     :
// Copyright   : use freely on your own risk, but contribute
// Description : testing template
//============================================================================
#include <iostream>
#include <type_traits>
using namespace std;

/*Parent Class*/
template<typename T>
struct parentMe{
T myData;
void print(void){
cout << "parentMe datasize " << sizeof(myData) <<endl;
}

};

template<bool B>
struct stUseless: parentMe<typename std::conditional<B, double, float>::type>{
typedef typename std::conditional<B, char, int>::type T;
typedef typename std::conditional<B, double, float>::type T2;

T dat;
void print(){
cout <<"Size is " <<  sizeof(dat) <<endl;
parentMe<T2>::print();
cout <<" --------------------  " <<  endl;
}
};

int main() {
stUseless<false> a;
a.print();

stUseless<true> b;
b.print();

cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}

and the output is below

Size is 4
parentMe datasize 4
——————–
Size is 1
parentMe datasize 8
——————–
!!!Hello World!!!

Categories: C++ Tags: , , ,

jsoncpp writing back the structures and arrays

May 24, 2013 Leave a comment

Well successfully read the json file of the matlab mat structure. Lots of things to care of, not as simple as it looks.

Now writing back, that is taking the C++ class, structure and basic data types and outputting a json structure. Since I have already written the reader to the writer should match the reader’s expectation.

This one is quite decent information and advice on how to design class for such activity. http://www.danielsoltyka.com/programming/2011/04/15/simple-class-serialization-with-jsoncpp/

 

Will follow the writing part now and later will try to implement the reader in much more structured way.

Categories: C++, code, jsoncpp Tags: , , , ,

parsing jason nested array using jsoncpp

May 22, 2013 Leave a comment

so first experiments with the json and json cpp.

the json string is as follow

{“id”: 1,”tags”: [ [800, 99.7], [], [76] ],”stock”: {“warehouse”: 300,”retail”: 20}}

Wanted to read the nested arrays of “tags” as you can see such an array could be e.g. cell datatype in the matlab or could be represented as the array of vectors

int main (){</pre>
unsigned int i,j;
char fileName[] ="abc.json";

ifstream infile;
infile.exceptions (ios::failbit|ios::badbit);
try
{
infile.open (fileName);
}
catch (ifstream::failure& e)
{
cerr<<"\n Exception opening file "<<fileName<<": "<<e.what ();
return 0;
}

string input;
Json::Reader reader;
Json::Value root;
bool parsingSuccessful;

try
{
while (getline (infile,input,'\n'))
{
if (false == (parsingSuccessful = reader.parse (input,root)))
{
cerr<<"\nFailed to parse configuration:"
<<reader.getFormatedErrorMessages ();
return 0;
}
else
{

int verbName = root.get ("id","").asInt ();
Json::Value data = root.get ("tags",0);
cout << "size is " << data.size() <<endl;

//vector<float> freq (mWidth * mHeight);
for (int i = 0; i < data.size(); i++){
int sizeint = data[i].size();
cout <<endl <<"---------------" <<endl;
cout << "Size of individual is " <<sizeint << endl;
Json::Value dat1 = data[i];

for(int j=0; j< dat1.size(); j++){
cout << dat1[j].asDouble() << " ,";
}

}
}
}
}
catch (ifstream::failure& e)
{

}

return 0;
}
<pre>
Categories: C++, code, jsoncpp, matlab Tags: , , , , , ,

matlab and OpenCV development kit

January 26, 2013 Leave a comment

mexopencv comes from Kota Yamaguchi. It is a development kit which is collection of mex functions for bridging matlab and OpenCV. I have not used it till now, but it looks easy to use. Especially interesting to me is it provides the data conversion utility to transfer matlab data to OpenCV datatypes, so one can use them to write their own mex functions. 

So do use and provide feed back. 

 

http://www.cs.stonybrook.edu/~kyamagu/mexopencv/

Categories: Uncategorized Tags: ,

2012 in review

January 2, 2013 Leave a comment

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 23,000 views in 2012. If each view were a film, this blog would power 5 Film Festivals

Click here to see the complete report.

Categories: Uncategorized

Running Makefile on the Windows

August 1, 2012 Leave a comment

There are many ways to run make program on the Windows, many of them will ask you to run in cygwin or similar shells. I was interested in running the makefile in the Windows so that the application generated could be used by the other Windows programs.
So the solution is to use the Visual Studio Command Prompt, run it, cd to the directory where the makefile is and then use the following

nmake -f Makefile

If the Makefile is using g++ or gcc in it you have to change it to “cl”, this the compiler being used by the VC. You might have to make little changes but then it should work fine.

 

Have a look at following

http://stackoverflow.com/questions/2532234/how-to-run-a-makefile-in-windows

 

Categories: C++, code Tags: , , , ,
Follow

Get every new post delivered to your Inbox.