{"id":428,"date":"2016-02-19T21:21:45","date_gmt":"2016-02-19T13:21:45","guid":{"rendered":"http:\/\/www.cgdev.net\/blog\/?p=428"},"modified":"2016-06-24T03:44:43","modified_gmt":"2016-06-23T19:44:43","slug":"sobel-operator","status":"publish","type":"post","link":"https:\/\/www.cgdev.net\/blog\/428.html","title":{"rendered":"Isotropic Sobel Operator"},"content":{"rendered":"<p>This is an improved Sobel operator mainly used in edge detection. It uses 3&#215;3 convolution matrix to compute the gradient in the x-direction (\\(G_x\\)) and y-direction (\\(G_y\\)):<br \/>\n\\[<br \/>\nG_x =<br \/>\n\\begin{bmatrix}<br \/>\n-1 &amp; 0 &amp; 1\\\\<br \/>\n-\\sqrt 2 &amp; 0 &amp; \\sqrt 2 \\\\<br \/>\n-1 &amp; 0 &amp; 1<br \/>\n\\end{bmatrix} * A<br \/>\n~~~~~~~~~~~~<br \/>\nG_y =<br \/>\n\\begin{bmatrix}<br \/>\n-1 &amp; -\\sqrt 2 &amp; -1\\\\<br \/>\n0 &amp; 0 &amp; 0 \\\\<br \/>\n1 &amp; \\sqrt 2 &amp; 1<br \/>\n\\end{bmatrix} * A<br \/>\n\\]<\/p>\n<p>As with the gradient vector \\( (G_x,\u00a0 G_y) \\), we can compute the absolute magnitude of the gradient using:<\/p>\n<p>\\[<br \/>\nG = \\sqrt{G_x^2 + G_y^2}<br \/>\n\\]<\/p>\n<p>For example,\u00a0 if A is the input image<\/p>\n<p>\\[<br \/>\nA =<br \/>\n\\begin{bmatrix}<br \/>\nP_1 &amp; P_2 &amp; P_3\\\\<br \/>\nP_4 &amp;\u00a0P_5 &amp;\u00a0P_6 \\\\<br \/>\nP_7 &amp;\u00a0P_8 &amp;\u00a0P_9<br \/>\n\\end{bmatrix}<br \/>\n\\]<\/p>\n<p>We can calculate the <span class=\"st\">gradient vector components<\/span>:<\/p>\n<p>\\[<br \/>\nG_x = P_3 &#8211;\u00a0P_1 + \\sqrt{2}(P_6 &#8211; P_4) +\u00a0P_9 &#8211;\u00a0P_7 \\\\<br \/>\nG_y = P_7 &#8211; P_1 + \\sqrt{2}(P_8 &#8211; P_2) + P_9 &#8211; P_3<br \/>\n\\]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is an improved Sobel operator mainly used in edge detection. It uses 3&#215;3 convolution matrix to compute the gradient in the x-direction (\\(G_x\\)) and y-direction (\\(G_y\\)): \\[ G_x = \\begin{bmatrix} -1 &amp; 0 &amp; 1\\\\ -\\sqrt 2 &amp; 0 &amp; \\sqrt 2 \\\\ -1 &amp; 0 &amp; 1 \\end{bmatrix} * A ~~~~~~~~~~~~ G_y = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-428","post","type-post","status-publish","format-standard","hentry","category-graphics"],"_links":{"self":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/posts\/428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/comments?post=428"}],"version-history":[{"count":0,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/posts\/428\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/media?parent=428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/categories?post=428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/tags?post=428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}