LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In LabVIEW NXG, how to operate the image type file?

where does this image come from? A file on your filesystem?

If so you just use Read File (Binary).

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 20
(1,955 Views)

OK. I try to use Read File (Binary) and Write File (Binary). On other PC, I also receive a file. but I can't open this file, note: The original data format is not recognized.

0 Kudos
Message 12 of 20
(1,945 Views)

The binary read and write file make sure no line ending conversion or other text transformations are done. If the data is not byte for byte the same on both sides, something else in the transfer chain is corrupting/transforming the data stream.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 13 of 20
(1,938 Views)

If you use the Binary Read and Binary Write nodes, it should do the job:

 

LV_NXG Send Bin Data.png

Greets, Dave
0 Kudos
Message 14 of 20
(1,925 Views)

Great! I success receive the image file by this way on one PC. But on two PCs and USRPs, the situation is different. At the transmitter,  I converted data and sent them by modulation signal , then we called these data 'data1'. At the receiver, I received the data from modulation signal and demodula them . In the end , I got the data called 'data2'.

 

Actually, the 'data1'  is exactly the same as the 'data2'.  So I think the way on two PCs and USRPs should be the same as the first way on one PC.

But I can't open this file, note: The original data format is not recognized.

0 Kudos
Message 15 of 20
(1,917 Views)

The whole idea of "binary files" and "binary file transfer" is that the two files are byte-for-byte identical.  So if "File 1" is the "original" file (in whatever format -- I recall you mentioned ".jpeg"), and "File 2" is the "copy" somewhere else,

  • Are the sizes of the two files (number of bytes) identical?
  • Are the file extensions the same?

One thing you might consider (since you seem fixated more on transferring data over USRP than with "image type file") is to try to transfer, say, a small Word document, or a small Text document whose content you know.  Do these simpler transfers work?

 

If you've got a complicated, difficult problem to solve, sometimes it helps to break it down in simpler pieces that you can test one at a time.

 

Bob Schor 

 

0 Kudos
Message 16 of 20
(1,922 Views)

File1 and File2 .  Their sizes are different. But  on one PC transport, their sizes also different. I can open this file. On two PC , it can't do that.

I also try to transfer a '.txt' file. It can be transmitted without problems. Now the problem is just the transfer of image files.

0 Kudos
Message 17 of 20
(1,912 Views)

@akjoker wrote:

 Now the problem is just the transfer of image files. 


No! Your problem is transferring any binary data. Image or not doesn’t matter. Somewhere after reading in the file your conversions you perform are NOT maintaining the binary consistency of the data. Reasons could be many:

1) Use of some functions meant to work on text data.

2) Bad attempt at compressing the data further.

3) Bug in your code.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 18 of 20
(1,904 Views)

I have to admit, in the example I showed above, point 1 and 3 are describing a likely problem.


@rolfk wrote:

1) Use of some functions meant to work on text data.

 

if NOT using file functions working with text data, per default the size of arrays is preceded. Since I didn't wire the boolean input "Prepend Array Size" with a FALSE- constant, the size of the saved data will be increased by four bytes, holding the size of the array.

 

2) Bad attempt at compressing the data further.

3) Bug in your code.

 

This should be considered a bug.

 

The funny thing is, that my Image- Viewer (Irfanview) had no problem, showing the newly saved jpg- image.


 

Greets, Dave
0 Kudos
Message 19 of 20
(1,894 Views)

I find the problem. The data type changed during processing. U8 becomes I8. If you change I8 back to U8, an error will occur.

So can I specify I8 type when reading the file?

0 Kudos
Message 20 of 20
(1,724 Views)