Convertir une image "Grayscale I16" en "RGB U64"

Bonjour,
je cherche depuis un petit moment sur tous les forums que je connais, et je ne trouve pas de réponse à mon besoin, à savoir convertir une image en niveaux de gris de 16 bits en RGB 64 bits. J'ai réussi à le faire en 32 bits, mais la dégradation est trop importante pour mes besoins.
Si vous avez une solution, je vous en serais reconnaissant.
Si ça peut vous aider, j'ai Labview 8.6 et NI Vision.
Merci d'avance

Si vous souhaitez, voici le VI que j'essaye de faire. 
Il marche très bien en grayscale 8bits => RGB 32 bits, mais pas en Grayscale 16 bits => RGB 64 bits...
J'ai supprimé tout le traitement que j'effectue sur l'image pour que ce soit plus lisible. Comme j'effectue divers traitement suivant la couche de l'image (R,G,B), je suis obligé de passer par un Imaq ReplaceColorPlane. 
Merci du temps que vous consacrez à mon problème.
Pièces jointes :
tests.zip ‏217 KB

Similar Messages

  • Convert "Grayscale I16" to "RGB U64"

    Hello, 
    I need to convert an image from Grayscale I16 to RGB U64, but it doesn't work (I have joined a zip file).
    I think there is a bug in the NI Vision, or it's not implemented because I have no problem to do it from Grayscale U8 to RBG32. 
    Can you help me to find a solution to do that? 
    I need to use ReplaceColorPlane function or equivalent because I have to perform various treatments on each layer (RGB).
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    tests.zip ‏217 KB

    Hi Badgones73,
    The U64 image is composed of four U16 values (R, G, B and alpha). LabVIEW represents 16-bit images as an I16. When the IMAQ Extract Color Planes is called, the U16 value must be converted into I16 values. This is done by converting all values with a MSB of 1 to a value of 0. This means all the values from 32,768 to 65,535 are now 0. To avoid using losing these values, you must read the image into LabVIEW without using the vision functions.
    Once you have extracted the U16 values, they can be converted from U16 images to I16 images. Once this is done, you will be able to use all of the Vision functions.
    Also, i invite you to read the information on our website:
    How Do I Convert a Color Image to Grayscale?
    http://digital.ni.com/public.nsf/allkb/ED42C55C29B9B34C862570A60079952E?OpenDocument
    Regards,
    Rémi D.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Les rencontres techniques de NI - Mesures et acquisition de données : de la théorie à la mise en ...

  • Convertir une image en un tableau RGB de valeur [0,255]

    Bonjour!
    je suis débutant sur Labview et je veux faire le traitement d'image . J'ai un programme que j'ai téléchargé sur internet qui simule un filtre de wiener Mais l'entré est un tableau de RBG , je veux prendre n'importe quelle image et lui appliquée ce filtre ; comment je peux faire ??
    ci-joint le programme utilisé .
    Merci 
    Attachments:
    01.Wiener Filter - Color.vi ‏2911 KB

    LabVIEW fait la lecture d'un image (fichier) jpeg, bmp, ou png en utilisant U8.  La fonction Wiener ne semble pas aimer les U8, mais plutot les doubles ayant des fractions, pas des nombres comme:  234.000, 543.000, etc.
    J'ai ameliorer la fonction qui converti l'image en une matrice 3D pour des images plus amples.  Voir ci dessous.
    Tu peux savegarder le fichier png sur ton ordi et "dragger" (je pense que ce n'est pas la bonne expression) le fichier png dans ton diagramme et automatiquement, tu auras le code.
    J'ai oublier d'enlever les fils allant ailleurs dans le code avant de faire un snippet...
    Attachments:
    jpeg2-3Darray.png ‏42 KB

  • Convertir une image en image IMAQ

    Bonjour,
    Je souhaite faire l'acquisition d'image issu d'une kinect de microsoft puis de comparer la 1 ere image acquise avec toutes celles qui suivront.
    Pour l'acquisition ça va mais la ou j'ai un problème c'est avec la fonction comparer 2 images. J'ai vu qu'il existe cette fonction dans vision and motion mais pour cella, il faut que mes images soient du type IMAQ.
    Donc j'aimerai savoir soit comment convertir mes images (issues d'un array U16 RGB) pour es comparer
    Soit savoir s'il y a un autre moyen de comparer 2 images pour savoir si un nouvel élément apparait sur l'image.
    merci de vos conseils
    ci joint une image pour vous montrer ou j'en suis.
    Pièces jointes :
    Image.png ‏19 KB

    J'ai réussi à éliminer les erreurs citées précedemment.
    En fait j'ai utilisé le VI ColorImageToArray. Je n'ai plus décomposé les plans de l'image initiale.
    Le problème maintenant est le suivant : lorsque mes commandes de seuil prennent les valeurs telles que l'image finale soit égale à l'image intiale, j'obtient une image bleue au lieu de l'image initiale. Pourtant mes tableaux de pixels sont les mêmes en entrée et en sortie.
    Je vous joins mon VI en PJ pour une meilleure compréhension. (le principe de calcul est le même que le VI Calcul précédent).
    Pièces jointes :
    Traitement image superposée 2.vi ‏54 KB

  • Convertir une image couleur en tableau

    Bonjour,
    Je souhaiterai appliquer un seuil sur une image couleur. Il semblerait que le VI IMAQ Threshold ne fonctionne que sur des images noir et blanc? j'aimerai donc procéder de la manière suivante : j'ai besoin d'extraire les plans de l'image et de les convertir en tableau. Puis j'applique un sous VI de calcul (créé par me soins) afin de créer un seuil. Seuilement, à l'exécution du VI plusieurs erreurs apparaissent :
    L'erreur -1074396080 s'est produite à : IMAQ ExtractColorPlanes.Raisons possibles : IMAQ Vision:  Type d'image non valide.
    L'erreur -1074396080 s'est produite à : IMAQ Array To Image. Raisons possibles : IMAQ Vision:  Type d'image non valide.
    L'erreur -1074396080 s'est produite à : IMAQ ReplaceColorPlane. Raisons possibles : IMAQ Vision:  Type d'image non valide.
    Comment résoudre ces problèmes ?
    Merci d'avance pour votre aide.
    PS : en PJ le sous VI Calcul qui est appelé dans le VI Traitement de l'image superposée pour créer un seuil.
    Attachments:
    Traitement image superposée.vi ‏68 KB
    calcul.vi ‏9 KB

    J'ai réussi à éliminer les erreurs citées précedemment.
    En fait j'ai utilisé le VI ColorImageToArray. Je n'ai plus décomposé les plans de l'image initiale.
    Le problème maintenant est le suivant : lorsque mes commandes de seuil prennent les valeurs telles que l'image finale soit égale à l'image intiale, j'obtient une image bleue au lieu de l'image initiale. Pourtant mes tableaux de pixels sont les mêmes en entrée et en sortie.
    Je vous joins mon VI en PJ pour une meilleure compréhension. (le principe de calcul est le même que le VI Calcul précédent).
    Pièces jointes :
    Traitement image superposée 2.vi ‏54 KB

  • Converting RGB images (sRGB or Adobe RGB) to 709 color space.

    I'm trying to determine the correct way to convert RGB images (sRGB or Adobe RGB) to 709 color space.  I can't just use the "covert to profile" function to do this because it does not produce results that fall within the 16 to 235 range that 709 dictates.  I've read that you can simply use the "Levels" adjustment and change the output levels to 16 to 235.  While this would clearly compress the luminance to the correct range, I'm not entirely clear if the end result would be a proper conversion (i.e. if color and gamma, for example, would be technically correct.)
    I noticed that converting the profile to "HDTV (Rec. 709)" does alter the image, so I'm wondering what the result would be if I did both this AND used the levels control to compress the output range to 16 to 235.
    Thanks for any feedback on this.

    (1)
    http://en.wikipedia.org/wiki/Rec._709
    (2)
    http://en.wikipedia.org/wiki/Rec._601
    The transfer functions for Rec.709 (1) refer to the range [0..1] or for 8 bits per pixel [0...255].
    It seems that the clipping, black=16 and white=235 has to happen after the application of the
    transfer function. If this should be true, then we don't have a level compression but a level
    clipping at both ends, as already for Rec.601 (2), like here:
    The ICC-Profile HDTV(Rec.709) in Photoshop contains the primaries and the white point
    (both like that in sRGB) and the transfer functions for [0..1], coded by a LUT with high resolution,
    as found by Profile Inspector. There is no clipping.
    By the way, that`s the internal profile name, I don't know the file name of the profile.
    Softproofing, source in sRGB, target HDTV(Rec.709), without clipping:
    With numbers not preserved: no change of the appearance, as expected.
    With numbers preserved: shows the effect of different effective gammas. 
    Your questions are very clear and I'm not sure whether my comments help. The information
    in the internet is not convincing.
    Best regards --Gernot Hoffmann

  • If you change the image mode of this image from 8-bit RGB image to Grayscale mode while in PSCS – what will the new Pixel Count be?

    If you change the image mode of this image from 8-bit RGB image to Grayscale
    mode while in PSCS – what will the new Pixel Count be?

    If you mean by Pixel count the number of pixels, this will not change. The image will have the same size thus the same number of pixels.

  • Converting from duotone to CYMK or RGB destroys image

    Hello
    I am trying to create an example of how colours are made up so I am splitting channels, colorising and then printing the individual colour layers RGB and CYMK on to transparency and then layering them on a light box.
    I am able to convert to duo tone by doing the following things:
    converting the image to 8 bit
    splitting channels of the image, i have one rgb image and one cymk image.
    converting to duotone and colorising.
    if I save the cymk duotone images they just revert to a flat image of the target colour, all of the detail is lost see below
    If I try to change the image back to rgb or cymk, the image goes blocky, see below
    I need to import these images into inDesign to print them as I have a template that allows me to line each of the images up properly.
    why is it doing this?
    I am using creative cloud. latest version of photoshop on windows 7 64 bit.
    I am close to self harm just now as it makes no sense to me.
    any help at all would really be appreciated.
    Thanks

    Quite frankly I don’t understand the procedure you explain.
    Could you post screenshots to illustrate the steps?
    If I try to change the image back to rgb or cymk, the image goes blocky, see below
    That looks like a problem of its own.
    Does turning off »Use Graphics Processor« in the Performance Preferences and restarting Photoshop have any bearing on the issue?
    Otherwise you might want to run some general trouble-shooting routines:
    http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html
    Though if it’s bad RAM …

  • 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.

  • How convert an image into its RGB value

    i want to find out how to convert an image files such as .gif or .jpg into its RGB value so that i can find out how much amount of a particular colors contain in the image.

    Try this:
    public int countColors(String filename) throws IOException {
    BufferedImage image = ImageIO.read(new FileInputStream(filename));
    Set colors = new HashSet();
    int height = image.getHeight();
    int width = image.getWidth();
    for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {
    colors.add(new Integer(image.getRGB(x, y)));
    return colors.size();

  • Convert color images to black&white bitmaps

    Hi,
    I have black&white scans of public domain books (image format). I use an OCR software to convert them to indexable PDFs (image+text format). However, the OCRed PDFs are insanely big: a 27 MB scanned PDF leads to an indexable PDF of 728 MB! And unfortunately, my OCR software doesn't have output settings, so I have to find a way to compress the files using Adobe Acrobat 9 Pro.
    Using Advanced Options > Optimization does reduce the file size, but not significantly. The problem seems to be that my OCR software converts the black&white scans to color images, and encodes them as such inside the PDF. So I need a way to set the image modes back to black&white. I tried using the Advanced Options > Preflight dialog, and selecting "Convert to black&white". However, the resulting PDFs stay about the same size! It seems that "Convert to black&white" converts the images to grayscale, instead of to bitmap.
    Any help would be appreciated!

    I mentioned "bitmaps", because when I open the original PDF and right-click a random page and select "Modify image..." and open the image in Photoshop, the mode is set to "Bitmap mode": meaning 1-bit mode, containing either black or white pixels. However, when I do "Modify image..." for the OCRed PDF, the mode is set to "RGB Color Mode". I think this explains, in part, the huge size of the OCRed PDF.
    Maybe this table will make it more clear:
    Original PDF (Bitmap Mode, 132 dpi)
    Size: 27 MB
    OCRed PDF (RGB Color Mode, 300 dpi)
    Size: 728 MB
    Now, from the table above, it's clear that I have to reduce the image resolution. So, using the Acrobat's PDF optimizer, I tried the following settings:
    Optimized OCRed PDF: Try 1 (Downsample to 132 dpi, JPEG compression)
    Size: 733 MB
    Optimized OCRed PDF: Try 2 (Downsample to 132 dpi, ZIP compression)
    Size: 449 MB
    But 449 MB is still huge for a single book. And I don't want to reduce the resolution under 132 dpi, because I will loose quality. Clearly, if the original document is just 27 MB, I should be able to squeeze the OCRed document too. But I don't know how.

  • Is there a way to select every other page in a multi page pdf and convert it to grayscale?

    I'm going to ask this question in a few sub-forums, so if you think you've seen it, you might have.
    Where I work I use a program that can print to pdf. We use it to produce mailings, usually postcards, that are addressed.
    I often end up with a 500 page document that will print on 250 sheets of cover stock, which will get cut into 1,000 postcard, all pre-addressed and sorted by zip code.
    Usually, the address side is all black and the front is color. The printers we use can print a black click on the address side and a color click on the other, IF the pdf is set up that way. Otherwise, both sides will be counted as color clicks.
    I know I can select pages individually in a pdf and convert them to grayscale and those pages will be counted by the printer as black clicks, which are cheaper than color clicks.
    The problem is, I have not figured out how to convert all the odd numbered pages to grayscale at once. As a result, I usually end up printing the color side simplex, then putting the job back in the tray and printing the black side. Of course, that only works if only one side is personalized, sometimes both sides are.
    Is there a way to select every other page in a pdf and convert it to grayscale?

    The Acrobat SDK has sample code that shows how to convert the colors for one page (the first page of a document). This sample can easily be adjusted to process every other page. You can then use an Action that executes this JavaScript to process the document. Do you know how to create an Action? If so, you can use this script (as I said, adapted from the sample in the SDK) to convert all odd pages (1, 3, 5, ...):
    // Get a color convert action
    var toGray = this.getColorConvertAction();
    // Set up the action for a conversion to RGB
    toGray.matchAttributesAny = -1;
    toGray.matchSpaceTypeAny = ~toGray.constants.spaceFlags.AlternateSpace;
    toGray.matchIntent = toGray.constants.renderingIntents.Any;
    toGray.convertProfile = "Gray Gamma 1.8";
    toGray.convertIntent = toGray.constants.renderingIntents.Document;
    toGray.embed = true;
    toGray.preserveBlack = false;
    toGray.useBlackPointCompensation = true;
    toGray.action = toGray.constants.actions.Convert;
    // Convert every other page
    for (var i=0; i<this.numPages; i++) {
      console.println("Processing page " + i);
      if (i % 2 == 0) {  // change to "if (i % 2 != 0) {" for all even numbers
      console.println("in page " + i);
      console.println(this.colorConvertPage(i, [toGray], []));
    As I've indicated in the code, you can change this to all even numbers by changing the == to !=

  • Is there a way to select every other page in a pdf and convert it to grayscale?

    I'm going to ask this question in a few sub-forums, so if you think you've seen it, you might have. Someone suggested it might be done with Javascript. I know nothing about Javascript.
    Where I work I use a program that can print to pdf. We use it to produce mailings, usually postcards, that are addressed.
    I often end up with a 500 page document that will print on 250 sheets of cover stock, which will get cut into 1,000 postcard, all pre-addressed and sorted by zip code.
    Usually, the address side is all black and the front is color. The printers we use can print a black click on the address side and a color click on the other, IF the pdf is set up that way. Otherwise, both sides will be counted as color clicks.
    I know I can select pages individually in a pdf and convert them to grayscale and those pages will be counted by the printer as black clicks, which are cheaper than color clicks.
    The problem is, I have not figured out how to convert all the odd numbered pages to grayscale at once. As a result, I usually end up printing the color side simplex, then putting the job back in the tray and printing the black side. Of course, that only works if only one side is personalized, sometimes both sides are.
    Is there a way to select every other page in a pdf and convert it to grayscale?

    The Acrobat SDK has sample code that shows how to convert the colors for one page (the first page of a document). This sample can easily be adjusted to process every other page. You can then use an Action that executes this JavaScript to process the document. Do you know how to create an Action? If so, you can use this script (as I said, adapted from the sample in the SDK) to convert all odd pages (1, 3, 5, ...):
    // Get a color convert action
    var toGray = this.getColorConvertAction();
    // Set up the action for a conversion to RGB
    toGray.matchAttributesAny = -1;
    toGray.matchSpaceTypeAny = ~toGray.constants.spaceFlags.AlternateSpace;
    toGray.matchIntent = toGray.constants.renderingIntents.Any;
    toGray.convertProfile = "Gray Gamma 1.8";
    toGray.convertIntent = toGray.constants.renderingIntents.Document;
    toGray.embed = true;
    toGray.preserveBlack = false;
    toGray.useBlackPointCompensation = true;
    toGray.action = toGray.constants.actions.Convert;
    // Convert every other page
    for (var i=0; i<this.numPages; i++) {
      console.println("Processing page " + i);
      if (i % 2 == 0) {  // change to "if (i % 2 != 0) {" for all even numbers
      console.println("in page " + i);
      console.println(this.colorConvertPage(i, [toGray], []));
    As I've indicated in the code, you can change this to all even numbers by changing the == to !=

  • Error message when uploading book for printing. All images are jpg and rgb. Could they be too large to upload? What size is required and how do I reduce size in Aperture?

    I receive an error message when I upload my book for printing. Not sure what the problem is. All my images are jpg and rgb. Could they be too large as it takes about 15minutes to upload to Apple. How do I reduce the size of the image in Aperture?

    Hi Leonie,
    Thanks for your reply.
    Error message below. The preview is fine . I can discount the first 2messages as its a new computer so plenty of disk space and upload doesn't seem to be interrupted. I have uploaded to iphoto before. have tried to upload 3times with the same error message. I had to photo my slides with a Kaiser Baas photo maker , which apparently doesn't scan but takes photos in megapixels of the slides. I am wondering now if the format is incompatible though they are jpg files or the colour type wrong. The image files are  around 1-3 mb each and  72 ppi. I think  I will now scan them properly with a scanner to 300dpi anyway to improve quality.
    Apple  talks about image files not being too big for uploading but gives no sizing of what too big is?
    Error message
    1. Upload Error. Loss of connection or file corruption during order upload may cause an incomplete order. Resubmitting your order usually resolves this issue.
    2. Low Disk Space. If your computer is running on low disk space, your files may be assembled incorrectly. Create more space by deleting unused files.
    3. Unreadable PDF file or image files. Files are sometimes assembled incorrectly due to CMYK or Grayscale color space. Use the RGB color space for best results.

  • Converting PDF to grayscale

    I am using Adobe CS 3, Acrobat 8 Professional, on Mac OS 10.4.11
    I am trying to convert a full color PDF document to grayscale. I tried to click Advanced > Print Production > Convert Colors and then Grayscale, but it is not working.
    I tried clicking Print and then choosing a PDF option, but it is taking unreasonably long and not finishing.
    So how can I convert it to grayscale?

    Hi,
    I had some trouble with this same issue of converting a color pdf to grayscale. I realized that in my particular pdf, just using the Tools/Print Production/Convert Colors function was not enough. Somehow there were extra spot colors inadvertently added to the file. Here are the steps to follow to make sure this works correctly if you are wanting to convert the entire pdf file to a grayscale image:
    (I am using Acrobat 7.0.9 on a Mac OS X, 10.4.11 system)
    1.) In your pdf file go to Tools/Print Production/Ink Manager click on the bottom left corner box that says (Convert all spots to process). Click okay.
    then
    2.) Go back to Tools/Print Production/Convert Colors. Click on (Device Gray: Convert) Action: Convert. Profile: Select your profile of choosing....for me it was 10% Dot Gain way at the bottom). Convert Pages: All. Conversion Options: Don't Embed Profile. Check box that says, Preserve Black Objects. Click okay.
    This should resolve any problems with those extra colors that will not convert to grayscale since they are assigned as spot colors.
    Hope this helps. Let me know if this works for anyone. just tried it once.
    Good luck!
    Janell

Maybe you are looking for

  • TS2551 photos will not upload

    Ive been adding pictures to my iphoto over past 6 months and they do no how up in "events", "last 12 months", etc. Then i import them from external harddrive and it shows up as a blank screen (pix visible in small frame but click on that items and ze

  • What's with those annoying ! exclamation points

    I know have double the number of tracks I actually should have in my iTunes, because iTunes cannot find the appropriate tracks in the external hard-drive. Now I understand the concept of it, and bravo... but how do I now delete those tracks without h

  • Xsd:dateTime formatting problems

    This is driving me nuts. I've been playing around with JAXB and it has worked great so far. Until now. I have an xml file with this little block    <timestamps>       <created>2000-03-04T20:00:00Z</created>       <last_modified>2003-03-14T02:20:02-05

  • Weblogic9.1 extended custom log field error

    Extended Logging Format Fields : x-TrueIP date time cs-method cs-uri sc-status bytes cs(Referer) cs(User-Agent) cs(cookie) class 如下: import weblogic.servlet.logging.CustomELFLogger; import weblogic.servlet.logging.FormatStringBuffer; import weblogic.

  • Regarding LDAP

    hi guys, need clarification on LDAP. I know LDAP is Light weight Directory access protocol. but no idea how its used for EP and Java. Please correct my understanding if its wrong. LDAP is protocol and this protocol accesses LDAP directories(need Soft