{"action":"created","issue":{"url":"https://api.github.com/repos/cedricve/raspicam/issues/15","repository_url":"https://api.github.com/repos/cedricve/raspicam","labels_url":"https://api.github.com/repos/cedricve/raspicam/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/cedricve/raspicam/issues/15/comments","events_url":"https://api.github.com/repos/cedricve/raspicam/issues/15/events","html_url":"https://github.com/cedricve/raspicam/issues/15","id":188629603,"number":15,"title":"Reducing frame width and height yields strange images","user":{"login":"birgersp","id":5260237,"avatar_url":"https://avatars.githubusercontent.com/u/5260237?v=3","gravatar_id":"","url":"https://api.github.com/users/birgersp","html_url":"https://github.com/birgersp","followers_url":"https://api.github.com/users/birgersp/followers","following_url":"https://api.github.com/users/birgersp/following{/other_user}","gists_url":"https://api.github.com/users/birgersp/gists{/gist_id}","starred_url":"https://api.github.com/users/birgersp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birgersp/subscriptions","organizations_url":"https://api.github.com/users/birgersp/orgs","repos_url":"https://api.github.com/users/birgersp/repos","events_url":"https://api.github.com/users/birgersp/events{/privacy}","received_events_url":"https://api.github.com/users/birgersp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-10T21:58:02Z","updated_at":"2016-11-14T21:39:50Z","closed_at":null,"body":"Hi,\r\n\r\nI want to to reduce the image quality before capturing. I reduce the frame width and height like I normally would in OpenCV but with raspicam I get some strange results. This is my test code:\r\n\r\n```\r\n#include <raspicam/raspicam_cv.h>\r\n\r\nint main ( int argc,char **argv ) {\r\n\r\n    raspicam::RaspiCam_Cv Camera;\r\n\tCamera.set( CV_CAP_PROP_FORMAT, CV_8UC1 );\r\n\t\r\n    cv::Mat image;\r\n\r\n    if (!Camera.open()) {return -1;}\r\n\r\n    Camera.set(CV_CAP_PROP_FRAME_WIDTH, 640); // <-- If i remove this and the next line, the images are \"normal\"\r\n    Camera.set(CV_CAP_PROP_FRAME_HEIGHT, 480);\r\n\r\n    Camera.grab();\r\n    Camera.retrieve(image);\r\n\r\n    Camera.release();\r\n\r\n    //save image \r\n    cv::imwrite(\"raspicam_cv_image.jpg\",image);\r\n    return 0;\r\n}\r\n```\r\n\r\nResulting image: http://i.imgur.com/u07TCX0.jpg\r\n\r\nIf I don't reduce the frame size (i.e. comment out the lines setting the properties), the image is normal.\r\n\r\nHardware:\r\n\r\n- Raspberry Pi Model B Rev 2\r\n- [Raspberry Pi Rev 2.1 Official 8.0 Megapixels HD Camera Module - Green](http://www.dx.com/p/raspberry-pi-rev-2-1-official-8-0-megapixels-hd-camera-module-green-433744)"},"comment":{"url":"https://api.github.com/repos/cedricve/raspicam/issues/comments/260471246","html_url":"https://github.com/cedricve/raspicam/issues/15#issuecomment-260471246","issue_url":"https://api.github.com/repos/cedricve/raspicam/issues/15","id":260471246,"user":{"login":"birgersp","id":5260237,"avatar_url":"https://avatars.githubusercontent.com/u/5260237?v=3","gravatar_id":"","url":"https://api.github.com/users/birgersp","html_url":"https://github.com/birgersp","followers_url":"https://api.github.com/users/birgersp/followers","following_url":"https://api.github.com/users/birgersp/following{/other_user}","gists_url":"https://api.github.com/users/birgersp/gists{/gist_id}","starred_url":"https://api.github.com/users/birgersp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birgersp/subscriptions","organizations_url":"https://api.github.com/users/birgersp/orgs","repos_url":"https://api.github.com/users/birgersp/repos","events_url":"https://api.github.com/users/birgersp/events{/privacy}","received_events_url":"https://api.github.com/users/birgersp/received_events","type":"User","site_admin":false},"created_at":"2016-11-14T21:39:50Z","updated_at":"2016-11-14T21:39:50Z","body":"Discovered that the frame width/height has to be set **before** camera is opened. Seems we cannot set any of these properties after camera is opened. Properties has to be committed, and it seems there is no way to commit the properties other than opening the camera..."}}
{"actor":{"display_login":"birgersp"}}