Ask Your Question

Yasmin93's profile - activity

2014-05-07 17:10:26 -0600 commented question image moment normalization

well actually i am not copying anything , i am trying to understand a method in the thesis , and i put the link only if more info is needed ! and i provided the number f pages and another equations that if found from a book .

2014-05-07 00:01:58 -0600 asked a question image moment normalization

I am doing a sign language to voice recognition ,i am using normalized moments to compare databse images and captured frame , moments are used to calculate the orientation of the image and rotate it so that between orientation and reference angle there's a 5 degree difference ,i am following the method in this thesis link text more explaination of normalizarion is from page 28 to 30 .

The problem is when i am trying to implement the code the results are as follows inputapplying contrast and thresholding first rotation and flipping !second rotation3rd rotation

when trying to compare the final result with an image captured by subtracting pixels and defining a threshold value of 80 percent , only input images which are the same give the correct answer , so the problem is in the normalization part but i can't identify how to improve it

this is the normalization method ::


   int normalize2 (const char * imageDB) 
{ 
FILE *fp; 
IplImage* pic1=0 , *pic2=0 , *tempT=0, *tempDB=0 , *temp3=0 , *temp4=0; 
double u11 , u20 , u02 , theta1=0 , compare=0, theta2=0 , theta3=0 , theta=0, ratio=0; 
//int h= 100 , w= 100 ;          // Parameters needed for rotation 
int a=0 , bright=0 , pixel1 =0 , pixel2 =0; 
int threshold = 80 , id=0 , i=0; 
CvMoments moments; 


cvNamedWindow("Tobe_Modified",1); 
cvMoveWindow( "Tobe_Modified", 0, 50); 
cvNamedWindow("final",1); 
cvMoveWindow( "final", 500, 50); 
cvNamedWindow("compare",1);
cvMoveWindow( "compare", 250, 400);


 imageDB="hand.jpg";   

const char * name=0; 

pic2 = cvLoadImage(imageDB,0); 
tempDB = cvCreateImage( cvGetSize(pic2), IPL_DEPTH_8U, 1 ); 
tempDB = cvLoadImage(imageDB,0); 
//cvResize(tempT,tempDB, CV_INTER_AREA);  // Normalize SIZE to standard size of Temp2
int w= cvGetSize(pic2).width/2;    //Set rotation axes from size of image 
int h=cvGetSize(pic2).height/2;


cout<<"widthis"<<w<<"heght is "<<h<<endl;

cvSmooth(tempDB,tempDB,CV_GAUSSIAN,1,1);
ContrastBrightness(tempDB,40,10);
cvThreshold(tempDB,tempDB,100,255,CV_THRESH_BINARY);
cvSaveImage("afternorm.jpg",tempDB);
int f= cvCountNonZero(tempDB);
cout<<f<<"Non Zero Pixels in TEST"<<endl;
GetRotatedImage(tempDB,0,h,w);

cout<<"done first rotation\n"<<endl;

cvSaveImage("FirstRotation.jpg",tempDB);

cvFlip(tempDB,tempDB);
theta1=0;
cout<<"Angle of first image "<<theta1<<endl;

cvShowImage("Tobe_Modified",tempDB);
cvMoments( tempDB, &moments, 1 );   

u11=cvGetCentralMoment( &moments, 1,1 ); 
u20=cvGetCentralMoment( &moments, 2,0 ); 
u02=cvGetCentralMoment( &moments, 0,2 ); 
/////////////////////////////////////// EQ 1 //////////////////////////////////////////////////
theta=2*u11/(u20-u02); 

cout <<" The ANGLE theta in radians  = " <<theta <<endl; 
theta = 180*theta/pi;
cout <<" The ANGLE theta in degree  = " <<theta <<endl; 

if ((theta >=0) & (theta <=pi)) {
//Page 65of 83 
theta2 = 0.5*atan(2*u11/(u20-u02));
cout<<"1"<<endl;
cout<<theta2<<"theta2 in radians in 1st cond"<<endl;
}
else {
if ((theta > pi) & (theta < 1.5*pi)) {
    cout<<"2"<<endl;
    theta2 = 0.5*(atan(2*u11/(u20-u02)) + pi);
cout<<theta2<<"theta2 in radians in 2nd cond"<<endl;
}
else{ 
    cout<<"3"<<endl;
theta2 = 0.5*(atan(2*u11/(u20-u02))+2*pi) ; 
cout<<theta2<<"theta2 in radians in 3rd cond"<<endl;
 }

}
theta2 = 180*theta2/pi;
cout <<"angle theta2 of secnod image in degrees = " <<theta2 <<endl; 


while ( (theta2-theta1 > 3 || theta2-theta1 <- 3) & (a < 360) || (theta1>0) & 
(theta2<0) || (theta1<0) & (theta2>0)) 
{ 
    printf("error b4 2nd rota \n");
tempDB ...
(more)
2014-04-28 03:52:03 -0600 asked a question Unrecognized Array type in cvGetMAt ,Moment Normalization

I am trying to understand and run this function of moment normalization for hand gesture recognition ,however i am getting this error unrecognized or unsupported Array type in function cvGetMAt or cvGetSIze , i think it is something with input to the function normalize2 it take char* test , in the main i called it with normalize2("hand.jpg") ,

It loads successfuly so this isn't the problem, and i also tried different images with jpg structute but it didn't help .

PART OF NORMALIZE Function int normalize2 (char * test) { FILE fp; IplImage pic1=0 , *pic2=0 , *temp1=0, *temp2=0 , *temp3=0 , *temp4=0; double u11 , u20 , u02 , theta1=0 , compare=0, theta2=0 , theta3=0 , theta=0, ratio=0; int h= 100 , w= 100 ; // Parameters needed for rotation int a=0 , bright=0 , pixel1 =0 , pixel2 =0; int threshold = 80 , id=0 , i=0;

char * imageDB="hands.jpg"; //Any image with standard size in DB test="hands.jpg"; //name of captured image to be tested with images in DB char * name=0;

cvNamedWindow("show",1); cvShowImage("show",test); CvMoments moments;

cvNamedWindow("Tobe_Modified",1); cvMoveWindow( "Tobe_Modified", 0, 50); cvNamedWindow("final",1); cvMoveWindow( "final", 500, 50); cvNamedWindow("compare",1); cvMoveWindow( "compare", 250, 400);

pic1 = cvLoadImage( test,0); //Size of captured image pic2 = cvLoadImage( test,0); //Size of standard-size image in dB(Standard)

w=cvGetSize(pic2).width/2; //Set rotation axes from size of image h=cvGetSize(pic2).width/2;

temp1 = cvCreateImage( cvGetSize(pic1), IPL_DEPTH_8U, 1 );

temp1 = cvLoadImage( test,0);

cvResize( temp1,temp2, CV_INTER_NN ); // Normalize SIZE to standard size of Temp2 temp3 = cvCreateImage( cvGetSize(temp2), IPL_DEPTH_8U, 1 ); temp4 = cvCreateImage( cvGetSize(temp2), IPL_DEPTH_8U, 3 );

Blockquote

Main

int main(int argc, char* argv) { IplImage img = cvLoadImage("hand.jpg");

if (!img) {

cout <<"NOT LOADED= "<<endl; return="" 1;="" }else="" {="" cout="" &lt;&lt;"loaded="" "="" &lt;<endl;="" normalize2("hand.jpg");="" }="" cvreleaseimage(&amp;img);<="" p="">

return 0; }

2014-04-19 12:29:41 -0600 asked a question Visual studio 2012 closes immediately

I know this question is asked before but i tried all solutions and it didn't work out in my case , from changing properties linker system adding cvwaity() key all didn't work , also ctrl +f5 didn't work , so can you please help , i need to go on with my project and this is making me late .

the windows opens and closes immediately , sometimes it opens and stays and then when i try running again and it goes back to the habit of closing immediately

//Code for hand detection and tracking;

include <iostream>

include "opencv/cv.h"

include "opencv/highgui.h"

using namespace std;

IplImage image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0,back = 0, back2 = 0,image2 = 0,image3 = 0,bg = 0; CvHistogram *hist = 0;

//IplImage * ContrastBrightness(IplImage *, int , int ); int backproject_mode = 0; int select_object = 0; int track_object = 0; int show_hist = 1;

CvPoint origin; CvPoint RECT1; CvPoint RECT2; CvPoint p1; CvPoint p2;

CvRect selection; CvRect track_window; CvRect roiS; //Rect for size of ROI

CvBox2D track_box;

CvConnectedComp track_comp;

int hdims = 16; float hranges_arr[] = {0,180}; float* hranges = hranges_arr; int vmin = 10, vmax = 256, smin = 30; int area=0; int contrast=100, bright=50,smooth=7; double x,y,h,w;

void on_mouse( int event, int x, int y, int flags, void* param ) { if( !image ) return; if( image->origin ) y = image->height - y;

if( select_object ) { selection.x = MIN(x,origin.x); selection.y = MIN(y,origin.y); selection.width = selection.x + CV_IABS(x - origin.x); selection.height = selection.y + CV_IABS(y - origin.y); selection.x = MAX( selection.x, 0 ); selection.y = MAX( selection.y, 0 ); selection.width = MIN( selection.width, image->width ); selection.height = MIN( selection.height, image->height ); selection.width -= selection.x; selection.height -= selection.y; } switch( event ) { //on left mouse click ,mark as origin and intialize rectangle case CV_EVENT_LBUTTONDOWN: origin = cvPoint(x,y); selection = cvRect(x,y,0,0); select_object = 1; break; case CV_EVENT_LBUTTONUP: select_object = 0; if( selection.width > 0 && selection.height > 0 ) track_object = -1; break; } } //Page 61of 83 //Audible Sign Language FYP Report- Spring 2006 CvScalar hsv2rgb( float hue ) { int rgb[3], p, sector; static const int sector_data[][3]= {{0,2,1}, {1,2,0}, {1,0,2}, {2,0,1}, {2,1,0}, {0,1,2}}; hue = 0.033333333333333333333333333333333f; sector = cvFloor(hue); p = cvRound(255(hue - sector)); p ^= sector & 1 ? 255 : 0; rgb[sector_data[sector][0]] = 255; rgb[sector_data[sector][1]] = 0; rgb[sector_data[sector][2]] = p; return cvScalar(rgb[2], rgb[1], rgb[0],0); } int main( int argc, char** argv ) {

CvCapture* capture = 0; capture = cvCaptureFromCAM(0); //creating 3 windows and co controlling their position cvNamedWindow( "CamShiftDemo", 1 ); cvMoveWindow( "CamShiftDemo", 335, 100 ); cvNamedWindow( "ROI", 1 ); cvMoveWindow( "ROI", 10, 100 ); cvNamedWindow( "grey", 1 ); cvMoveWindow( "grey", 670, 100 );

bg=cvLoadImage ("bg.jpg",1);

//C++: void setMouseCallback(const string& winname, MouseCallback onMouse, void* userdata=0 ) //cvSetMouseCallback( "CamShiftDemo", on_mouse, 0 );

//C++: int createTrackbar(const string& trackbarname, const string& winname, int* value Optional pointer to an integer variable whose value reflects the position of the slider ... (more)

2014-04-14 18:37:25 -0600 answered a question background subtraction help

check this out link text

2014-04-14 18:14:52 -0600 received badge  Supporter (source)
2014-04-10 18:41:01 -0600 answered a question hand detect -android

Hello can you please inform me where did u reach in this project and provide help Thank u

2014-04-05 14:30:54 -0600 commented question OpenCV Image blob detection and Gesture support on Android

Hello Did u reach any finding , can you please share Thanks

2014-04-05 12:08:54 -0600 commented answer opencv4android - hand detection using viola jones (haar cascade)

Hello , Can you please share the links or if you find anything that could help this is my project too . Thanks

2014-04-05 10:43:27 -0600 received badge  Editor (source)
2014-04-05 10:42:37 -0600 asked a question HelloOpencvAndroid Error

Hello , I am a newbie for both android and OpenCv , My project is Gesture recognition I started with the helloOpencV example here http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#dev-with-ocv-on-android

I imported Opencv and all the samples work with no errors , but when i try to do my own project i click android-properties-add-openCv library it gives a red X like this image description

Also any suggestions of steps i can to take to do my project as i feel clueless about it.

Thanks Alot