Assigning an RGB Value variable that doesnt Change

Hi,
I have been working on a program that takes an image, tuurns all the dark pixels to blue ones and then finds the bounderies of the blue areas. Im having difficulty detecting the Blue pixels
Im using
BufferedImage.getRGB(x,y) to get the value of a blue pixel
I assigned the blue value as int blue = 0xff;
but the program doesnt seem to pick up the same RGB value each time !
Thanks for the help
Graeme

Hi,
The code i used for fliping the coords below, Ive not touched ColorModels didnt think it was nessecary if it was just a straight forward color comparison. It sets the color but seems to be reading it in differently
bi = getBufferedImage("C:/GB Y4/Project/Backups Project/lego/VisionSystem/Workstation/Images/image.jpeg",this);
          rgb = 0;
          // loops through and gathers the rgb values for the Image !!
          for(int a =0; a < 320; a++){
          for(int b =0; b < 240; b++){
          rgb = bi.getRGB(a,b) ;
          red = (rgb / 0x10000) & 0xff ;
          green = (rgb / 0x100) & 0xff ;
          blue = rgb & 0xff ;
          //System.out.println("Blue :" +blue );
          // loops through all the pixels in the Image 240 X 320 = 76000 pixels
          // If a Black pixel then find edge
     if(red > 0 && red < 60 || green > 0 && green < 80 || blue > 0 && blue < 80 ){
               // TESTING (See if coordinates are being scanned)
               //System.out.println("Black pixel found at (" + a +","+ b +")");
               //     Replacing Pixels re-write the image boundery in Blue
               bi.setRGB(a,b,0xff0000ff );
               // TESTING
               //     Saving the Position of all the Blue Pixels
               savePos(a,b);
          

Similar Messages

  • How to assign a default value when there is no prompted value

    Dear all,
    I create a filter and it's value is relate to a prompt.If the prompt is not fill I found that all record is selected.
    How did I assign a default value so that when I didn't fill some value in to the prompt and still can get the result by
    the default value I set?
    Thanks a lot!

    Are you using dates for between or some character column?
    Post your example.
    Instead of between use to is equal prompts, so u will have then 2 fields one for date from a nd one for date to. Everything is the same as I wrote just repeat steps...
    You must put 2 separate fields if you are using date between and you want to have default variable for both.
    Column formula for the first calendar date prompt:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.1900' as date) end
    and for the second:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.2900' as date) end
    Now you set up default repository variable for both prompts.
    Presentation variable you put in the set presentation variable on each prompt:
    p_date_from
    p_date_to
    And in Answers filter will be like this:
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char")} and @{p_date_to}{VALUEOF("rv_test_date_to_char")}*
    or you can put a different default variables
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char_from")} and @{p_date_to}{VALUEOF("rv_test_date_to_char_to")}*
    I posted similar in my blog:
    Date between in filter and title when using presentation variable from calendar dashboard prompt or drop-down list in OBIEE
    http://108obiee.blogspot.com/2009/03/date-between-in-filter-and-title-when.html
    Regards,
    Goran O
    http://108obiee.blogspot.com
    Edited by: Goran O on 2009.04.23 03:37

  • Can't assign a string value to a member of type TEXT in Calculation Manager

    I can assign a string value to that member of type TEXT using a run-time prompt of type StringToNumber.
    Example: "My Text Member" = {string_rtp};
    However, I need to accompllish the same function without using a run-time prompts.
    I have a planning application and I know that text along with all other non-numeric
    values are stored on the relational side in the planning application schema.
    It seems reasonable to assume that if this can can accomplish
    with a run-time prompt that I could do also do it without a run-time prompt.
    What appears to be lacking is a function like:
    "My Text Member" = @StringToNumber(<String Literal>);
    Clearly, this is already being done "under the covers" for run-time prompts. If
    would appear to be a minor enhancement to expose such a function to developers.
    NOTE: I suppose you would also need to add new syntax/function to identify a string
    literal from say a member name. I'm wondering if this is the more difficult challenge
    from a product perspective????

    When executing a Calculation Manager rule in Planning, the run-time prompt (RTP) is populated by looking up the outline information present in the relational Planning application database. If the RTP is of type TEXT, the strings displayed in the member select are from the from the relational Planning application database too. Subsequently when executing the Rule, the RTP's value is in fact the record ID (a number) which is then saved into the appropriate intersection in Essbase.
    You need to bear in mind, the Rule is executed in Essbase. If Essbase needs to "write" a text, it would then need to connect to the Planning relational database to create a new record. The newly created record ID then needs to be feed back to Essbase, in order to store it in the appropriate intersection.
    What you are suggesting, comes with a big overhead causing Essbase and the rule to slow. Thus, the disadvantages outweighs the advantages.

  • Report Painter - ERP Financials - Question on Value Variable useage

    I want to use a value variable that works in Report Writer (table GLPCT, field MSL [quantity] but cannot select MSL as a variable field in Report Painter to insert the same variable (it is not a selectable characteristic) using the same Library and Table.
    Is there a way to make the field selectable in Report Painter in order to select a value variable that uses the field MSL ?  It is a valid field in the Library that I am building the report in.
    In building the columns, I can select characteristic fields such as:
    Ledger
    Record Type
    Version
    Fiscal Year
    Profit Center
    Functional Area
    Account number
    Period
    etc
    but not MSL Quantity.  Is there configuration to make this (or any field) accessible to Report Painter ?
    Any advice is welcome.....
    Thanks......

    Quantity is a key figure. When you create the column values you would get this from the key figure drop list.

  • DigitalColor Meter - RGB Values Don't Match?

    I've saved a 16 color palette under 'Colors' in the 'TextEdit' application. Each color has been set by directly typing in the values for R, G and B, for example one of the colors is R=68, G=255, B=153.
    If however I open the 'DigitalColor Meter' application, which is set to 'RGB As Actual Value, 8-bit' and move the aperture over the same color in the 'Colors' window the DigitalColor Meter reports the RGB values of that color differently to what was set. For the color mentioned above it reads R=73, G=250, B=151.
    Why don't the two match as they should? This happens with any color, but not black, white or a shade of grey.
    If I save an image from a website by draging the image to the desktop then open the image and use the DigitalColor Meter to compare the RGB values of any given pixel in the saved image to those of the same image displayed on the webpage then again the RGB values between the two will not quite match, but black, white or a shade of grey will.
    If however I save the image to my desktop by using >Apple-shift-4 to grab the image then the RGB values do match.
    Can someone explain exactly what's going on? Does it have something to do with perhaps OS X applying gamma correction to the screen so that any image displayed on the screen will have its RGB values slightly altered?
    If this is the case why isn't the DigitalColor meter affected or does it read a pixel's RGB values directly from graphics memory instead of screen memory where the gamma correction is being applied, not that I know how a Mac's graphics are organized, but I'm assuming anything to be displayed on the screen first has to be fetched from graphics memory.
    Powermac G4 Quicksilver Dual 1 GHz   Mac OS X (10.4.10)   1.5 GB SDRAM, 120 GB HD, 23" Cinema Display
    Powermac G4 Quicksilver Dual 1 GHz   Mac OS X (10.4.10)   1.5 GB SDRAM, 120 GB HD, 23" Cinema Display

    Well this is a day of debugging I'd rather have back.
    With a form of Rubber ducking my colleague helped me notice that the number of items being displaced was equal to the number of page zero item I added recently.
    These items were placed in my menu region, which happens to be region position 7.
    I had commented out a section of my page template
    <!--<header id="uHeader">
      <div class="apex_grid_container clearfix">
        <div class="apex_cols apex_span_12">
          #REGION_POSITION_07#
          <div class="logoBar">
            <h1><a href="#HOME_LINK#" id="uLogo">#LOGO#</a></h1>
            <div class="userBlock">
              <img src="#IMAGE_PREFIX#f_spacer.gif" class="navIcon user" alt="">
              <span>&APP_USER.</span>
              #NAVIGATION_BAR#
            </div>
          </div>
        </div>
      </div>
    </header>-->
    but this content was obviously still being generated.
    At some point during the page submission, this disturbed what apex was doing - somewhere these 'duplicated' yet commented field definitions were causing apex_application.accept to store the values in locations offset by the four P0 items.
    I often look to page zero for potential causes to strange issues - but this one initially beat me.

  • 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();

  • Its illegal to assign a XML value directly to the messageType variable

    I was recently working in JDeveloper 11g (11.1.1.7.0)  on an internal SOA project making some changes in the BPEL and noticed this message: Error(172): its illegal to assign a XML value directly to the messageType variable "InvokeFetchUpdatedUserId_FetchUpdatedUserID_InputVariable" I searched for this error message and didn't find anything.  The message is somewhat explanatory but I thought I would post the fix here just in case.  I modified my assign from the following:                                                                                                                           To this making sure to assign it to the underlying entity.                                                                                                                           Then it compiled just fine. Thanks, Tom

    In case if you are returning multiple value or with multiple columns then you have to use record or cursor to do that operation.
    satyaki>
    satyaki>ed
    Wrote file afiedt.buf
      1  declare
      2       cursor c1
      3       is
      4         select *
      5         from emp;
      6       r1 c1%rowtype;
      7     begin
      8       for r1 in c1
      9       loop
    10         dbms_output.put_line(r1.empno||' - '||r1.ename);
    11       end loop;
    12*   end;
    13  /
    7521 - WARD
    7654 - MARTIN
    7788 - SCOTT
    7839 - KING
    7844 - TURNER
    7876 - ADAMS
    7900 - JAMES
    7902 - FORD
    7934 - MILLER
    7566 - Smith
    7698 - Glen
    1 - boock
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.02
    satyaki>
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Assigning a javascript value to a JSP variable

    How do i assign a javascript value to a JSP variable?
    eg
    <%
    String JSPvar;
    %>
    <script language="JavaScript1.2">
    <!--
    var javascriptVar="hey"
    -->
    </script>
    <%
    JSPvar = javascriptVar ???
    %>

    You do know that the JSP runs on the server and generates HTML, including Javascript, that is executed on the client, don't you?

  • How to Assign a Field value to a Variable??

    Dear All,
    Kindly let me know, if <b>"HOW TO ASSIGN A FIELD VALUE TO A VARIABLE????"</b>
    Situation is, we have a Field (OBJK-TASER) in which 2 tables (SER01 & SER03) are stored. And we want to access names of the Tables which are there in the field(TASER) in  (OBJK) table  to a variable and then passing that variable to the sql query as a table name to get data accessed dynamicaly.

    try this
    select TASER from OBJK into table it_table.
    loop at it_table.
    select field1 field2 from (it_table-table) into table it_fields.
    endloop

  • Jsp:useBean and assigning a value to that bean

    Hello,
    I have a type called Country and I have declared a bean using the "jsp:useBean" syntax.
    I then try to assign a value to that bean in a scriptlet. Eventually I try to retrieve the values using "jsp:getProperty". The problem is that it appears to null.
    Here is the code of the jsp
    <%@ page language="java" %>
    <%@ page import="com.parispano.latinamericaguide.*" %>
    <%
    /* We retrieve the Countries object from the servlet context. */
    ServletContext sc = getServletContext();
    Countries cs = (Countries)sc.getAttribute("countries");
    %>
    <jsp:useBean id="country" class="com.parispano.latinamericaguide.Country"/>
    <%
    /* If the request contains a country id, then we set the variable. */
    country = cs.getCountryFromId(Integer.parseInt(request.getParameter("countryID")));
    %>
    <html>
    <head>
    <title>Country details</title>
    </head>
    <body>
    <table>
    <tr><td>Name</td><td><jsp:getProperty name="country" property="name"/><!-- This is not working--></td></tr>
    <table>
    <%
    out.println(country.getName());//This is working
    %>
    </body>
    </html>This is the code for the bean
    package com.parispano.latinamericaguide;
    * @author Julien Martin
    * Represents a country.
    public class Country implements Comparable {
         private int id;
         private String name;
         private int landArea;
         private String capital;
         private String currency;
         private String flag;
         private String internet_domain;
         private String dialling_code;
         private float literacy;
         private float male_life_expectancy;
         private float female_life_expectancy;
         private String map;
         private int population;
         private int population_year;
         private float birth_rate;
         private int birth_rate_year;
         private float death_rate;
         private int death_rate_year;
         private int gdp;
         private int gdp_per_head;
         private int gdp_year;
         private float unemployment_rate;
         private int unemployment_rate_year;
         public Country() {
         public Country(
              int id,
              String name,
              int landArea,
              String capital,
              String currency,
              String flag,
              String internet_domain,
              String dialling_code,
              float literacy,
              float male_life_expectancy,
              float female_life_expectancy,
              String map,
              int population,
              int population_year,
              float birth_rate,
              int birth_rate_year,
              float death_rate,
              int death_year_rate,
              int gdp,
              int gdp_year,
              float unemployment_rate,
              int unemployment_rate_year) {
              this.id = id;
              this.name = name;
              this.landArea = landArea;
              this.capital = capital;
              this.currency = currency;
              this.flag = flag;
              this.internet_domain = internet_domain;
              this.dialling_code = dialling_code;
              this.literacy = literacy;
              this.male_life_expectancy = male_life_expectancy;
              this.female_life_expectancy = female_life_expectancy;
              this.map = map;
              this.population = population;
              this.population_year = population_year;
              this.birth_rate = birth_rate;
              this.birth_rate_year = birth_rate_year;
              this.death_rate = death_rate;
              this.death_rate_year = death_year_rate;
              this.gdp = gdp;
              this.gdp_year = gdp_year;
              this.unemployment_rate = unemployment_rate;
              this.unemployment_rate_year = unemployment_rate_year;
         public float getBirth_rate() {
              return birth_rate;
         public int getBirth_rate_year() {
              return birth_rate_year;
         public String getCapital() {
              return capital;
         public String getCurrency() {
              return currency;
         public float getDeath_rate() {
              return death_rate;
         public int getDeath_rate_year() {
              return death_rate_year;
         public String getDialling_code() {
              return dialling_code;
         public float getFemale_life_expectancy() {
              return female_life_expectancy;
         public String getFlag() {
              return flag;
         public int getGdp() {
              return gdp;
         public int getGdp_per_head() {
              return gdp / population;
         public int getGdp_year() {
              return gdp_year;
         public int getId() {
              return id;
         public String getInternet_domain() {
              return internet_domain;
         public float getLiteracy() {
              return literacy;
         public float getMale_life_expectancy() {
              return male_life_expectancy;
         public String getMap() {
              return map;
         public String getName() {
              return name;
         public int getPopulation() {
              return population;
         public int getPopulation_year() {
              return population_year;
         public int getLandArea() {
              return landArea;
         public float getUnemployment_rate() {
              return unemployment_rate;
         public int getUnemployment_rate_year() {
              return unemployment_rate_year;
         public void setBirth_rate(float f) {
              birth_rate = f;
         public void setBirth_rate_year(int i) {
              birth_rate_year = i;
         public void setCapital(String string) {
              capital = string;
         public void setCurrency(String string) {
              currency = string;
         public void setDeath_rate(float f) {
              death_rate = f;
         public void setDeath_rate_year(int i) {
              death_rate_year = i;
         public void setDialling_code(String string) {
              dialling_code = string;
         public void setFemale_life_expectancy(float f) {
              female_life_expectancy = f;
         public void setFlag(String string) {
              flag = string;
         public void setGdp(int i) {
              gdp = i;
         public void setGdp_per_head(int i) {
              gdp_per_head = gdp/population;
         public void setGdp_year(int i) {
              gdp_year = i;
         public void setId(int i) {
              id = i;
         public void setInternet_domain(String string) {
              internet_domain = string;
         public void setLiteracy(float f) {
              literacy = f;
         public void setMale_life_expectancy(float f) {
              male_life_expectancy = f;
         public void setMap(String string) {
              map = string;
         public void setName(String string) {
              name = string;
         public void setPopulation(int i) {
              population = i;
         public void setPopulation_year(int i) {
              population_year = i;
         public void setlandArea(int i) {
              landArea = i;
         public void setUnemployement_rate(float f) {
              unemployment_rate = f;
         public void setUnemployment_rate_year(int i) {
              unemployment_rate_year = i;
         public String toString() {
              return name;
         public int compareTo(Object o) {
              Country c = (Country)o;
              int cmp = name.compareTo(c.name);
              System.out.println(cmp);
              return cmp;
    }Can anyone please help?
    Thanks in advance,
    Julien.

    Thanks,
    I have added scope="application". It still show "null" indicating that the bean is not initialized with the properties. I would like a quicker way to initialize a bean property than invoking the setProperty tag for each property.
    Here is a simple example that demonstrates the problem:
    <%@ page language="java" %>
    <%@ page import="com.tests.*" %>
    <jsp:useBean id="monBean" class="com.tests.MonBean" scope="application"/>
    <%
    MonBean mb = new MonBean();
    mb.setName("toto");
    monBean= mb;
    %>
    <html>
    <head>
    <title>Lomboz JSP</title>
    </head>
    <body bgcolor="#FFFFFF">
    <jsp:getProperty name="monBean" property="name"/>
    </body>
    </html>And the bean
    package com.tests;
    public class MonBean {
    private String name;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    }This show "null".
    Any other idea why this is not working?
    Thanks,
    Julien

  • Doubt about  a null value assigned to a String variable

    Hi,
    I have a doubt about a behavior when assigning a null value to a string variable and then seeing the output, the code is the next one:
    public static void main(String[] args) {
            String total = null;
            System.out.println(total);
            total = total+"one";
            System.out.println(total);
    }the doubt comes when i see the output, the output i get is this:
    null
    nulloneA variable with null value means it does not contains a reference to an object in memory, so the question is why the null is printed when i concatenate the total variable which has a null value with the string "one".
    Is the null value converted to string ??
    Please clarify
    Regards and thanks!
    Carlos

    null is a keyword to inform compiler that the reference contain nothingNo. 'null' is not a keyword, it is a literal. Beyond that the compiler doesn't care. It has a runtime value as well.
    total contains null value means it does not have memory,No, it means it refers to nothing, as opposed to referring to an object.
    for representation purpose it contain "null"No. println(String) has special behaviour if the argument is null. This is documented and has already been described above. Your handwaving about 'for representation purpose' is meaningless. The compiler and the JVM don't know the purpose of the code.
    e.g. this keyword shows a hash value instead of memory addressNo it doesn't: it depends entirely on the actual class of the object referred to by 'this', and specifically what its toString() method does.
    similarly "total" maps null as a literal.Completely meaningless. "total" doesn't 'map' anything, it is just a literal. The behaviour you describe is a property of the string concatenation operator, not of string literals.
    I hope you can understand this.Nobody could understand it. It is compete nonsense. The correct answer has already been given. Please read the thread before you contribute.

  • How to change the text color of a label by using RGB values without changing the background colour?

    xCode interface builder:
    When I try to change the color property of a label's text by using the RGB values, the background color also changes to the same value automatically.
    in other words:
    While setting the RGB values for text colour of labels, the background colour also changes unless we use the sliders.
    How to make sure that only the color of text changes and not the background?

    You can simply do this.
        [labelname setTextColor:[UIColor colorWithRed:38/255.0f green:171/255.0f blue:226/255.0f alpha:1.0f]];

  • Is it possible to store a field name in a variable, then assign it a value?

    Good day, everyone!
    I am working on a program in which there are many different amount fields in which an amount may be assigned.  For reusability purposes, I was wondering if it would be possible to write a routine that identifies the target amount field, stores it in a variable that is passed back to the calling program, and then assigns a value to it.  There may be different structures having the same field name; what I'm trying to do is avoid having to code a huge IF or CASE statement for each structure.  For example:
    Structures S1, S2, and S3 have some fields identically named.  Call one of them F1.
    What I'd like to do is call a routine that identifies "F1" as my target field to populate.  Then, upon return, I can assign it to the desired structure.  Kinda like this:
    S1-fieldname = 24.17.  (but fieldname isn't a true field in the structure -- it would hold the value of the true field, "F1").
    I realize this might not even be possible, but given how talented the folks are on this forum, I thought I should at least pose the question.
    As always, points given for all helpful answers, and thank you!!
    Dave

    Ok.  I gave that a shot, but what happens is that my ASSIGN COMPONENT statement doesn't work.  It gets a sy-subrc of 4, and <column> remains unassigned.  The program then abends on the line to assign <a1>-trbtr's value to the field because of <column> being unassigned.
      DATA:
        w_setname         TYPE setleaf-setname,
        w_column_name(20) TYPE c.
        ASSIGN COMPONENT w_column_name OF STRUCTURE wa_expense_ng_report
                      TO <column>.
        <column> = <a1>-trbtr.
    Any thoughts on what I might be doing wrong?

  • Preview changes RGB values when resizing images

    Since I upgraded to snow leopard, preview increases the Red spectrum when resizing images (png). Is this a bug or do I need to change a setting to preserve the original RGB values?

    Figured it out. It seems that when you don't specify the BufferedImage that the operation will write too it changes the type to something it uses for the operation. This still seems like it should be a bug to me, but i got around it by doing this:
    BufferedImage tempIMG = new BufferedImage((int)(srcImg.getWidth()*scale),(int)(srcImg.getHeight()*scale),srcImg.getType());
    op.filter(srcImg, tempIMG);
    return tempIMG.

  • I want to set a variable with default value and can be changed by the user

    hi,
    i want to set a variable with default value and can be changed by the user, so i new a variable with setting : customer exit, single value, optional, ready for input.
    in my customer exit code, i set a default value, eg. 20070530
    when the variable screen popup, it display the default value 20070530, i changed it to 20070529, but it doesn't work , it still display the data in 20070530, how can i solve this problem? 
    your help is appreciated.

    Liu,
       As mentioned by Anil, you need to restrict your customerr Exit code to I_STEP = 1.
    or.
       <u>Open your Variable in change mode, in the Last Page os the Variable Maintenance you can provide default value. Note: you are doing same thing in Customer Exit. In your case no need of Customer Exit.</u>
    Nagesh Ganisetti.
    Assign points if it helps.

Maybe you are looking for

  • How to change Availability check (MTVFP) in sales order

    Hi, is it possible to change the Availability check on an material in an sales order? Some material have the value KP (no check) of Availability check in table MARC. If we use this material in sales orders somtimes we want change the Availability che

  • Return Process- ASAP please

    Hello gurus There is an issue here about the returns i have couple questions. Plant basically does make to order scenario, 1. Is the material valuated and shows up in G/L account, when we bring in material through RE process. 2. Legacy system as some

  • Approver cannot approve account though he has enough amount.

    Hello SAP-FI Gurus, I have this issue that has something to do with the Approver being not able to approve an amount in the PO posted. The PO posted has this IR(Invoice) which has a G/L account of 6-digit number.  Determining the expense type helps u

  • (crud) stored procedures generator script

    Hi, I am wondering if somebody can help me. I need an oracle sql script that create a package with stored procedures for the basic CRUD (Create, Read, Update, Delete) operations for each table in my database. For example: Table EMP When the sql scrip

  • Can't open I tunes 10 because Quick time error -2096

    Hello Dear Apple users, it now about a day that I tried to install and unistall all itunes and Quick time and I delete the Temp directory in the AppData directory and restart, the same in the support area, but the error -2096 showed is the same. I ca