How to get pixel colour?

Is there any way to get pixel colour from specified point? Example: colour = image.getPixel(x, y);
J2ME/MIDP 1.0
Thanks!

{color:#800000}*I am happy to compare the two pixels of same image using this code in Java:*
{color}
Image ori, nw;
public void init()
{ ori = getImage(getDocumentBase(),"flower.jpg");
int pxl[]= new int [65536];
PixelGrabber pg = new PixelGrabber(ori,0,0,256,256,pxl,0,256);
// Image is stored into Array
try{ pg.grabPixels(); }
catch(InterruptedException e) {}
for(int i=0;i<65536;i++)
{ int p = pxl[i];
int ri = (0xff & (p>>16));
int gi = (0xff & (p>>8));
int bi = (0xff & p); // Take the RGB value of each pixel
for(int j=0;j<255;j++) // Chk. other similar pixel in color range of 0 to 255
int q = pxl[j];
int rj = (0xff & (q>>16));
int gj = (0xff & (q>>8));
int bj = (0xff & q);
if ( (ri==rj)&&(gi==gj)&&(bi==bj)&&(!(i==j)))
{ ri+=70;//if (ri<0) ri = 0;
gi+=70;//if (gi<0) gi = 0;
bi+=70;//if (bi<0) bi = 0;
pxl[i] = ( 0xff000000|ri<<16|gi<<8|bi); // Change value
else
pxl[i] = ( 0xff000000|ri<<16|gi<<8|bi);// Keep as it is
Email : [email protected], Profile: www.aribas.edu.in/Mr.Brijesh_Jajal.htm

Similar Messages

  • How to get a coloured bar at the edge of a video

    Hi,
    I have a very funny few minutes of video of a family event that I am using for the closing moments of home movie. Unfortunately, my idiot cousin is in the background "flicking the bird to the camera" the entire time. Fortunately, she is near the edge of the screen so I have an idea how to "remove" her but I do not know how to do it.
    My idea is to to put a black (or any colour, really) bar across the edge of the screen and I can have the credits appear there.
    However, I do not know how to get a coloured bar to appear over part of a video.
    Can anybody help?
    Regards

    NeddySeagoon wrote:
    .. My idea is to to put a black (or any colour, really) bar across the edge of the screen and I can have the credits appear there.
    Can anybody help?
    why not cropping the video.. ?
    • click on clip
    • click on crop-tool
    • crop/Zoom-in .. => cousin gone, away, digital nirvana ..

  • How to get more colour for my solaris 8

    Hi All
    Before I used Solaris 8 for my PC with video card ATI Rage 3D Xpert 98. It only supports 1024X768X256 Colour. Now I changed my video card to ATI Rage 128 pro, but I still get 256 Colour. I checked HCL list, this card should support true colour. when I want to change more colour with kdmconfig, But I failed. Anyone can help.
    Thanks
    Jaff

    Hi vamsimandru,
    Take a look at this document to see if it helps you resolve your issue.
    Thanks,
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Need help!-----How to get pixel from pixel location??

    Hi, I have the location of a pixel (x, y), how to get the pixel value which will be used in DirectColorModel cm.getRGB(int pixel)?
    thanks a lot!!!

    Hi, my image is created by Toolkit.createImage(byte[]). I think I should use PixelGrabber to grab all pixels value to int[], use location(x,y) to get pixel index(y*width+x), then use ColorModel.getRGB(int pixelIndex) to get the rgb value at that location, right? is there any other way to do it?
    thank you.

  • How to get consistent colour prints from different Macs?

    Hello Forum,
    we are unable to get consistent colour prints from the various Macs in our office. There is only one printer, and for the sake of this discussion only one PDF file to be printed. The Macs have various OSes, from 10.4.11 up to 10.9.5; most are Minis of one vintage or another.
    The printed results *should* IMHO be identical no matter which computer issues the "print" command, but they are far from that. Some computers print with a reddish tint, others with too little saturation or too much brightness (to put it in Photoshop terms).
    What exactly must we do to get identical results no matter which computer does the printing?
    Thanks in advance
    John
    p.s. May I just say what a ridiculous pain in the neck it is to have to choose from that list of purchasable Apple products aka communities? Some questions, like this one, do not belong in a single community or at least there is no community whose title describes our problem. I am uneasy filing it under "Mac Mini" because there is absolutely no reason to believe that the problem is a misbehaviour of *one* of our Minis. In the old days, when help was geared to users rather than to pushing the sale of further Apple products, there used to be forums with titles like "Printing problems".

    Thanks for the suggest, which didn't solve the problem — because it wasn't a Mac problem at all. Acrobat Reader was getting the colours wrong! Setting "Print as image" in the Print dialog extensions solved it.
    Resolved, case closed.

  • How to get at Colour drop down box for simple shape ?

    Hi,
    If I go new file, Insert Symbol, Movie Clip, then draw a
    circle and a line using those two tools, I am unable to get the
    colour drop down box to show so that I can select Alpha. I have
    managed to do this many times for an imported to library graphic
    from Freehand, one simply clicks on the graphics line after the
    graphic has been drag/dropped to stage, go properties and the
    Colour drop down list from where you select the word Alpha appears.
    I have tried a single click, a double click, a treble click,
    just cant see that dropdown box for simple shapes !
    Help
    Envirographics

    Hi,
    If I go new file, Insert Symbol, Movie Clip, then draw a
    circle and a line using those two tools, I am unable to get the
    colour drop down box to show so that I can select Alpha. I have
    managed to do this many times for an imported to library graphic
    from Freehand, one simply clicks on the graphics line after the
    graphic has been drag/dropped to stage, go properties and the
    Colour drop down list from where you select the word Alpha appears.
    I have tried a single click, a double click, a treble click,
    just cant see that dropdown box for simple shapes !
    Help
    Envirographics

  • How to get pixel data in the format I want

    I'm writing a format plug-in and am having some difficulty getting the pixel data from photoshop in the format I want. From what I gather from the documentation in the SDK I need to specify the following to tell photoshop what format to deliver my pixels in:
    theRect
    loPlane
    hiPlane
    data
    colBytes
    rowBytes
    planeBytes
    planeMap
    I specify all of these appropriately for a 32 bit rgba8888 uncompresssed image and it works just fine... but ONLY if the image I load in the first place matches the format I am requesting. If the image I load is some other format, like a 256 color image with a palette, gFormatRecord->advanceState() just fails with a nebulous -30500 error code (formatBadParameters) instead of delivering pixel data.
    So my big question is this: Is Photoshop capable of doing the conversion and delivering the pixels to my format plug-in in my requested format? If it CAN do it, what might I be doing wrong? Please help! Thanks!!

    You noticed you can use the planeMap[] array to permute the channels. It's not so obvious that Photoshop should offer generalised bit depth/colour space/palette processing. It can be argued that's the role of the plugin itself: to mediate between Photoshop's native image data (which it does offer conveniently) and whatever arbitrary image format the user requires. At least, that's what most of
    my plugins do.
    Sure, there are a few obvious conversions, but you have to stop somewhere... Sooner or later you'll be implementing stuff on the Photoshop side that
    should be in a plugin. I don't have a big problem with the line drawn in the current API.

  • How to get the colour of a line depending on the attribute of first charact

    Hi
    I am using DefaultStyledDocument in JTextPane.the function is depending on the frirst character of the line the whole line should be of one colour.for example if i tye the first character as '\' the whole line following this character must be green .Can anyone suggest me how to do it

    Hi,
    Simple example below:
    Suppose you have this method in AppmoduleImpl:
    public void testHello( ) {
    return "Hello";
    1.After you expose this to clientInterface,drop this method on the jspx page as ADF Parameter
    form
    2.Drop the return String as outputText
    3.Run the page,click on the commandButton & the outputText returns 'Hello'
    Regards,
    Shantala

  • How to get pixel positions with IMAQ Vision for CVI

    Hi,
    I am trying to connect a callback to an IMAQ window that contains an image that I generated. The purpose simply to get the coordinates of the mouse for every left_click event on that IMAQ window.
    How can I do this by using the function
    imaqGetPixelAddress(); and using a callback associated to the IMAQ window.
    Is there an example code to help doing this in LW-CVI?
    Many thanks,
    JHH

    Hello,
    You can do this by calling the imaqGetLastEvent() function with IMAQ_CLICK_EVENT as the tool parameter.
    Hope this helps!
    Yusuf C.
    Applications Engineering
    National Instruments

  • How to get background colour in smartform

    hi ,
    i have developed one smartform with table i want heading means header part of the table in colour full please help me for that.....
    thanks ...

    First select the line type of the table. then click on shading. select the desired colour.
    save check and activate and run ur smartforms.
    hope ur problem solved.
    Regards,
    shiva

  • How to get more than 4 coloured rows in a report depending on column values

    Hi,
    I've looked through the forum and found some stuff on mutli-coloured reports and found the link to http://htmldb.oracle.com/pls/otn/f?p=11933:7:557008579481721819
    But I have several problems:
    This shows how to get 3 colours, but it's easy to get up to 4 by just using the "Column Templates" in a new report template.
    I don't understand where to put the snippets. It says to put them in "Row Templates" , "Before Rows" and "After Rows" but my report template page doesn't have these options! I've got "Column Templates" (4 of them), "Before Each Row" and "After Each Row".
    Am I looking at a link for an old version?
    What I want to do is set the row colour dependant on a column called "level" which is between 1 and 5.
    Thanks

    Hi Vikas,
    It's almost perfect now. My only problem is that the pagination table is, for some reason, enclosed within the results table (I've used FireFox web developer's tools and checked the souce HTML to be sure of this). So, if I have a border at table level, it appears on the row containing the pagination.
    I've had to remove table borders and put right borders on the table data cells, but I can't find a way to put left borders on the table rows, so I have a pretty table with 5 levels of colour, but no borders on the left-hand side.
    Ideally I'd like to avoid having the pagination stuff within the results table, but I can't see how/where to put a </table> to sort this out!
    Ros

  • How to get Length in pixel of a String in j2ee??

    Hi guys, im having a problem trying to find out how to get pixels from a string length, but in j2ee, i've researched, but everyone said to use Graphics2D, but since im using j2ee, i dont know how to use this.
    For example i found this piece of code, but this doesnt work for me:
    public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    Font font = new Font("Serif", Font.PLAIN, 12);
    FontMetrics fontMetrics = g2d.getFontMetrics();
    int width = fontMetrics.stringWidth("aString");
    int height = fontMetrics.getHeight();
    How to get g2d, if i dont have a graphics to send it to the method??
    I would be really happy if anyone could send me a example using a javabean.
    How to do this guys???? please help me with this guys,thanks.
    yellr

    im working on a good explanation for this question, im trying to send pics of my programso you understand me pretty well. But a general idea, its im creating dynamically components, like labels, textFields, dropDowns, etc. My problem comes when im adding to form the labels, these labels are going to show the descripcion of the component, which it could be a textField, dropDown, textArea etc.
    I put all these components on a gridPanel, for each row i can have severals componets,
    I have a gridPanelGeneral which have all other gridPanels, this gridPanelGeneral have gridPanelRow+"numRow"
    This gridPanelRow+"numRow" can have severals components which show like columns.
    Sincerely i would like to put pictures of the program, so that way you will understand my problem, i need to set the label.setStyle(width:"+numPixelesOfDescriptionOfComponent+"px). To put these labels well, because the user cant see very well the description of the component when i have severals components, each component does have a label for its description. descriptionOfComponent is a string thats why i need to get the pixels of the string.
    One question, how do i do put pics on this forum??
    Edited by: yellr on Oct 30, 2007 9:56 AM

  • How to get the pixel data so as to work on it?

    Hi all,
    I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?
    Assumption: No layers i.e., only background
    Thanks in advance,
    Sailu

    Hi Ilya,
    Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
    Matthew Hollingworth, "ADM Color Managed Preview?" #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.
    Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.
    Thank you all for your help
    Cheers,
    Chaker

  • Convert colour images to grayscale images & get pixel data from them

    Is the code below correct to convert colour images to grayscale images in Java?
    public void convertToGrayscale (String sourceName,String destName) throws Exception {
    JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(new FileInputStream(sourceName));
    JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(new FileOutputStream(destName));
    BufferedImage sourceImg=decoder.decodeAsBufferedImage();
    BufferedImageOp op =new ColorConvertOp(
              ColorSpace.getInstance(ColorSpace.CS_GRAY),null);
         BufferedImage destImg = op.filter(sourceImg,null);
    encoder.encode(destImg);
    decoder = null;
    encoder = null;
    When I get grayscale images from the code below, I would like to access the pixels of those images. So I tried to do:
    byte[] dd=((DataBufferByte)mImage.getRaster().getDataBuffer()).getData();
    BUT the data result array is not 0-255. Could anyone suggest how to obtain pixel data from grayscale images?
    In case that my code shown is not correct or suitable, please give your advice. What I would like to do are in the steps as follows:
    1 change 100*70 jpeg-images to 100*70 grayscale images.
    2 create two dimensional array of pixel data (example [100][70]) from converted images. The number in the array should be between 0-255, right??? And 0 refers to black colour and 255 refers to white colour???
    I am confused about grayscale images. Please help.
    Thank you so much

    I am not sure i understand what is the problem exactly.
    Structure of DataBuffer is described by SampleModel used by same Raster
    object. E.g. it might be 1 byte per xipex or 4 bytes per pixel.
    In your example convertToGrayscale saves images to file as JPEG and
    it seems you later read it back. It is possible what image you read back
    is not greyscale but ARGB and data buffer has different format.
    Technically, if you just need level of grey you may simply
    call getRGB on your output image. Grey is uniform mix of R, G and B.
    Also, instead of ColorConverOp you may dimply create output image of
    grayscale type and draw your color input image with drawImage().
    If none of these helps please try to provide more details.

  • The screen on my MacBook has been flickering and shaking up and down. It starts flickering, shaking, gets 'pixelated,' then eventually begins to fade to white and freezes. Restarting sometimes helps, but only temporarily. Why is this? How can I fix it?

    The screen on my MacBook has just started flickering and shaking up and down while I am using it. The screen starts flickering, shaking, gets pixelated, begins to freeze, and eventually fades to white. Why is it doing this? How can I fix it?
    It is a newer MacBook, just over 1 year. It is well cared for, hasn't been dropped, etc. I don't want to pay for expensive repairs for such a new computer, and I certainly can't afford a new one!
    I've tried updating my system like the Support page suggested, but no improvement. The problem started just the other day, and is progressively getting worse.
    .... as I typed this, it did it again. Only, this time it did not flicker and shake, but got 'pixelated' (pixels came up checkered-like darkened and lightened). It did this for about 2 minutes and then stopped after I did not touch the computer.... Now it is flickering... HELP!

    it means that it is not a hardware issue.  Other then that, Im not too sure.  Sorry I can't help you any further, but Im sure others members of this forum will read your question and be able to help you.  Good luck

Maybe you are looking for