CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@GULNAZ KMT • 21 Dec, 2010
Hi.. Am looking for appropriate java codes for Comparing images.. I searched thru net but no apt codes related 2 it.. Anybody 2 help me out thre???😔
@Reya • 21 Dec, 2010 You mean to compare two images whether they are equal?
@GULNAZ KMT • 21 Dec, 2010 Yup.. Irrespective of size of the image, I need to write a JAVA code, where it'l compare the image given as an input with another image already contained in my database and return true if comparison matches. For Eg., if I give an image of computer, my code should be able to compare with images of computer in my database and return the o/p.. Database codin part, leave it upto me. I just need help in, how Java compares two images..
@Ankita Katdare • 22 Dec, 2010 Hi Gulnaz,

I searched for your query on the net and found this result:

Mind Meat: Java Image Comparison / Motion Detection

Does that help?
@Ankita Katdare • 22 Dec, 2010 Here is some information about processing pixels in an image using Java :

Processing Image Pixels using Java, Getting Started - Developer.com
@Morningdot Hablu • 27 Dec, 2010 Sorry for late reply actually i am busy in exams.
Well i have an idea how to compare two images check this code.
Use it to compare two images hope it works.But it's just an idea you can edit it on your own way.
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
/*<Applet code="comp" height=400 width=400></applet>*/
public class comp extends JApplet implements ActionListener
{
Button b;
String str,str1;
public void init()
{
b=new Button("submit");
add(b);
setLayout(new FlowLayout());
b.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
repaint();
byte b1[]=new byte[60000];
byte b2[]=new byte[60000];
try
{
int i=0;
FileInputStream f1=new FileInputStream("kk.jpg");
f1.read(b1);
FileInputStream f2=new FileInputStream("kk1.jpg");
f2.read(b2);
while(b1!=3 || b2!=3)
{
if(b1==b2)
i++;
else
{
str="not matched";
break;
}
}
if(b1[i-1]==b2[i-1])
{
str="matched";
str1=Integer.toString(i);
}
}
catch(Exception ee)
{
System.out.println("Exception caught");
}
}
public void paint(Graphics g)
{
g.drawString(str,100,100);
g.drawString(str1,200,200);
}
}
8.3k views

Related Posts

@jijo jacob · Oct 12, 2015

M.tech project topics related to structural engineering
7.1k views

@Kaustubh Katdare · Aug 1, 2013

I've a spare modem, Linksys E2000 which I want to configure as a range extender or wireless repeater. There are DD-WRT firmware versions available that 'promise' to allow to do...
7.6k views

@ram_149955 · Apr 15, 2015

Hi Everyone, I see so many posts here by fresh engg. graduates about software testing vs development career career related questions. This post is just about my perspective of both...
3.4k views

@RISHABH LALA · Apr 10, 2013

Many people doubt the use of C++/C# programming in civil engineering . But we can also make our career in this field as programming is the sole of any civil...
3.3k views

@samaira · Jul 12, 2009

How to write a program in c to find a substring? (without using library functions) ?
13k views