{"action":"created","issue":{"url":"https://api.github.com/repos/hybridgroup/gocv/issues/339","repository_url":"https://api.github.com/repos/hybridgroup/gocv","labels_url":"https://api.github.com/repos/hybridgroup/gocv/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/hybridgroup/gocv/issues/339/comments","events_url":"https://api.github.com/repos/hybridgroup/gocv/issues/339/events","html_url":"https://github.com/hybridgroup/gocv/issues/339","id":367582450,"node_id":"MDU6SXNzdWUzNjc1ODI0NTA=","number":339,"title":"How to get and set pixel color to Mat?","user":{"login":"esimov","id":883386,"node_id":"MDQ6VXNlcjg4MzM4Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/883386?v=4","gravatar_id":"","url":"https://api.github.com/users/esimov","html_url":"https://github.com/esimov","followers_url":"https://api.github.com/users/esimov/followers","following_url":"https://api.github.com/users/esimov/following{/other_user}","gists_url":"https://api.github.com/users/esimov/gists{/gist_id}","starred_url":"https://api.github.com/users/esimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esimov/subscriptions","organizations_url":"https://api.github.com/users/esimov/orgs","repos_url":"https://api.github.com/users/esimov/repos","events_url":"https://api.github.com/users/esimov/events{/privacy}","received_events_url":"https://api.github.com/users/esimov/received_events","type":"User","site_admin":false},"labels":[{"id":696157666,"node_id":"MDU6TGFiZWw2OTYxNTc2NjY=","url":"https://api.github.com/repos/hybridgroup/gocv/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-07T18:54:55Z","updated_at":"2018-10-19T14:50:10Z","closed_at":null,"author_association":"NONE","body":"<!--- Please provide a general summary of the issue in the Title above -->\r\n\r\n## Description\r\nIn OpenCV you can get and set pixel values in the following manner.\r\n\r\n```c\r\nMat image = img;\r\nfor(int y=0; y<img.rows; y++)\r\n{\r\n    for(int x=0; x<img.cols; x++)\r\n    {\r\n        // get pixel\r\n        Vec3b color = image.at<Vec3b>(Point(x,y));\r\n\r\n        // ... do something to the color ....\r\n\r\n        // set pixel\r\n        image.at<Vec3b>(Point(x,y)) = color;\r\n    }\r\n}\r\n```\r\nHow can i do something similar in gocv? One way i have tried is using the `SetTo` method and providing a scalar as parameter, but there is no way i can tell with this method which pixel value i want to update, something like `SetTo(x, y, sclarValue)`. Is there something i'm missing? I'm afraid iterating over the image pixels and updating the underneath matrix will update only the last iteration.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hybridgroup/gocv/issues/comments/431389492","html_url":"https://github.com/hybridgroup/gocv/issues/339#issuecomment-431389492","issue_url":"https://api.github.com/repos/hybridgroup/gocv/issues/339","id":431389492,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTM4OTQ5Mg==","user":{"login":"ibenben","id":13758704,"node_id":"MDQ6VXNlcjEzNzU4NzA0","avatar_url":"https://avatars3.githubusercontent.com/u/13758704?v=4","gravatar_id":"","url":"https://api.github.com/users/ibenben","html_url":"https://github.com/ibenben","followers_url":"https://api.github.com/users/ibenben/followers","following_url":"https://api.github.com/users/ibenben/following{/other_user}","gists_url":"https://api.github.com/users/ibenben/gists{/gist_id}","starred_url":"https://api.github.com/users/ibenben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibenben/subscriptions","organizations_url":"https://api.github.com/users/ibenben/orgs","repos_url":"https://api.github.com/users/ibenben/repos","events_url":"https://api.github.com/users/ibenben/events{/privacy}","received_events_url":"https://api.github.com/users/ibenben/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T14:50:10Z","updated_at":"2018-10-19T14:50:10Z","author_association":"NONE","body":"`func pixelColor(data []byte, ch int, cols int, x int, y int) []byte {\r\n\tidx := x*cols*ch + y*ch\r\n\r\n\tif idx+2 >= len(data) {\r\n\t\treturn nil\r\n\t}\r\n\r\n\tc := make([]byte, 3)\r\n\r\n\tc[0] = data[idx+0]\r\n\tc[1] = data[idx+1]\r\n\tc[2] = data[idx+2]\r\n\r\n\treturn c\r\n}`\r\n\r\nDid I do the right thing? \r\n@esimov"}}
{"actor":{"display_login":"ibenben"}}