08-22-2018 07:11 AM - edited 08-22-2018 07:18 AM
I have a LINUX based target system to which i send some commands (using TCP Write VI) via TCP/IP. The target system gives an array (2D) of Bytes which represent a Picture Frame. I need to create a grayscale image from this array of bytes and the dimension of camera is: 752 X 480.
But instead of getting a grayscale image, I am getting a binary image with Image Pixels(U8) with 0,1,2,3 values etc resulting into a dark image.
Can someone suggest why I am getting a dark black image instead of a grayscale Image?
08-22-2018 07:48 AM - edited 08-22-2018 07:51 AM
Can you show the code that is sending the image? Are you sure you are converting the data correctly?
Also, in the first TCP read, you are reading 1024 bytes to get the message length.. Are you sure that is correct? 1024 Bytes to specify the message length seems excessive...
08-22-2018 08:10 AM - edited 08-22-2018 08:11 AM
The target system has a camera fixed in it. So when the specific commands "grab_frame" is sent to the target system, it reads an Array of 2D Bytes representing a Picture frame. The target system does specific functions according to it's corresponding commands. Therefore, I don't have the internal code how the target system is designed to execute the commands.
Yes 1024 Bytes is excessive. I have tried with 4 Bytes too, but it gives me the same problem.
08-22-2018 08:17 AM
I agree with Paul Ross. Most "size" parameters are 4-byte Integers, so if you changed the 1024 for the first TCP Read to 4, it might suddenly work (read the Help on TCP Read). You didn't say, but I would have expected the (truncated, why?) Error Line would have given a Timeout Error in the "Error Out" indicator.
Bob Schor
08-22-2018 08:23 AM
Where are you getting the 1024 or 4 Bytes from? Is there some documentation with the target system that describes the message packet? If the message length header is 4 bytes, and you are reading 1024, you are going to be missing some of the data in your message because you already read that data and just discarded it when you did the first read.
Beyond that, it is going to be difficult for anyone here to give you much help without more information - what is the hardware? Is it some off the shelf item that maybe someone else here has used? Can you share the documentation? My guess is that message packet has some defined format, and you are not parsing it into the image data correctly.
08-22-2018 08:59 AM
@Bob_Schor wrote:
I agree with Paul Ross. Most "size" parameters are 4-byte Integers, so if you changed the 1024 for the first TCP Read to 4, it might suddenly work (read the Help on TCP Read). You didn't say, but I would have expected the (truncated, why?) Error Line would have given a Timeout Error in the "Error Out" indicator.
Bob Schor
I have checked using with 4 Bytes too, same Problem. Yes, you are right. I am getting timeout error with error Code:66
08-22-2018 09:01 AM
@paul.r wrote:
Where are you getting the 1024 or 4 Bytes from? Is there some documentation with the target system that describes the message packet? If the message length header is 4 bytes, and you are reading 1024, you are going to be missing some of the data in your message because you already read that data and just discarded it when you did the first read.
Beyond that, it is going to be difficult for anyone here to give you much help without more information - what is the hardware? Is it some off the shelf item that maybe someone else here has used? Can you share the documentation? My guess is that message packet has some defined format, and you are not parsing it into the image data correctly.
I will check with the documentation about the message header. Thanks for the valuable Information. However, Please check the attached Image ,which I have got from Wireshark.
08-22-2018 09:30 AM
I'm guessing that if you thought that picture had information relevant to the issue, we have issues beyond LabVIEW to explore...