Raw pixel data

Any suggestions of how to get to a CGImageRef or UIImage from raw pixel data in open gl?
uint8_t testColor[4 * 480 * 480]; // 4 bytes, RGBA
glReadPixels(0,0,480,480,GL_RGBA, GLUNSIGNEDBYTE, &testColor);

i have a feeling someone is going to help me eventually
This creates an image, but it doesn't look like the one i draw. Any tips on figuring out the CGImageCreate parameters for something in GL_FLOAT raw pixel data. I assume that is where I am going wrong.
size_t size = 10;
float testColor[4 * size * size]; // 4 bytes, RGBA
glReadPixels(0,0,size,size,GL_RGBA, GL_FLOAT, &testColor);
size_t w = size;
size_t h = size;
size_t bitsPerComponent = 32;
size_t bitsPerPixel = 32;
size_t bytesPerRow = 4 * w;
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, testColor, 4 * 480 * 480, NULL);
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent intent = kCGRenderingIntentDefault;
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
CGImageRef img = CGImageCreate(w, h, bitsPerComponent, bitsPerPixel, bytesPerRow, space, bitmapInfo, provider, NULL, NO, intent);
UIImage* result = UIImage imageWithCGImage:img;
NSData *imgData = UIImagePNGRepresentation(result);
imgData writeToFile:@"/Users/alexander/Desktop/test.png" atomically:YES;

