Finding a color with a robot

Hey i am making this program and i need an efficient findcolor algorithm i am currently using this:
     public Point FindColor(Color c,int x1,int y1,int x2,int y2,int tol){
          for (int i=y1;i<=y2;i++){
               for(int j=x1;j<=x2;j++){
                    if (colorSimilarity(getPixelColor(j, i),c)*100>100-tol){
                         return new Point(j,i);
          return null;
     public double colorSimilarity ( Color col1, Color col2 )
          double dr, dg, db;
          dr = col1.getRed() - col2.getRed();
          dg = col1.getGreen() - col2.getGreen();
          db = col1.getBlue() - col2.getBlue();
          return 1-(( Math.sqrt ( ( dr * dr ) + ( dg * dg ) + ( db * db ) ) )/(255*Math.sqrt(3)));
but it takes forever to search the whole screen (by forever i mean 8-9 seconds). any ideas as to how i could improve its efficiency to more like .1-.5 seconds

Crosspost:
http://forum.java.sun.com/thread.jspa?threadID=5125012

Similar Messages

  • [AS] CS3- Find any text with style, then replace that text with a new applied fill color.

    I am trying to find the simplest way in cs3 to find any text with style, then replace that text with a new fill color. I can find text and change text. I can find a style and change it to a new style. I can't seem to find a style and change the applied fill color. I do not want to change the properties of the style, just the applied color. Yes, I want the + sign, for now. I know, why not update the style, I am not allowed to. Any help would be great. Since the search is not available, I need a new response.
    Thanks.

    You can work around the bug by just doing a find, then looping through the<br />results, changing the color one at a time. It'll be a fraction slower, but<br />should do the trick:<br /><br />tell application "Adobe InDesign CS3"<br />    set find text preferences to nothing<br />    set properties of find text preferences to {applied paragraph style:"The<br />name"}<br />    set theFinds to find text document 1<br />    repeat with i from 1 to count of theFinds<br />        set properties of item i of theFinds to {fill color:"Replace color"}<br />    end repeat<br />end tell<br /><br />The bug is fixed in CS4, BTW.<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

  • How can I find the position of a robotic arm with a cFP-CTR card?

    Hello,
    I use a CTR-500 to measure the pulses of 3 encoders.
    The encoders are related to the 3 axis (x,y,z), to which a robotic arm is moving.
    Each encoder has 2 channels (A,B) which go to each pair of Count Inputs of the CTR card.
    When the robotic arm is moving on one axis, the corresponding pair of Count Inputs is increasing, but there is a phase between the one Count Input and the second one. What is more, the Count Inputs do not decrease when the robotic arm is moving to the other direction, but they still increase.
    So, I cannot find easily the position of the robotic arm.
    What I have done, is to try finding the position, by using only one Counter Input for each axis. This means that I use the value of the encoder as a counter, and I calculate the position with some software tricks. But for some reason, it does not work properly.
    I have heard that the method I use is not proper. Instead, I have been told that I must use the phase of the 2 Count Inputs, in order to find the direction to which the robotic arm is moving. But, the Count Inputs of the CTR are augmenting in parallel, when the robotic arm is moving forward or backward.
    How can I find the position of the robotic arm, as it is moving like a CNC ?
    Thank you very much.
    Message Edited by nikosfs on 08-21-2009 12:27 PM

    You don't want to use a cFP-CTR-500 card.  What you have are quadrature signals.  You should be using the cFP-QUAD-510.  It has 4 channels that can handle both the A and B signals of a quadrature encoder.  It has the built in circuitry do determine the phasing of A vs. B to know when to count up vs. count down.

  • How to make preflight profile witch find out if exist in document spot color with name "CutContour", if not show allert,  I try many combinations but nothing works

    How to make preflight profile witch find out if exist in document spot color with name "CutContour", if not show allert,  I try many combinations but nothing works

    Thanks very much for your help, but I'm still overlooking something. I double checked to make sure that I did not have a hidden .txt file extention. I then decided to abandon the lock on preferences idea until I get it working. I converted my mozilla.cfg file back to plain text. I made sure I do not have an extra blank line at the end of each file. The syntax looks good, as far as I can tell. I'll copy and paste what I have so far. Did I have the file locations correct posted above? Also, if you feel i can delete some lines of text in my mozilla.cfg file I'll be happy to do so.
    mozilla.cfg
    <pre><nowiki>//
    pref("privacy.sanitize.sanitizeOnShutdown", true);
    pref("privacy.sanitize.promptOnSanitize", false);
    pref("browser.rights.override", true);
    pref(“app.update.auto”, false);
    pref(“extensions.blocklist.enabled”, false);
    pref(“extensions.shownselectionUI”, true);
    pref(“browser.shell.checkDefaultBrowser”, false);
    pref(“toolkit.telemetry.enabled”, false);
    pref(“toolkit.telemetry.prompted”, 2);
    pref(“toolkit.telemetry.rejected”, true);
    pref(“app.update.auto”, false);
    pref(“browser.download.useDownloadDir”, true);
    pref(“browser.search.update”, false);
    pref(“signon.autofillForms”, false);
    pref(“signon.rememberSignons”, false);
    pref(“browser.download.manager.scanWhenDone”, true);
    pref(“browser.formfill.enable”, false);
    pref(“xpinstall.enabled”, true);</nowiki></pre>
    channel-prefs.js
    pref("app.update.channel", "release");
    override.ini
    [XRE]
    EnableProfileMigrator=false
    all-lmc.js
    pref("general.config.filename", "mozilla.cfg");
    defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://bbc.co.uk");
    Again, thank you very much for your time. Do I create my own browserconfig.properties, and firefox.js? Also, I forgot to mention I'm running Windows 8.

  • Adobe Acrobat wipes the Finder label color of edited-saved PDF files

    Adobe Acrobat X Pro 10.1 wipes the Finder label color of PDF files when edited with Acrobat. For instance, if a PDF file has a particular Finder label color, if then it is open and edited or simply modify in any way (for instance, just marking some text with the yellow fluorescent marker) and saved, Acrobat wipes out the Finder label color of such file.
    How to send feedback to Adobe about this problem?
    Thanks.

    Report the issue here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • How to change the Find highlight color

    I am trying to find out if there is a way to change the Find Highlight color in office 2013.
    Every time I search for a word or anything it uses a light yallow to highlight that line or word, and I woudl like to replace the yellow with like a teal or a green or some other color that I'm not using already in my Word document. This way I can find out
    were it is telling me It is because I have a lot of stuff already highlighted yallow, and when I click find and search for something in the Navigation window and it finds it. It also puts it as a lighter yellow and it confuses me.

    Hi,
    As far as I know, we can't change the highlight color when using Find in Word. The highlight color is fixed.
    As a workaround, you can try to use Advanced Find instead which will show the search result with a different color.
    Best Regards,
    Steve Fan
    TechNet Community Support

  • Why can't I find the color profile info in the library ?

    Why can’t I find the color profile info in the library ?
    It’s sometimes necessary to convert to sRGB for some applications ( internet, some beamers in clubs,…).
    I convert them but afterwards it is nice to have the possibility to check this out and should be possible in lightroom, the info is present why not showing it ( it is not so easy to go in finder and look at it in info for every image)?
    Since I’m always working in Adobe profile for printing and so this is important to know !
    But no trace of it anywhere….
    Thx for any reply.

    The disconnect here is many (including me) don't reimport rendered JPEGs
    into our Lightroom Catalogs. Why you are doing that is beyond me. You
    have the original and can recreate any rendered file at any time.
    Storing the derivative JPEGs is redundant, creates additional confusion
    and serves little real purpose. Exported versions are considered
    discarable by many.
    Yes, understand what you're meaning. but the fact is that I started rather recently with lightroom. So my images where classified in directory's and subdirectory's...already.
    I think that this is the major problem. This is always a problem when you step in a new system.
    Let's say I am going to submit to a photographic society, I have an Export
    preset created that exports to proper size and color space for
    projection. It creates a file. I send it to the club. Then I delete it.
    Why save it? I can recreate it. Then I don't have to manage it, search
    for it, or worse yet, risk confusion with my original file or othe
    resultant derivatives. 
    The fact that I like to keep them is
    indeed an inborn result of the "pré-lightroom period". A bad habitude
    indeed. I'm thinking now of deleting them, will maybe better. On the other side
    I still have them just for me in order to know which ones I used and when.
    Another bad habitude.
    But
    since I'm not a professional photographer I'm mostly confronted with the time
    issue and it is for me easier to take existing files ready for use...
    ( doesn't mean you’re not confronted
    with this problem
    Today place for jpeg's is rather easy since the Gb's are almost free...
    Same is true of a client photo. They want an 8x10. I go to the retouched
    original, create a JPEG from an 8x10 preset in the proper dimensions and color space. Send it to the lab. Then, I can delete it.
    One of the strengths of Lightroom is that it creates many fewer
    intermediate file versions along the way toward final creation. Another
    strength is that you can save (via snapshots in Develop) your
    derivatives, export, and discard them without having to create, import
    and manage additional files on disk. In the old days of just Photoshop
    you might end up with a dozen or more files on your disk for every
    worked file. With Lightroom, you only need one or two.
    Will look deeper in your proposed workflow...and yes I'm comming from the old days.
    That said, if you want to keep the derivatives for purposes down the road,
    that is up to you but I don't understand why they need to be inserted
    into your catalog.
    Since my catalog is made in the time
    from before lightroom I’m still having all these directory's and
    subdirectory's...
    Easier
    for me since even with back-ups of the catalogue still afraid for crashes. And
    I keep liking these directory structure because for the moment it's lighrtroom
    and tomorrow it can be another program, you never know. It's like a website, "on line versoin only", big problem when a firm at some moment stop to provide this possibility.
    I think I will try to go deeper in "how to use lightroom better..."
    thanks
    Edward De Bruyn

  • Pantone Colors with CMYK Colors?

    Dear all!
    I am LUCK. I am wondering about Pantone Colors with CMYK Colors. It's that I got 1 Pantone Color from my customer and then I changed it to the equivalent CMYK Color. Will I get different colors when changing from Pantone to CMYK because I will print with CMYK Printing Process? Anyway, I am wondering whether the Pantone color is the fix and specific color or not. I mean when I print the Pantone Color, I will get the same result as I print before. Is it right?
    Please help to explain to me whether Pantone Colors will keep their colors the same and stable or not. Or would you mind telling me what kind of colors that can produce the same color every time I print, especially for the Formal Uses?
    Sorry for being unaware of my knowledge here. Thanks a lot and best wishes to all!
    I am looking forward to hearing from you.
    My best regards,
    LUCK

    Pantone is a company, not a color. Pantone produces spot color inks, process color inks, and color references.
    Understand first: Five color printing ("process plus one") is not uncommon, because six-color presses are not uncommon. When a project is printed on a 6-head press, it does not dramatically affect the costs, because the job can still be printed in one pass. Brochures and other marketing collateral are often printed in 5 inks when a company specifies a spot color as its identity color. When done right, the company's identity specifications also provide a CMYK mix to use in lieu of its spot color(s) when restricted to only CMYK (as in magazine placement ads).
    So I'll assume your customer specified a Pantone spot color, and does not provide a preferred CMYK substitute, and your project is restricted to four color process (CMYK) printing.
    CMYK mixes do not exactly match spot color inks; they can only approximate. How closely they can approximate depends upon which spot color you are dealing with.
    Pantone provides its recommended CMYK values for approximating its spot color inks. That's why Illustrator provides a Pantone solid to process Swatch Library. But such lookups are recommendations; they are not absolute equivalents. There are many many colors in nature (and in spot ink pigment) which simply cannot be matched in CMYK. And any time you try to convert between color models (spot to CMYK, RGB to CMYK, etc.) you encounter ambiguities, because there are multiple algorithms that can be used to generate four values from fewer values.
    I often find Pantone's spot-to-process recommendations to be unsatisfactory, and use my own CMYK approximations instead. This is not necessarily due to any failure or shortcoming of the Pantone libraries, but just differences that exist in specific printing houses and workflows. The printing process is full of variables.
    Will I get different colors when changing from Pantone to CMYK
    Yes, the colors will be different. But whether the difference is noticable depends upon the specific spot ink you are trying to match. It also depends upon the specific use of the color. Fact is, human color perception is very adaptive. Colors that are "mathematically" equivilant according to some colorimetric algorithm are not necessarily perceived as equivilant by human eyes, because much depends upon environment (adjacent colors, etc.)
    You can refer to a printed process color reference against which you can compare a printed spot color swatch book and judge for yourself which CMYK values best approximate the spot color. Or, you  can set up simple test sheet of your own, and have it printed to determine a "best match" in a particular printing environment.
    All the above is just one reason why contract proofs are still important. If your customer is very picky about his spot color, then he needs to understand that converting it to CMYK is merely an approximation, and perfect matching is simply not possible. That's one reason why spot inks exist in the first place. If he is not willing to pay for five-color printing, then he will likely have to settle for a minor compromise.
    JET

  • Screensaver off color with wide gamut monitor

    I have a NEC SpectraView 241 calibrated wide gamut monitor and an older 15" AppleStudio monitor (also calibrated). The screensaver colors are OK on the AppleStudio monitor, but completely off on the wide gamut monitor, as if the software was not taking into account its color profile: greens and reds are too saturated.
    As I can't find any post with a similar problem, I must be doing something wrong; but I can't see what!
    Oh, and by the way, Photoshop or GraphicConverter photos are perfect on both screens...
    Any idea?
    MacOS 10.9.4
    Early 2009 MacPro 2x2.26 GHz Quad-Core Intel Xeon
    20 GB RAM
    NVIDIA GeForce GT 120 512 MB

    Finally fixed by modifying SpectraView Profiler Preferences to set the Profile in the system ColorSync Folder rather than the user ColorSync Folder...

  • Mixing Color with a simple Brush Tool

    Ok, I know this i probably a very rookie mistake, and the solution might be around the corner, but I really can get it.
    I would like to use two colors to create a new one (like using a real color palette, on a real painting), using only the Brush tool, finding a middle tone between them. I've seen this simple procedure on Youtube, but I can't replicate it.
    So I have two colors:
    I sample from the bright-blu to lighten up the dark-blu and starting to find the first shade.
    But as you can see below, it does not merge the two colors, creating a gradation, it only paint the bright-blu OVER the dark-one.
    The same happens in reverse (if I paint with the dark-blu over the bright-one).
    No matter how many time I paint over, in shorts I can only replace one color with the other one.
    As shown on the video, I use a Hard Round Brush (not the Mixer Brush Tool), with 100% opacity and 50% flow.
    Any idea?
    Hanks in advance,
    Franz

    Thank you, Sudarshan.
    Actually the first video explain what I'm trying to achive, but not how to do it.
    As you can see, he doesn't use the Mixer Brush (widely covered in the second video), he uses a simple Brush tool. Painting with some yellow over red, he blends the two color and comes out with an orange. As simple as that.
    In my case, when I paint with the bright-blue over the dark-blu, (as in the picture), bright-blu totally cover the dark-blu. Doesn't merge with it.
    So you can get a middle tone of blu (as he got the orange)
    So, I'm thinking I've might accidentaly selected (or de-selected) 'something' in one of the billions menus of Photoshop.

  • Flare in a Grey color with the black background

    Hi:
    I just need to fix this problem and can't find a solution.
    Why I'm getting a grey Flare when I open it with a black background, but it's in color when I open it in a white background?
    I know that flare works better with a black background, but for any reason it looks grey and it's hard to create effects.
    Can anybody help me? please. I'll appreciate it.
    Thanks
    - Pepe

    This is very exciting you are the third person to post a qquestion about the flare tool since I can remenber and I can remember before the falre tool existed.
    You need to have the flare effect behind an object to get the full impact so you would put it behind a black object or a colored object. If you place it on a white back ground you only se the actual construction of the device before it has the effect which has to be applied to an object.
    So how do you get a white object to show the effect since does not work with a white object?
    Interesting that you asked you apply it say to a black object instead. You say what? that is the opposite of what i want?
    Abraccadabra!
    you open it with Photshop as a Smart Object that keeps it a live ai file which can be update and the changes will be reflected in the photoshop file.
    You then go to layers>Adjustments>invert and that will make the color object white instead of black but will also ivert the colors of the flare
    but you can adjust those colors using Hue Saturation as an adjust manet layer
    then save as a psd file and place it in Illustrator as linked files, you will be able to adjust the smart object in ai save it then save the psd file and it will updated in the new illustrator file.
    Created in AI
    Placed in Photoshop as a smart object and given a Invert adjustment layer
    then I worked on the color with Hue Saturation adjustment layer you can acheive a lot more than I tried that way.

  • Replace color with transparency?

    Hello,
    Using the Replace Color Tool, I can't find transparancy as the new color. Am I doing something wrong? If not, would there be another way to replace a color with transparancy in Fireworks? I have Fireworks 8 (and I love it).
    Thanks,
    Frank

    Great question. I have to admit, I've never used the Replace Color Tool—I didn't even know it was there.
    Initially, I thought you might have been referring to the Find panel, which is useful for replacing colors with vector objects. It, too, lacks support for transparency. There is a trick you can do to force the transparent (or "None") swatch to appear: In the hex code input of the Color Picker, add a "0" to the end of the 6-digit hex code. The problem is, this won't actually work to replace the color with transparency; once you try to apply it, the color reverts to its previous value.
    If you're working with bitmaps, your best bet might be to use a bitmap selection tool or command, and then once the color is selected, just use the Delete key to remove it. If working with vector objects, remember that you can always select multiple objects and then use the Properties inspector to adjust the fill or stroke color of all the selected objects at once. Also, using Symbols can allow you to edit just a single object and have it affect multiple instances.

  • FCP  to Color with 2+hrs of multi camera footage

    Greetings,
    I am sending quite a large project to Color, it is a Multi clip sequence that I am sending, I have collapsed the sequence prior to sending it, however I am finding one camera angle is being sent to color with the wrong time code, or should I say the footage is not what is in the timeline, there are a few minutes that were deleted (removal of a speaker or two). The deleted footage is showing up when the sequence is sent to color. This is only happening to ONE angle. I noticed it AFTER I sent the project back to color, and all of that angle was completely out of sync.
    Thankfully I saved the timing droplets(for a lack of better terms),
    I set up the render before I go home for the night.
    I am working with Color 1.0.4, FCP 6.06
    The footage is 720 60p.
    Any suggestions would be greatly appreciated.
    Thank you!
    Andrew

    Upgrade wouldn't work anyway, because the grades are not valid from version 1.0 to 1.5.
    If you have collapsed the multiclip to one V1 and then gone to COLOR and then discovered the snag in the workflow, then a media manage, making the active angle independent will get you a new project/sequence that will respond well to an Import Color Corrections from the original colorproj.
    The new sequence must be identical to the original, so that the clip sequence 1- how ever many you have, corresponds one-to-one with the old one... for example, clip 92, if there is one is the same clip on both timelines... except the new one is independent whereas the old one is a container/nested placeholder (which is sort of how multiclip works) that COLOR has no idea what its supposed to be or where it came from.
    There aren't that many other options.
    jPo

  • Find a color in a document

    Hello,
    I feel I was able to do this once and now I cannot find it.
    I am using INDCS3 and I thought I could use the find and change to find a color in the document, see where it is being used and change it if I wanted.
    Is that possible?? I thought it was??
    thanks!
    babs

    Babs,
    Not sure if your asking this, but if you want to completely replace one color throughout a document with a different color that can be done.
    First make sure you have the "new" color in the swatch panel. Then, in the Swatch Panel, click on the color you want to remove, click on the trash can at the bottom of the panel, select the the color you want to use as a replacement.
    If the color you want to remove came into the document via an imported eps file it gets more complicated but I assumed you did not.
    Marvin

  • HT4356 My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    hi
    could you tell us what the other app is please

Maybe you are looking for

  • Difference B/W Byname and  Bydate in communication channel ,processing.

    What is Difference bettween byname and bydate . if we give  date in processing sequence will it take on that date data or will it take all the data as date wise means all the data from target.

  • How do I make preview show only one page at a time in full screen

    When I show a document using full screen (or slideshow) in Preview, it shows two pages at a time.  I just want to show one at a time, but can't find anything that lets me specify this.  There is no relevant Preference that I can see, and if I check s

  • CSV File Content Conversion

    Hello, I have a litte problem with the File-Adapter and the File Content Conversion. We get csv-files in which are 2 structures the first row contents headerinformations like invoicenumber and sumfields. The following rows contents item-informations.

  • Discussion Forum  - Retain Portal Login

    Hi all, Hope I'm in the right place for this. We are looking to install a discussion forum solution (currently running 9.0.4.1.0 - Build: 129). Ideally we would like the forum to work in the following way: A user logs into the portal, clicks on 'Disc

  • Notes app "Titles" issue

    This has only happened since upgrading to Mountain Lion and the new Notes app. In the Mac Notes app I'm having a frequent issue where I see two notes with the same title (like a note has been duplicated) and it appears that another note has disappear