2016-02-27 17:18:23 -0600 | commented question | 8UC4 Mat to qimage tried reverting from opencv3 to opencv2 installed via homebrew (OS X pkg manager), output was the same. Also tried answer posted and it did not work, see comment below. still works if I make the Qimage Format_Grayscale8. I have no idea what else to try but figured I'd post an update! continues with all cameras tried which makes me believe it is a programmatic error. |
2016-02-27 17:08:33 -0600 | received badge | ● Critic (source) |
2016-02-27 17:08:12 -0600 | commented answer | 8UC4 Mat to qimage this results in essentially the same output. I made the following changes: mainly changed variable names to work with my code and changed rgb8888 to rgba8888 as the image is 8UC4 and rgb8888 crashes at runtime |
2016-02-18 12:59:49 -0600 | commented question | 8UC4 Mat to qimage The isContinuous function returns true. step1() changes the image slightly but it still very distorted like the attached screenshots. So unfortunately I'm still stuck but thanks for the suggestions! |
2016-02-17 13:26:12 -0600 | received badge | ● Editor (source) |
2016-02-17 12:36:50 -0600 | asked a question | 8UC4 Mat to qimage trying to convert local webcam stream from cv::Mat to QImage but the output is weird. I've tried a bunch of things and searched for hours; I'm officially stuck. This may be outside the scope of this forum, if so I am sorry but I have not been able to find a solution elsewhere. here is the code snippet in question I've tried adding image.step, tried every QImage format, tried img.invertPixels() and img.invertRGB/invertRGBA() I've also tried creating a temporary image to run cvtColor and convert (tried CV_BGRA2RGB and BGRA2RGBA) and this gives the same result. type() output is 24 which, if I am correct, is CV_8UC4. If I use any sort of above I get the following (although some formats will show incorrect color instead of just grayscale. This is with RGBA8888): http://i.imgur.com/79k3q8U.png if I output in grayscale everything works as it should: http://i.imgur.com/8b4APE0.png I have tried a solution from Ypnos on stackexhange but that output is still a mess. here is that code: and the relevant section of VideoView where it is converted to PixMap and pushed to display AND the new but still messed up output http://i.imgur.com/1jlmfRQ.png the FaceTime camera built into my macbook pro as well as with 2 other USB cams I've tried (logitech c270 and a no-name chinese garbage cam) all give the same output The one thing I haven't tried is writing the mat to a file and reading it into a qimage. My thinking is that this is very inelegant and will be too slow for my needs. any ideas? On mac 10.11 with QT creator 5 and opencv 3.1.0. current compile flags are: However I also had compiled it with flags but that gave the same output. I tried removing and recompiling OpenCV at one point which is why I have the new flags. I |