Counting the number of pixels in a certain range within an ROI

I am using Vision 6.0 for Visual Basic.
I would like to get a count of the number of pixels within a particular region whose value falls within a certain range (e.g., the number of pixels with values between 86 and 255).
Can anyone tell me how I can do this?
Thanks.

bep -
Have you looked at the Histogram example? It should be under the Analysis directory wherever the examples are.
After doing the Histogram like the example does, you will have a CWIMAQHistogramReport object (let's call it HistogramReport) that contains the result of the Histogram. To access the 1-dimensional array containing the count in each bin, use the Histogram property on the CWIMAQHistogramReportItem that the HistogramReport contains.
To use this array, however, you will need to assign it to a variant. So, to find the number of pixels that are in the 5th bin (with the default options, this will be the pixels that have exactly the value 4), do
Dim Histogram As Variant
Dim HistogramReport As New CWIMAQHistogramReport
CWIMA
QVision1.Histogram2 CWIMAQViewer1.Image, HistogramReport
Histogram = HistogramReport(1).Histogram
' Now Histogram(5) contains the number of pixels in the 5th bin.
Let me know if this helps.
Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D

Similar Messages

  • How to determine the number of pixels of a desired object within a digital photograph?

    Hi everyone. I want to determine the number of pixels in an object that is part of a digital photo. I use cameras to film chunks of ice breaking away from ice cliffs or tidewater glaciers. I want to know the size of the ice chunk that my digital photographs capture. I know the width and height of the ice cliff in metres already, so I was thinking that I could convert the equivalent of 1 pixel : ? metres - this is really what I want to do. That way every time I see a chunk of ice breaking off, I can pull up the photo, outline the chunk, calculate how many pixels fill the area of ice removed by the chunk breaking off and convert to metres area 2 - thus giving me my size order. If anyone has ideas on how to do this I would really appreciate it, thanks so much community. I was thinking that Photoshop or Fireworks could help me with this, Ricky

    Thanks gener7 and normfb.
    The Photoshop help measurement page is brilliant and I think I can use the info on that page to work out my iceberg sizes. Check out the attached photo - you are looking at an ice cliff - essentially the front of a tidewater glacier that flows in the ocean. I'm a research student and I look at the process of iceberg calving - this is the term we use to define the sudden breaking away or detachment of ice chunks from glaciers that end in the sea.
    I used the lasso tool to crop the area of ice lost as a single chunk of ice detached from the ice cliff. At the same time I had the histogram window open. The histogram showed me how many pixels were contained in the cropped area. What I need to do now is work out what 1 pixel is equivalent to in metres. Soon I will have a digital elevation model for the ice cliff that will offer centimetre to metre scale resolution of the surface topography - so that should really help. The photographs I have are taken every 30 seconds - which is brilliant for documenting how the geometry of the ice cliff adjusts in response to detaching ice pieces and also because the ice is moving. I am a research student in Canada, and at the time I took the photos we measured that the ice cliff was advancing at a rate of approximately 12 metres per day! That's pretty fast. The flow of the ice is a first order control on the rate of iceberg production - you are essentially pushing ice into the ocean where it breaks off. I'm having to learn everything Photoshop from scratch...so please bare with me because maybe some of the photoshop questions I ask are simple to most!
    I noticed the "integrated density" function on the help sheet you suggested. This function also provides the square number of pixels contained in the cropped area I select...I guess this is similar to the histogram right?
    Either way - i just need the scale conversion to go from 1 pixel : metres or cm equivalent. At that point I think I will have to manually select every single iceberg event from my time-lapse photos and do this the manual way!  I have about 800 events to manually digitise and calculate the area for...
    Thanks everyone, Ricky

  • How can I count the number of pixels in a non-rectangular selection?

    I need to know the exact number of pixels that I select for a size comparison. It's a non-rectangular selection similar to a cloud.
    I'm using CS2 but could upgrade if needed.

    Thank You
    Michael D. Sutton
    (435) 723-3566
    (435) 720-2878
    [email protected]

  • Count the number of a certain document type in a document-set

    The Content types allowed in my Document-Set are document type A and document type B. How can I count the number of document type A in the document-set with workflows? I need to know if there is at least one document of type A inside the
    document-set. With “Item child count” condition in workflows I can only count the total number of the documents and not the number of specific document type.

    Hi pax123,
    According to your description, my understanding is that you want to count the number od the documents based on Content Types.
    As a workaround, you can create two columns to store the count of documents for your two content types. Then create a loop action to loop all documents, if content type is equal to your content type A, do a calculate to plus 1 to the numberA, then update
    the column numberA. Do a same if condition in the loop for your content type B.
    How to loop through all items
    http://blog-sharepoint.blogspot.com/2010/01/sharepoint-looping-workflow-how-to-loop.html
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Is there a way to count the number of times an array moves from positive to negative?

    I have an array of values, and I need to find the number of times that the array changes signs (from positive to negative, or vice versa). In other words from a graphical standpoint, how many times a certain line crosses the x-axis. Counting the number of times the array equals zero does not help however, because the array does not always equal exactly zero when it crosses the axis (ie, the points could move from .1 to -.1).
    Thanks for you help. Feel free to email me at [email protected] I only have lv 5.1.1 so if you attach any files, they cannot be version 6.0.

    Attached is a VI showing the # of Pos and Neg numbers in an array, with 0 considered as non-Pos. It is easily modifiable to other parameters - including using the X-axis value as your compare point versus only Zero.
    This is a modified VI from LV (Separate Array.vi)
    Compare this with your other responses to find the best fit.
    Doug
    Attachments:
    arraysizesposneg.vi ‏40 KB

  • How do I count the number of occurrences of a string within a group of cells?

    Hello all, I'm trying to figure out how to count the number of times a child has completed certain tasks.  Here is a sample of the data (it is highly simplified here, but contains what I hope is needed to answer my question):
    Unnamed Table
    Objective
    John
    Ann
    Alex
    Dave
    Eric
    20a 20b 20c
    x
    20a 20b 20c
    x
    20a 20b 20c
    x
    x
    19b 20a
          x
           x
    20c 21b 22
         x
    What I am trying to do is count the number of times each child completed each objective - but I can't figure out how to go about splicing up the "objectives" fields for counting while still being able to compare them to whether or not the "child" has 'an x in the box' in that particular row.

    If I read your example correctly, John's counts should be 2 for 20a, 1 for 19b, 20b and 20c, and 0 for any other objectives listed.
    Here's an example that will work for your data set, assuming that any objective ma occur only once in each row of column A of the Main table. I've added an a to objective 22, but I think it is unnecessary, provided there is no objective 122, 221, etc.
    This uses a two step process.
    The table AUX extracts the objectives completed by each student, using the checkboxes in Main. Note that it also adds a space at the beginning and end of each string. This provides an extra character before the first objective code and after the last objective code in that row, used by the wildcard specification in the formula in the Summary table.
    Formula:
    Aux::B2: =IF(OFFSET(Data :: $A$1,ROW()-1,COLUMN()-1)," "&OFFSET(Data :: $A$1,ROW()-1,0)&" ","")
    Fill right to the last column and down to the last row of Aux.
    Summary uses COUNTIF to count the number of occurrences of each of the objectives listed in column A of that table.
    Formula:
    Summary::B2: =COUNTIF(Aux :: B,"=*"&$A2&"*")
    Fill right and down as the previous formula.
    Regards,
    Barry

  • How can I export the number of pixels of each layer into an excel file?

    I would like to export the number of pixels that each layer of an image contains into excel. How can I do this?
    Secondly, as I need to do this with several images, is there any way to name the layers so that all layers with let's say for example the name "yellow" appear in the same column in excel?
    Some background information on why I need to do this... I would like to know how many percent of an image are yellow and have therefore created  layers of one image for each color it contains.
    Thanks for your help!!!

    Maybe my question was a bit unclear. I do not want to find out the number of pixels of a color in a layer but the number of pixels of the complete layer.
    What color these layers are is a different question. I am using images with a very limited range of colors (sort of like the image above but with about 10 colors). I have seperated these colors into layers and now need to count the pixels of each layer and export them.
    You can record number of pixels/layer  into the Measurement Log, then export data to Excel. But I'm not sure how to automate that without scripting.
    Does anyone know how to do this?
    For normal artLayers it is somewhat easy to get the number of pixels in the layer. But that is just how many pixels are in the layer.
    But that is exactly what I need to know, how many pixels are in the layer. I know how to find this out by looking at the histogram of the selection. But I want to export this information of all layers at once into an excel or text file. Any ideas on how to automate this with or without scripting?
    |

  • How to count the number of text boxes that are data entered

    How to count the number of text boxes that are data entered in visual basic form.

    Here is an Iterator that expands on my previous response:
    ''' <summary>
    ''' Iterator for form controls
    ''' </summary>
    ''' <param name="onlyControlsOfType">specify type if a certain type of controls needed</param>
    ''' <param name="onlyTopLevel">if true don't search containers within the form</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Iterator Function AllControls(Optional onlyControlsOfType As Type = Nothing, _
    Optional onlyTopLevel As Boolean = False) As IEnumerable(Of Control)
    Dim ctrl As Control = Me.GetNextControl(Me, True)
    Do Until ctrl Is Nothing
    If onlyControlsOfType Is Nothing OrElse ctrl.GetType = onlyControlsOfType Then
    If TypeOf ctrl.Parent Is Form OrElse Not onlyTopLevel Then
    Yield ctrl
    End If
    End If
    ctrl = Me.GetNextControl(ctrl, True)
    Loop
    End Function
    Some sample uses:
    For Each
    For Each c As Control In AllControls()
    Debug.WriteLine(c.Name)
    Next
    List of all controls, including controls in containers i.e. Groupbox
    Dim l As List(Of Control) = AllControls().ToList
    List of all Textbox controls, including Textboxes in containers i.e. Groupbox
    l = AllControls(GetType(TextBox)).ToList
    List of all Textbox controls, don't include Textboxes in containers i.e. Groupbox
    l = AllControls(GetType(TextBox), True).ToList
    'Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it.'  JohnWein
    Multics
    My Serial Port Answer

  • How do I count the number of records returned in the CMIS query

    How do I count the number of records returned in the query CMIS?
    SELECT COUNT(*) FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition = \'RD_PROJETOS_EXCLUSIVOS\''}
    Euler Homero

    Hi Euler,
    interestingly enough, the reference guide for CMIS ( http://wiki.alfresco.com/wiki/CMIS_Query_Language ) that I found does not mention the COUNT function at all. On the other hand it states that: "The SELECT clause identifies which virtual columns to return in the result set. It can be either a comma-separated list of one or more queryNames of properties that are defined by queryable object types or * for all virtual columns."
    There are, however, some other posts like e.g. http://alfrescoshare.wordpress.com/2010/01/20/count-the-total-number-of-documents-in-alfresco-using-sql/ which state that they could make it working.
    Having asked in the WebCenter Portal forum, I assume that your content repository is WebCenter Content. The CMIS doc for the Content is available here: http://docs.oracle.com/cd/E23943_01/doc.1111/e15813.pdf (no COUNT there either). It does, however, mention explicitly that "CMIS queries return a Result Set where each Entry object will contain only the properties that were specified in the query.". This means your could rather investigate the Result Set. Note that there are also other means than CMIS how to get the requested result set (e.g. calling a search service directly via so-called RIDC).
    In the given context I am also interested what your use case is. OOTB CMIS in WebCenter Portal is used, for instance, in Content Presenter, where it is content rather than "parameters" what's displayed.

  • How do I reduce the number of pixels in my photos?

    How do I reduce the number of pixels in my photos?

    Export them at a smaller size:
    File -> Export - not the options at 'Size'
    Regards
    TD

  • How to count the number of rows in a cube!!??

    Experts,
    I can somebody tell me how do I count the number of rows in my cube when i am using listcube???..
    Thanks
    Ashwin

    Hi,
    have a look ath this theard too
    Number of Records in Cube
    regards

  • How to count the number of rows in a resultser object?

    hi there
    how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanks

    You don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
    select count(id) from YourTable where [filter]
    from the resulting ResultSet do
    int res.getInt(1);
    which gives you the count and then
    select id from YourTable where [filter]
    to produce the actual result set.
    in the second query the id part can be substituted with the actual fields you want.

  • How to Count the number of TAB chars value '0A' in a line?

    I have a requirement to count the number of TABs in a text file that I am processing (they must equal 75) to ensure that all the fields have been submitted on the file I am reading?
    How do I identify the TABs in a line?
    I have this so far:
             CONCATENATE gv_unix_file gv_lstfiles-name INTO gv_unix_file.
              OPEN DATASET gv_unix_file for INPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              CONCATENATE gv_unix_file_arc gv_lstfiles-name INTO gv_unix_file_arc.
              OPEN DATASET gv_unix_file_arc FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              DO.
                READ DATASET gv_unix_file into lv_str.
                IF sy-subrc <> 0.
                  exit. "exit do loop, file is done.
                else.
                  TRANSFER lv_str to gv_unix_file_arc.
                ENDIF.
              ENDDO.

    Here is a sample code:
    DATA: lv_string TYPE string,
          lv_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
          lv_i TYPE i.
    DATA: result_tab TYPE match_result_tab.
    DO 3 TIMES.
      CONCATENATE 'A' lv_string INTO lv_string SEPARATED BY lv_tab.
    ENDDO.
    " this is how you need to find how many tabs are in your transfer work area...
    FIND ALL OCCURRENCES OF lv_tab IN lv_string RESULTS result_tab.
    DESCRIBE TABLE result_tab LINES lv_i.
    WRITE:'No. of tabs found:', lv_i.

  • Programatically count the number of files in a folder

    Hi Folks
    I need to programatically count the number of files in a given folder and return the value to a Program Unit to be included in further processing.
    Can anyone point me in the right direction. I have looked at UTL_FILE but this does not offer what I want.
    Does anyone know of an obscure package in Oracle that I could use?
    I'm using 9i in a W2K environment.
    Many thanks
    Simon Gadd

    Hi,
    following a java based solution i found somewhere on Tom Kyte's AskTom forum.
    GRANT JAVAUSERPRIV to TESTUSER;
    dbms_java.grant_permission( 'TESTUSER', 'SYS:java.io.FilePermission', 'c:\', 'read' );
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace and compile java source named "DirList"
    as
      import java.io.*;
      import java.sql.*;
      public class DirList
        public static void getList(String directory)
                           throws SQLException
          File path = new File( directory );
          String[] list = path.list();
          String element;
          for(int i = 0; i < list.length; i++)
              element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    exec get_dir_list( 'c:\temp' );
    select count(*) from dir_list;

  • Counting the number of IDocs in a package of IDocs in BPM

    Hello All,
        I need a solution where I need to count the number of EDI_DC40  segments (The IDoc Count) in a package of IDoc's. The following is the scenario
    1) We are receiving a package of IDoc's in receive step using the XI File Adapter. I was wondering if there is a way that I can count the number of IDoc's in the BPM using a container operation or some other Method. I appreciate any help.
    Thanks.

    HI,
    We have two ooptions,
    one as explained above , yu can use standard count function and that can be used.
    Second one is we have count option in file adapter to count the msgs.
    see the below link
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/0b/9a50465ccf84479e39a6d50c90fb3f/content.htm
    Regards
    Chilla

Maybe you are looking for

  • Slideshow in Imovie

    I am putting together a slideshow in imovie and am having problems with the Ken Burns effect. All of my portrait style photos are cropped to landscape, is there any way to rotatethe crop instead of the photo?

  • Do Classic apps work on new Intel models?

    I'm ready to buy a new computer, but I am confused about whether the classic OS9 applications I need to be able to use from time to time will work at all with the new models that have Intel chips. Do I need to look for an older model that still uses

  • Capture from DVD-R?

    Hello, Can I capture video from a DVD-R?

  • MDM Console/Data Manager Info

    Hi Guys. I am new to MDM world. I am looking for goof reference documents for Console and Data Manager I can use of. Also whether we can access Teched videos for 5.5 MDM stuff? Thank you in advance Jake

  • Writing discs with Firewire CD/DVD-R/W drive

    I recently got an external CD/DVD-R/W drive. It works fine for playing CD's through Finder, but does not show up as an option for burning discs in iTunes or Toast. System Profiler says it's model sym13fw500 made by LSI Logic. There it identifies it a