LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

image size?

I'm trying to process some image data, and am uncertain about the actual image size once I have pixmap data.

 

I use "read bmp data".  If I look at the image data from that function, the "rectangle" is 0,0 and 640,480.  Then I "draw flattened pixmap", and link this to an image object on the front panel.  I set the image properties height and width to 640 and 480.  But the resulting image is cropped compared to the original.

 

I read in "draw flattened pixmap" help that image creation VIs add 2 pixel padding around the image.  So maybe I need to increase the image properties to 644 and 484.  But I find that I'm still cropping 2 pixels.

 

I need to understand why the size appears to be incorrect, because I need to perform some image processing of specific zones in the image.  Can anyone explain why the image is getting cropped?

 

Thanks

0 Kudos
Message 1 of 15
(5,919 Views)

A copy of your code (VI with the part of your code that give you problem) would be make it so much easier for us to help you and for you to get the proper help.

Marc Dubois
0 Kudos
Message 2 of 15
(5,904 Views)

OK, thanks.  See attached file.  Default image in VI is a 30 wide 20 high image with red rectangle inside from 0,0 to 29,19 and blue rectangle from 1,1 to 28,18 (the forum wouldn't let me insert the original BMP file).  In the VI I have to set the image properties to 36 wide, 26 high, or the image gets cropped.  Why?  I can understand maybe this 2 pixel boundary is added, so perhaps I have to set it to 34 wide 24 high, but why 36x26?  

 

In other words, I just need to understand why...

0 Kudos
Message 3 of 15
(5,883 Views)

@mattstiles wrote:

I'm trying to process some image data, and am uncertain about the actual image size once I have pixmap data.

 

I use "read bmp data".  If I look at the image data from that function, the "rectangle" is 0,0 and 640,480.  Then I "draw flattened pixmap", and link this to an image object on the front panel.  I set the image properties height and width to 640 and 480.  But the resulting image is cropped compared to the original.

 

I read in "draw flattened pixmap" help that image creation VIs add 2 pixel padding around the image.  So maybe I need to increase the image properties to 644 and 484.  But I find that I'm still cropping 2 pixels.

 

I need to understand why the size appears to be incorrect, because I need to perform some image processing of specific zones in the image.  Can anyone explain why the image is getting cropped?

 

Thanks


There is nothing spefically named "image properties height and width". How are you setting these values, programmatically using the "draw area size" property (which is how you should do it, using ricght-left and bottom-top from the image data cluster) or by right-clicking the 2D picture control and setting the size height and width manually? (note that what I observed using 2D Picture modern control is that the border is 3 pixels thick).

 

Ben64

0 Kudos
Message 4 of 15
(5,880 Views)

Hi,

 

Yeah, the latter (right click the picture control).  All my images are the same size so this should be OK, but I could do this programmatically as well.  So is this just because of the picture control?  The bottom line is that I'm going to draw a circle over the image, and it needs to be located properly down to the pixel.  For example, if I want a circle center coord at 10,10, do I need to add any pixels to accommodate some sort of boundary added by the VIs I'm using?

 

Thanks

0 Kudos
Message 5 of 15
(5,873 Views)

@mattstiles wrote:

Hi,

 

Yeah, the latter (right click the picture control).  All my images are the same size so this should be OK, but I could do this programmatically as well.  So is this just because of the picture control?  The bottom line is that I'm going to draw a circle over the image, and it needs to be located properly down to the pixel.  For example, if I want a circle center coord at 10,10, do I need to add any pixels to accommodate some sort of boundary added by the VIs I'm using?

 

Thanks


It is better to set the drawing area to the size of the image.

 

auto draw area size.png

 

Ben64

Message 6 of 15
(5,857 Views)

COULD YOU SEND YOUR VI IN LOWER VERSION ?
also why you do not use vision toolkit for this propose 

0 Kudos
Message 7 of 15
(5,825 Views)

@Hatef wrote:

COULD YOU SEND YOUR VI IN LOWER VERSION ?
also why you do not use vision toolkit for this propose 


Who are you responding to?

 

Why would someone use the vision toolkit which is a pricey addon when it isn't needed in this case?

0 Kudos
Message 8 of 15
(5,816 Views)

Hi 

0 Kudos
Message 9 of 15
(5,788 Views)

@Hatef wrote:

Hi 


  1. A possible solution was already given, I also wonder why you propose something which is using Vision, and not really relevant in this case.
  2. Using capital letters in a whole sentence is considered in every forum as shouting. 
  3. Please try to start your sentences with a capital letter, and stop them with a period symbol ".". It would improve the readability of your posts even if the English is limited (English is neither my native language just to note, but try to improve it).
  4. If you want to post often images of your code, I would recommend you to install the Code Capture Tool ( http://sine.ni.com/nips/cds/view/p/lang/en/nid/210424 ). A LabVIEW snippet is a much better way to share code in the forum.
0 Kudos
Message 10 of 15
(5,756 Views)