LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw Flattened Pixmap Oddity/Bug? Picture Control Gurus Needed

Attached is the Draw Flattened Pixmap.vi. It is slightly modified in which I saved default values image data (480 rows by 640 columns) and created scroll bars on the output picture control. Now if you adjust the bottom control to say 100, the image displays correctly. Change bottom back to 480 and change right from 640 to 638. Why does the image become garbled????

Picture control gurus (and app engineers) please respond.
0 Kudos
Message 1 of 21
(6,491 Views)
I forgot to attach the VI.
0 Kudos
Message 2 of 21
(6,479 Views)
Because your data is 640 bytes each line. When you wraw it 638 bytes each line, 2 extra bytes goes to next line. That mess up the image.

That's the nature of bitmap. LabVIEW inherits this from MS Window.

If you want to change the image size to 638 x 480, you can unflatten the image to a 2d array, get array subset,
and then flatten it to pixmap data.

George Zou
http://gtoolbox.yeah.net
George Zou
Message 3 of 21
(6,453 Views)
Hi George:

In essence, what you stated is what I'm doing. I'm actually loading a partial map image using the read binary file VIs. I pass the partial image to flatten pixmap and draw flatten pixmap. Draw flatten pixmap cannot draw clipped column arrays!

See attahed VI for more info.
0 Kudos
Message 4 of 21
(6,452 Views)
If you download the first VI and set the Right control to 639, the image dispays correctly after it chops off the last column. Anything below 639, the image is hosed. Seems like a bug to me.
0 Kudos
Message 5 of 21
(6,458 Views)
There is something wrong with this image :
to display it entirely, you need to enter 933 and 933 (293+640) as left and right limits.
CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 21
(6,453 Views)
I have to side with George on this one.

The attached illustrates how to insert a clipped version of your image.

The tricky part is that you need an even number of bytes.

I vote no bug but that is just my opinion.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 21
(6,446 Views)
Thanks Ben for the VI. This I vote is a bug. The VI should be able to clip images with odd number of columns. It works with odd number of rows. Then too, you had to modify the VI to work with columns!

In any case, I'm starting to understand what George had to say. Now that one half of my problem is solved (thanks again Ben) in which I can live with drawing even number of columns, I want to load a clipped image from a binary file.

The reason I want to do this is I do not want to load the whole image into memory since I'm using the PDA.

Attached is a VI that shows what I think George was alluding to.

The original array size is 6 rows by 10 columns. The rows works fine. However, if you set the columns to something less than 10, you get unexpected behavior.

For example, set columns to 9. You would think element values 9,19,29,39,49,59 would not be loaded from the original file. However, element values 54,55,56,57,58,59 are not loaded. Is this the Windows limitation George was talking about?

Any workarounds?
0 Kudos
Message 8 of 21
(6,434 Views)
Since most of what I know about the picture control was derived from George, HP plotters and experimenting, I can can not argue that this is or isn't a bug.

I reacall first seeing this issue in LV DSC 6.1 when trying to imbed control images into a picture. I saw the same behaviour with all image depths I tried and eventually figured out what George suggested.

To truely settle this question we will have to get someone who KNOWS how the picture control is supposed to work.

I will see what I can get together.

Stay tuned,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 21
(6,415 Views)
Hi rberger,

When a bitmap is stored in memory it is basically stored as a one-dimension array without rows and columns. Therefore, when you specify that your image is only 638 pixels wide, you are not telling LabVIEW to cut off the last two pixels in each line, but simply to divide the bitmap (1D-array of pixels) in portions (lines) of 638 pixels each. Therefore you will see pixel number 639 and 640 in the beginning of line two etc.

A similar behavior happens when you are trying to read multi-dimensioned arrays from a file. In the example that you attached, you need to specify the number of rows and columns in the array. Since the data is saved as a 1D-array, your choice of rows and columns will simply tell the Read File function how to interpret the data in the file.

If you want to perform a true subset of your 2D data, you should use the functionality of the Array Subset function. Using that function you can choose exactly what part (subset) of the 2D-array you want to extract. Please see the attached ArraySubset.vi for a simple array example. I also attached an example called CropSave.vi that performs the subset function on a pixmap.

Have fun!

Message Edited by Philip C. on 06-06-2005 12:39 AM

- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
Download All
0 Kudos
Message 10 of 21
(6,393 Views)