{"id":1954,"date":"2014-02-05T17:32:47","date_gmt":"2014-02-05T17:32:47","guid":{"rendered":"https:\/\/www.anagram.at\/en\/diplomarbeit\/the-pinhole-camera\/"},"modified":"2014-02-05T17:32:47","modified_gmt":"2014-02-05T17:32:47","slug":"the-pinhole-camera","status":"publish","type":"page","link":"https:\/\/www.anagram.at\/en\/diplomarbeit\/the-pinhole-camera\/","title":{"rendered":"The Pinhole Camera"},"content":{"rendered":"<p><body><br \/>\n<!--Navigation Panel--><br \/>\n<b> Next:<\/b> <a name=\"tex2html266\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/camera-model-with-lens\/\">Camera Model with Lens<\/a><br \/>\n<b> Up:<\/b> <a name=\"tex2html262\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/perspective-projection\/\">Perspective Projection<\/a><br \/>\n<b> Previous:<\/b> <a name=\"tex2html256\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/perspective-projection\/\">Perspective Projection<\/a><br \/>\n<!--End of Navigation Panel--><\/p>\n<h2><a name=\"SECTION00311000000000000000\"><br \/>\nThe Pinhole Camera<\/a><br \/>\n<\/h2>\n<p>\nAn ideal model of a camera is the pinhole camera, as seen in Figure <a href=\"#pinhole\">2.2<\/a>. This kind of<br \/>\ncamera can be imagined as a box with a pinhole, through which<br \/>\nlight enters and forms a two-dimensional image on the opposite site. A point<br \/>\n<img loading=\"lazy\" width=\"118\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img36.png\" alt=\"$ P=(X,Y,Z)$\"\/> in the three-dimensional <img loading=\"lazy\" width=\"51\" height=\"16\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img37.png\" alt=\"$ XYZ$\"\/>-space is projected to an image-point<br \/>\n<img loading=\"lazy\" width=\"82\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img38.png\" alt=\"$ p=(x,y)$\"\/> in the two-dimensional <img loading=\"lazy\" width=\"25\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img39.png\" alt=\"$ xy$\"\/>-space (wall). If the coordinate system of the<br \/>\n<img loading=\"lazy\" width=\"51\" height=\"16\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img37.png\" alt=\"$ XYZ$\"\/>-space is aligned at the pinhole so that the Z-axis coincides with the optical axis and the image<br \/>\nplane has its origin at <img loading=\"lazy\" width=\"66\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img40.png\" alt=\"$ (0,0,f)$\"\/>, then the projection equations are<br \/>\ngiven by<\/p>\n<\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_x_c\"\/><!-- MATH\n begin{equation}\nx = frac{fX}{Z}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"72\" height=\"61\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img41.png\" alt=\"$displaystyle x = frac{fX}{Z}$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.4)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\nand <\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_y_c\"\/><!-- MATH\n begin{equation}\ny = frac{fY}{Z}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"70\" height=\"61\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img42.png\" alt=\"$displaystyle y = frac{fY}{Z}$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.5)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"pinhole\"\/><a name=\"286\"\/><\/p>\n<table>\n<caption align=\"BOTTOM\"><strong>Figure 2.2:<\/strong><br \/>\nPinhole camera model<\/caption>\n<tr>\n<td>\n<div align=\"CENTER\">\n <img loading=\"lazy\" width=\"556\" height=\"328\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/pinhole.jpg\" alt=\"Image pinhole\"\/><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\nTo represent Equation <a href=\"#proj_x_c\">2.4<\/a> and Equation <a href=\"#proj_y_c\">2.5<\/a> in a linear way, we transform the point <img loading=\"lazy\" width=\"48\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img43.png\" alt=\"$ (x,y)$\"\/> in the Euclidean plane to a point <img loading=\"lazy\" width=\"66\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img44.png\" alt=\"$ (x,y,1)$\"\/> in the projective plane. This represents the same point, we simply added a new coordinate <img loading=\"lazy\" width=\"14\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img45.png\" alt=\"$ 1$\"\/>. Overall scaling is unimportant. The point <!-- MATH\n $p = (alpha x,alpha y,alpha)$\n --><br \/>\n<img loading=\"lazy\" width=\"127\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img46.png\" alt=\"$ p = (alpha x,alpha y,alpha)$\"\/> can be re-transformed by dividing through <img loading=\"lazy\" width=\"17\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img47.png\" alt=\"$ alpha$\"\/>. Thus <img loading=\"lazy\" width=\"14\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img48.png\" alt=\"$ p$\"\/> is similar to <!-- MATH\n $(frac{x}{alpha},frac{y}{alpha})$\n --><br \/>\n<img loading=\"lazy\" width=\"53\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img49.png\" alt=\"$ (frac{x}{alpha},frac{y}{alpha})$\"\/>. Because scaling is unimportant, the coordinate <img loading=\"lazy\" width=\"66\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img44.png\" alt=\"$ (x,y,1)$\"\/> is called <i>homogeneous coordinate<\/i>. Homogenous coordinates can also be used within a higher dimensional domain. Now we can combine Equation <a href=\"#proj_x_c\">2.4<\/a> and Equation <a href=\"#proj_y_c\">2.5<\/a> to <\/p>\n<\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_hom_c\"\/><!-- MATH\n begin{equation}\nbegin{pmatrix} xcr ycr 1 end{pmatrix} =\nbegin{pmatrix}\nfrac{f}{Z} & 0 & 0 & 0cr 0 & frac{f}{Z} & 0 & 0cr 0 & 0 & 0 & 1\nend{pmatrix}\nbegin{pmatrix}\nx cr y cr z cr 1\nend{pmatrix}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"249\" height=\"149\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img50.png\" alt=\"$displaystyle begin{pmatrix}xcr ycr 1 end{pmatrix} = begin{pmatrix}frac{f...&#10;...cr 0 &amp; 0 &amp; 0 &amp; 1 end{pmatrix} begin{pmatrix}x cr y cr z cr 1 end{pmatrix}$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.6)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\n<p>\nIf we want to know the image coordinates we have to take four more values into account. Namely\n<\/p>\n<dl>\n<dt><strong><img loading=\"lazy\" width=\"45\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img51.png\" alt=\"$ c_x,c_y$\"\/><\/strong><\/dt>\n<dd>image principal point, which is the intersection between the camera&#8217;s optical axis and the image plane.\n<\/dd>\n<dt><strong><img loading=\"lazy\" width=\"49\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img52.png\" alt=\"$ d_x,d_y$\"\/><\/strong><\/dt>\n<dd>distance between two sensor elements in <img loading=\"lazy\" width=\"15\" height=\"19\" align=\"BOTTOM\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img25.png\" alt=\"$ x$\"\/> and <img loading=\"lazy\" width=\"14\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img26.png\" alt=\"$ y$\"\/> direction\n<\/dd>\n<\/dl>\n<p><img loading=\"lazy\" width=\"23\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img53.png\" alt=\"$ d_x$\"\/> and <img loading=\"lazy\" width=\"22\" height=\"35\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img54.png\" alt=\"$ d_y$\"\/> can normally be found in the datasheet<a name=\"tex2html8\" href=\"footnode.html#foot313\"><sup>2.2<\/sup><\/a> of the sensor chip. The image principal point has to be found by calibration (see Section <a href=\"node9.html#camcal\">2.2<\/a> for more information). If the parameters and the point in camera coordinates are known, we can compute the image coordinates with the following formulation<\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_x_i\"\/><!-- MATH\n begin{equation}\nx_i = frac{x_c}{d_x} + c_x\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"107\" height=\"51\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img55.png\" alt=\"$displaystyle x_i = frac{x_c}{d_x} + c_x$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.7)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\nand <\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_y_i\"\/><!-- MATH\n begin{equation}\ny_i = frac{y_c}{d_y} + c_y\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"105\" height=\"51\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img56.png\" alt=\"$displaystyle y_i = frac{y_c}{d_y} + c_y$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.8)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\nwhere <img loading=\"lazy\" width=\"22\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img57.png\" alt=\"$ x_c$\"\/> and <img loading=\"lazy\" width=\"20\" height=\"33\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img58.png\" alt=\"$ y_c$\"\/> are the coordinates of the point in the camera coordinate system. If we combine Equation <a href=\"#proj_hom_c\">2.6<\/a> with Equation <a href=\"#proj_x_i\">2.7<\/a> and Equation <a href=\"#proj_y_i\">2.8<\/a> we can formulate the translation from Point <img loading=\"lazy\" width=\"93\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img59.png\" alt=\"$ P(X,Y,Z)$\"\/> to the image coordinates <!-- MATH\n $p(x_i,y_i)$\n --><br \/>\n<img loading=\"lazy\" width=\"67\" height=\"37\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img60.png\" alt=\"$ p(x_i,y_i)$\"\/><\/p>\n<p\/>\n<div align=\"CENTER\"><a name=\"proj_hom_i\"\/><!-- MATH\n begin{equation}\nbegin{pmatrix}x_icr y_icr 1 end{pmatrix} =\nbegin{pmatrix}frac{f}{Zd_x} & 0 & 0 & C_xcr 0 & frac{f}{Zd_y} & 0 & C_ycr 0 & 0 & 0 & 1 end{pmatrix} \nbegin{pmatrix}x cr y cr z cr 1end{pmatrix}\nend{equation}\n --><\/p>\n<table cellpadding=\"0\" width=\"100%\" align=\"CENTER\">\n<tr valign=\"MIDDLE\">\n<td nowrap=\"nowrap\" align=\"CENTER\"><img loading=\"lazy\" width=\"295\" height=\"149\" align=\"MIDDLE\" border=\"0\" src=\"https:\/\/www.anagram.at\/app\/uploads\/2014\/02\/img61.png\" alt=\"$displaystyle begin{pmatrix}x_icr y_icr 1 end{pmatrix} = begin{pmatrix}fr...&#10;...cr 0 &amp; 0 &amp; 0 &amp; 1 end{pmatrix} begin{pmatrix}x cr y cr z cr 1end{pmatrix}$\"\/><\/td>\n<td nowrap=\"nowrap\" width=\"10\" align=\"RIGHT\">\n(2.9)<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><br clear=\"ALL\"\/><\/p>\n<p\/>\n<hr\/>\n<p><!--Navigation Panel--><b> Next:<\/b> <a name=\"tex2html266\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/camera-model-with-lens\/\">Camera Model with Lens<\/a><br \/>\n<b> Up:<\/b> <a name=\"tex2html262\" href=\"https:\/\/www.anagram.at\/diplomarbeit\/perspective-projection\/\">Perspective Projection<\/a><br \/>\n<!--End of Navigation Panel--><\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Pinhole Camera<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1946,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":""},"categories":[],"featured_image_src":null,"featured_image_src_square":null,"_links":{"self":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1954"}],"collection":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/comments?post=1954"}],"version-history":[{"count":0,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1954\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/pages\/1946"}],"wp:attachment":[{"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/media?parent=1954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anagram.at\/en\/wp-json\/wp\/v2\/categories?post=1954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}