Images XOR, AND, etc... logical operators to compare two distinct objects

is there a way of comper two images without comparing all it bytes...
the problem: actually I�m parsing the values of the bytes of the two images and then comparing it...
idea: if I have the two byte arrays containing the image info.. may I use a logical operator to compare these objects ??

FelipeGaucho again,
Did you come up with an optimized method for logical operators? I actually want to perform the boolean operations to turn most pixels of an image to zero, then compress that (as in your post 'String compressor II'). Are these two posts related for you as well? They are separated by several months.
abnormal,
I'm assuming that Java's classes would be optimized, but if my code will execute at the same speed as theirs, then I guess I can stop searching for optimized (or already provided) classes. Do you know if Java's provided classes run faster than classes we create? I'm going to test the provided System.arraycopy against my own while waiting for a reply.

Similar Messages

  • Compare two Java Objects without Comparable / Comparator

    Hi Friends,
    I would like to compare two java objects (lots o attributes) without using Comparable / Comparator.
    Any suggestion/sample code would be helpful.
    Thanks,
    Sachin

    I suppose you could design another feature to compare Objects... but that would involve a design process, so asking for sample code is definitely premature. And as EJP says, what would be the point?
    At least that's what I would answer if this was one of those stupid interview questions.

  • How to compare two date Objects

    Hi,
    I have two Calendar Objects, one is coming from client and one is my server time, I need to evaluate that incoming time with server time so that if it is sent before an hour back then i should not do anything on that request Object. I have converted the incoming String into Calendar Object and how can i evaluate these two Calendar Objects including their hours and minutes.
    Thanks in advance
    bajju

    bajjurireddy, ignore Mobiquity's post. It contains no useful information and will only serve to confuse and frustrate you.
    Mobiquity wrote:
    Also make sure that the two date objects are in the same date format..
    public static String DateToDateString(java.util.Date d, String dateFormat)
         throws ParseException {
              SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
              sdf.setLenient(false); // this is required else it will convert
              String dateString = sdf.format(d);
              return dateString;

  • How to compare two database objects?

    Hi,
    I need to compare two objects with embedded objects/collections in it to tell exact difference between the two.
    e.g.,
    create type t1 as object (name varchar2(10), age number);
    create type t2 as table of t1;
    create type t3 as object (user t1, family t2);
    ... and so on.. this type hirarechy is big in my case..
    I want a procedure/function which can tell me what and where is the difference.
    PROCEDURE (obj1 T1 , obj2 T1) IS
    BEGIN
    END;
    e.g., t1.name = 'John' and t2.name = 'Mich' then it should return t1.name etc..
    Is it possible?
    Thanks

    Why a new thread?
    how to read objects/collections dynamically?

  • Compare two similar objects

    Do you know about any possible Java bugs with JDK update?
    In my case, my code stopped working.
    Here is what I have. There are two similar objects, but Object 1 has key, and Object 2 (same as Object 1) has no key. I need to compare both, and if they are equal, I need Object 1 to assign key to Object 2.
    It worked before. How I can get around.
    Please help me if you can.
    Respectfully,
    Alex

    Let me change the question:
    "Can we compare two objects one with key and another one without key? How?

  • Comparing Two Jtree Objects

    Hi
    I had constructed two JTree objects. Now i want to find the difference between these two JTree's Node wise.I dont have any idea how to proceed further.If some one help me in this regard i would be very thankful.
    -Rosy

    The JTree component handles the 'view' side of things. The actual data it displays is held in a TreeModel. You can create your own and pass it to the JTree when you create it otherwise a DefaultTreeModel is created for you by the JTree.
    What I'm getting at is that to achieve your aim you want to compare the TreeModels rather than the JTrees.
    If you haven't created your own, you can get it from the JTree using jTree.getModel()
    Calling methods on each model and comparing the results will achieve your aim.

  • How to RELIABLY compare two File objects?

    Hi java community!
    I have two File objects and I need to know whether they both point to the same file on the system. First, I tried using the equals() method of the File object, but later I found that this often returns false even when file being pointed to by both objects is the same file.
    For example:
      public static void main(String[] args) throws Exception {
        File mFileA = new File("C:\\PROGRA~1\\MYPROG~1\\MYDATA~1.TXT");
        File mFileB = new File("C:\\Program Files\\My Program\\My Data File.txt");
        DataInputStream mInputA = new DataInputStream(new BufferedInputStream(new FileInputStream(mFileA)));
        DataInputStream mInputB = new DataInputStream(new BufferedInputStream(new FileInputStream(mFileB)));
        System.out.println("Contents of file A:");
        while (mInputA.available() > 0) {
          System.out.println(mInputA.readLine());
        System.out.println("\nContents of file B:");
        while (mInputB.available() > 0) {
          System.out.println(mInputB.readLine());
        System.out.println("\nAre file A and file B the same file?");
        System.out.println(mFileA.equals(mFileB) ? "Yes" : "No");
      }Running this gives the following output:
    Contents of file A:
    First line of the file.
    Second line of the file.
    Third and final line of the file.
    Contents of file B:
    First line of the file.
    Second line of the file.
    Third and final line of the file.
    Are file A and file B the same file?
    NoIt seems that the different representation of the paths (short 8.3 file names, vs. long file names) is confusing Java into believing that they are two separate files, even though the example above confirms that they are in fact the same file by showing the contents from input streams derived by the two File objects (which are, needless to say, identical).
    So, does anyone know how to reliably determine whether two File objects point to the same file?
    Cheers,
    Martin

    sabre150 wrote:
    Bren_McGuire wrote:
    Thanks guys.
    I'd just found it too right after I made this post. :p95% of the time the promised Dukes never arrive so thanks for the Dukes.Ditto

  • How to compare two libraries

    I recently bought a 17-inch MBP to replace my old WindTunnel G4 as my primary machine. (The G4 will still be in service as a server.) I'm in the process of bringing my iTunes library over to the MBP, a process that has been made much easier by Home Sharing in iTunes 9. Thank you, Apple, for this feature!
    My question is, when I connect to the shared library, iTunes on the MBP shows 41 fewer tracks than iTunes on the G4 shows. With nearly 200GB of music (over 40,000 tracks) in my library, manually comparing the two libraries to determine which tracks are missing would be an exercise in boredom and futility. Is there any automated way, any software, that I can use to compare the contents of the two libraries so I can locate the missing tracks and figure out what's wrong with them? I'm not averse to using Terminal if that's going to be the most straightforward way to do it.

    I am in the same boat as you are Mark. I only have about 88G and 16,000 tracks of music (that does not include any video), and in trying to manually compare two libraries from directory listings by hand is not the way to do things. I am also thinking that creating some output listings for the directory is the solution, but the directory structure is not the same, and would require some level of automation for dumping the differences. I am a tad rusty at my unix scripting to say the least, but I guess I could pull out some of the old reference books. Even if a properly specified ls command could give an output format to pull into an excel file? and then be able to do the diff there with some small tweaking ? I've gotten myself into a bit of a mess with this (nothing that can not be resolved with some careful cleanup), but I don't want to have to rebuild another new library from my old master if I could do a diff between the two, so I can add the remaining 10G (estimated) that is missing in the new library.
    Hopefully by replying to your thread someone else will spot this and can give an assist.
    I am missing a lot more than 41 tracks, I am guessing a few hundred (200 - 300 plus?).
    One place to check on the old library is in the unknown folders? (unknown album or unknown artist?) and also to check under what is labeled as a compilations folder.
    I think what created part of my problem is that I suspect the new directory structure (part of the new iTunes version) placed on top of the old directory structure (prior iTunes versions - when the orig library was created back in 2003 and then moved to an external device) was something I did not clearly understand or investigate sufficiently prior to starting to move things around. I have not lost anything (i.e. the physical files are all still there in the old master, along with a backup), but certainly the new master is not in full synch with the old master.
    I would have preferred to be far less cognizant of some of these things, but as this exercise continues some of this gets unearthed.

  • Compare two mail message

    I am writing an application to download mail messages from some other pop3/imap mail servers to the folder that created at default imap server.
    I want to compare the message get from server and current messages inside the folder, so I don't get the duplicates. How do I compare two Message object?
    Thanks in advance!

    The way I will do it is to creat a new class that extends java.mail.Message. In such a subclass, one can override "equal" method to compare the data within.

  • Logical operators using "AND" and "OR" operators

    I currently have written code which has two for loops to search a user query. I am able to search user queries entered for a simple and composed query. Eg. Simple query can be "Hello" and composed query can be "Hello World".
    What i would like to do now is be able to use logical operators such as "AND", "OR" when searching e.g. "Hello AND World" or "Hello OR World" Once this is done i would like to score the highest point depending on where the query is found.
    Could someone please help me with either giving me some tips of going about this or some starting code and hints. I have attached some code below which explains what i am currently doing to do the simple query.
    private void SearchButtonActionPerformed(java.awt.event.ActionEvent evt) {                                            
    /* Gets the simple query enterted into the text field. It then looks at the strippedFile in memmory */
    long start = System.currentTimeMillis();
    // long elapsed = System.currentTimeMillis() - start;
    String userQuery = SearchTextField.getText();
    StringTokenizer userQ = new StringTokenizer(userQuery);
    String[] brokenStrings = new String[userQ.countTokens()];
    int counter2 = 0;
    while (userQ.hasMoreTokens()) {
    String moreStrings = userQ.nextToken();
    brokenStrings[counter2] = moreStrings;
    counter2++;
    int Simplematches = 0;
    for (int i = 0; i < strippedFile.length; i++) {
    String LongCurrentLine = strippedFile;
    StringTokenizer st = new StringTokenizer(LongCurrentLine);
    String[] currentline = new String[st.countTokens()];
    int counter = 0;
    while (st.hasMoreTokens()) {
    String moreStrings1 = st.nextToken();
    currentline[counter] = moreStrings1;
    counter++;
    highlighter.highlight(HTMLOutputTextArea, userQuery);
    for (int j = 0; j < brokenStrings.length; j++) {
    for (int k = 0; k < currentline.length; k++) {
    if (brokenStrings[j].equalsIgnoreCase(currentline[k])) {
    long elapsed = System.currentTimeMillis() - start;
    Simplematches++;
    String output = "\"" + currentline[k] + "\" was found on line " + (i + 1) + "." + " At postion " + (k + 1) + " and took " + elapsed + " milliseconds." + " Found " + Simplematches + " matches" + "\n";
    //String output = "\"" + currentline[k] + "\" was found on line " + (i + 1)+ "." + " At postion " + (k + 1) + " Found "+ Simplematches+ " matches"+ "\n";

    jschell wrote:
    london_guy86 wrote:
    jschell wrote:
    Not clear what you search, but....
    First you need to specifically define the syntax. For example what does the following mean?
    a OR b AND c OR d
    Once you do that then you parse the input to create an expression tree. Then you write an interpreter to run the expression tree.Is there any chance you could give me a starter code or soe sources i could look at. I really dont understand how to go about doing what you have mentioned. As in i have declared the syntax at the moment and i am then using the replaceAll() and calling in what i have declared. with empty strings.
    Is this what you mean?Hard to say since I don't understand your statement.
    There are three parts
    1. Parse the expression.
    2. Interpret the expression
    3. Do the "search", this is actually part of 2 however it should be possible to implement some or all of it separate from 1 and 2.
    Do NOT mix the three parts until you are ready to mix them.
    Your posted code is mixing them.
    Presumably what you posted is mostly search. So to start re-write JUST the search code as a class.
    However you can't really do that until you define what the expressions do.After doing everything you mentioned do you think it would be hard to get a score on the best match search found?
    If not could you also give me some tips towards that if you know any.
    Thanks

  • Query form requires Logical operators and/or Quotes

    In ORACLE 9I Jdeveloper beta I used the BC4J JSP wizard to create a - Query Form. The query form looks nice and runs except I have to also include the logical operators (= > <) and Quotes. For example to query on the name Joe I have to enter it as ="JOE". If I use JOE it gives me a JSP error. The error message shows the generated Select statment with the where clause JOE but is missing the "=" and quotes.
    How do I hard code the "=" and quotes around strings so that the user doesn't have to?

    In ORACLE 9I Jdeveloper beta I used the BC4J JSP wizard to create a - Query Form. The query form looks nice and runs except I have to also include the logical operators (= > <) and Quotes. For example to query on the name Joe I have to enter it as ="JOE". If I use JOE it gives me a JSP error. The error message shows the generated Select statment with the where clause JOE but is missing the "=" and quotes.
    How do I hard code the "=" and quotes around strings so that the user doesn't have to?

  • Vivado 2015.2: Simulation and synthesis reverse bit order of std_logic_vector in logical operators

    In both simulation and synthesis the logical operators on std_logic_vector bit-reverse the operands in the result, at least in the case where the result of the expression is passed to a function.
    I suspect this issue applies to other operators as well, though I have only tested the problem with the logical operators. I also suspect the issue exists in other situations where a function is not involved. 
    This is incompatible with both ModelSim simulation and XST synthesis and it breaks a lot of our code.
    The attached xsim7.vhd example shows the issue. The xsim7.tcl script will run the Vivado simulation. Under Windows, the xsim7.bat will run the whole thing. The xsim7.xpr project file allows synthesis under Vivado, and you can look at the schematic to see the issue in the synthesized netlist.
    The source module also simulates under ModelSim and synthesizes under XST, and these show what I believe to be correct behavior.
    Can someone please verify this error and either file a CR or tell me to file an SR?
    Ian Lewis
    www.mstarlabs.com

    Hello Bharath,
    When I said "what was index 'LOW becomes index 'HIGH" I meant the 'LOW of the source operands and the 'HIGH of the result, independent of the actual index range. I would have no problem with any 'HIGH and 'LOW on the result of the operator as long as the direction matched the left source operand, though personally I would prefer the same 'HIGH and 'LOW as that of the left operand.
    Looking at the IEEE implementation of logical "or" on std_logic_vector from package std_logic_1164: https://standards.ieee.org/downloads/1076/1076.2-1996/std_logic_1164-body.vhdl:
    -- or
    FUNCTION "or" ( l,r : std_logic_vector ) RETURN std_logic_vector IS
    ALIAS lv : std_logic_vector ( 1 TO l'LENGTH ) IS l;
    ALIAS rv : std_logic_vector ( 1 TO r'LENGTH ) IS r;
    VARIABLE result : std_logic_vector ( 1 TO l'LENGTH );
    BEGIN
    IF ( l'LENGTH /= r'LENGTH ) THEN
    ASSERT FALSE
    REPORT "arguments of overloaded 'or' operator are not of the same length"
    SEVERITY FAILURE;
    ELSE
    FOR i IN result'RANGE LOOP
    result(i) := or_table (lv(i), rv(i));
    END LOOP;
    END IF;
    RETURN result;
    END "or";
    the operator does exactly what Vivado seems to be doing: alias the downto source vectors to a to range of 1 to 'LENGTH and then return a vector of 1 to 'LENGTH. This both bit reverses the downto indexes (the alias on the source operands does that) and changes the range to "to" with a 'LOW value of 1.
    This gives us the 'LEFT 1 and 'RIGHT 4 we see.
    So far, I have found no definition from IEEE of what logical operators, such as "or", are supposed to do on std_logic_vector except as defined by this piece of code for "or" and the other operators' associated bodies from the std_logic_1164 package.
    What this code does seems like a horrible decision about how to implement the logical operators on std_logic_vector with respect to range direction, but it is compatible with what Vivado does, and incompatible with what XST does. (I had never investigated this issue before because what ModelSim and XST did made perfect sense to me.)
    That the assignment  (Result := s)  works as expected, makes sense. The assignment of the "to" range s to the "downto" range Result maintains the 'LEFT relationship. That is, Result'LEFT (index 3) receives s'LEFT (index 1). So, the bits are reversed a second time.
    That ISIM does not match what XST does seems like a defect no matter how you look at it. Your simulation can never match your synthesis if you care about the range direction inside a function (and I suspect in other places too). This deserves an SR or CR if you are still doing any work on those two tools. I think you may not be.
    Are you able to find out whether Vivado was changed from XST on purpose with respect to the behavior of logical operators?
    If this is "as designed" then I have to start working on updating our code to live with it. But, if this is something that happened by accident, and you will change Vivado to match XST, then I probably want to wait. Updating our code to live with this behavior is going to be a pretty big job.
    Thank you for your help,
    Ian

  • How to compare two images and display the difference on Front Panel

    HI..
    I have attached two images.
    I want to compare these two images and subtract the differenc from these two images and display the difference(the mouse) on the front panel
    Anyone can help me?
    Really thanks
    Attachments:
    IMG_2117.JPG ‏1677 KB
    IMG_2118.JPG ‏1650 KB

    The missing thing. You have to keep in mind that what you see is not the same as the camera sees.
    So when using IMAQ Substract it gives you the difference of the value of every single pixel!
    In order to find the mouse as only difference you have to manage that every other pixel value stays the same, e.g. with a proper lightening.
    At the other hand you can combine different filters or alogorithms to get the object, e.g. if the object is darker or brighter then everything else in the image you could use a threshold and then use morphologic operations to get the objects size and position.
    Christian

  • I am new to ios & using 5C. I want to know where is all the media (Images, videos, Audio etc) received through Whatsapp are saved after downloading in Iphone. And also how to access the same.

    I am new to ios & using 5C. I want to know where is all the media (Images, videos, Audio etc) received through Whatsapp are saved after downloading  in Iphone. And also how to access the same.

    These are user to user forums.  You ARE NOT addressing Apple by posting here.
    Also, why are you YELLING at us??  Stop using ALL CAPS.
    What steps have you done to try and fix the problem?

  • System Imager back to showing var, tmp, and etc

    Anyone notice that after the 10.4.8 update, that var, tmp, and etc are showing up on Netinstall images? This used to be a problem up to 10.4.3, but it appears to be back.
    Anyone else having this problem?

    Hi Martin,
       I can't help a lot; my stupid Script Editor and AppleScript have also changed. AppleScript just seems to get flakier and it's more than I want deal with much. However, I'll tell you what I found out, even though it's the opposite of a solution.
       My Script Editor won't let me save a POSIX file reference either. I can tell you that you can change (file "MyHDName:private:var") to (folder "MyHDName:private:var") and you won't get the error. Of course that's not what you want since it's the symbolic link and not the directory to which it points whose visibility you want to change. I now also get the same error with the command that you posted but the following produces no error for me:
    tell application "System Events" to set the visible of (POSIX file "/var" as alias) to false
    Of course you can't save it but you can run it. However, you can save it as a shell script that uses the osascript command:
    osascript -e 'tell application "System Events" to set the visible of (Posix file "/var" as alias) to false'
       However, this is ultimately no help either because you don't have privileges as a regular user to change the properties of this symlink. Since it's not a "do shell script" command, you can't invoke administrator privileges as far as I know. You can't change the ownership or permissions of a symlink from the command line so the only thing of which I can think is to enable the root user and login as root and run the command. It seems that in order to make AppleScript secure, Apple has made it almost useless as an administrative tool. Hopefully someone more knowledgeable and less frustrated with AppleScript will know how to get administrator privileges.
    Gary
    ~~~~
       If all the seas were ink,
       And all the reeds were pens,
       And all the skies were parchment,
       And all the men could write,
       These would not suffice
       To write down all the red tape
       Of this Government.

Maybe you are looking for

  • All websites down after uninstalling Exchange 2010 from Web Server

    Hello, I successfully uninstalled Exchange 2010 (Client Access Role) from a webserver that hosts a company website and some other web apps, as a last step on a migration to 2013. But after that, some application pools were not started automatically,

  • In iClouds...How do i change the old Apple ID email to the new one I created??

    In iClouds...How do i change the old Apple ID email to the new one I created with

  • How to approach this scenario (Many to Many). A bit confused

    Hi all, I have a scenario where I am confused and am looking for some guidance. Let me explain the scenario I have. I have an Item Table (Which will be used to create Item Dimension) : ItemID ItemName Item1 ItemName1 Item2 ItemName2 Item3 ItemName3 I

  • Content type change

    Hi Experts, I am trying the test the webservice scenario using Webservice Studio tool and getting the below error. I am using ABAP port(Used the default url while creating the wsdl file from ID). url: "http://<servername:8001/sap/xi/engine?type=entry

  • Cant multitask Photos (after 4.2 upgrade)

    I use the "Email photo" option from within the Photos app all the time. After the 4.2 upgrade I cant go back to Photos to add another photo to the email. I have to create new email and then go to photos and copy/paste 1 pic at a time. Friend at work