Counting pixels of a specific colour

Hello.
Can anyone tell me if it's possible to load an image into
flash and count the pixels of a specific colour in that image?
I'm trying to develop an application that loads images with a
white background, then counts all the white pixels and returns the
number of non-white pixels.
I don't need a step-by-step explanation of how to achieve
this (although I'd be immensely grateful if anyone would go to that
trouble), for a now a simple yes or no, and perhaps a few clues
would be plenty of help.
Thanks in advance.

Extract the bitmapData from the image you load in - this will
be in Bitmap(loader.content).bitmapData. Then you can loop through
the bitmapData pixels with BitmapData.getPixel() and keep a tally
of white/non-white pixels.

Similar Messages

  • Is there a way to use specific colours on gradient noise?

    Hi,
    I am hoping to make a radial gradient noise effect, but I would like to select the specific colours on the effect. I see that when you go to the gradient-maker tool and switch it to the noise option, there is no option to select the specific colours. Is there a different way to achieve this desired effect?
    Basically, I would like to make circular lines of colour from a specific colour set.
    Thanks!

    Hi again,
    Thanks again for your help. For example, I am starting with an image like this created in photoshop:
    Next, I will take indexed colours from this (probably 50 of them), and want to make an image like this but with only the 50 colours indexed:
    So in the end you get a "colour pie chart" like this:
    Anyway it sounds like there is not an automatic way to do this? Otherwise I will just overlay a template with the slices and manually fill in the colours--- but as there are many photographs in my project I was just hoping to find a quicker way to achieve this or something similar.
    If you have any further tips, let me know. Otherwise, thanks again for your input until now!

  • Count records for a specific date range

    Hi,
    I am using BI Publisher with Siebel 8.1.1.1. I have a monthly report where I want to count the number of service requests entered per customer per month.
    I am using the following expression that works for one month:
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d',psfn:getCanonicalDate(ssCreated), xdoxslt:current_date($_XDOLOCALE,$_XDOTIMEZONE), $_XDOLOCALE, $_XDOTIMEZONE) <=28])?>
    However, I want to be able to specify a specific date range for my count, i.e ssCreated >= '01/02/2011' and <= '28/02/2011', as opposed to count for the past 28 days. Can you please advise what syntax I can use to specify a date range?
    Any help will be greatly appreciated!
    Claire

    Hello,
    Many many thanks for your reply.
    I'm doing as you suggest and am using the date_diff to the end of the period in question. I've tried the following to get the number of Service Requests with Severity 1-Critical, created in Jan 2011, feb 2011:
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-31', $_XDOLOCALE, $_XDOTIMEZONE) <=31])?>
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-02-28', $_XDOLOCALE, $_XDOTIMEZONE) <=28])?>
    In my xml sample data that I'm using I have 2 service requests that mean the criteria for Jan, yet when I run my report I'm getting '0'. The problem seems to be with my end of period date '2011-01-31'. I've also tried with both start and end period date (using a negative value as per your suggestion), but I still get '0':
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-01', $_XDOLOCALE, $_XDOTIMEZONE) <=-31 and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-31', $_XDOLOCALE, $_XDOTIMEZONE) <=31])?>
    Many thanks,
    Claire

  • How do I count objects of a specific type in a Vector? Java 1.3 source.

    How do I count the objects of a specific type in a Vector?

    isInstance may allow too much for your needs as it allows any object which can be typecast to 'type' while you seem to want to limit to objects which are exactly of the type 'type'. In such a case you could do this:
    for (Enumeration e = attachmentTypes.elements(); e.hasMoreElements();)
      Object check = e.nextElement();
      if (check.getClass().equals(type)) {
        counter++;
    }Javadoc of the isInstance() method:
    http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29
    (I link to the old Javadoc given you mentioned Java 1.3 compatible source)

  • Counting records in a specific time block per day

    I have a scenario where I need to find the number of records in a table called 'DEALS', for a specific time frame (in this case 8am until 9am where the date field stores dates in the following format '06/01/2005 08:23:35'). I need to run this query to include each business day between two dates (ie., june 1, 2005 until current_date).
    In addition, this query has to take into account only Users that are ACTIVE in a second table called 'DEALUSERS'
    I have worked out the following to get the overall record set, but it is not narrowed down to just the specified time frame, nor does it produce the count for each day's 8:00-9:00 time frame.
    SELECT fdls.DEALDATE, user.USERROLE
    FROM DEALS dls, DEALUSER user
    WHERE dls.CLIENTUSERID = user.USERID
    AND user.STATUS = 'ACTIVE'
    AND dls.PROXYTRADEFLAG = 'YES'
    AND dls.MODENAFLAG = 'YES'
    AND TRUNC(dls.DEALDATE)
    BETWEEN TO_DATE('06/01/2004 08:00:00', 'MM-DD-YYYY HH:MI:SS')
    AND current_date
    I tried using the following at the end of the above query, but it doesn't work - any ideas? :confused:
    AND TO_CHAR(EXTRACT('HOUR' FROM DEALTS)) = '8'
    Can someone help, pls :o

    Not quite sure what you ultimately want here, but something like:
    SELECT TRUNC(dls.dealdate, 'hh'), user.userrole, count(*)
    FROM deals dls, dealuser user
    WHERE dls.clientuserid = user.userid AND
          user.status = 'ACTIVE' AND
          dls.proxytradeflag = 'YES' AND
          dls.modenaflag = 'YES' AND
          dls.dealdate BETWEEN TO_DATE('06/01/2004 08:00:00', 'MM-DD-YYYY HH:MI:SS') AND current_date and
          TO_CHAR(dls.dealdate, 'hh24') = '08'
    GROUP BY TRUNC(dls.dealdate, 'hh'), user.userroleshould give you some ideas.
    HTH
    John

  • How to count interrupts of a specific driver / HW

    I am using Perfmon to get #interrupts/sec.
    I can also drill down to single core resolution (e.g. core0, 1, 2, 3 in a 4 core CPU)
    This is good, but i would like to get interrupts/sec for a specific source (e.g. network interface card) or all interrupts handled by a specific driver.
    Couldn't find this capability in Perfmon.
    does anyone have an idea?
    Thanks,
    Ami

    No version of Reader offers word counting or word auditing.

  • Specific Colour changing Script from RGB to CMYK

    I need to change the RGB values (imported from word) to specific CMYK values in Indesign (its not a straight swop) so I need a script or a similar plug-in that enables me to input the colour values for the CMYK so they automatically change.... the doc i work on is huge and im importing from a word file many times so i need to save time!!
    Can anyone help me?
    Thank you!

    Hi Phil... Hmmm not sure if i explained myself! Or maybe I am being thick.... I tried the new code but im not sure I was clear on my problem?
    This is the current code i use to change the RGN values to the CMYK is: I have entered the RGB and CMYK values as they need to be changed and it works but the swatch pallette ends up looking messy! See below.
    var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R122_G75_B153"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[48,72,0,0];
                     mySwatch[j].name = "C=" + myCV[48] + " M=" + myCV[72] +" Y=" + myCV[0] + " K=" + myCV[0];
             }catch(e){alert(e)}
    var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R255_G0_B255"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[0,100,0,0];
                     mySwatch[j].name = "C=" + myCV[0] + " M=" + myCV[100] +" Y=" + myCV[0] + " K=" + myCV[0];
             }catch(e){alert(e)}
      var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R0_G0_B255"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[100,0,0,0];
                     mySwatch[j].name = "C=" + myCV[100] + " M=" + myCV[0] +" Y=" + myCV[0] + " K=" + myCV[0];
             }catch(e){alert(e)}
      var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R255_G255_B255"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[0,0,0,0];
                     mySwatch[j].name = "C=" + myCV[0] + " M=" + myCV[0] +" Y=" + myCV[0] + " K=" + myCV[0];
             }catch(e){alert(e)}
      var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R0_G0_B0"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[0,0,0,100];
                     mySwatch[j].name = "C=" + myCV[0] + " M=" + myCV[100] +" Y=" + myCV[0] + " K=" + myCV[100];
             }catch(e){alert(e)}
      var myIDOc = app.activeDocument;
    var mySwatch = myIDOc.swatches;
    for (var j=4; j<mySwatch.length; j++){
        try{
             if(mySwatch[j].space ==ColorSpace.RGB){
                 if(mySwatch[j].name=="Word_R234_G229_B255"){// may be this is correct you can check the indesign swatches name
                     mySwatch[j].model=ColorModel.PROCESS;
                     mySwatch[j].space = ColorSpace.CMYK;
                     var myCV = mySwatch[j].colorValue=[8,10,0,0];
                     mySwatch[j].name = "C=" + myCV[8] + " M=" + myCV[10] +" Y=" + myCV[0] + " K=" + myCV[0];
             }catch(e){alert(e)}
    The outcome is the swatch pallette attached:
    How do I incorporate the new code to make sure all the values are hopefully to end up looking similar to this!!??
    Thanks for all your time and effort helping me!
    babeanz

  • Using a specific colour

    I want to replace one colour in an image with another specific one which I have the Hex code for. How do I do that? Thanks!

    No one has come across this problem before?
    Regards,
    Andi

  • Count pixels labview vision 2013

    hi
    i want to determined percentage of pixels in a region, like function count pixcels in NI Vision Builder AI but in labview vision 2013 

    Brad, thanks for the response. I don't have access to the code anymore, I was more just curious about it. One of my old coworkers has actualy been in contact with me recently because he's the one who inherited my code. I had to walk him through how I implemented the VBAI code in to the main application because he couldn't just change a few setting inputs. It was more of just a inconvenience.
    I guess my suggestion for the future would be for an option to output the VBAI code as LabVIEW code without all of the subVI hierarchy for those who are used to just using the IMAQ VIs. Just a linear set of code that goes from the start to fnish of the VBAI diagram that I could manipulate the way I want would be nice.

  • X220 IPS: latency of pixels too high - slow colour switchback

    Sorry guys to present you with a new problem concerning the X220 but I noticed today (only half an hour ago) that if I switch my screen to a black screensaver and wait around 15s and go back to normal screen then the colours will be "unreal" -> means they appear to bright and "undetailed" for some time (15 to 20s) and then go back to normal (it's like slowly increasing colour depth from 256k to 32bit or the latency of the all pixels is to high).
    To literally talk in pictures: I have one of these standard "I-come-with-windows-please-use-me"-background pictures of a koala. In normal state I can the details of its fur. But if the I do the above the Koalas fur is more like a big grey surface.
    Sadly, I couldn't capture the phenomena with a screenshot (I tried several times but no luck) so it seems to me more like a hardware issue (have an IPS panel but so far had no problem with ghosting. but I have the screen bleeding.). Also because it's late and quite dark here in Germany I can't take a good photo of it.
    If a Lenovo employee should read this here are some more hints for debugging: Have a recently bought X220 (Type: 4290-W1B) and it's currently running on battery (haven't checked plugged-in yet because I'm dead tired but hopefully will have time tomorrow) with brightness level 5 (changed it to max of 15 but problem is still occuring).
    Please tell me if you need more informations! And thanks for your help beforehand.
    Using x230t (i5-3320M, 8GB RAM, 256GB SSD, 80GB mSata-SSD) and loving it!
    "I may not own the world but I own my mind and therefore the world is at my feets." (me)
    Solved!
    Go to Solution.

    erik wrote:
    take a look at the following KB article and see if it helps.   your issue may be due to how your intel graphics control panel is set.   turning off the power-saving technology option might fix it.
    http://forum.lenovo.com/t5/X-Series-ThinkPad-Lapto​ps/Display-contrast-reduced-while-on-battery-mode-​...
    This sounds like it'll fix my problem but I can only confirm it this evening. Thanks for the fast help!
    Using x230t (i5-3320M, 8GB RAM, 256GB SSD, 80GB mSata-SSD) and loving it!
    "I may not own the world but I own my mind and therefore the world is at my feets." (me)

  • Count Cells Based on Font Colour

    I have a Numbers spreadsheet that lists all my movies. The font is different colours based on Blu-Ray DVD (Blue), Apple TV (Green) or normal DVD. Column A has the list and I would like to list the number of DVD's based on DVD type (Font Colour) in column B. B1 list number of cells in column A with Blue Font and B2 list number of cells in column A with Green Font.
    I am a newbie with Macs, Scripts and Numbers so any help would be appreciated.

    Hi JSS,
    Text colour is a cell format and can not be used as a "value" except maybe in AppleScript.
    With another column to list DVD type,
    COUNTIF (in another table)
    Formula in B2 (and Fill Down)
    =COUNTIF(Table 1::B,A2)
    Regards,
    Ian.

  • How do I count numbers within a specific range in a column?

    I'm creating a spreadsheet for my college courses where I enter each score from each class as I get them back and it continues to recalculate my grades in each course.  Now I'm on the part where I want to make a box that calculates the current GPA for the semester.  I know how I'm going to do it already but I need to figure one thing out first.  Say my scores are as follows:
    85.50%
    82.00%
    92.35%
    94.25%
    78.00%
    I need a working code that counts the amount of scores within a certain range, say for example, tell me how many scores are between 80.00 and 89.99.  I can figure out how many are above/below a certain value (80.00 again for example) with a code like this [scores being the column with the grades]:
    =COUNTIF(Scores,">=80.00") ---- this gives me "4" correctly
    BUT when I add another value and want it to limit scores to not just being equal to/above 80.00 but also below 90.00 it freaks out.  I tried the two following codes:
    =COUNTIF(Scores,">=80.00","<90.00")
    =COUNTIF(Scores,">=80.00",Scores,"<90.00")
    Neither work, i'm sure i'm just wording it wrong.  It should obviously spit out the number "2" with there being two B's.  Any help would be appreciated!

    Jeremy.Osborne wrote:
    I have set up a chart just like yours with the intervals (60-100) on the left and on the right I have no idea what to do.  Do I enter that code into each box? Right now it looks like:
    =INDEX(FREQUENCY(Scores, I have no idea what to put here)
    Jeremy,
    in my response, I gave you the expression I used to build the frequency table. It was:
    =INDEX(FREQUENCY(Data :: A,A),ROW()-1)
    If you build a document exactly as the one I illustrated, the same expression will work for you. If you use a different table name, you will have to adjust the reference.
    Regarding the COUNTIFS function, you must read carefully the syntax defined in the Function Browser or the Formulas and Functions user guide and follow it to the letter.
    Jerry

  • Arraylist.toString (need to count amount of a specific character in a list)

    hi
    I have a sql query that im using to populate a ArrayList<String>. I need to count the amount of "+" symbols in the all of the list. My first idea was to use Arraylist.toString and then run the resulting string through this method
    public static int countMsgs(String result){
              int counter = 0;
              for(int i=0;i<result.length();i++)
                        if(result.charAt(i)=='+')
                        counter++;                                      
              return counter;However when I do this:
    ResultSet userid1021result = sql.executeQuery
          ("select address from MESSAGES where SENT_TIME >=  '" + start + " 00:00:00' AND SENT_TIME <= '"+ end + " 23:59:59' "
          + "and USER_ID = 1");
          while (userid1021result.next()) {
                  String addresses = userid1021result.getString("address");
                  userid1021.add(addresses);
          String blah = userid1021result.toString();
          System.out.println(blah);It outputs "com.mysql.jdbc.JDBC4ResultSet@1abc7b9" which is obviously not what i was expecting
    How do i get the contents of the arraylist into one big string so I can run it through my countMsgs method?
    Thanks

    Guys,
    Where a, b, and c are strings: plusesIn(a) + plusesIn(b) + plusesIn(c) == plusesIn(a+b+c)
    Ergo, concatenating the strings is just a waste of time.
    Also... I'd factor out the character-to-find from countMsgs to make a static helper method (in a "reusable" StringUtils class)...
    * Returns the number of times target occurs in string
    public static final int occurences(String string, char target) {
      int count = 0;
      for ( char c : s.toCharArray() ) { // 1.6 only
        if( c == target ) count++;
      return target;
    }

  • Keep specific colour of an object and make everything else b & w... help :(

    how do I keep the colour of, say a football, in red and make everything else in the clip black and white?

    Kevin Brock wrote:
    stuckfootage wrote:
    http://www.lafcpug.org/tutorials/basicpleasantvillelook.html
    Man, if I only had a $ for each time this link was shown to someone on this forum.
    <chuckle> Googling around, there are lots of explanations how to do this
    effect online, but I think the LAFPUG page is the easiest to understand.
    That's the nature of these forums, that people keep asking the same
    questions over and over.

  • To paint a rectangle in a specific position of a specific colour --- help!

    Hi,
    i want to paint many 2D squares of colour "contrast" (which i have set previously and changes each time the 2D square is drawn so that many 2D square of different colours result) and i want to draw these 2D squares in a particular position.
    my code so far is (in the Paint method: )
    for(j = 0; j < max; j++)
    for(k = 0; k < max; k++)
    g2D.setPaint(new Color(contrast, contrast, contrast));
    Rectangle2D r2 = new Rectangle2D.Float( j , k , 2 , 2 );
    g2D.fill(r2);
    }but this is in a class called "Second" which is called from the class where the main method is called "First". "First" may change the size and position of where the "Second" draws. how do i make sure it draws where i want it to?
    thank you

    i want to draw these 2D
    squares in a particular position.
    but this is in a class called "Second" which is
    called from the class where the main method is called
    "First". "First" may change the size and position of
    where the "Second" draws. how do i make sure it
    draws where i want it to?This seems to be a contradiction in goals here, care to explain it more fully?
    Make a third class that sets everthing back the way you want before you call second. This is just a guess, because your statements of desire and implementation seem to contradict each other.

Maybe you are looking for

  • Unexplained Verizon Data Usage on Iphone 5s

    I have data usage charges showing up on my Iphone 5s every day at 5:40am Eastern time.  The problem is that my phone is not being used at that time of day and is always connected to WiFi while I am home.  The data usage has been very large, from 60mb

  • Error when launching Flex Builder 3

    Hello, I'm new to flex and just downloaded the trial version of Flex Builder 3. When launching the builder, I get the following error in the log. What am I missing? !SESSION 2008-12-07 21:08:26.880 eclipse.buildId=unknown java.version=1.5.0_11 java.v

  • CS5 - Exporting images and captions to epub

    I am exporting an inDesign document to epub and would like to create image captions that stay with their images as the text flows across page breaks. I am anchoring the images inline to the text, and the images are fine. When it comes to the captions

  • Can someone tell me why Safari windows follow from space to space?

    I open a new space via Mission Control.  I want to have only a couple terminal windows in there.  For some reason Safari windows follow me when I switch from one space to another.  Why is this?  It doesn't happen with email, Firefox, or any other app

  • Printing witholding tax in AP invoice

    In the layout to print the Ap invoice i need to print the witholding tax. however the invoice can be in local currency or foreign currency. i can not find the variable to use which will work in both case. Either I get the local currency or the foreig