How to display a bmp in labview?
Hi, all
I want to display bmp in labview. I use function: draw image from File in OpenG library.
But i report error because this is Unsupported image depth. My bmp is 16 bit depth.
Should i conver it to other supported bit depth? there are so many files. Anyone can tell
me how to resolve this problem? Thanks very much.
attached my bmp file.
br
Attachments:
bmp.zip 8 KB
For vision you will need a seperate license.
Here's a VI that will read 16 bit images. However the colors for 16 bit color are ambigious. So you will need to tinker with the colors.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!
Attachments:
ReadMain.vi 22 KB
Similar Messages
-
How to display scope plot in Labview GUI?
I am trying to figure out how to show TDS8000 scope output plot in LV GUI(?)
This maybe a two fold question.
1. I suppose it may be necessary to adjust the scope scale with appropriate level so that the plot will show enough details of information. (e.g., finding Max and Min points)
2. how to display scope plot in LV GUI?
It would be a great help if anyone can share an example VI.
Thanks,Hi jjlee,
It shouldn't be that difficult of a task. Most instrument drivers have
a simple initialize VI, and then some type of waveform measurement VI.
You would connect these two VIs and then take the output from the
waveform measurement (may be waveform acquire or something like that)
to a graph or chart (depending on if you're outside of inside of a
loop). That should be all you need to do for the simplest form of this
application. You would, of course, want to handle errors and close the
connection to the device when you're done collecting the data.
Hope this is of some help,
Regards,
Matt S.
LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA. -
Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
I have attached the VI.
Thanks for the help
Attachments:
new_control_and_acquisition_program.vi 946 KBTake a look at this document that discusses how to monitor IMAQ memory usage:
http://digital.ni.com/public.nsf/websearch/8C6E405861C60DE786256DB400755957
Hope this helps -
Julie -
I am trying to generate an application that saves a copy of its front panel on completion. This is easy to do using an invoke node with Print VI to HTML but this does not work in an .exe format. I have seen elsewhere that you have to use the Get Panel Image method, but no details are supplied in LV 5.0.1 documentation of how to use the "image" data (1-D Unsigned Byte array) that is generated. I want to save this in a format that can then be read as a bitmap in any standard graphics package. Any assistance?
Hi,
If you'd upgrade to LV5.1 or 6 you could use the 'standard' vi's for this.
You need a VI called "Write BMP File.vi". It's not shipped with LV5.0.1.
This vi only uses 3 subVI's, so perhaps someone at NI can convert it and
send it to you (sorry, I won't, it's copywrited).
If you cannot get this VI anywhere, you'll need to figure out the BMP file
format yourself. It's not too complicated, but still could take some days.
Perhaps someone figured it out before LV5.1 was released.
Regards,
Wiebe.
"RDK" wrote in message
news:[email protected]..
> I want to use Get Panel Image in Labview 5.0.1 and need details on how
> to save the BMP data generated
>
> I am trying to generate an application that saves a copy
of its front
> panel on completion. This is easy to do using an invoke node with
> Print VI to HTML but this does not work in an .exe format. I have seen
> elsewhere that you have to use the Get Panel Image method, but no
> details are supplied in LV 5.0.1 documentation of how to use the
> "image" data (1-D Unsigned Byte array) that is generated. I want to
> save this in a format that can then be read as a bitmap in any
> standard graphics package. Any assistance? -
Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
I have attached the VI.
Thanks for the help
Attachments:
new_control_and_acquisition_program.vi 946 KBgot these vi's off ni site a while ago - see if they help
Attachments:
Memory_Monitor.zip 132 KB -
How to display a 16-bit bmp file
Hi,
i have a 16 bit BMP file available in a byte[] along with the BITMAPINFO information. how to display this in Java.
i was able to find the code for displaying the 8-bit/24-bit BMP file in Javaworld :Java Tip 43 .
Pls provide pointers to sample/example code if available.Try JAI it supports 8, 16, and 32 bit image data types.
http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/index.html -
How to display different fonts in same indicator in labVIEW
hi
i want to know how to display different fonts in same string indicator at run time in labVIEW 8.2
Regards
Abhishek VermaHi ABHI VERMA,
see this http://digital.ni.com/public.nsf/allkb/6BD344ACA4DEE20A8625692700737E16
Mike -
please send me ready VIs doing that
Please post more information on what you are trying to do, and which software you have.
Are you using any Image Acquisition (IMAQ) software?
Which toolkit do you have?
Are you trying to display animated .jpeg or .gif images in LabVIEW front panel?
Animating LabVIEW Controls
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/6a44b4dccc2f435d86256afe0070265c?OpenDocument
Are you trying to display live images of LabVIEW front panels in a web browser?
Publishing Front Panels to the Web
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/aad6b634e63adabe86256921004c7edd?OpenDocument
Are you trying to display live web page images in LabVIEW front panel?
Building a Simple Web Browser Using ActiveX
http://zone.ni
.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/a17ad4e3a1eafe7086256775007827b6?OpenDocument
Please give more information so we can better assist you.
Zvezdana S.
National Instruments -
How to display URL images and URL link (html) from Smartforms?
Hi Gurus,
I'm having difficulty on how to display targeted URL images and URL link from the smartforms, after i sending it out as html mail. The mail i sent just can be preview as a plain text, which can't execute the html code that i put inside the smartforms itself. I follow a few step from this very useful blog.. Hopefully, you guys can give me some solutions or ideas on this.
/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp -thanks to Pavan for his useful blog.
My code is like this..
<--- Start Code.
FORM call_smartforms.
DATA : lv_subject TYPE so_obj_des,
lc_true(1) VALUE 'X',
lw_control_parameters TYPE ssfctrlop,
lw_output_options TYPE ssfcompop,
lc_graphics(8) VALUE 'GRAPHICS',
lw_xsfparam_line TYPE ssfxsfp,
lc_extract(7) VALUE 'EXTRACT',
lc_graphics_directory(18) VALUE 'GRAPHICS-DIRECTORY',
lc_mygraphics(11) VALUE 'mygraphics/',
lc_content_id(10) VALUE 'CONTENT-ID',
lc_enable(6) VALUE 'ENABLE',
lw_job_output_info TYPE ssfcrescl,
lw_html_data TYPE trfresult,
lw_graphics TYPE ssf_xsf_gr,
lt_graphics TYPE tsf_xsf_gr,
lv_html_xstr TYPE xstring,
lw_html_raw LIKE LINE OF lw_html_data-content,
lv_incode TYPE tcp00-cpcodepage VALUE '4110',
lv_html_str TYPE string,
lv_html_len TYPE i,
lc_utf8(5) VALUE 'utf-8',
lc_latin1(6) VALUE 'latin1',
lv_offset TYPE i,
lv_length TYPE i,
lv_diff TYPE i,
lt_soli TYPE soli_tab,
lw_soli TYPE soli,
lc_mime_helper TYPE REF TO cl_gbt_multirelated_service,
lv_name TYPE mime_text VALUE 'sapwebform.htm',
lv_xstr TYPE xstring,
lw_raw TYPE bapiconten,
lt_solix TYPE solix_tab,
lw_solix TYPE solix,
lv_filename TYPE string,
lv_content_id TYPE string,
lv_content_type TYPE w3conttype,
lv_obj_len TYPE so_obj_len,
lv_bmp TYPE so_fileext VALUE 'BMP',
lv_description TYPE so_obj_des VALUE 'Graphic in BMP format',
lc_doc_bcs TYPE REF TO cl_document_bcs,
lc_bcs TYPE REF TO cl_bcs,
lc_send_exception TYPE REF TO cx_root,
lw_adsmtp TYPE lty_adsmtp,
lv_mail_address TYPE ad_smtpadr,
lc_recipient TYPE REF TO if_recipient_bcs,
lc_send_request TYPE REF TO cl_bcs,
lv_sent_to_all TYPE os_boolean.
DATA : v_language TYPE sflangu VALUE 'E',
v_e_devtype TYPE rspoptype.
v_form_name = 'ZTEST_EMAIL'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = v_form_name
IMPORTING
fm_name = v_namef
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc = 0.
break mhusin.
ENDIF.
starting here. ***
Set title for the output
lv_subject = 'Smartforms.'.
Set control parameters to "no dialog"
lw_control_parameters-no_dialog = lc_true.
IF lw_service_subject-code = lc_fm1.
*--- To get output device type
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
lw_output_options-tdprinter = v_e_devtype.
lw_control_parameters-getotf = 'X'.
IF sy-subrc = 0.
break mhusin.
ENDIF.
Set output options
lw_output_options-xsf = lc_true.
lw_output_options-xsfcmode = lc_true.
lw_output_options-xsfoutmode = 'A'.
lw_output_options-xsfoutdev = space.
lw_output_options-xsfformat = lc_true.
lw_xsfparam_line-name = lc_graphics.
lw_xsfparam_line-value = lc_extract.
APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
lw_xsfparam_line-name = lc_graphics_directory.
lw_xsfparam_line-value = lc_mygraphics.
APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
lw_xsfparam_line-name = lc_content_id.
lw_xsfparam_line-value = lc_enable.
APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
Get the smartform content
CALL FUNCTION v_namef
EXPORTING
control_parameters = lw_control_parameters
output_options = lw_output_options
*pass other application specific parameters (eg order number, items ).
IMPORTING
job_output_info = lw_job_output_info
TABLES
tt_tabh = tt_tabh
tt_tabb = tt_tabb
tt_tabf = tt_tabf
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc = 0.
break mhusin.
ENDIF.
lw_html_data = lw_job_output_info-xmloutput-trfresult.
lt_graphics[] = lw_job_output_info-xmloutput-xsfgr[].
CLEAR lv_html_xstr.
LOOP AT lw_html_data-content INTO lw_html_raw.
CONCATENATE lv_html_xstr lw_html_raw INTO lv_html_xstr IN BYTE MODE.
ENDLOOP.
lv_html_xstr = lv_html_xstr(lw_html_data-length).
CALL FUNCTION 'SCP_TRANSLATE_CHARS'
EXPORTING
inbuff = lv_html_xstr
incode = lv_incode
csubst = lc_true
substc_space = lc_true
IMPORTING
outbuff = lv_html_str
outused = lv_html_len
EXCEPTIONS
OTHERS = 1.
*HACK THE HTML CODE GENERATED BY SMARTFORM TO MAKE THE
*EXTERNAL IMAGES APPEAR AS <IMG> TAG IN HTML
REPLACE ALL OCCURRENCES OF '<IMG' IN lv_html_str WITH '<IMG' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '/>' IN lv_html_str WITH '/>' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '</A>' IN lv_html_str WITH '' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<' IN lv_html_str WITH '<' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '>' IN lv_html_str WITH '>' IGNORING CASE.
CALL METHOD html_control - >load_mime_object
EXPORTING
object_id = 'ZWN'
object_url = 'ZWN.GIF'
EXCEPTIONS
OTHERS = 1.
REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH lc_latin1.
REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH 'iso-8859-1'.
break mhusin.
lv_html_len = STRLEN( lv_html_str ).
lv_offset = 0.
lv_length = 255.
WHILE lv_offset < lv_html_len.
lv_diff = lv_html_len - lv_offset.
IF lv_diff > lv_length.
lw_soli-line = lv_html_str+lv_offset(lv_length).
ELSE.
lw_soli-line = lv_html_str+lv_offset(lv_diff).
ENDIF.
APPEND lw_soli TO lt_soli.
ADD lv_length TO lv_offset.
ENDWHILE.
CREATE OBJECT lc_mime_helper.
CALL METHOD lc_mime_helper->set_main_html
EXPORTING
content = lt_soli
filename = lv_name
description = lv_subject.
LOOP AT lt_graphics INTO lw_graphics.
CLEAR lv_xstr.
LOOP AT lw_graphics-content INTO lw_raw.
CONCATENATE lv_xstr lw_raw-line INTO lv_xstr IN BYTE MODE.
ENDLOOP.
lv_xstr = lv_xstr(lw_graphics-length).
lv_offset = 0.
lv_length = 255.
CLEAR lt_solix[].
WHILE lv_offset < lw_graphics-length.
lv_diff = lw_graphics-length - lv_offset.
IF lv_diff > lv_length.
lw_solix-line = lv_xstr+lv_offset(lv_length).
ELSE.
lw_solix-line = lv_xstr+lv_offset(lv_diff).
ENDIF.
APPEND lw_solix TO lt_solix.
ADD lv_length TO lv_offset.
ENDWHILE.
CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_filename.
CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_content_id.
lv_content_type = lw_graphics-httptype.
lv_obj_len = lw_graphics-length.
*Add images to the email
CALL METHOD lc_mime_helper->add_binary_part
EXPORTING
content = lt_solix
filename = lv_filename
extension = lv_bmp
description = lv_description
content_type = lv_content_type
length = lv_obj_len
content_id = lv_content_id.
ENDLOOP.
TRY.
lv_subject = lv_subject.
lc_doc_bcs = cl_document_bcs=>create_from_multirelated(
i_subject = lv_subject
i_multirel_service = lc_mime_helper ).
CATCH cx_document_bcs INTO lc_send_exception.
CATCH cx_bcom_mime INTO lc_send_exception.
CATCH cx_gbt_mime INTO lc_send_exception.
ENDTRY.
Create send request
TRY.
lc_bcs = cl_bcs=>create_persistent( ).
CATCH cx_send_req_bcs INTO lc_send_exception.
ENDTRY.
TRY.
lc_bcs->set_document( i_document = lc_doc_bcs ).
CATCH cx_send_req_bcs INTO lc_send_exception.
ENDTRY.
Set-up email receiver
lv_mail_address = '[email protected]'.
TRANSLATE lv_mail_address TO UPPER CASE.
TRY.
lc_recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = lv_mail_address ).
CATCH cx_address_bcs INTO lc_send_exception.
ENDTRY.
TRY.
lc_bcs->add_recipient( i_recipient = lc_recipient ).
CATCH cx_send_req_bcs INTO lc_send_exception.
ENDTRY.
Send smartforms as HTML email
TRY.
lc_bcs->send( ).
CATCH cx_send_req_bcs INTO lc_send_exception.
ENDTRY.
COMMIT WORK.
WRITE:/ 'Mail sent'.
ENDFORM. "call_smartforms
End Code --->
Thanks and Regards.1- put your images in a directory under the web app directory. Example: app/images/
2- in your jsp, use: String file = application.getRealPath("/images/"); to get the images directory. See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
3- it's not the right forum to post this kind of question. Post them in the JSP/Servlet JSTL forum instead -
I Want to display a bmp file and use an image icon to display it, how do I do this?
tnxHi
I am giving you the source code to display BMP file in Java
SOURCE CODE =======>>
public Image loadBitmap (byte[] bmpImage)
Image image = null;
try
ByteArrayInputStream fs=new ByteArrayInputStream(bmpImage);
int bflen=14; // 14 byte BITMAPFILEHEADER
byte bf[]=new byte[bflen];
fs.read(bf,0,bflen);
int bilen=40; // 40-byte BITMAPINFOHEADER
byte bi[]=new byte[bilen];
fs.read(bi,0,bilen);
// Interpret data.
int nsize = (((int)bf[5]&0xff)<<24) | (((int)bf[4]&0xff)<<16) | (((int)bf[3]&0xff)<<8)| (int)bf[2]&0xff;
int nbisize = (((int)bi[3]&0xff)<<24)| (((int)bi[2]&0xff)<<16) | (((int)bi[1]&0xff)<<8)| (int)bi[0]&0xff;
int nwidth = (((int)bi[7]&0xff) << 24) | (((int)bi[6]&0xff)<<16) | (((int)bi[5]&0xff)<<8)| (int)bi[4]&0xff;
int nheight = (((int)bi[11]&0xff) << 24)| (((int)bi[10]&0xff)<<16)| (((int)bi[9]&0xff)<<8)| (int)bi[8]&0xff;
int nplanes = (((int)bi[13]&0xff)<<8)|(int)bi[12]&0xff;
int nbitcount = (((int)bi[15]&0xff)<<8)|(int)bi[14]&0xff;
// Look for non-zero values to indicate compression
int ncompression = (((int)bi[19])<<24)|
(((int)bi[18])<<16)| (((int)bi[17])<<8)|(int)bi[16];
int nsizeimage = (((int)bi[23]&0xff)<<24)|
(((int)bi[22]&0xff)<<16)| (((int)bi[21]&0xff)<<8)|
(int)bi[20]&0xff;
int nxpm = (((int)bi[27]&0xff)<<24)|
(((int)bi[26]&0xff)<<16)| (((int)bi[25]&0xff)<<8)|
(int)bi[24]&0xff;
int nypm = (((int)bi[31]&0xff)<<24)| (((int)bi[30]&0xff)<<16)| (((int)bi[29]&0xff)<<8)| (int)bi[28]&0xff;
int nclrused = (((int)bi[35]&0xff)<<24)|(((int)bi[34]&0xff)<<16)| (((int)bi[33]&0xff)<<8)| (int)bi[32]&0xff;
int nclrimp = (((int)bi[39]&0xff)<<24)| (((int)bi[38]&0xff)<<16)| (((int)bi[37]&0xff)<<8)| (int)bi[36]&0xff;
Toolkit tk = Toolkit.getDefaultToolkit();
if (nbitcount==24)
* No Palette data for 24-bit format butscan lines are
* padded out to even 4-byte boundaries.
int npad = (nsizeimage / nheight) - nwidth * 3;
if (npad == 4)
npad = 0;
int ndata[] = new int [nheight * nwidth];
byte brgb[] = new byte [( nwidth + npad)* 3 * nheight];
fs.read (brgb, 0, (nwidth + npad) * 3 *nheight);
int nindex = 0;
for (int j = 0; j < nheight; j++)
for (int i = 0; i < nwidth; i++)
ndata [nwidth * (nheight- j - 1) + i] = (255&0xff)<<24 | (((int)brgb[nindex+2]&0xff)<<16)|(((int)brgb[nindex+1]&0xff)<<8) | (int)brgb[nindex]&0xff;
nindex += 3;
nindex += npad;
image = tk.createImage( new MemoryImageSource (nwidth, nheight, ndata, 0, nwidth));
else if (nbitcount == 8)
* Have to determine the number ofcolors, the clrsused
* parameter is dominant if it is greaterthan zero. If
* zero, calculate colors based onbitsperpixel.
int nNumColors = 0;
if (nclrused > 0)
nNumColors = nclrused;
else
nNumColors = (1&0xff)<<nbitcount;
// Some bitmaps do not have the sizeimagefield calculated// Ferret out these cases and fix 'em.
if (nsizeimage == 0)
nsizeimage =((((nwidth*nbitcount)+31) & ~31 ) >> 3);
nsizeimage *= nheight;
int tempSize = ((((nwidth*nbitcount)+31)& ~31 ) >> 3);
tempSize *= nheight;
// Read the palatte colors.
int npalette[] = new int [nNumColors];
byte bpalette[] = new byte[nNumColors*4];
fs.read (bpalette, 0, nNumColors*4);
int nindex8 = 0;
for (int n = 0; n < nNumColors; n++)
npalette[n] = (255&0xff)<<24|(((int)bpalette[nindex8+2]&0xff)<<16)|(((int)bpalette[nindex8+1]&0xff)<<8)|(int)bpalette[nindex8]&0xff;
nindex8 += 4;
* Read the image data (actually indices into the palette)//
* Scan lines are still padded out to even 4-byte// boundaries.
int npad8 = (nsizeimage / nheight) -nwidth;
int ndata8[] = new int [nwidth*nheight];
byte bdata[] = new byte[(nwidth+npad8)*nheight];
fs.read (bdata, 0,(nwidth+npad8)*nheight);
nindex8 = 0;
for (int j8 = 0; j8 < nheight; j8++)
for (int i8 = 0; i8 < nwidth;i8++)
ndata8[nwidth*(nheight-j8-1)+i8] = npalette[((int)bdata[nindex8]&0xff)];
nindex8++;
nindex8 += npad8;
image = tk.createImage( new MemoryImageSource (nwidth, nheight, ndata8, 0, nwidth));
//support for 4Bpp bmps...
else if (nbitcount == 4)
int nNumColors = 0;
if (nclrused > 0)
nNumColors = nclrused;
else
nNumColors = (1&0xff)<<nbitcount;
* Some bitmaps do not have the sizeimagefield calculated//
* Ferret out these cases and fix 'em.
if (nsizeimage == 0)
nsizeimage =((((nwidth*nbitcount)+31) & ~31 ) >> 3);
nsizeimage *= nheight;
* Read the color table. BMP's always have the complete color
* table when the number of colors used = 0
int npalette[] = new int [nNumColors];
byte bpalette[] = new byte[nNumColors*4];
fs.read (bpalette, 0, nNumColors*4);
int nindex8 = 0;
for (int n = 0; n < nNumColors; n++)
npalette[n] = (255&0xff)<<24|(((int)bpalette[nindex8+2]&0xff)<<16)|(((int)bpalette[nindex8+1]&0xff)<<8)|(int)bpalette[nindex8]&0xff;
nindex8 += 4;
* Read the image data (actually indicesinto the palette)//
* Scan lines are still padded out toeven 4-byte// boundaries.
int half = nwidth/2;
if (nwidth%2 != 0)
half++;
int npad4 = (nsizeimage / nheight) -half;
int tempSize = ((((nwidth*nbitcount)+31)& ~31 ) >> 3);
tempSize *= nheight;
int ndata4[] = new int [2*half*nheight];
byte bdata[] = new byte [(half +npad4)*nheight];
fs.read (bdata, 0, (half +npad4)*nheight);
int nindex4 = 0;
for (int j4 = 0; j4 < nheight; j4++)
for (int i4 = 0; i4 < half; i4++)
int i1 =nwidth*(nheight-j4-1)+(2*i4) ;
ndata4 [i1] = npalette[((int)bdata[nindex4]&0xf0)>>4];
ndata4 [i1+1] = npalette[((int)bdata[nindex4]&0xf)];
nindex4++;
nindex4 += npad4;
image = tk.createImage( new MemoryImageSource (nwidth, nheight, ndata4, 0, nwidth));
//support for monochrome...
else if (nbitcount == 1)
int nNumColors = 0;
if (nclrused > 0)
nNumColors = nclrused;
else
nNumColors = (1&0xff)<<nbitcount;
* Some bitmaps do not have the sizeimagefield calculated
* Ferret out these cases and fix 'em.
if (nsizeimage == 0)
nsizeimage =((((nwidth*nbitcount)+31) & ~31 ) >> 3);
nsizeimage *= nheight;
* Read the color table...
* BMP's always have the complete color table when the number
* of colors used = 0
int npalette[] = new int [nNumColors];
byte bpalette[] = new byte[nNumColors*4];
fs.read (bpalette, 0, nNumColors*4);
int nindex1 = 0;
for (int n = 0; n < nNumColors; n++)
npalette[n] = (255&0xff)<<24|(((int)bpalette[nindex1+2]&0xff)<<16)|(((int)bpalette[nindex1+1]&0xff)<<8)|(int)bpalette[nindex1]&0xff;
nindex1 += 4;
* Read the image data (actually indicesinto the palette)
* Scan lines are still padded out to even 4-byte// boundaries.
int limit = nwidth/8;
int npad1 = (nsizeimage / nheight) -limit;
if (nwidth%8 != 0)
int tempSize = ((((nwidth*nbitcount)+31)& ~31 ) >> 3);
tempSize *= nheight;
int ndata1[] = new int[(nwidth*nheight)];
byte bdata[] = new byte [(limit +npad1)*nheight];
fs.read (bdata, 0, (limit +npad1)*nheight);
nindex1 = 0;
for (int j1 = 0; j1 < nheight; j1++)
for (int i1 = 0; i1 < limit;i1++)
int id1 =nwidth*(nheight-j1-1)+(8*i1);
* here each bit of thearray should be converted to a
* byte - 0 or 1
ndata1 [id1] = npalette[(int)((bdata[nindex1]&0x80)>>7)];
ndata1 [id1+1] = npalette[(int)((bdata[nindex1]&0x40)>>6)];
ndata1 [id1+2] = npalette[(int)((bdata[nindex1]&0x20)>>5)];
ndata1 [id1+3] = npalette[(int)((bdata[nindex1]&0x10)>>4)];
ndata1 [id1+4] = npalette[(int)((bdata[nindex1]&0x8)>>3)];
ndata1 [id1+5] = npalette[(int)((bdata[nindex1]&0x4)>>2)];
ndata1 [id1+6] = npalette[(int)((bdata[nindex1]&0x2)>>1)];
ndata1 [id1+7] =npalette [(int)(bdata[nindex1]&0x1)];
nindex1++;
nindex1 += npad1;
image = tk.createImage( new MemoryImageSource (nwidth, nheight, ndata1, 0, nwidth));
else
image = (Image)null;
fs.close();
return image;
catch (Exception e)
e.printStackTrace();
return (Image) null;
Deepak
[email protected] -
How to display PSA screen capture on Front Panel
Any one know how to display screen capture of PSA series specturm analyzer on front panel. I can save the JPEG file in the C drive, but I can't display on the front pannel. Please see my labview code.
Solved!
Go to Solution.
Attachments:
Capture screen E4446A.vi 21 KB
reading and writing binary number.vi 22 KB
yumg.jpg 20 KBDo you actually need to save the front panel image? Or do you want to save a graph of the signal (spectrum) that you acquired? If the latter will do the trick, you can simply read the waveform over GPIB (or whichever means you control the analyzer) into an array that is plotted to a waveform graph in LabVIEW. You then save the image of the waveform graph as an image.
Since you have all the data, you can even save the data which can be viewed later (and not only by LabVIEW). -
How to display every other images in image indicator
Hi All,
I am using IMAQ to grab and save high freq and high resolution images. I have an image indicator directly from "Image Grab Acquire". So, the image indicator is displaying every single images at a very high frequency too. We have to display frames, but not necessarily every single one (enough so the operator can see what's going on). So, I am wondering how I can display, say every other images (such as all odd/even number of images), or jump over two and display the third?
Any help will be appreciated!
Thanks!
Wenlong
Solved!
Go to Solution.Here are some general comments.
Image acquisition is "a horse of a different color" -- unlike many other I/O devices, the memory that holds the data (here called the "buffer") is managed by the driver, and isn't directly available to LabVIEW.
I'm guessing that you are using NI Video hardware, as you are using IMAQ functions (I've only used IMAQdx). Is this true? What camera are you using?
The IMAQ Extract Buffer (probably) "clocks" itself to the camera (I say "probably" because I don't know the hardware you are using). This means that the While loop containing it will run at the frame rate of the camera (hence you can easily calculate the frame rate, as your code shows).
This looks like an NI Demo routine, so I'm guessing that you don't have a lot of experience with Vision processing. If you've got a lot of other LabVIEW experience, you should be able to make the leap to vision, once you get the idea of how buffers work. Unfortunately, there's not as much in the way of tutorials and white papers on Vision as on other LabVIEW topics.
So to your question -- how to display every Nth image. Here's the key loop (which is lifted directly from your code):
As menioned above, this routine is "clocked" by the Extract Buffer function. What you do to display every N'th image is to put the Image control inside something like a Case statement that "fires" every Nth time.
Here's an "Nth" version of the above loop (some details omitted) --
We still drive the loop filling every buffer with a frame. But we then use the Integer Divide function to select the Nth image (those that have a remainder of 0 when i is divided by Nth) and wire the "image" line (it doesn't really hold an image) to the "Image" control, with the other case being "Default" (so all other valeus go there) and with nothing inside. Thus every Nth time through this loop, the output of Extract Buffer is wire to an Image (and displayed), the other N-1 times the wire goes nowhere.
Bob Schor -
How to display two waveforms in one waveform chart?
hellow!anyone can tell me how to display two waveform together in one waveform chart? thanks!
Hello,
An easy way to tell how to make multi-plot charts and graphs is to hold your mouse over the chart/graph terminal on the block diagram and make sure Context Help (Help >> Show Context Help) is enabled. This screen will tell you how to connect the indicator for a multiple-plot display.
You might want to take a look at my attached screenshots of a working multi-plot chart.
Hope this helps!
Liz F
National Instruments
Attachments:
Multi-plot_chart.bmp 902 KB -
Idoc-xi-file scenario. how to display file in html format
I am not sure whether this is a valid question.........but want to confirm as it was asked by somebody
In idoc-xi-file scenario....... how to display file in html format ??
Thanks in advance
KumarHi Vijayakumar,
Thanks for your reply !! You mean to say I got to use XSLT mapping and also .htm and .html extension together to produce the html file ?? or it is sufficient to use any one of them to produce the html file ??
Regards
Kumar -
In sap scripts how to display the driver program
Hi,
I Want to know the sap scripts How to display the output to driver programHi,
Go to NACE Transaction.
Select application for ex: if sales V1.
Click on output types.
Select the output type for ex : BA00
Double click on Processing routines.
There you can find the Driver Program name and Script/smart form name.
Reward if useful.
Thanks,
Raju
Maybe you are looking for
-
just bought and setup a HP 7520 printer it is running wireless and is connected to my router and pc I have printed an emailed page and a word document from PC. My problem is whenever I try one of the apps on the touch screen it goes to Apps Updating
-
In PA30 if we switch on the object manager, we get a section in the left hand side "Find by". Here we get only "Person" and under it "Collective search help", "Search Term" and "Free Search". How can we add other objects in this section like Organiza
-
Safari "Bad Request" Grizzly 1.9.18-o
I have two websites that have suddenly begun to show the above error on every page, but only when viewed with Safari. I haven't a clue where the problem might be. Can anyone help? The error appears near the very bottom of every page at http://dingh
-
HT3819 Why can't I get Home Sharing to work since updating iTunes to 11.1?
Why can't I get home Sharing to work since updating iTunes to 11.1?
-
Can I read an ibook on my desktop
Can I read ibooks on apple desktop?