<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>OpenCV</title>
	<atom:link href="http://opencv.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://opencv.wordpress.com</link>
	<description>Learning OpenCV</description>
	<lastBuildDate>Sat, 09 Feb 2008 21:48:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='opencv.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>OpenCV</title>
		<link>http://opencv.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://opencv.wordpress.com/osd.xml" title="OpenCV" />
	<atom:link rel='hub' href='http://opencv.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Face detection, Image warping, and trackbar</title>
		<link>http://opencv.wordpress.com/2008/02/09/face-detection-image-warping-and-trackbar/</link>
		<comments>http://opencv.wordpress.com/2008/02/09/face-detection-image-warping-and-trackbar/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 21:48:39 +0000</pubDate>
		<dc:creator>rmehran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://opencv.wordpress.com/2008/02/09/face-detection-image-warping-and-trackbar/</guid>
		<description><![CDATA[This is a sample program that demonstrates the how to use face detection, image warping, and trackbar GUI in OpenCV. Thanks to Bilal Orhan for providing his example code for image warping. (Download Source) // simple_face_detect_warp_trackbar.cpp : Defines the entry point for the console application. // #include &#8220;stdafx.h&#8221; #include &#60;cv.h&#62; #include &#60;highgui.h&#62; #include &#60;math.h&#62; #include [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=10&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a sample program that demonstrates the how to use face detection, image warping, and trackbar GUI in OpenCV. Thanks to <a href="http://server.cs.ucf.edu/%7Evision/" title="Bilal Orhan" id="pt1h">Bilal Orhan</a> for providing his example code for image warping.</p>
<p>(<a href="http://cs.ucf.edu/%7Eramin/simple_face_detect_warp_trackbar.cpp" title="ownload Source" id="y3av">Download Source</a>)</p>
<blockquote><p>// simple_face_detect_warp_trackbar.cpp : Defines the entry point for the console application.<br />
//</p>
<p>#include &#8220;stdafx.h&#8221;</p>
<p>#include &lt;cv.h&gt;<br />
#include &lt;highgui.h&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;string&gt;</p>
<p>static const double pi = 3.14159265358979323846;<br />
#define N 500</p>
<p>inline static double square(int a)<br />
{<br />
return a * a;<br />
}</p>
<p>int thresh = 11;<br />
double scale = 1;</p>
<p>// define a trackbar callback<br />
void on_trackbar(int h)<br />
{<br />
int b = h-11;<br />
if(b&lt;0)<br />
scale = -1.0/(b-1);<br />
else if(b&gt;0)<br />
scale = b*1.0+1;<br />
else<br />
scale = 1.0;<br />
printf(&#8220;scale %d\n&#8221;,b);<br />
}</p>
<p>// Create a string that contains the exact cascade name<br />
const char* cascade_name =<br />
&#8220;C:/Program Files/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml&#8221;;<br />
/*    &#8220;haarcascade_profileface.xml&#8221;;*/</p>
<p>// Function prototype for detecting and drawing an object from an image<br />
void detect_and_draw( IplImage* image , int scale,int min_neighbors,int min_size,IplImage* faceimg,  CvRect* tmprect );<br />
/*<br />
This will pop up a small box with &#8220;Hello World&#8221; as the text.<br />
@author: Gavin Page, gsp8334@cs.rit.edu<br />
@date: 28 November 2005<br />
*/<br />
int main( int argc, char** argv ) {</p>
<p>CvCapture* cap  = cvCaptureFromAVI(&#8220;C:\\Documents and Settings\\Ramin\\Desktop\\AVIPlayer\\VeryFunny_NEW.avi&#8221;);<br />
int count = 1;</p>
<p>IplImage* img1 = cvQueryFrame(cap);<br />
IplImage* img2 = cvQueryFrame(cap);<br />
IplImage* gim1 = cvCreateImage(cvSize(img1-&gt;width,img1-&gt;height),IPL_DEPTH_8U, 1);<br />
IplImage* gim2 = cvCreateImage(cvSize(img2-&gt;width,img2-&gt;height),IPL_DEPTH_8U, 1);</p>
<p>cvNamedWindow(&#8220;transformed&#8221;, 0);<br />
cvNamedWindow(&#8220;org&#8221;, 0);<br />
// create a toolbar<br />
cvCreateTrackbar(&#8220;param&#8221;, &#8220;org&#8221;, &amp;thresh, 21, on_trackbar);<br />
on_trackbar(11);<br />
int number_of_features = N;</p>
<p>img1 = cvQueryFrame(cap);<br />
IplImage* sframe;<br />
sframe = cvCreateImage(cvSize(img1-&gt;width/1,img1-&gt;height/1),img1-&gt;depth,img1-&gt;nChannels);</p>
<p>cvResize(img1,sframe);<br />
cvFlip(sframe,sframe,0);<br />
IplImage * faceimg = cvCreateImage(cvSize(sframe-&gt;width,sframe-&gt;height),sframe-&gt;depth,sframe-&gt;nChannels);<br />
CvRect * tmprect = new CvRect();</p>
<p>while(1){</p>
<p>img1 = cvQueryFrame(cap);<br />
cvResize(img1,sframe);<br />
cvFlip(sframe,sframe,0);<br />
detect_and_draw( sframe,1,1,0,faceimg,tmprect);</p>
<p>cvConvertImage( img1, gim1, CV_CVTIMG_FLIP );<br />
cvWaitKey(1);<br />
/*    img2 = cvQueryFrame(cap);<br />
cvConvertImage( img2, gim2, CV_CVTIMG_FLIP );<br />
*/</p>
<p>//feature points to track<br />
/*    if( 0 ){ //save the image<br />
char name[] = &#8220;c:\\flow\000.jpg&#8221;;</p>
<p>//name += 2*11;<br />
name[11] = (char)(count % 10+48);<br />
if(count &gt;= 10 )<br />
name[10] =(char)(count / 10+48);<br />
if(count &gt;= 100 )<br />
name[9] =(char)(count / 100+48);</p>
<p>printf(&#8220;%s\n&#8221;,name);<br />
cvSaveImage(name,gim1 );<br />
count++;<br />
}<br />
*/    // map matrix for WarpAffine, stored in array</p>
<p>CvMat* map_matrix = cvCreateMat(2, 3, CV_32F);</p>
<p>int w = gim1-&gt;width;<br />
int h = gim1-&gt;height;<br />
double moveC = (scale-1)/2;</p>
<p>cvmSet(map_matrix ,0,0, scale);<br />
cvmSet(map_matrix ,0,1, 0);<br />
cvmSet(map_matrix ,0,2, -moveC*w);</p>
<p>cvmSet(map_matrix ,1,0, 0);<br />
cvmSet(map_matrix ,1,1, scale);<br />
cvmSet(map_matrix ,1,2, -moveC*h);</p>
<p>cvWarpAffine(gim1,gim2,map_matrix);</p>
<p>cvShowImage(&#8220;transformed&#8221;, gim2);</p>
<p>CvPoint p1,p2,q1,q2;</p>
<p>p1.x = (int)w/2-w/scale/2;<br />
p1.y = (int) h/2 + h/scale/2;</p>
<p>p2.x = (int)w/2+w/scale/2;<br />
p2.y = (int) h/2 + h/scale/2;</p>
<p>q1.x = (int)w/2-w/scale/2;<br />
q1.y = (int) h/2 &#8211; h/scale/2;</p>
<p>q2.x = (int)w/2+w/scale/2;<br />
q2.y = (int) h/2 &#8211; h/scale/2;</p>
<p>CvScalar color = CV_RGB(50,0,250);<br />
cvLine( img1, p1, q1, color, 1, CV_AA, 0 );<br />
cvLine( img1, p2, q2, color, 1, CV_AA, 0 );<br />
cvLine( img1, p1, p2, color, 1, CV_AA, 0 );<br />
cvLine( img1, q1, q2, color, 1, CV_AA, 0 );</p>
<p>cvShowImage(&#8220;org&#8221;, img1);<br />
//cvResizeWindow( &#8220;HelloWorld&#8221;, 800, 800 );<br />
//cvMoveWindow( &#8220;HelloWorld&#8221;, 200, 0 );</p>
<p>//if((cvWaitKey(100) &amp; 255) == 27) break;<br />
}</p>
<p>return 0;<br />
}<br />
// Function to detect and draw any faces that is present in an image<br />
void detect_and_draw( IplImage* img, int scale,int min_neighbors,int min_size,IplImage* faceimg,  CvRect* tmprect )<br />
{</p>
<p>// Create memory for calculations<br />
static CvMemStorage* storage = 0;</p>
<p>// Create a new Haar classifier<br />
static CvHaarClassifierCascade* cascade = 0;</p>
<p>//int scale = 1;</p>
<p>// Create a new image based on the input image<br />
IplImage* temp = cvCreateImage( cvSize(img-&gt;width/scale,img-&gt;height/scale), 8, 3 );</p>
<p>// Create two points to represent the face locations<br />
CvPoint pt1, pt2;<br />
int i;</p>
<p>// Load the HaarClassifierCascade<br />
cascade = (CvHaarClassifierCascade*)cvLoad( cascade_name, 0, 0, 0 );</p>
<p>// Check whether the cascade has loaded successfully. Else report and error and quit<br />
if( !cascade )<br />
{<br />
fprintf( stderr, &#8220;ERROR: Could not load classifier cascade\n&#8221; );<br />
return;<br />
}</p>
<p>// Allocate the memory storage<br />
storage = cvCreateMemStorage(0);</p>
<p>// Create a new named window with title: result<br />
cvNamedWindow( &#8220;result&#8221;, 1 );</p>
<p>// Clear the memory storage which was used before<br />
cvClearMemStorage( storage );</p>
<p>// Find whether the cascade is loaded, to find the faces. If yes, then:<br />
if( cascade )<br />
{</p>
<p>// There can be more than one face in an image. So create a growable sequence of faces.<br />
// Detect the objects and store them in the sequence<br />
CvSeq* faces = cvHaarDetectObjects( img, cascade, storage,<br />
1.1, min_neighbors, CV_HAAR_DO_CANNY_PRUNING,<br />
cvSize(min_size, min_size) );</p>
<p>// Loop the number of faces found.<br />
for( i = 0; i &lt; (faces ? faces-&gt;total : 0); i++ )<br />
{<br />
// Create a new rectangle for drawing the face<br />
// CvRect* r = (CvRect*)cvGetSeqElem( faces, i );<br />
tmprect = (CvRect*)cvGetSeqElem( faces, i );<br />
if (tmprect-&gt;height&lt;= 0 ) continue;<br />
cvSetImageROI( img, cvRect(tmprect-&gt;x*scale,tmprect-&gt;y*scale,tmprect-&gt;width*scale,tmprect-&gt;height*scale) );<br />
//sprintf(file_num,&#8221;G:\\faces_from_movie\\%d.jpg&#8221;,int(framenum));<br />
//cvReleaseImage(faceimg);<br />
faceimg = cvCreateImage(cvSize(tmprect-&gt;width*scale,tmprect-&gt;height*scale),img-&gt;depth,img-&gt;nChannels);<br />
//faceimg = cvCloneImage(img);<br />
cvCopyImage(img,faceimg);<br />
cvNamedWindow(&#8220;The Face&#8221;, 0);<br />
cvShowImage(&#8220;The Face&#8221;, faceimg);</p>
<p>cvResetImageROI(img);</p>
<p>// Find the dimensions of the face,and scale it if necessary<br />
pt1.x = tmprect-&gt;x*scale;<br />
pt2.x = (tmprect-&gt;x+tmprect-&gt;width)*scale;<br />
pt1.y = tmprect-&gt;y*scale;<br />
pt2.y = (tmprect-&gt;y+tmprect-&gt;height)*scale;</p>
<p>// Draw the rectangle in the input image<br />
cvRectangle( img, pt1, pt2, CV_RGB(255,0,0), 3, 8, 0 );<br />
}<br />
}</p>
<p>// Show the image in the window named &#8220;result&#8221;<br />
cvShowImage( &#8220;result&#8221;, img );<br />
//IplROI roi =  cvRectToROI(&amp;r</p>
<p>// Release the temp image created.<br />
cvReleaseImage( &amp;temp );<br />
}</p></blockquote>
<p><span style="font-weight:bold;">Sample Image</span><br />
<img src="http://docs.google.com/File?id=dcmkbssn_61hgqm8cfq" style="float:left;margin:1em 1em 0 0;" height="360" width="386" /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opencv.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opencv.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opencv.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opencv.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opencv.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=10&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opencv.wordpress.com/2008/02/09/face-detection-image-warping-and-trackbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/53c30d226c3c704a5efa1ac7402a6185?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rmehran</media:title>
		</media:content>

		<media:content url="http://docs.google.com/File?id=dcmkbssn_61hgqm8cfq" medium="image" />
	</item>
		<item>
		<title>Calculating Fundamental Matrix</title>
		<link>http://opencv.wordpress.com/2008/02/05/calculating-fundamental-matrix/</link>
		<comments>http://opencv.wordpress.com/2008/02/05/calculating-fundamental-matrix/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 19:18:20 +0000</pubDate>
		<dc:creator>rmehran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://raminia.wordpress.com/2008/02/05/calculating-fundamental-matrix/</guid>
		<description><![CDATA[Even though OpenCV Wiki states the following code as example for fundamental matrix calculation I made another code to work. There was an issue with different behaviors in cvFindFundamentalMat() and cvFindFundamentalMatrix() that I didn&#8217;t understand as well. Lets&#8217; look at the example code from Wiki Example. Estimation of fundamental matrix using RANSAC algorithm from wiki [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=9&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Even though OpenCV Wiki states the following code as example for fundamental matrix calculation I made another code to work. There was an issue with different behaviors in  <i>cvFindFundamentalMat()</i> and <i>cvFindFundamentalMatrix()</i> that I didn&#8217;t understand as well.</p>
<p>Lets&#8217; look at the example code from Wiki</p>
<h3>Example. Estimation of fundamental matrix using RANSAC algorithm from wiki <br /></h3>
<blockquote><p>int point_count = 100;<br /> CvMat* points1;<br /> CvMat* points2;<br /> CvMat* status;<br /> CvMat* fundamental_matrix;</p>
<p> points1 = cvCreateMat(1,point_count,CV_32FC2);<br /> points2 = cvCreateMat(1,point_count,CV_32FC2);<br /> status = cvCreateMat(1,point_count,CV_8UC1);</p>
<p> /* Fill the points here &#8230; */<br /> for( i = 0; i &lt; point_count; i++ )<br /> {<br />     points1-&gt;data.db[i*2] = ;<br />     points1-&gt;data.db[i*2+1] = ;<br />     points2-&gt;data.db[i*2] = ;<br />     points2-&gt;data.db[i*2+1] = ;<br /> }</p>
<p> fundamental_matrix = cvCreateMat(3,3,CV_32FC1);<br /> int fm_count = cvFindFundamentalMat( <br /> points1,points2,fundamental_matrix,<br /> CV_FM_RANSAC,1.0,0.99,status ); </p></blockquote>
<p>
<h3>            My example code for Fundamental Matrix (<a title="source" href="http://cs.ucf.edu/%7Eramin/opencv/fundamental_matrix_calculation.cpp" id="qxy1">source</a>)</h3>
<h3> </h3>
<p>with help of <a title="code from Paul Smith" href="http://www.cs.ucf.edu/%7Evision/Code/Fundamental%20Matrix/Fundamental%20Matrix.zip" id="vqe_">code from Paul Smith</a><span class="style11"><font face="Arial,Helvetica" size="2"> (UCF vision Lab website) calculating the fundamental matrix using 8-point algorithm.</font></span></p>
<p>
<blockquote><img alt=""><br />// first_console_openCV.cpp : Defines the entry point for the console application.<br />//<br />#include &#8220;stdafx.h&#8221;<br />#include <br />#include <br />#include <br />    struct mousedata<br />    {<br />        int cntr ;<br />        CvPoint p1[8];<br />        CvPoint p2[8];</p>
<p>    } pp ={0,{},{}};<br />      IplImage* image ;<br />  IplImage* image2 ;</p>
<p>void on_mouse(int event, int x, int y, int flags, void* param)<br />{<br />    switch(event)<br />    {<br />    case CV_EVENT_LBUTTONDOWN:<br />        {</p>
<p>            int cntr = pp.cntr;<br />            char cntr_s[5];</p>
<p>            CvFont font;<br />            cvInitFont(&amp;font,CV_FONT_HERSHEY_PLAIN|CV_FONT_ITALIC,1,1,0,1);</p>
<p>            CvPoint ptr = cvPoint(x,y);<br />            printf(&#8220;(%d,%d)&#8221;,ptr.x,ptr.y);<br />            if (cntr &lt;8)<br />            {<br />                itoa(cntr,cntr_s,10);<br />                pp.p1[cntr] = ptr;<br />                cvCircle(image,pp.p1[cntr],1,cvScalar(0,0,255),3);</p>
<p>                cvPutText(image,cntr_s,pp.p1[cntr],&amp;font,cvScalar(0,0,255));<br />                cvShowImage(&#8220;mywindow&#8221;, image);<br />                cvSaveImage(&#8220;c:\img1.jpg&#8221;,image);</p>
<p>            }<br />            else if (cntr &lt;16)<br />            {    pp.p2[cntr-8] = ptr;<br />                cvCircle(image2,pp.p2[cntr-8],1,cvScalar(0,0,255),3);<br />                _itoa(cntr-8,cntr_s,10);<br />                cvPutText(image2,cntr_s,pp.p2[cntr-8],&amp;font,cvScalar(0,0,255));<br />                cvShowImage(&#8220;mywindow2&#8243;, image2);<br />                cvSaveImage(&#8220;c:\img2.jpg&#8221;,image2);<br />            }</p>
<p>            pp.cntr = cntr + 1;<br />        }<br />        break;</p>
<p>    }<br />}<br />int _tmain(int argc, _TCHAR* argv[])<br />{</p>
<p>//    mousedada *pp;<br />    pp.cntr = 0;</p>
<p>  // load 8-bit, 1 channel grayscale PGM image<br />  image = cvLoadImage(&#8220;C:\Documents and Settings\Ramin\Desktop\images\apt1.jpg&#8221;);<br />  image2 = cvLoadImage(&#8220;C:\Documents and Settings\Ramin\Desktop\images\apt2.jpg&#8221;);</p>
<p>  // Create a window in which the captured images will be presented<br />  cvNamedWindow(&#8220;mywindow&#8221;, CV_WINDOW_AUTOSIZE);</p>
<p>  // set the mouse call back<br />  cvSetMouseCallback(&#8220;mywindow&#8221;,on_mouse,0);</p>
<p>  // display results<br />  cvShowImage(&#8220;mywindow&#8221;, image);</p>
<p> // Create a window in which the captured images will be presented<br />  cvNamedWindow(&#8220;mywindow2&#8243;, CV_WINDOW_AUTOSIZE);</p>
<p>  // set the mouse call back<br />  cvSetMouseCallback(&#8220;mywindow2&#8243;,on_mouse,0 );</p>
<p>  cvShowImage(&#8220;mywindow2&#8243;, image2);</p>
<p>  // wait for a keypress<br />  cvWaitKey(0);</p>
<p>  //transfer the vector of points to the appropriate opencv matrix structures<br />    int i1,i2;<br />    i2 =0;<br />    int numPoints =8;<br />    CvMat* points1;<br />    CvMat* points2;<br />    CvMat* status;<br />    CvMat* fundMatr;<br />    points1 = cvCreateMat(2,numPoints,CV_32F);<br />    points2 = cvCreateMat(2,numPoints,CV_32F);<br />    status = cvCreateMat(1,numPoints,CV_32F);</p>
<p>    for ( i1 = 0; i1 &lt; numPoints; i1++) {</p>
<p>        cvSetReal2D(points1,0,i1,pp.p1[i1].x/1);<br />        cvSetReal2D(points1,1,i1,pp.p1[i1].y/1);</p>
<p>        cvSetReal2D(points2,0,i1,pp.p2[i1].x/1);<br />        cvSetReal2D(points2,1,i1,pp.p2[i1].y/1);<br />    }</p>
<p>    //create the output fundamental matrix<br />    fundMatr = cvCreateMat(3,3,CV_32F);</p>
<p>    //see opencv manual for other options in computing the fundamental matrix    <br />    int num = cvFindFundamentalMat(points1,points2,fundMatr,CV_FM_8POINT,1.0,0.9999,status);</p>
<p>    if( num == 1 )<br />    {<br />        printf(&#8220;Fundamental matrix was foundn&#8221;);</p>
<p>    }<br />    else<br />    {<br />        printf(&#8220;Fundamental matrix was not foundn&#8221;);<br />        return -1;</p>
<p>    }</p>
<p>    //now visualize the fundamental matrix<br />    int numOutputPoints;</p>
<p>    CvMat* corrLines;<br />    corrLines= cvCreateMat(3,numPoints,CV_32F);</p>
<p>    //specify which direction to compute epipolar lines<br />    int startImage = 2;<br />    cvComputeCorrespondEpilines( points2,<br />        startImage,//means points are in image 1<br />        fundMatr,<br />        corrLines);</p>
<p>    CvMat* a = cvCreateMat(3,1,CV_32F);<br />    CvMat* b = cvCreateMat(3,1,CV_32F);<br />    CvMat* c = cvCreateMat(3,1,CV_32F);<br />    CvMat* d = cvCreateMat(3,1,CV_32F);</p>
<p>    //create output window<br />    char windowName[100];<br />    strcpy_s(windowName,&#8221;Output Window&#8221;);<br />    cvNamedWindow(windowName,CV_WINDOW_AUTOSIZE);</p>
<p>    //for all the points set the point and corresponding epipolar line<br />    //and determine where the epipolar line intersects the image plane<br />    //then display all this info<br />    CvMat* epiLine = cvCreateMat(1,3,CV_32F);<br />    for (  i1 = 0; i1 &lt; numPoints; i1++) {</p>
<p>        for (i2 = 0; i2 &lt; 3; i2++) {<br />            cvmSet(epiLine,0,i2,cvmGet(corrLines,i2,i1));<br />        }</p>
<p>        CvPoint epipolarLinePoint1, epipolarLinePoint2;</p>
<p>        int  i4;</p>
<p>        CvMat* a = cvCreateMat(3,1,CV_32F);<br />        CvMat* b = cvCreateMat(3,1,CV_32F);<br />        CvMat* c = cvCreateMat(3,1,CV_32F);<br />        CvMat* d = cvCreateMat(3,1,CV_32F);</p>
<p>        for ( i4 = 0; i4 &lt; 3; i4++) {</p>
<p>            cvSetReal2D(a,i4,0,cvGetReal2D(epiLine,0,i4)/cvGetReal2D(epiLine,0,2));        <br />        }</p>
<p>        if (abs(cvGetReal2D(epiLine,0,0)) &gt; abs(cvGetReal2D(epiLine,0,1)) ){</p>
<p>            double ylim = image-&gt;height;</p>
<p>            cvSetReal2D(b,0,0,0);<br />            cvSetReal2D(b,1,0,1);<br />            cvSetReal2D(b,2,0,0);</p>
<p>            cvCrossProduct(a,b,c);<br />            for ( i4 = 0; i4 &lt; 3; i4++) {<br />                cvSetReal2D(c,i4,0,cvGetReal2D(c,i4,0)/cvGetReal2D(c,2,0));        <br />            }</p>
<p>            cvSetReal2D(b,0,0,0);<br />            cvSetReal2D(b,1,0,-1.0/ylim);            <br />            cvSetReal2D(b,2,0,1);<br />            cvCrossProduct(a,b,d);<br />            for ( i4 = 0; i4 &lt; 3; i4++) {<br />                cvSetReal2D(d,i4,0,cvGetReal2D(d,i4,0)/cvGetReal2D(d,2,0));        <br />            }</p>
<p>        }<br />        else  {<br />            double xlim = image-&gt;width;<br />            cvSetReal2D(b,0,0,1);<br />            cvSetReal2D(b,1,0,0);<br />            cvSetReal2D(b,2,0,0);</p>
<p>            cvCrossProduct(a,b,c);<br />            for ( i4 = 0; i4 &lt; 3; i4++) {<br />                cvSetReal2D(c,i4,0,cvGetReal2D(c,i4,0)/cvGetReal2D(c,2,0));        <br />            }</p>
<p>            cvSetReal2D(b,0,0,-1.0/xlim);<br />            cvSetReal2D(b,1,0,0);<br />            cvSetReal2D(b,2,0,1);<br />            cvCrossProduct(a,b,d);<br />            for ( i4 = 0; i4 &lt; 3; i4++) {<br />                cvSetReal2D(d,i4,0,cvGetReal2D(d,i4,0)/cvGetReal2D(d,2,0));        <br />            }</p>
<p>        }</p>
<p>        epipolarLinePoint1.x = cvmGet(c,0,0);<br />        epipolarLinePoint1.y = cvmGet(c,1,0);</p>
<p>        epipolarLinePoint2.x = cvmGet(d,0,0);<br />        epipolarLinePoint2.y = cvmGet(d,1,0);</p>
<p>        //cvCircle(image2,cvPoint(cvmGet(points2,0,i1),cvmGet(points2,1,i1)),5,CV_RGB(255,255,0),1);</p>
<p>        cvShowImage(windowName,image2);<br />        //cvWaitKey(0);</p>
<p>        cvLine(image,epipolarLinePoint1,epipolarLinePoint2,CV_RGB(0,255,0));</p>
<p>        cvShowImage(windowName,image);<br />        //    cvWaitKey(0);<br />    }<br />    cvWaitKey(0);<br />    cvSaveImage(&#8220;c:\epipolars.jpg&#8221;,image);<br />    return 0;</p>
<p>}</p>
</blockquote>
<p></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opencv.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opencv.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opencv.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opencv.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opencv.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=9&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opencv.wordpress.com/2008/02/05/calculating-fundamental-matrix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/53c30d226c3c704a5efa1ac7402a6185?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rmehran</media:title>
		</media:content>
	</item>
		<item>
		<title>Necessary Libraries</title>
		<link>http://opencv.wordpress.com/2008/02/05/necessary-libraries/</link>
		<comments>http://opencv.wordpress.com/2008/02/05/necessary-libraries/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 19:01:38 +0000</pubDate>
		<dc:creator>rmehran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://raminia.wordpress.com/2008/02/05/necessary-libraries/</guid>
		<description><![CDATA[Always remember to add libraries to OpenCV Project in Visual Studio Go to project properties-&#62; linker -&#62; input. In additonal dependencies box, add these libraries: cxcore.lib cv.lib highgui.lib cvaux.lib cvcam.lib<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=8&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Arial;"><font size="2">Always remember to add libraries to OpenCV Project in Visual Studio<br /> Go to project properties-&gt; linker -&gt; input. In additonal dependencies box, add these libraries:</font></span>
<p>   <b><span style="font-family:Arial;"><font size="2">cxcore.lib cv.lib highgui.lib cvaux.lib cvcam.lib</font></span></b> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opencv.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opencv.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opencv.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opencv.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opencv.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opencv.wordpress.com&amp;blog=2757655&amp;post=8&amp;subd=opencv&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opencv.wordpress.com/2008/02/05/necessary-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/53c30d226c3c704a5efa1ac7402a6185?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rmehran</media:title>
		</media:content>
	</item>
	</channel>
</rss>
