2020-09-27 02:53:54 -0600 | received badge | ● Student (source) |
2020-09-27 02:53:46 -0600 | received badge | ● Nice Answer (source) |
2020-09-27 02:36:07 -0600 | received badge | ● Teacher (source) |
2020-09-26 20:34:34 -0600 | marked best answer | Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that may be provided here: I am trying to send a Mat image from a server to a client over TCP-ip with winsock (between two different PC's). Like many others in these forums I am also new to socket programming. I have followed this very good thread "https://answers.opencv.org/question/1..." which I have basically adopted for my own solution. Thank-you therefore to the contributors (pwk3, berak & opalmirror). I have "successfully" been able to send a uchar vector, (converted from cv::Mat via imencode(..)) which appears to be exactly the same size when received on the client-side in comparison to the server-side prior to sending. Unfortunately however when I try to decode it on the client side it results in an empty matrix. According to the docs: "If the buffer is too short or contains invalid data, the function returns an empty matrix ( Mat::data==NULL )." Therefore I am assuming that although the exact number of bytes were sent... there is still some corruption somewhere. If I decode the encoded buffer on the server side before transmission the original Mat is directly recoverable with the same code. Hence the issue has to occur in the transmission between PC's somehow. I have attached code replicating the problem whereby the server sends one image and the receiver receives the full buffer but fails to decode: If someone could please assist in perhaps explaining why I am able to decode on the server side without obtaining an empty Mat but not on the client that would be much appreciated. I feel the data must somehow be corrupted during transmission (even though it looks as though all data was received). Any tips would be much appreciated. Thank-you in advance. (more) |
2020-09-26 20:34:31 -0600 | received badge | ● Self-Learner (source) |
2020-09-26 19:26:00 -0600 | answered a question | Cannot decode server-sent uchar vector on client side: Empty Mat results. So it was indeed an embarrasing overlooked syntax error on my behalf. As pointed out by berak in the comments I had size |
2020-09-26 14:43:25 -0600 | commented question | Cannot decode server-sent uchar vector on client side: Empty Mat results. haha as a new user I need to wait two days after question originally posted... therefore another 4 hours. Will update :) |
2020-09-26 14:43:08 -0600 | commented question | Cannot decode server-sent uchar vector on client side: Empty Mat results. haha as a new user I need to wait two days... therefore another 4 hours. Will update :) |
2020-09-26 13:26:07 -0600 | commented question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Ok that was all the help I needed. The sizeof(size_t) was the issue! It seems like an obvious error now - apologies for |
2020-09-26 06:03:20 -0600 | commented question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Apologies berak, that was a bit silly of me. Thank-you very much for your response: I have now updated my question. |
2020-09-26 06:02:35 -0600 | edited question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that |
2020-09-26 05:58:43 -0600 | edited question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that |
2020-09-26 05:57:43 -0600 | edited question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that |
2020-09-26 05:55:35 -0600 | received badge | ● Editor (source) |
2020-09-26 05:55:35 -0600 | edited question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that |
2020-09-24 18:52:58 -0600 | asked a question | Cannot decode server-sent uchar vector on client side: Empty Mat results. Cannot decode server-sent uchar vector on client side: Empty Mat results. Hello, thank-you in advance for any help that |