Unfortunately, the Image class doesn't implement the operator or the Equals method, which means it inherits the default implementation from the Object class that simply checks if the object references are the same. It turns out that this will fail, even if an image is assigned to the PictureBox directly out of your ImageList.
Unfortunately, the Image class doesn't implement the == operator or the Equals method, which means it inherits the default implementation from the Object class that simply checks if the object references are the same. It turns out that this will fail, even if an image is assigned to the PictureBox directly out of your ImageList. So, you'll need to implement your own logic to check if the images are the same.
There are a couple of different approaches. You could either load each of the two images into a byte array and do a byte-by-byte comparison, or you could loop through the two images pixel-by-pixel and compare their colors. Of course, both of these methods are going to be anywhere from relatively to unreasonably slow.
You could potentially optimize either by simply comparing the dimensions first (the Image object does provide a Size property that returns its dimensions) and returning False if they are not equal, but this probably won't work in your case, since all of the images in the ImageList will have the same dimensions. If it were me, I'd save myself the trouble and just keep the index of the image in the ImageList that I assigned to the PictureBox somewhere in a class-level variable... If you're still resolute despite my warnings, see the answers to this similar question.
I know that there is a possibility to handle in class-level variable but I want to know where there is any option to check (i.e. , properties, etc. ,) – Kumaran T Dec 21 '10 at 6:08 @Kumaran: I don't understand what you mean. There's no property or method built in to compare two images.
It's not part of the . NET Framework, and the first paragraph of my answer attempts to explain why the two things you might think to try won't actually work. If you want to be able to compare two image objects, you'll need to implement your own solution, as the second part of my answer explains.
– Cody Gray Dec 21 '10 at 7:12 I did attempt my solution, as well as a number of others and I stand corrected and apologize. You're absolutely correct; there doesn't appear to be a direct way to compare images in this scenario. +1 – SnOrfus Dec 21 '10 at 7:32 @SnOrfus: No need to apologize!
Like I said, I first thought the same thing you did. It would be far simpler and more convenient if that would work. There's an interesting discussion on that subject here: stackoverflow.
Com/questions/2762310/… – Cody Gray Dec 21 '10 at 7:37.
Dude instead of going for a image list. Just go with the list box. I have a programmed a tool in C# wherein it takes 2 inputs from user.
First being the folder which contains bulk of images and second being the input image ( whose similar images you need to separate from the bulk of images. When to take the input folder. List out the contents of the folder in the listBox i.
E; the path of every image in the folder. Now since you have the path of every image in the folder, take images one by one into a Image for Bitmap and compare it with the input image you have given earlier. Use any methods or similarity metric to find out to what extent or what % the images are same.
Note the %'s and then separate them from the bulk of images.( this is again easy since you have the path of every image in the folder. ) I don't know to what extent I made myself clear. I hope this was of some help to you.
Good luck.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.