Comparing images


I read in 2 images both using the Image Reader node. How can I compare the 2 images?

Imagine in a production line where PCB boards are assembled and their pictures are taken to be compared to find faults.



Hi Kenny,

this is a very generic question ;-) Depending on what you want to compare, some preprocessing, feature extraction or other image processing and analytics techniques have to be applied. If you could provide a bit more information or maybe even some example images, I can try to help you getting started.

Have a nice rest of the week,


You might want to give the KNIME testing plugin a try.  Normally it is for testing new nodes, but it has a node to compare a test image to a reference image as I remember.  Might be an easy starting point


Hi Steve,

I'm afraid this node won't help.Unfortunately the image compare of KNIME testing does not work with KNIP images (yet). However, there would be a "Compare Images" node in our framework for testing. Anyway, I think he wants to find some defects or anomalies on his images. There, a pixel-wise comparison would nearly always return that the images are different (light conditions, sensor irregularities etc). But maybe I'm really missing something here :-)


Hi Christian,

Thanks for your reply.

I would like to flag out major image differences as attached in the file pcb-compare.png.

Is there a way to filter out certain conditions like light, as you mentioned, before comparing 2 images in KNIME?



Hi Kenny,

cool, this is interesting. I suppose you have one image with correct PCB and many with incorrect ones? In that case I would set-up a first workflow as follows:


1.1 Image Reader with all faulty images

1.b Image Reader with the single correct image

2. Use the Cross-Joiner Node to combine the two tables

3. Gaussian Convolution or Quantile Filter to remove slight differences (sensor jitter or so)

** Please make sure, that you do that for both columns (the faulty and correct ones)

4. Use the Image Calculator and simply subtract the two images of each row (abs(Image-Image)).

** Make sure that you have FloatType as Output type if you don't want to use the "abs", as FloatType allows you to have negative values.

5. Use the Image Features Node to calculate the sum of all pixels of the difference images (if the sum is high, there are several differences etc..). You can determine a threshold when there are too many differences and like that you can detect faulty boards.

However, this is a very simple approach, which can be extended. For example we could make sure, that only differences are counted which have a certain size ...

If you can send me some more examples (10 faulty, one correct) via E-Mail, I can help you setting up a first workflow.




1 Like


       I had recently started using KNIME for Image Comparison, In my R&D, I came across your blog and its very helpful to me for achieving what I want but, I need some extension of the steps that you mentioned above. After processing the images we got all our required statistic values.

Here comes my work, based on those values, I need to find the percentage of difference between those two images. Is there a node which meets the requirment (or) suggest me a way to achieve that percentage difference value (between two images).

Thank you,

Dinesh N.

Hi Dinesh,

I'm not sure at which point of your analysis you are? Did you already achieve to measure the difference between two images? What kind of images do you have? How do you measure difference?

Dependings on these questions, I can help you calculating the percentage of intensity (=pixel value) deviation. Usually it comes down that you calculate the overall intensity of Image A (Using Feature Calculator or Image Feature node) and compare it to the sum of intensities of the difference image. But I'm not sure if percentage is a good measurement here as your images might be very big and if only a small area in the image changes (but heavily changes), then the percentage will be low.

So if you want, you can provide more details about the current status of your work and maybe some example images and how you want to compare them. We're happy to help.




PS: Merry Christmas :-)


Thank you very much for your reply,

Actually in my work, I will get a group of images(paintings) drawn by the children, with refference to an orginal painting(this is my refference painting), I need to compare the images that I received with the refference image and need to find the percentage difference(or) matching between them.

For Example,

1st image matches 62% refference image.

2nd image matches 75% refference image.

I need to declare that 2nd one is the best match(winner).

please see the below link, I need the result like shown here

I hope you understand my requirment, and please try to help me to acehive it through KNIME.

Thank you,

Dinesh N

Thank you very much for this answer. Really easy (because of KNIME) and helpful :slight_smile: