Use shaders to compare images

641 views Asked by At

Do you know how can I write simple shader (hlsl) to compare two images ? I want to get on result percent of similarity ? Is it posible to use shaders in this case ? Can I for example count red pixels on image with shaders ?

1

There are 1 answers

0
toujamaru On

It can be done simply by passing two textures to a shader and then running a pixel by pixel comparison in the pixel shader. Though it would take really long to compare the two images, the shader should give you an output image showing the difference!

But, if you want an output number representing the percentage difference, you should just run the comparison on the CPU!