Colors in a specific region in an image

hi all;
i have an image and a list of 4 RGB colors.
i need to check a specific region of the image (a small sub-image) to see if it contains any of the 4 colors i have.
what my best option here?
any help would be great.
thanks in advance.

This can be easily done with a StringBuffer:StringBuffer sb = new StringBuffer("leone24");
sb.replace(5,7,"31");
String newString = sb.toString();

Similar Messages

  • Drawing Over Transparent Region of SplashScreen Image

    Has anyone been successful trying to paint over a transparent region of an image using the Java 6 SplashScreen ?
    I've got a PNG with a transparent background as my SplashScreen image, and I would like to paint over part of the transparent area. Whatever I try, I can't seem to accomplish it. I've played around with the Graphics2D setComposite and setClip, but I'm not having any luck. It paints over the non-transparent area, but not the transparent area. It's like there is a clip region for the image that I cannot seem to undo.
    Anyone have any suggestions?

    To expand on the problem, I tried doing the same thing just in a panel, like so:
    public class SplashTest {
         public static final File IMAGE_FILE = new File("SplashTest.png");
         public static void main(String[] args) {
              SplashScreen splashScreen = SplashScreen.getSplashScreen();
              Graphics2D g2d = splashScreen.createGraphics();
              g2d.setColor(Color.RED);
              g2d.fillRect(0, 200, 300, 100);     // draw red rectangle across bottom
              g2d.dispose();
              splashScreen.update();
              try {
                   Thread.sleep(3000);     // show splash for 3 seconds before exiting
              } catch (Exception e) {
                   e.printStackTrace();
              splashScreen.close();
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             JFrame frame = new JFrame("Try it again");
                             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                             final BufferedImage image = ImageIO.read(IMAGE_FILE);
                             Graphics2D g2d = image.createGraphics();
                             g2d.setColor(Color.RED);
                             g2d.fillRect(0, 200, 300, 100);     // draw red rectangle across bottom
                             g2d.dispose();                         
                             JPanel panel = new JPanel() {
                                  @Override
                                  protected void paintComponent(Graphics g) {
                                       super.paintComponent(g);
                                       g.drawImage(image, 0, 0, this);
                             frame.setContentPane(panel);
                             frame.setSize(300, 300);
                             frame.setLocationRelativeTo(null);
                             frame.setVisible(true);
                        } catch (IOException ioe) {
                             ioe.printStackTrace();
    }The rectangle shows up completely in the JPanel, which suggests the problem is somehow specific to the SplashScreen. For now I'm just going to edit the image so I'm not trying to paint over any transparent regions. But if anyone can shed any light on this, please do. :-)
    Edited by: Skotty on Jul 26, 2010 10:17 PM

  • How do you tell the color value of a pixel in an image data

    Hi,
    Given a BufferedImage of type, say BufferedImage.TYPE_4BYTE_ABGR, how do you tell the color value of a pixel in the image?
    Specifically, in the following code:
    Raster imgData = image.getData();
    int x = imgData.getMinX();
    int y = imgData.getMinY();
    int width = imgData.getWidth();
    int height = imgData.getHeight();
    I want to search the raster looking for a specific color, e.g., Color.WHITE.
    According to the API, "getSample()" may be used for this purpose. But, how do you know which color band a band index parameter in getSample() refers to? Does band index of 0 always refer to the RED band? Does band index of 1 refer to the GREEN band? etc.
    I'd greatly appreciate any help you may be able to provide.
    Thanks,
    --HS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    In the print dialog underneath the settings for number of copies and print range you should see a dropdown menu probably called Layout. If you don't see that look for a button labeled Details and click it.
    Under the Layout menu you should find an option labeled Printer where you will find Printer specific options. Look for something there. You might also find an option called Color which may have options you are looking for.
    If this doesn't help, go to the printer manufacturer's website and look for answers there.

  • Coloring of a (specific) row in ALV report-How?

    Hi Experts,
    Am looking to assign a color for a (specific)row in ALV report.......so, pls. let me know How to get it done?
    thanq

    TABLES:LFA1.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    SORTL LIKE LFA1-SORTL,
    CFIELD(4) TYPE C,
    END OF ITAB.
    data:col(4).
    data:num value '1'.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    LOOP AT ITAB.
    concatenate 'C' num '10' into col .
    ITAB-CFIELD = col.
    num = num + 1.
    if num = '8'.
    num = '1'.
    endif.
    MODIFY ITAB.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
    LAYOUT-EDIT = 'X'.
    LAYOUT-info_fieldname = 'CFIELD'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    this is for coloring cols
    REPORT ZBHCOLOR_COLS.
    TABLES:LFA1.
    SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
    PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
    GRID RADIOBUTTON GROUP ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    SORTL LIKE LFA1-SORTL,
    REGIO LIKE LFA1-REGIO,
    COL TYPE LVC_T_SCOL,
    END OF ITAB.
    DATA:COLR TYPE LVC_S_SCOL.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB.
    IF ITAB-LIFNR IN C_LIFNR.
    COLR-FNAME = 'NAME1'.
    COLR-COLOR-COL = '5'.
    COLR-COLOR-INT = '1'.
    COLR-COLOR-INV = '0'.
    COLR-NOKEYCOL = 'X'.
    APPEND COLR TO ITAB-COL.
    COLR-FNAME = 'LIFNR'.
    APPEND COLR TO ITAB-COL.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-ZEBRA = 'X'.
    layout-coltab_fieldname = 'COL'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    IF LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ELSEIF GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ENDIF.
    Reward points if useful.

  • What values are stored in the alignment region of an image and how can they be set?

    I am calling a number of C++ functions with different variable sized LabView images at rates in excess of 20 images per second. I need to tell the C++ code developer what values to expect in the alignment region of the image. Right now I am creating an image with a zero border that is 32 byte aligned, so there is no alignment region and everything works fine.
    I would like to move to using normal LabView images, as it saves sereval steps and allows me to use a combination of LabView and C++ operations. I do not want to re-write all the C++ functions to be aware of the LabView alignment and border areas. I just want the alignment area and border area to be zero and process them like they were part of the image.
    I can set the border region to zero using Fill Image but I am not clear as to what the values will be in the alignment region, or if I can set them. Does Fill Image also fill the alignment region? Since the C++ code is being developed on a system without LabView, and I do not have the means to debug it on my LabView system, it is tricky to know what is in this region.
    In the ideal world, I would like it to be zero or to be able to set it to zero.
    Thanks in advance.
    Andrew

    Hi Andrew,
    The function IMAQ Fill Image allows you to set the border and all or part of your image to a certain pixel value that you define. One of the inputs to Fill Image is "Image Mask" which you can use to specify which pixels in your original image will be modified. This help document describes the Fill Image VI in detail and can provide some good information for you.
    Essentially, the locations of any non-zero pixels in your Image Mask are where the new pixel value will be set in your original Image. Does that make sense? So if you know where your alignment region is then you can use an image mask with Fill Image to set the alignment region and the border to zero. If you don't use an Image Mask, the Fill Image VI will assign the new pixel value to the entire original image. 
    Regards,
    Daniel H.
    Customer Education Product Support Engineer
    National Instruments
    Certified LabVIEW Developer

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • Jump to specific region on a page

    I have a page with multiple (10+) sql report regions. What I’m looking to do is let users select one of the regions from a list thereby jumping (moving focus) to that specific region on the page.
    If possible I’d like to do this without submitting the page again.
    If anyone has tips or has seen a thread with this answered already, please let me know.
    Thank you

    Give each report region a unique ID using the region's Static ID property, for example emp-report.
    These can be referenced as fragment identifiers in URLs:
    <a href="#emp-report" title="Go to Employee report on this page">Employees</a>
    Re: Lists that go to items.

  • How can I save a region of an image into another image?

    How can I save a region of an image into another image? Should I use JAI?
    Java2d? Is there an example?
    Thank you.

    Here is what I try, but I find out I just get a black square for my output image, can you please tell me what am I missing?
              ImageIcon file=new ImageIcon("images/clouds.jpg"); // You can't open bmp files
                   // width, height looks correct:
                   System.out.println (" width" + file.getIconWidth());
                   System.out.println (" height" + file.getIconHeight());
                   BufferedImage bi = new BufferedImage(file.getIconWidth(), file.getIconHeight(),
                   BufferedImage.TYPE_INT_RGB);
                   int x = 0;
                   int y = 0;
                   BufferedImage subimage = bi.getSubimage(x, y, 40, 40);
                   File outputFile = new File("newimage.png");
                   ImageIO.write(subimage, "png", outputFile);

  • Find a region in an image

    hi everybody
    i need to find a red region in an image . but i don't have any idea to do this as fast as possible . can u give any advices. i just need to find the beginning and the ending points of a red painted region in an image (there is only one red region)
    thanks

    i wanted to mean the "fastest method" while writing " as fast as" :)

  • How to extract the license plate region from the image of cars

    HI, I want to extract the license plate region from the image of cars with vision assistant. I try to adjust the threshold value, remove small objects. But i still cannot get the perfect license plate region. I have attached 4 images that i am working now. I hope someone can help me to extract that region. Really thanks.
    Attachments:
    IMG_2029.JPG ‏150 KB
    IMG_2031.JPG ‏155 KB
    IMG_2089.JPG ‏130 KB

    Hi, I have attached my extrated images.. Please check them...
    Attachments:
    35.PNG ‏17 KB
    36.PNG ‏12 KB
    37.PNG ‏13 KB

  • Button target to a specific region

    Hello again,
    i want to load an apex-page in an specific region after pressing a button.
    My first attempt was to create a dynamic action which will set the value of a "Display Only"-Item using $s(':ITEM', "bla").
    It appears to be very tricky to display a apex site in a specific region isn't it?
    Do you have any clue about this?

    Sounds like you want to use an iframe?
    See Paul's example here
    http://apex.oracle.com/pls/apex/f?p=34839:IFRAME

  • Getting specific area of an image

    Is there away to display a specific area of an image?i have an image icon that uses a jpeg,but i do not want it to use the whole image for the icon.i know that imagebuffer has the method getsubimage but does imageicon have something similar?How can i do this?

    rogerio7 wrote:
    Is there away to display a specific area of an image?i have an image icon that uses a jpeg,but i do not want it to use the whole image for the icon.i know that imagebuffer has the method getsubimage but does imageicon have something similar?How can i do this?Not that I've seen, but you can always render that onto a BufferedImage which does...
    BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    bi.getGraphics().drawImage(myImageIcon.getImage(), 0, 0, null);Now you can do pretty much what ever you want with it.

  • My RGB colors are turning to cmyk while bringing image from illustrator or photoshop. Why?  Removing the image from that page bright RGB colors are back.. hmm

    My RGB colors are turning to cmyk while bringing image from illustrator or photoshop. Why? 
    Removing the image from that page bright RGB colors are back.. hmm

    Edit > Transparency Blend Space > Document RGB

  • Incorrect colors after importing a Canon XTI RAW image into LR

    I've been using LR for about a week now and love it. However, it does a poorer job of rendering RAW images (and therefore also exporting to JPG) than Canon's Digital Photo Professional. LR image have a sickly yellow+green for skin tones vs. Canon's images, which are more Red.
    I've tried every combination of compensating for this by twiddling with white-balance settings, Hue, Saturation etc. but have been unsuccessful in getting the images to look as gorgeous as Canon's Digital Photo Pro does out-of-the-box. That's, of course, extremely frustrating since I like LR's features so much better. Help! Has anyone solved this? I've seen similar postings on various web sites (eg. www.dpreview.com), but no one seems to have a solution yet!
    Thanks.

    Yes, I've tried various suggested solutions in this forum and others. The problem is that so far they have all been one-of solutions. ie. if I spend about 30+ mins on a given picture, I can make it look like what Canon's Digital Photo Professional does right off the bat. Additionally, the presets that I've seen recommend only seem to work for a given lighting condition. When the light is even slightly different, the resulting preset processed LR image ends up over-corrected or generally looking unappealing.
    Here is an example that shows I'm still struggling with this issue. Here are examples of pictures: http://public.fotki.com/eshwars/lr-issues/ All I did to get the JPG image was the following:
    1. Opened the CR2 file in DPP, "Convert and Save" with Image Quality=10, Output Resolution=350 dpi. Output image is named: DPP_20070408_4038.JPG
    2. Imported and opened the very same CR2 file in LR. Used "Export Photos" to JPG. Image quality=100, Color space=sRGB, Resolution=350dpi. Output image is named: LR_20070408_4038.jpg
    3. I tried "compensating" for LR based on suggestion in another forum by modifying the Camera Calibration settings in LR. Hue=-40, Saturation=+10. I've tried other values as well, but it just doesn't look as good as DPP does by default. Output image is named: LR_20070408_4038_compensated.jpg
    I would greatly appreciate some pointers that does not require me to custom-fixup every image.
    The editing capabilities of LR are wonderful (!), but if the end-result simply looks not-so-pleasing for Canon RAW images, it simply wouldn't be practical to use for Canon users. :(

  • HELP !  why doesn't color picker select specific color ? i make secondary layer and use the tool but no colors are selected and the gray out menu shows nothing !

    HELP !  why doesn't color picker select specific color ? i make secondary layer and use the tool but no colors are selected and the gray out menu shows nothing !
    what am i missing ??!!

    Please add you system info and SpeedGrade version and build number if you actually want help.

Maybe you are looking for

  • Query Print Layout - Generated PDF Document Name?

    Hi All, Query Print Layouts associated to my user queries work great for printing...but does anyone know if there is a way to set a more appropriate document file name when attaching an edited PDF report to an email? It seems to always automatically

  • How to get a report in pdf format.

    Hi Experts, Could any one let me know that, how to get the report in PDF format. Once a report is generated it should be displayed in pdf format or downloaded in pdf format. Thanks in Advance, Regards, Irfan Hussain

  • Status of the transfer orders

    i have a delivery document if i see the document flow of that delivery document i found there are 4 WMS Transfer orders in that 4 transfer orders 2 are with status completed and 2 are with status open i am an ABAPER in my report i need only transfer

  • Can't connect to itunes player from my browser

    I downloaded the win7 64 bit ver. of itunes player which works fine. However when I follow a link from an itunes university podcast from my firefox browser to be played on my computer I keep getting a must load itunes player page. As I stated I can u

  • Fiscal period text

    Hi All, in our bw sysytem the fiscal period text is not displaying correctly.i.e for period 11.2006 it is displaying as feb 2006.it should display feb 2007.  my fiscal variant is V3. can any body help me. Regards, sekhar