Help on converting bmp to 8bit grayscale arrays

I am using Labview 6, and need to read a bmp file and obtain the grayscale values in an array to analyse the data. What is the best way of doing this.

Hi mepgkas;
I do not have a clear idea of what you want to accomplish. I tried to go through your vi, but it is not clear to me how it is suppose to work with the images.
In the attachment you will find three VIs. The first (formula_final_2.vi) do the same as your first VI. I just modified it a little to try to understand its operation. I hope you find the modifications helpful.
The second file (formula_final_test.vi) is also your original VI. I modified it to work as a subVI. The third VI (example w gray.vi) uses the second VI as a subVI and input the two images. I assumed that picture 1 should go in ta1, picture 2 should go in ta2 and the resulting array is formed using t2 as it elements. Chances are I am wrong, however, it shoul
d give you a good starting point.
Best regards;
Enrique
www.vartortech.com
Attachments:
example_2.zip ‏43 KB

Similar Messages

  • Find the rotation angle for an 8bit grayscale image

    Hi all,
    I have an 8bit grayscale image of dimension 3969 X 600, the image is slightly tilted. i need to find the rotation angle and apply the rotation before i do the processing.
    Is there any transformation functions readily available in LabVIEW to find the rotation angle?
    Need your suggestions folks,
    Regards,
    KM
    Solved!
    Go to Solution.

    Hi Klemen,
    Thanks for your time,
    I am not sure which points i need to use as reference to calculate the degree of rotation, is there any functions available to calculate the rotation, I have attached the 2d array of image. I need a little more help.
    Can i use the vi (rotate 8bit) which can be found in the following link below?
     http://www.ni.com/example/26943/en/
    Regards,
    KM
    Attachments:
    2d array1.xlsx ‏3561 KB

  • Convert colour images to grayscale images & get pixel data from them

    Is the code below correct to convert colour images to grayscale images in Java?
    public void convertToGrayscale (String sourceName,String destName) throws Exception {
    JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(new FileInputStream(sourceName));
    JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(new FileOutputStream(destName));
    BufferedImage sourceImg=decoder.decodeAsBufferedImage();
    BufferedImageOp op =new ColorConvertOp(
              ColorSpace.getInstance(ColorSpace.CS_GRAY),null);
         BufferedImage destImg = op.filter(sourceImg,null);
    encoder.encode(destImg);
    decoder = null;
    encoder = null;
    When I get grayscale images from the code below, I would like to access the pixels of those images. So I tried to do:
    byte[] dd=((DataBufferByte)mImage.getRaster().getDataBuffer()).getData();
    BUT the data result array is not 0-255. Could anyone suggest how to obtain pixel data from grayscale images?
    In case that my code shown is not correct or suitable, please give your advice. What I would like to do are in the steps as follows:
    1 change 100*70 jpeg-images to 100*70 grayscale images.
    2 create two dimensional array of pixel data (example [100][70]) from converted images. The number in the array should be between 0-255, right??? And 0 refers to black colour and 255 refers to white colour???
    I am confused about grayscale images. Please help.
    Thank you so much

    I am not sure i understand what is the problem exactly.
    Structure of DataBuffer is described by SampleModel used by same Raster
    object. E.g. it might be 1 byte per xipex or 4 bytes per pixel.
    In your example convertToGrayscale saves images to file as JPEG and
    it seems you later read it back. It is possible what image you read back
    is not greyscale but ARGB and data buffer has different format.
    Technically, if you just need level of grey you may simply
    call getRGB on your output image. Grey is uniform mix of R, G and B.
    Also, instead of ColorConverOp you may dimply create output image of
    grayscale type and draw your color input image with drawImage().
    If none of these helps please try to provide more details.

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • Convert Color PDF to Grayscale using Preflight in Acrobat 9 Pro

    Has anyone posted a step-by-step procedure to convert color PDFs to grayscale? I've unsuccessfully been trying to use the new Preflight dialog to do this. This is the procedure I tried:
    1) In the Preflight dialog, Create New Preflight Fixup.
    2) Fixup Category: Color Spaces, Spot Colors, Inks. For Type of Fixup: Convert Colors.
    3) In the Conversion settings tab, chose All Objects, Using Any Color (except spot colors), plus All Objects, Using Spot colors(s).
    4) For Destination, I chose a grayscale destination Dot Gain 25%.
    5) After clicking OK, I selected the new profile and clicked on the Fix button, and saved the file.
    Nothing happens, and the colors don't change.
    If anyone can explain what I'm missing, I would greatly appreciate it.

    Refer to Acrobat 9 Help PDF (installed with Acrobat 9 is installed).
    Review the  discussion for Exporting PDFs in Chapter 5 of this Help PDF.
    The PDF is also available on Adobe's site.
    http://help.adobe.com/archive/en_US/acrobat/9/professional/acrobat_pro_9.0_help.pdf 
    Good to know is that the Acrobat 9.x product family passed into End of Support mid-year 2013.
    Be well...

  • Why does spot EPS not output when converted to CMYK or grayscale?

    Apologies if this is a known issue but I can't find it anywhere... I'm using AI CS3 (13.0.2) on an Intel iMac/Os 10.5.4 and I can't figure out why a white logo made from text outlines outputs fine to PDF if I use a spot color but if I change it to grayscale or CMYK, part of the logo doesn't output at all.
    The part which self-destructs is a supplied roundel of Caflisch text which has been converted to outlines (unfortunately I don't have the font on my system to do any deep testing). Another part of the supplied logo is a line drawing which outputs fine in any color mode.
    So I'm really looking for something to explain why the text part of this roundel outputs fine as a spot color but disappears from view when converted to CMYK or grayscale. I have been placing the file in a Quark 7.1 document and then exporting to PDF but I see the same problem when using the Flattener Preview.
    Thanks for any help.
    Simon

    Sorry for talking to myself like this -- been doing it for years...
    Finally found out what was wrong: the submitting designer had set the white coloured text objects to overprint. When I set them to knock out all was well.
    Kudos to Acrobat Pro Preflight for pinpointing the problem.
    Simon

  • Converting XML String to MessageElement array

    Hi,
    I am trying to call a .NET web service from my Java client. I used WSDL2Java to generate the java classes for calling the .NET web service. The generated classes to call the service expects an array of org.apache.axis.message.MessageElement objects. I have a string representing an XML document which looks like this:
    String xmlString = "<Results><Adjustments><Adjustment><RebuildAdjustmentID>16</RebuildAdjustmentID><IsBasicAdjustment>true</IsBasicAdjustment><AdjustmentType>stone/AdjustmentType><Title>External walls</Title></Adjustment></Adjustments></Results>"
    I have tried converting the string into an array of MessageElement objects by the following way:
    MessageElement[] m = new MessageElement[1];
    Document XMLDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(result2.toString())));
    m[0] = XMLDoc.getDocumentElement();
    However I keep getting the following message returned from the service:
    "Object reference not set to an instance of an object"
    I have tried a handful of ways but keep getting this same error. I have searched the web for hours looking for a solution to this problem without success so any help/ideas much appreciated,
    Thanks.
    Paul

    Any updates on this?
    I am facing a similar problem.

  • I want to convert a String into an array of bytes

    I am working with telnet programming with java, where I want to convert login name and password of an online user in 'String' format to 'Bytes', plz help me. Which Input or Output Stream I can use

    Assuming you've got the username / password into a String object, you can convert it to a byte[] array using this method.
    String.getBytes();
    Look at the String API
    http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html
    Hope that helps.

  • Scanning options, 8bit grayscale vs 24bit color, psd vs jpg, experience and opinions sought

    I have an Epson Scanner, PSE5 and want to scan about 100 8x10 sheets (multiple photos per sheet) from a 50 yr old photo album. photos are yellowed, and in future I want to be able to crop/select some of the small photos on the sheets. Few questions, I'd like to get advice from those more experienced:
    Resolution, file format
    I've scanned at 2400 dpi and 1200 dpi - I can notice slight difference when working with the small pictures so my preference is to go 2400 but the storage size for the 8x10 sheet is 1.5gb when saved as tiff or psd. When I save as jpg max quality (500k) I cannot tell difference even when looking at 100% or enlarging - no pixelation. So, I'm thinking I'll have better quality scanning at 2400 and saving as jpg (500k) vs. scanning at 1200 and saving as psd or tiff (385mb). Do you agree?
    Scanning 24bit color vs. grayscale
    For some photo projects I like having the colored pictures which I get if I scan 24bit color. Others I want the grayscale which removes the color. I could scan twice but that has obvious disadvantages (time and storage). I know I can use PSE to add yellow to grayscale scan or to remove yellow from color scan. Does anyone have an opinion, if I want to scan once, am I better off 24bit color or grayscale?
    Is answer/advice any difference if I'm scanning 8 bit grayscale vs 24bit color - scanning in 16 bit grayscale has lots of limiations editing and saving (jpg isn't available). Am I losing alot of by scanning in 8bit grayscale vs. 24bit color. I haven't tested print quality but on screen I don't notice the difference even at 100%. Opinions of whether I'm better 8 bit grayscale vs 24 bit color for these yellowed black and white pictures?
    Anything else I should be thinking about for this type of project?
    thanks!
    picsob

    If these are full size images, you really don't need to go above 300 ppi. I would save as TIFF or PSD unless you have a compelling reason for not doing so. JPEG applies compression every time you save and close the image, so you'll want to convert to another format for working anyway, and storage is cheap now. (There's a difference between ppi and dpi, although scanner makers ignore it. You want the highest possible dpi when printing, but the human eye cannot distinguish much difference when you go above 300 ppi. If you want to make extra sure, go to 600, but that's not going to provide more useful information to a printer, really. Mostly just a much larger file size.)
    I would also scan in color. When you scan in greyscale you are saving much less information, and you might want that someday.

  • Converting bmp file to pdf

    Hi all,
    Please help me to solve this:
    1) convert bmp file to PDF( using FM) .
    2)There can be many such bmp files ..append them to single pdf file after converting them.
    Thanks and Regards,
    KC

    As has been discussed many times here before, you can't really merge PDF files programmatically in ABAP after they have been created.  Your best bet with this 'unique' requirement is to use a form-based approach I think.
    With a smartform one approach is to create a single page with a window with a graphics node (dynamic name) in it, with the bitmap name specified in the form interface.  Unless you have already loaded the bitmaps in the graphics manager (SE78), you would load the bitmaps at runtime from the presentation server or the application server and then create the graphics dynamically using the methods of class CL_BDS_DOCUMENT_SET prior to calling the form for each bitmap (a topic discussed recently in the ABAP forums or you can view how SE78 does it by checking the code).  Create a merged spool and then use the standard function to convert the OTF data to PDF format.
    A similar approach can be used with Adobe forms, but you would need to load the bitmaps to the web repository, not the graphics manager.
    What exactly is in the bmp files and where are they stored?  Are they form templates?  You may get a better answer with more details.

  • Convert BMP, JPEG, GIF to WBMP

    I've searched the forum abt this topic but i could not find concrete answers. Pls do tell me how to convert bmp, jpeg and gif to wbmp format. Sample codes would be very helpful. Thanks a lot!!

    what the hell is WBMP....i have actually converted a Image File into a Base64 format but never hears of WBMP format
    Cheers,
    Manja

  • Convert JPA Query getResultList to Array

    I have been struggling with this problem for several hours now. All I have succeeded in doing is attempt every possible way to convert a List into an array and I just get errors.
         // create native SQL query
         Query q = em.createNativeQuery("SELECT * FROM Project p");
         // get and process the results
         List<Project> list = q.getResultList();
            Project[] retVal = new Project[list.size()];
         for (int i = 0; i < list.size(); i++)
             retVal[i] = list.get(i);
         }One would assume this to work, however this generates a ClassCastException, cannot convert Object to Project, oddly because as far as I can see everything in the code is strongly typed. I think Persistence fills the typed List with Object and not Project??
    So I tried:
    Project[] retVal = list.toArray(new Project[0]);This generates an ArrayStoreException.
    Finally I tried the basic, should generate x-lint warning:
    Project[] retVal = (Project[])(list.toArray());This also return ClassCastException, same reason as the first attempt.
    I want my WebService function to return a standard Project[] not the java.lang.List class. But it seems JPA queries only support getting a List. I have googled to no end for a solution. Help appreciated!
    Thanks.

    You are almost right, you can solve this two ways as below:
    First, use native query with result class reference.
    Second, use JPA query with createQuery method.
    Both the options should work, see code below:
    // First option, create native SQL query with result class reference.
    Query q = em.createNativeQuery("SELECT * FROM Project p",Project.class);
    // Second option, Create JPA Query.
    // Query q = em.createQuery("SELECT p FROM Project p");
    // get and process the results
    List<Project> list = q.getResultList();
    // Putting result to an array
    Project[] retVal = new Project[list.size()];
    list.toArray(retVal);*Cheers,
    typurohit* (Tejas Purohit)

  • Convert binary string into binary array

    Dear I am looking for a way to convert my ten bit string array into 10 bit array.
    Any idea?

    Yes, but you need to tell us in more details what you have and what you want.
    There is no "10bit string", they come in integer multiples of 8 bits. Some possible interpretations:
    Maybe you have a 2 character string (16bits). Do you want the 10 low order bits?
    Maybe you have a 10 character formatted string of zeroes and ones, one character for each bit.
    Do you have a long string and every 10 consecutive bits are one 10bit number that you want as integer?
    Please clarify!
    There is no "10bit array". Do you want:
    a boolean array with 10 elements, one element per bit?
    An integer array if ones and zeroes?
    An array of U16, each element corresponding to 10bits of the original string?
    something else?
    It might help if you could attach a small example containing typical data. (make current values default before saving and attaching here).
    LabVIEW Champion . Do more with less code and in less time .

  • Convert a string to an array/collection

    Hi,
    I have a string
    String s = "[ab,cd,ef,gh]";How can I convert this into a string array , arraylist or vector such that ab, cd, ef, gh are the elements of the array/collection.
    Please help.
    Any help in this regard will be well appreciated with dukes.
    Regards,
    Anees

    virusakos wrote:
    codingMonkey, the "^\\[|\\]$" regular expression will only work for [....,...,....] inputs and not for [...,[....],]...[,...] inputs.
    The OP should find the correct regular expression according to the requirements ;-)Meaning that any brackets which are part of the actual data will remain intact.

  • How to convert BMP to BufferedImage?

    I would like to convert .bmp file to bufferd image. I have already got known how to convert .bmp to ImageProducer but I have no idea how to get BufferedImage from ImageProducer :-(((
    Any help will be great! Thanks! regards

    I haven't played much with images, but wouldn't a call of:
    javax.imageio.ImageIO.read(Inputstream or File or ImageInputStream or URL);return a BufferedImage? Try it

Maybe you are looking for

  • Error While uploading Long Text for Operations in IA05 Transaction.

    Dear Team, Good Day. While we are trying to upload the Long Text through BDC for IA05 operations  the text is updating in Database but it is not visible in the long Text field. Is it possible to upload the long text through BDC or any bapi's which ca

  • Share no longer working without restarting iTunes. Why?

    Hey guys. Once upon a time, I could open a video in QuickTime, select Share > iTunes and the video would appear in my iTunes library automatically after processing. For the past month or two (perhaps since upgrading to Lion), I've found I have to res

  • LG-LOST CONTACTS AND PICTURES-CAN I GET THEM BACK?

    I have an LG and have lost my contacts and pictures.  My daughter tried to unlock my phone and kept trying to unlock then she turned off the phone and when the phone came back on all my contacts, pictures and other data were gone.  Is there a way to

  • Using macromedia flex in web dynpro

    how can i use flash object in web dynpro for displaying charts instead of using the webdynpro default charts . i want to use from NWSD not through the portal ..

  • "Specify filter names" error in BADI Implementation

    Hi everyody, I am trying to create a BADI Implementation for the standard badi BADI_LAYER in SE19. When I try to save this, it gives an error saying "Specify filter names". Can somebody kindly tell me what this problem is and how I can fix it? Thanks