Similar Messages

  • Read Binary(raw Image) data from a file

    Hi
    PLEASE HELP, I want to Read Binary(Raw Image)data (16 bit integer) from a file and display on the JPanel or JFrame.

    Hi, you'll need to use MemoryImageSource.
    You read each RGB triple and add it to a pixel[].
    Heres the roughg idea.
    Hope that helps.
    Harley.
    int width,height;
    int[] pixels = new int[width*height];
    while(!fileDone)
    for(int i=0; i<(width*height) i++){
    int rgb = inputStream.readInt();
    pixels[i] = rgb;
    DirectColorModel colorModel = new DirectColorModel(16,0xff00,0x00ff,0x00ff);
    MemoryImageSource memImage = new MemoryImageSource(width,height,pixels,0,width));

  • How to get pixel data in the format I want

    I'm writing a format plug-in and am having some difficulty getting the pixel data from photoshop in the format I want. From what I gather from the documentation in the SDK I need to specify the following to tell photoshop what format to deliver my pixels in:
    theRect
    loPlane
    hiPlane
    data
    colBytes
    rowBytes
    planeBytes
    planeMap
    I specify all of these appropriately for a 32 bit rgba8888 uncompresssed image and it works just fine... but ONLY if the image I load in the first place matches the format I am requesting. If the image I load is some other format, like a 256 color image with a palette, gFormatRecord->advanceState() just fails with a nebulous -30500 error code (formatBadParameters) instead of delivering pixel data.
    So my big question is this: Is Photoshop capable of doing the conversion and delivering the pixels to my format plug-in in my requested format? If it CAN do it, what might I be doing wrong? Please help! Thanks!!

    You noticed you can use the planeMap[] array to permute the channels. It's not so obvious that Photoshop should offer generalised bit depth/colour space/palette processing. It can be argued that's the role of the plugin itself: to mediate between Photoshop's native image data (which it does offer conveniently) and whatever arbitrary image format the user requires. At least, that's what most of
    my plugins do.
    Sure, there are a few obvious conversions, but you have to stop somewhere... Sooner or later you'll be implementing stuff on the Photoshop side that
    should be in a plugin. I don't have a big problem with the line drawn in the current API.

  • What this mean? "could not rasterize because the pixel data for this layer is not"

    I've taken a color picture and made it black and white by doing the following: Layer>New Adjustment Layer>Hue/Saturation. I brought the saturation down to -100.  The pencil is selected and my foreground color is black.
    When I try to select the flowers in my picture to bring out their color (within the black and white image), I get a circle with a black line thru it and the error message "could not rasterize because the pixel data for this layer is not directly editable".  The steps I followed are working for most of my team but some of us are getting this error message.
    Any idea why and/or how to fix it?

    Ah, thank you!  I didn't have the mask selected. So once I did select it, the color came thru like magic. 

  • How to get the pixel data so as to work on it?

    Hi all,
    I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?
    Assumption: No layers i.e., only background
    Thanks in advance,
    Sailu

    Hi Ilya,
    Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
    Matthew Hollingworth, "ADM Color Managed Preview?" #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.
    Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.
    Thank you all for your help
    Cheers,
    Chaker

  • Raw to date function in oracle

    Hi..
    I would like to know the details and usage of Raw to date function in oracle database.Could some one let me know the function details?

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set serveroutput on
    SQL> DECLARE
      2   rv RAW(32) := '786B060818023A';
      3   dt DATE := NULL;
      4  BEGIN
      5    dbms_stats.convert_raw_value(rv, dt);
      6    dbms_output.put_line(TO_CHAR(dt, 'DD-MON-YYYY'));
      7  END;
      8  /
    08-JUN-2007
    PL/SQL procedure successfully completed.
    SQL>Regards,
    Jo
    PS: This is not my own example. I don't recollect the link I got this example from. Will post the link if I come across it again. I think its www.psoug.org (not sure)

  • Camera Raw updates Date Taken in JPG Files

    Hi,
    I have CS6/CR 7.2.  I have had this issue where my file dates became changed (8000 odd files) so I had to restore 23000 files from backup . 
    When investigating trying to find out what happened.  when I open a JPG from Windows Explorer, photoshop is set to use Camera Raw for jpg files on open (ok).  If I cancel the dialog, nothing happens (ok).  If I click Done or Open Image, the file itself has the "Date Taken" time updated - 7 hours ahead of the original correct time. 
    This pretty much matches the date issue I have on the 8000 files.  Is this expected behaviour?  Why would Camera Raw update Date Taken and did it choose 8 hours because I am in the PST timezone (GMT-8 or currently GMT-7 with daylight savings)?
    I have reproduced this on 4 or file random files - taking copies and comparing afterwards.
    Thanks!
    Mark.

    Camera Raw writes your JPEG files back out with updated metadata no matter what settings you choose, because Adobe feels they understand the format of metadata in the files well enough to be confident they will not corrupt the files.
    I've asked them for years to avoid doing that, to no avail.  I don't want my original files re-written.  It sounds as though you are of a like mind. 
    It is for this reason that I *never* open a JPEG file through Camera Raw.
    It's possible there is a time zone problem or something, but that's not the point.  What, specifically, is corrupted is less important than Adobe believing it's okay to write back to your JPEG files.  That you have actually seen something corrupted is testament to it not being unfounded paranoia.
    Generally I'm supportive of Adobe's design decisions, but absolutely not on this issue.  All I ask is that Adobe honor the "keep settings in the central database" preference choice for ALL input files, not just those for which they would otherwise write an XMP file.  I don't think it's too much to ask.
    By the way, you might want to visit the Camera Raw-specific forum and make note of your issue there:
    http://forums.adobe.com/community/cameraraw
    -Noel

  • Help! Read raw Image data from a file and display on the JPanel or JFrame.

    PLEASE HELP, I want to Read Binary(Raw Image)data (16 bit integer) from a file and display on the JPanel or JFrame.

    Hey,
    I need to do the same thing. Did you find a way to do that?
    Could you sent me the code?
    It's urgent, please.
    My e-mail is [email protected]

  • Raw up date for new nikon d7100 in cs5.1

    raw up date for nikon d7100 for cs5.1 can any one please help me on this matter

    The D7100 is supported only in PS-CS6/ACR 7.4 and newer.  There will be no update for CS5.1.
    You can upgrade your CS to CS6 or CC or download the free DNG Converter to make DNGs from your NEFs and open those in older versions of Camera Raw.  You’ll want to make sure to set the DNGC compatibility options to something lower than the default of ACR 7.1.  The DNG Converter is available, here:
    http://www.adobe.com/downloads/updates

  • Working with raw Microphone data...

    so I'm creating an audio recorder and I'm writing the floats from the SampleDataEvent to a byteArray.  Everything works fine locally, but we need to store these files on our server.  I have tried to use Sound.load with the url of the byteArray however I get an IO Error which I assume is prob. because this file is not an mp3.  What I need to do is either find out what type of file the byteArray actually is, so that we can have our backend re-encode from this file type to an mp3, or I need to convert on the front end, to an mp3 and just send that new byteArray along.  I found Thibalt's WaveEncoder library, but this encodes to Wav files, not mp3's.  Any help or suggestions out there about how to resolve this issue?
    Thanks,
    BK

    It is not in a popular format.  It is simply RAW audio data in FLOATS.
    A WAV file is really a container, not a format in it self, it can store multiple types of formats, with or without compression.
    Do note the second sentence.  A good part of audio conversion tools expect raw audio data to be in integers, while the raw data that you get from the mic is actually in FLOAT, which is not the same a DOUBLE.  Flash's Number is a Double.
    You also have to be carefull with Endianes of your ByteArray, as this is also very important.

  • Retrieve raw captured data after report generation crash

    Hi everyone
    Yesterday we were performing load tests on a server. During which I created and I scheduled a User defined data collector set based on the system performance collector set. The data capture ran for 2 hours. It then proceeded with the process of generating
    the report. During this process I observed the Tracerpt.exe was slowly and consistently consumed memory. The generate report process was taking a while, so I came back to it 15 minutes later, to discover the process has ended, but no report could be found. 
    I'm assuming the process crashed.
    Is there a way to retrieve the raw capture data and attempt to regenerate a report? Where is the raw data temporarily stored?
    Is there any why to retrieve the missing information?
    Any help is appreciated.
    Ernie Prescott

    Suppressing Result Rows can be done in Query designer itself for one time. You need not to do after you get the report every time.
    If you always expect some 10 free chars constantly, i suggest you to insert them in Rows pane in Query designer but not in Analyzer. So that your report layout will be taking care with all settings what you want to do after the report generates in Excel. I mean you will get desired layout when you run the report first time itself.
    Suppress repeated key values also can be done in Query designer itself one time.
    By doing above, your report execution will not be tedious and it will be minimizing your efforts.
    Over all, What I have understood is, you are doing all sorts of settings in Analyzer after getting such huge volume of data, by which it gives you crash error.
    With all above steps, you can run your report with all pre-defined settings.

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

  • Need help for FM that converts RAW format data to xls format

    Hi all,
         I am able to get the data from the given spool number to be converted into 'RAW' format. I need to convert this data into Excel format nad want to send the mail as attachment.
         I want to know is there a Function Module that converts this RAW format data into the Excel format?
    regards,
    Brijesh Patel

    Hi,
    instead of that you can do this....
    once spool is generated you have spool number , using the spool number you can generate the excel file using the FM <b>RSPO_DOWNLOAD_SPOOLJOB</b>, pass the spool number, and filename as some.xls and then it will download it to xls file,
    Regads
    vijay

  • OSX: Updating pixel data for image

    Heya
    I have a buffer of pixel data that I need to update/change once every 25ms or so.  What's the best way of creating a UI element that I can update on the fly?  It looks like my old way of creating an NSBitmapImageRef and getting a pointer to the data via getBitmapDataPlanes was broken in the transition from 10.5-10.6 [1].  A workaround is to create a new NSBitmapImageRef every time I want to update and render a frame, but that creates a ton of object churn.  I figure there's got to be a better way to have byte-level access to a UI image of some kind.  Thoughts?
    Thanks
    [1] https://groups.google.com/forum/?fromgroups#!topic/cocoa-dev/f05K9ZaafMw

    Theoretically it may be doable assuming the tool used to modify B triggers proper events (not every tool does, unfortunately) AND your updates to layer A can be performed without disrupting user's work on B. What you'd need to do in this case is to implement an automation plugin based on Listener from the SDK samples that would monitor the events. Upon the event you'd need to determine the activate layer in your C++ code and if it's B then update A. The problematic part here would be whether you'd able to modify the non-current layer in a fashion that doesn't interrupt user's work on B (for example, you probably wouldn't want upon any change on B to change the current layer to A which would cause the focus to jump to A and then go back) and this would depend on the the type of changes you'd like to make there.
    Anyway, this would be the general direction I'd take here.
    HTH
    ivar

  • Converting raw pixel into bitmap:

    Hi i wonder to convert raw pixel into bitmap format. Is that any function is provided?
    Thanks to your help.
    Tham

    Hi i wonder to convert raw pixel into bitmap format. Is that any function is provided?
    Thanks to your help.
    Tham

Maybe you are looking for

  • Sales Analysis Comparative

    Dear Experts, Hope you are having a great day. I just wanted to confide my problem in regards to my formula for generating the correct GP based on the sales analysis report from sap, for comparative purposes. Sales Analysis Report Screenshot from SAP

  • Ipad mini replacement terms and conditions..

    I have this problem on my ipad mini that it always restarts or automatically. And sometimes it appears in the screen a blue color and a stripe one.. And an html somethinf like that. So under the warrAnty ivsurrender the unit to the store. I have read

  • Mac laptop fails to logon wireless to WRT160N V2 after setting up a Dell laptop

    I assisted a cooworker over the phone with wireless setup of a Dell Laptop and afterwards she could not connect her Mac laptop (it was working okay before). The only thing we did was log the Dell into the router via ethernet cable, obtain the PIN for

  • ACL strange behaviour

    Hello, I've inherited an old  Win 2000 server. On it there are several shares that I'm forced to move on a 10.6.7 server.. I've added this 10.6 server in the AD and moved on it those shares, and I've assigned necessary ACL on them. It's something sim

  • How to show master and detail tables in different pages?

    Hi, Can somebody expalin me how to include or bind the master and detail tables to different pages which are included at runtime. thnaks, Naresh.