LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Misinterpreted image data in picture indicator

Hello! I have a problem with a JPG color image that is wrongly displayed in a picture indicator (I do not have vision).
The file is read with "Read bmp file" and the image data is connected to "Draw flattended pixmap" which is connected to a picture indicator. Some pixels have the wrong color (as if the picture indicator is using a colormap). If I probe the pixel data it is correctly displayed in the probe.
What to do?
/tj
0 Kudos
Message 1 of 7
(3,227 Views)
First, It is a bmp file not a jpg.
I realized that if the zoom-factor is less than 1 this strange behaviour occurs. Otherwise not.
Seems to be a NI problem.
/tj
0 Kudos
Message 2 of 7
(3,225 Views)
This doesn't happen just with the picture control, but could happen also with pictures you copy and paste into your front panel. I have seen several references in the past to LV's problem dealing with various formats and would definitely like to see LV handling this better. Attached is a small example showing this (7.1).
As a solution, I can suggest that you write your own subVI to perform the zoom by removing some of the data. Not as easy as using the zoom, but it should be fairly simple.

___________________
Try to take over the world!
0 Kudos
Message 3 of 7
(3,211 Views)
This is the example.
The display made the problems in 7.1 on XP.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(3,205 Views)


@tst wrote:
This is the example.
The display made the problems in 7.1 on XP.




Scaling pictures is a tricky business. There is no single perfect scaling routine. It all depends on the type of picture you have. For true color pictures (photos) you would need a scaling algorithme such as bilinear. But that gives rather bad results for vector graphics or similar things with sharp edges. So the problem here is that whatever algorithme the Picture Control would use it would be always wrong for at least half of the users. And then considering that the Picture Controls typical use was meant for Vector Graphics (look at the extensive library of vector graphic drawing commands) and bitmap support was only really a byproduct, it is clear why they didn't choose bilinear interpolation or similar algorithmes (besides that those algorithmes are also several times more processor intense). For true color picture support the IMAQ Toolkit would be a little better suited I would guess.

Or just take the real LabVIEW approach and implement the bilinear interpolation in a LabVIEW VI instead and then do the scaling yourself. I'm pretty sure there was a few years ago someone on Info-LabVIEW who posted about this.

Google also gives a few links (the first two relevant ones):

http://www.ammonsengineering.com/Image_Mapping/body_image_mapping.html
http://forums.lavausergroup.org/index.php?showtopic=472&mode=linearplus

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
Message 5 of 7
(3,194 Views)
Actually, my problem was always with pasting images on the FP, as part of the UI. There doesn't appear to be control over how this is done (I tried casting a decoration to a picture class, but it wasn't allowed), and it seems that no amount of playing can get it exactly right. If I play around enough with the picture in photoshop and powerpoint, I usually manage to paste it into the FP with no distortions, but quite often I get this effect in the picture. I am fairly sure I saw also immediately after pasting and not only when resizing.
I know I could use a picture control and load the picture, but I would like to avoid that.
This isn't an intolerable problem, just an inconvenience which it would be very nice to see solved.

___________________
Try to take over the world!
0 Kudos
Message 6 of 7
(3,181 Views)
Thank you all for the information. I hope NI can fix this problem because I cannot understand why a picture of pink skin will be green etc when the size is reduced.
Now I found a problem about the mouse position in a picture indicator but I will post that in another thread.
/tj
0 Kudos
Message 7 of 7
(3,171 Views)