{"id":462,"date":"2016-03-09T18:31:40","date_gmt":"2016-03-09T10:31:40","guid":{"rendered":"http:\/\/www.cgdev.net\/blog\/?p=462"},"modified":"2023-04-21T08:39:03","modified_gmt":"2023-04-21T00:39:03","slug":"roberts-operator","status":"publish","type":"post","link":"https:\/\/www.cgdev.net\/blog\/462.html","title":{"rendered":"Roberts Operator"},"content":{"rendered":"<p>Compared with the <a href=\"\/blog\/428.html\" target=\"_blank\" rel=\"noopener\">Sobel Operator<\/a> which use 8 points, the Roberts Operator use only 4 points to compute the gradient magnitude.\u00a0 The <span class=\"st\">first order derivative<\/span> represents the directional derivative:<\/p>\n<p>\\[<br \/>\nG_x =<br \/>\n\\begin{bmatrix}<br \/>\n-1 &amp; 0\\\\<br \/>\n0 &amp; 1<br \/>\n\\end{bmatrix} * A<br \/>\n~~~~~~~~~~~~<br \/>\nG_y =<br \/>\n\\begin{bmatrix}<br \/>\n0 &amp; -1\\\\<br \/>\n1 &amp; 0<br \/>\n\\end{bmatrix} * A<br \/>\n\\]<\/p>\n<p>We can compute the gradient magnitude using:<\/p>\n<p>\\[<br \/>\nG = \\sqrt{G_x^2 + G_y^2}<br \/>\n\\]<\/p>\n<p>For example: if A is the input image<\/p>\n<p>\\[<br \/>\nA =<br \/>\n\\begin{bmatrix}<br \/>\nP_1 &amp; P_2 \\\\<br \/>\nP_3 &amp;\u00a0P_4<br \/>\n\\end{bmatrix}<br \/>\n\\]<\/p>\n<p><span class=\"st\">For \\(P_1\\), the gradient vector components are computed using:<br \/>\n<\/span><\/p>\n<p>\\[<br \/>\nG_x = P_4 &#8211;\u00a0P_1\u00a0 \\\\<br \/>\nG_y = P_3 &#8211; P_2<br \/>\n\\]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compared with the Sobel Operator which use 8 points, the Roberts Operator use only 4 points to compute the gradient magnitude.\u00a0 The first order derivative represents the directional derivative: \\[ G_x = \\begin{bmatrix} -1 &amp; 0\\\\ 0 &amp; 1 \\end{bmatrix} * A ~~~~~~~~~~~~ G_y = \\begin{bmatrix} 0 &amp; -1\\\\ 1 &amp; 0 \\end{bmatrix} * A [&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-462","post","type-post","status-publish","format-standard","hentry","category-graphics"],"_links":{"self":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/posts\/462","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=462"}],"version-history":[{"count":0,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/posts\/462\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/media?parent=462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/categories?post=462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cgdev.net\/blog\/wp-json\/wp\/v2\/tags?post=462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}