04-12-2010 11:31 AM
Hello
I am using C328 EV232 V2 board. I am using LabVIEW to acquire the image data through serial port. I have successfully acquired all the image data packets and have arranged them in sequence after removing all the packet headers and their respective Checksums (as mentioned in the user mannual of C328). I am writing image data in a text file. only 10% of image is clear and the rest of it is distorted. Why this is so?... Am I doing something wrong while reconstructing the image? I have checked the data packet headers and arranged the packets in sequence (as required to construct the image). Only starting image is correct but the 90% of it is completely distorted. Why this is happening?.. Am I doing something wrong while writing the data into text file?
I have attached both the images, the one which is captured by "C328Ap.exe" application software (snapshot.jpg), and the one that I acquired following through protocols (acquied image.jpg)
04-12-2010 11:42 AM
Serial Data reading wrote:
I am writing image data in a text file. only 10% of image is clear and the rest of it is distorted. Why this is so?...
Why are you writing to a text file?
I think you should be writing to a binary file. There's a difference with hexadecimal and text. For instance 0xA5 != "A5" or "0xA5".
Maybe there is something I do not understand, but typically, you would want to save the image data to a binary file.
04-12-2010 11:45 AM
actually what i am receiving through VISA read are characters. I am directly writing those characters into text file. By the way I already have tried writing binary file.... but no change in the result. Do i need to remove some special characters from the image data? like 0A (end of line) or 0D(carriage return)?
04-12-2010 11:57 AM
Can you post an example or a portion of the data that you received and want to write to file?
You may have to typecast it from string to U16 or U32. And you should probably remove all special characters first.
04-12-2010 11:59 AM
This is the hex data whose equivalent characters are needed to be written in a file so that they can be reconstructed as image. This is the first packet of image data. There are several packets like this
FF D8 FF E0 00 11 4A 46 49 46 00 01 02 03 04 05 06 07 08 09 0A
FF DB 00 43 00 10 0C 0C 0E 0C 0A
10 0E 0E 0E 12 12 10 14 18 28 1A 18 16 16 18 32 24 26 1E 28 3A 34 3E 3C 3A 34 38 38 40 48 5C 4E 40 44 58 46 38 38 50 6E 52 58 60 62 68 68 68 3E 4E 72 7A 70 64 78 5C 66 68 64 FF DB 00 43 01 12 12 12 16 16 16 30 1A 1A 30 64 42 38 42 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 FF C4 00 1F 00 00 01 05 01 01 01 01 01 01 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A
0B FF C4 00 B5 10 00 02 01 03 03 02 04 03 05 05 04 04 00 00 01 7D 01 02 03 00 04 11 05 12 21 31 41 06 13 51 61 07 22 71 14 32 81 91 A1 08 23 42 B1 C1 15 52 D1 F0 24 33 62 72 82 09 0A
16 17 18 19 1A 25 26 27 28 29 2A 34 35 36 37 38 39 3A 43 44 45 46 47 48 49 4A 53 54 55 56 57 58 59 5A 63 64 65 66 67 68 69 6A 73 74 75 76 77 78 79 7A 83 84 85 86 87 88 89 8A 92 93 94 95 96 97 98 99 9A A2 A3 A4 A5 A6 A7 A8 A9 AA B2 B3 B4 B5 B6 B7 B8 B9 BA C2 C3 C4 C5 C6 C7 C8 C9 CA D2 D3 D4 D5 D6 D7 D8 D9 DA E1 E2 E3 E4 E5 E6 E7 E8 E9 EA F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FF C4 00 1F 01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0A
0B FF C4 00 B5 11 00 02 01 02 04 04 03 04 07 05 04 04 00 01 02 77 00 01 02 03 11 04 05 21 31 06 12 41 51 07 61 71 13 22 32 81 08 14 42 91 A1 B1 C1 09 23 33 52 F0 15 62 72 D1 0A
16 24 34 E1 25 F1 17 18 19 1A 26 27 28 29 2A 35 36 37 38 39 3A 43 44 45 46 47 48 49 4A 53 54 55 56 57 58 59 5A 63 64 65
04-12-2010 02:46 PM
You probably should remove all the OA.
Looks like you got a color image. The raw data size should be width * height * 3.
04-12-2010 03:50 PM
Is this what the image file should look like?
(it's a binary file of U32). I called it dra.jpg because I want to be able to atach it to this post (limitation), and I did not know what format your image should be.
04-13-2010 02:00 AM
04-13-2010 02:04 AM
Dimensions are 640x480
What I think is that the problem is only writing the characters into text file in LabVIEW.
04-13-2010 02:10 AM