An easy way to extract all values of pixel lab - please help!

Hello

For an image of any size and dimensions, I try to automatically extract the color for each pixel coordinate information, ideally the laboratory values. So the result would look something like this:

x          y          L          a          b

0          0          100     0          0

0          1          99       0          0

etc. Ideally, the output would be in the CSV format.

I've seen some pretty exceptional scripts that are similar to what I need (but not quite) and I'm also a perfect starting script so don't know where to start! Any help gratefully received!

Oh and I'm on PS3 extended.

See you soon

Steve

OK, this script assumes

There is an open document which is the Lab 8-bit mode

The script creates a CSV file in the same location as the open document (if she had not saved it will be saved on the desktop) with the same name as the opened document.

File.prototype.readByte = function() {
  return this.read(1).charCodeAt(0);
};
function convertByteToSignedByte(num){
     var dec = (num | (num % 256))-128
     return dec;
};
function convertByteToLum( num){
     var dec = Math.round((num/256)*100);
     return dec;
};
function main(){
if(!documents.length) return;
if(activeDocument.mode != DocumentMode.LAB) {
    alert("Please convert this document to Lab mode\r Then re-run this script");
    return;
    }
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
try{
var Path = activeDocument.path;
}catch(e){var Path = '~/Desktop';}
var rawFile = new File(Path +"/"+Name +".raw");
saveAsRaw(rawFile);
var csvFile = new File(Path +"/"+Name +".csv");
var len = 0;
var W = activeDocument.width.as('px');
CountW=0;
CountH=0;
rawFile.encoding = 'BINARY';
rawFile.open('r');
csvFile.open('w');
csvFile.writeln('X,Y,L,a,b');
while(!rawFile.eof){
    csvFile.write(CountW+',');
    csvFile.write(CountH+',');
     csvFile.write(convertByteToLum(rawFile.readByte())+',');
     csvFile.write(convertByteToSignedByte(rawFile.readByte())+',');
     csvFile.writeln(convertByteToSignedByte(rawFile.readByte()));
     len++;
     if(len % W == 0){
         CountH++;
         CountW=0;
         }else{
     CountW++;
     }
}
rawFile.close();
csvFile.close();
rawFile.remove();
}
main();
function saveAsRaw(file) {
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putString( charIDToTypeID('FlCr'), "8BIM" );
desc2.putBoolean( charIDToTypeID('ChnI'), true );
desc1.putObject( charIDToTypeID('As  '), charIDToTypeID('Rw  '), desc2 );
desc1.putPath( charIDToTypeID('In  '), new File( file ) );
desc1.putBoolean( charIDToTypeID('Cpy '), true );
executeAction( charIDToTypeID('save'), desc1, DialogModes.NO );
};

Tags: Photoshop

Similar Questions

  • Easy way to extract the line of two-dimensional array?

    Y at - it an easy way to extract a two table row Dimensions? I have two lists of table to a dimension that I consider a pine table, where each pin list is a table of numbers. I want to go through it and to extract a line at a time to send in a vi. Currently, I'm looking to do a bit of a long way, and I was wondering if there was an easier way. The long way:

    GetArrayBounds (Locals.ArrayOfPinsToTestAtOnce, Locals.BogusString, Locals.ArrayBounds), / / enter the quantity of lines and columns Locals.ArrayBounds
    Locals.ElementsPerList = Val (Mid (Locals.ArrayBounds, 1, 1)), //Get number of bowling by list
    Locals.NumberOfLists = Val (Mid (Locals.ArrayBounds, 4, 1)), //Extract number lists
    SetArrayBounds (Locals.OneRow, "[0]", "[" + Str (Locals.ElementsPerList) + "']" ") //Set table defines for a line chart
    < locals.numberofgroups;="" i++="" )="" would="" be="" done="" in="" teststand="" step,="" just="" for="" easy="">
    {
    < locals.elementsperlist;="" j++)="" also="" would="" be="" done="" in="" teststand="">
    Locals.OneRow [j] = ArrayOfPinsToTestAtOnce [j] [i]
    PERFORM STEP HERE (Locals.OneRow)
    }

    Thanks for the tips!

    In all honesty, I just want to do in LabVIEW.  You can try to add to the list in this idea.

  • IIOMetadataNode is there an easy way to get all the items?

    Y at - it an easy way to get all elements with no recursion to a depth of level in the XML getAsTree IIOMetadataNode ("formatname") document and make the images of type jpeg with EXIF metadata (when its present on the image) who return to the IIOMetadataNode?

    You can call getChildNodes() on the node returned by getAsTree(). The returned NodeList will contain children with a depth of level.

    The EXIF data will be be summarised into a byte array [] under a sequence of 'unknown' marker with a value of 225 marker.

    /**Returns the EXIF information from the given metadata if present.  The
     * metadata is assumed to be in 
    javax_imageio_jpeg_image_1.0
    * format. If the EXIF information were not present, then null is recuperer.* / public static ubyte [] getEXIF (IIOMetadata meta) {//javax_imageio_jpeg_image_1.0 //-->markerSequence //--->unknown (attribute: 'MarkerTag' val: 225 (for exif)) root IIOMetadataNode = (IIOMetadataNode) meta.getAsTree ('javax_imageio_jpeg_image_1.0');} IIOMetadataNode markerSeq = root.getElementsByTagName("markerSequence").item (0) (IIOMetadataNode); Notorious NodeList = markerSeq.getElementsByTagName ("unknown"); for (int i = 0; i)< unkowns.getlength();="" i++)="" {="" iiometadatanode="" marker="(IIOMetadataNode)" unkowns.item(i);="" if("225".equals(marker.getattribute("markertag")))="" {="" return="" (byte[])="" marker.getuserobject();="" }="" }="" return="" null;="">

    You must use a TIFFImageReader to analyze the table of byte [] being the TIFF metadata EXIF metadata.

  • Is there an easy way to download all the adobe photoshop tutorials video to watch offline on a trip?

    Is there an easy way to download all the adobe photoshop tutorials video to watch offline on a trip?

    Thank you

    If you buy something like that, you can watch whenever you want: 15 http://www.adobepress.com/store/adobe-photoshop-cc-2015-release-learn-by-video-97801343841

  • Is there a way to extract all the text from the captivate course?

    Hi all, someone can tell me if there is a way to extract all the text from a captivate file? We need to convert all the texts on the audio screen and insert audio into each slide... Thank you for all the input.

    Hello

    Try clicking on file > export > project captions and subtitles. Who should produce a Microsoft Word document.

    See you soon... Rick

    Useful and practical links

    Captivate wish form/Bug report form

    Certified Adobe Captivate training

    SorcerStone blog

    Captivate eBooks

  • When I opened outlook express Inbox, all messages have been deleted, please help restore the same

    When I opened outlook express Inbox, all messages have been deleted, please help restore the same

    Go to view | Current view | Show all messages to make sure that you have just selected 'Hide read messages.

    If this does not help, check your Recycle Bin, the bak files which are dbx files, you can restore backups.  See www.oehelp.com/OETips.aspx#2

    If this does not help, then you will probably need my program DBXpress (www.oehelp.com/DBXpress/), which will extract the messages from individual dbx files, and if messages are no longer in the files, it can extract from the disc itself.

    Steve

  • I am a beginner using photoshop and I hid the layer tool and can not find a way to get it back... Please help

    I am a beginner using photoshop and I hid the layer tool and can not find a way to get it back... Please help

  • Is there an easy way to view all the elements of the façade which are hidden in a pragmatic way?

    Hello

    There were some cases where the new indicator that I created was actually overlaps the other indicator which was hidden at the time of development.

    I knew only when the program is operating normally and the hidden indicator will appear on the front panel.

    It would be great if I can see all the elements of hidden façade while in development mode.

    Is there an easy way to do this or am I missing something?

    Thank you.

    Steve

    See here: http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-08-14-2006/m-p/403788

    You can also choose to vote in favour of this idea: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Show-all-hidden-controls-and-indicators/idi-p/1113431

  • Easy way to hitTestObject all elements of array?

    Hey guys, is there an easy way, using 1 or more for loops, to hit the all test objects in a table against any object in this table.

    So I have a table of 6 work

    If (1 hits 2)

    If (1 typo 3)

    If (1 hits 4)... etc.

    If (the 2 hits 1)

    If (2 hits 3)

    If (the 2 hits 4)... etc.

    Thanks in advance, much appreciated.

    for (var i: int = 0; i<>

    for (var j: int = i + 1; j<>

    {if (array1 [i] .hitTestObject (array1 [j]))}

    do everything.

    }

    }

    }

  • Multi-page site needs an easy way to update all pages at the same time

    I should just start each post with my lack of qualifications.  I am the author of 2 sites and try to make the most recent design.  I'm starting a new site and have a column on the right side, where I post an update, sort of a newsbite.  I would like this update to appear on each page and have only update once so he could fill on all pages.  I'm just starting to work in CSS and using DIV. is there a way to do this?  I can't view the site that the new version is in offline mode. If this is impossible, I am early enough on the site to work on it to remove it on all except the home page.

    Thank you

    Gary

    An easy way to do this is to copy your old text and replace it with the new find and replace. Find the root folder and it should

  • Is there an easy way to copy all of a Hotmail folder in a folder of Windows?

    Copy of one of Hotmail mails in the folder Windows is terrible. Is there a way to copy all of a Hotmail folder in a folder of Windows?

    Hello Pope Clementius,.

    Thank you for visiting the community! You can copy your Hotmail emails on your computer using Windows Live Mail to connect to your email. You can download Windows Live Mail from:

    Windows Live Mail

    ·         Download and install Windows Live Mail

    ·         Open Windows Live Mail

    ·         Enter the account information in the Connection Wizard

    ·         Wait for email to be downloaded onto your computer

    ·         Once the download is complete, exit Windows Live Mail

    ·         Click Start

    ·         Click on my computer

    ·         In the address bar, paste this address: %userprofile%\Local Settings\Application Data\Microsoft\Windows Live Mail

    ·         Open a folder that will look like Hotmail (*) where the asterisks could be anything

    ·         Here will display your folders (Inbox, drafts, etc.), open the folder you want to copy on your computer

    ·         Press Ctrl + a on your keyboard to select all

    ·         Right click on a file highlighted

    ·         Click copy

    ·         Open the folder that you want to copy the emails to

    ·         Right-click on an empty spot in the folder

    ·         Click Paste

    When you delete/move emails in Windows Live Mail or online access email on your computer in the Application Data folder will be deleted/moved as well. That's why you need to copy the mails to another location so that the copies are not deleted/moved.

    Hope that helps, I look forward to hearing from you.

    Steven
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • BlackBerry smartphones no way to actually download appworld 3.1.2 - please help

    Hello, I have a 9900 (t-mobile).

    I tried to access the app store and said that to do this I need to update the application. I followed the prompt (click 'upgrade'); took me to a Web page, the only valid option is 'download it today "; clicked on it and was taken to a page with two links on this subject: 'View BB app world availiability' brings me to a list of countries with no link, and a link "change language", witch leads to a page with an 'English' link, which brings back me to the previous page.

    Go to the download page for blackberry for the app (3.1.2) and I have a download email link to my e-mail address of bb configured. As before, I clicked on it and was taken to a page with two links on this subject: 'View BB app world availiability' brings me to a list of countries with no link, and a link "change language", witch leads to a page with an 'English' link, which brings back me to the previous page.

    Then I navigate to the page with the bb browser and click on the download link and, once again,.
    has been brought to a page with two links on this subject: 'View BB app world availiability' brings me to a list of countries with no link, and a link "change language", witch leads to a page with an 'English' link, which brings back me to the previous page.

    I can't find any way to actually download this application, which is the method for downloading of all other applications. It is a worrying phenomenon.

    Please HELP or give me an idea where to start with this question.

    (Edit) I just did an assembly/disassembly by the desktop client - still get the prompt 'need to update', which brings me through the links lead nowhere, as shown above. I also removed app world and tried a new installation of the 2 ways this last mentioned above and got the same behavior. Something is happening with the download page?

    Try this:

    • Each time a random strange behavior or slow creeps, the first thing to do is a battery pop reboot. With power ON, remove the hood back and remove the battery. Wait a minute, then replace the battery and cover. Power on and wait patiently through the long reboot - about 5 minutes. See if things return to functioning. Like all computing devices, BB suffers from memory leaks and others... with a hard reboot is the best remedy.

    But give him maybe 15 minutes to "settle", without doing anything. Then, the first thing to go in the BB native browser and try the link again...

    Best!

  • For CS6, is there an easier way to redirect all my files and folders for all programs?

    Hey people adobe, Im wondering, I know you can configure each preference individually, but I want to redirect all caught space, storage of brushes and etc for all my programs in an another disc as volume change c / e /. Is there a way to do this with a program to make it easier? I don't want to accidentally delete files that are not all adobe programs.

    The reason is I don't want anything else then store programs on the SSD, and theoretically, I want the other disk, so it can run faster.

    There is no global option for this.

    Mylenium

  • Is there an easy way to restore all panels to their original state?

    I have been using Adobe Classroom in a Book and have re-wired some panels the wrong way.  This means that they are not more like the book.  Is a shortcut or another method to restore the State of out-of-the-box?

    You can restore the preferences of Muse to its original state by disabling them. So get out of Muse and delete the folder AdobeMuse to the following location:

    Mac OS: ~/Library/Preferences

    Windows XP: %APPDATA%\protector.exe

    Windows 7: %APPDATA%\protector.exe

    Now when you restart the application, all preferences must be restored to its original state.

    Thank you

    Vinayak

  • Easy way to delete all the DRM configuration

    Hi team,

    We have few resources to install and so whenever a new project is, you need to delete the old configuration manually going to each objects. Wanted to know is there any utility that is available or any simple process that removes the DRM configuration and makes the application as fresh.

    I know that we can delete the schema and create new ones, but this requires a DBA help and we do not have to do the same. DBA needs time to remove the schema and the new restoration, we cannot create the DRM scheme directly. Y at - it a script that can be provided to the DBA to run and clear all the tables in the DRM schema without disturbing the important data like Dal_updates etc.

    Any other ideas are welcome.

    Thank you

    @

    Hello

    I have an idea on this requirement, which is a bit, but as far as I know, it should work.

    There will be a first activity of the side time DBA. The DBA to create two application (APP1 and APP2) ask for the first time. So both applications are now empty.

    Now, you start your work in APP1 and hold APP2 because it is safe and empty. Once your work is done and you want to delete everything he just run the copy of the application functionality and copying in APP1 APP2. So, it will copy the empty APP2 application in application APP1 . I think that this will also remove the audit tables.

    So donnot you need DBA help every time.

    The link to the copy of the application is: https://docs.oracle.com/cd/E51367_01/financialsop_gs/FADRI/ch04s03.html

    Let me know if it helps

    Thank you

    Khady Sylla

Maybe you are looking for