LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drawings on Picture Control become blurry when zooming a picture subset

Hi,

 

I have an application where I draw a bunch of shapes onto a picture control. I have added zoom functionality on it as well using property nodes zoom factor method. after using property node I clip the extra image from the picture control using get image subset function to make sure only the visible part of the image is loaded to the front panel so that front panel dosen't slow down because otherwise it slows down drastically. The issue is as soon as I take subset of the visible area of the picture the drawing objects in the picture control become really blurry.

NoumanFaheem_0-1693214659135.png

 

 

Notice that the only curved drawings get blurry the straight line remains sharp. Is there any other way to achieve this functionality without the blur. I have attached a simplified VI that replicates the issue. 

 

Note the attached VI is a really simplified version the original implementation has thousands of drawing objects in it.

 

Regards,

Nouman Faheem

0 Kudos
Message 1 of 13
(1,304 Views)

Hi Nouman,

 


@NoumanFaheem wrote:

Notice that the only curved drawings get blurry the straight line remains sharp. Is there any other way to achieve this functionality without the blur.


Drawing in a 2DPicture indicator works pixel-based: when you zoom into pixel-based images the pixels get "blurry" like in any other pixel-based graphics tool! There's no way around that (except using more advanced zooming algorithms to minimize that problem)…

 

Btw. the "straight line" at 45° in your image also gets blurry!

 

Possible solution: find a tool that uses vector-based graphics (like InkScape). Use that tool to draw your images and to zoom into those images. Then export the image from that 3rd party tool to a pixel-based picture format and display it in your 2DPicture indicator…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(1,299 Views)

Yes you might be right but the thing is this issue only occurs when converting the picture data into image data and then reconstructing the image from that image data back to a picture. I have attached a VI that shows this behavior. Also in the picture below you can see when I feed the picture data directly to the indicator and then zoom it the blurriness doesn't occur even though I am using property nodes for zooming in. So it can be deduced that the VIs that convert the picture to image data and vice versa changes something which causes the effect. The 2nd VI demonstrates this behavior.

NoumanFaheem_0-1693216492730.png

 

Download All
0 Kudos
Message 3 of 13
(1,290 Views)

For example here I have zoomed the image 48x but still there is no pixilation.

NoumanFaheem_0-1693218262586.png

 

0 Kudos
Message 4 of 13
(1,278 Views)

Hi Nouman,

 


@NoumanFaheem wrote:

Yes you might be right but the thing is this issue only occurs when converting the picture data into image data and then reconstructing the image from that image data back to a picture.


So you convert to a 2D array of pixels and then you display that "bunch of pixels" in your picture display - and now you wonder about that blurring when zooming into an array of pixels?

(Btw. I cannot open your VIs as I'm stuck to LV2019 right now.)

 


@NoumanFaheem wrote:

So it can be deduced that the VIs that convert the picture to image data and vice versa changes something which causes the effect.


Converting to "image data" is like printing your vector-based image onto a sheet of (fixed-sized) paper: all information on how that image originally was drawn is lost in this translation process!

 

Converting the "image data" back to "picture data" is like scanning the printed sheet: you "just" place a 2D array of pixels into your picture…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 13
(1,271 Views)

Ok that makes a lot of sense thank you. Now is there another way to take the subset of my picture without converting it to "image data" and loosing vector information?

 

Also I have attached the VI in 2019 version.

0 Kudos
Message 6 of 13
(1,267 Views)

Hi Nouman,

 


@NoumanFaheem wrote:

Now is there another way to take the subset of my picture without converting it to "image data" and loosing vector information?


AFAIK there is no other way…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 13
(1,248 Views)

@NoumanFaheem wrote:

Ok that makes a lot of sense thank you. Now is there another way to take the subset of my picture without converting it to "image data" and loosing vector information?

 

Also I have attached the VI in 2019 version.


  • I am not sure about the purpose of the upper loop. It is not needed for the demo.
  • What's the purpose of the disconnected image subset function?
  • your code still allows non-positive zoom factors.

Instead of "zooming", you could keep the zoom factor at "1" and redraw the image with scaled/transformed positions and linewidths.

0 Kudos
Message 8 of 13
(1,199 Views)

Draw the whole thing, but use the picture ctrl properties (origin and draw area size) to show the subset.
It might be faster than drawing a subset in image data.

George Zou
0 Kudos
Message 10 of 13
(1,190 Views)